Message Boards Message Boards

2 Replies
2 Total Likes
View groups...
Share this post:

How to Construct Matrix Representation of a Tensor Product from submatrices

For an online quantum mechanics course, I had to construct a matrix representation of the tensor product of two Pauli Spin Matrices. I did it as follows:

In[1]:= p1 = PauliMatrix[1]; p2 = PauliMatrix[2];

In[2]:= Join[Join[p1[[1, 1]]*p2, p1[[1, 2]]*p2, 2], 
 Join[p1[[2, 1]]*p2, p1[[2, 2]]*p2, 2]]

Out[2]= {{0, 0, 0, -I}, {0, 0, I, 0}, {0, -I, 0, 0}, {I, 0, 0, 0}}

I got the right answer but don't like the method I used, as it would be difficult to generalize to large matrices. Any suggestions?

POSTED BY: Frank Kampas
2 Replies

This operation is called the kronecker product when applied to matrices. There is a function for it:

KroneckerProduct[p1, p2]

Usually when you see this, you're actually doing a tensor product.

ArrayFlatten@TensorProduct[p1, p2]

{{0, 0, 0, -I}, {0, 0, I, 0}, {0, -I, 0, 0}, {I, 0, 0, 0}}

But, if I hadn't known any of this before, here is how I might have written it:

ArrayFlatten[placeholder*p2 /. placeholder -> p1]
POSTED BY: Sean Clarke

Thanks. I've been using Mathematica since Version 2.2 but still only know part of its functionality.

POSTED BY: Frank Kampas
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract