Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can we simplify tensor expressions in Mathematica 9 using the mixed-product identity $(A\otimes B)(C \otimes D) \equiv AC \otimes BD$ ?

Is it possible to implement this kind of evaluations using the new Mathematica 9 tensor capabilities?

The following expression is false:

TensorProduct[a, b].TensorProduct[c, d] === TensorProduct[ a.c, b.d]

I don't really need to prove this identity, but rather to use it for simplifying some expressions. In my case, $a$ and $c$ are some (unknown) symbolic matrices, while $b$ and $d$ are explicit integer $2\times 2$ matrices. I'd like Mathematica to evaluate the matrix product between $b$ and $d$ explicitly.

For instance, when

b=PauliMatrix[1]; d=PauliMatrix[3];

as the product of two Pauli matrices gives another Pauli matrix, I'd like to obtain the simplified result

TensorProduct[a.c, -I PauliMatrix[2]]
share|improve this question
up vote 4 down vote accepted

You could also do

$Assumptions = (a | b | c | d) \[Element] Matrices[{k, k}]

KroneckerProduct[a, b] . KroneckerProduct[c, d] // TensorExpand

which returns

KroneckerProduct[a.c, b.d]
share|improve this answer
That is exactly what I was looking for. Thanks – benkj Feb 3 '14 at 16:13
  1. The mixed-product identity

    $$ (A\otimes B)(C \otimes D) \equiv AC \otimes BD$$

    is written in terms of the Kronecker product (see here) not TensorProduct. They have different dimensions

    A = RandomReal[1.0, {10, 10}];
    KroneckerProduct[A, A] // Dimensions
    TensorProduct[A, A] // Dimensions
    {100, 100}
    {10, 10, 10, 10}
  2. lhs === rhs gives exact comparison of lhs and rhs. You need to use ==.

  3. Unfortunately tensors operations with KroneckerProduct and Dot is not fully implemented in Mathematica 9. However, for example, Dot[a,b] is equivalent to TensorContract[a\[TensorProduct]b, {{2, 3}}].

Finally, you can rewrite your identity as

$Assumptions = (a | b | c | d) \[Element] Matrices[{k, k}];

   TensorContract[a\[TensorProduct]b\[TensorProduct]c\[TensorProduct]d, {{2, 5}, {4, 7}}], 
 {1, 3, 2, 4}] == 
 TensorContract[a\[TensorProduct]c, {{2, 3}}]\[TensorProduct]TensorContract[
   b\[TensorProduct]d, {{2, 3}}] // TensorReduce


Unfortunately, I can't explain derivation of this formula because I don't understand it completely.

share|improve this answer
Thanks, your answer makes me understand a little bit better the new Tensor capabilities of Mathematica 9. However, I'm not able to use your commands for simplifying expression. This was indeed, my main problem. I edited the question to better clarify this point. – benkj Oct 16 '13 at 7:44
@benkj I think it is much simpler to implement it with pattern replacements or do it manually. – ybeltukov Oct 16 '13 at 9:55

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.