# How to multiply the elements of each site of tensor products to each other while using symbolic representation?

If I have, say three sites in a symbolic operator which is of the form A = a⊗1⊗c and I want it to act on another operator B = a1⊗b⊗1 in order to find the commutator A.B - B.A, the result I expect would be A.B = a.a1⊗b⊗c, but I am unable to achieve such a result using the regular A.B command. A.B gives a⊗c.a1⊗b. I would also like to know how I can expand the dot product to multiple terms if they exist. Any help would be appreciated.

I tried the following:

A = TensorProduct[a, 1, c]

B = TensorProduct[a1, b, 1]

A.B

The output it gives is a⊗c.a1⊗b but the output I expect is a.a1⊗b⊗c

• Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour and check the faqs! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! Commented Sep 17, 2019 at 4:13
• Perhaps you can give some examples of formatted code you have tried ? This makes it much easier for others to try to work on answering your question Commented Sep 17, 2019 at 4:14
• @Dunlop Edited as instructed.
– Net
Commented Sep 17, 2019 at 4:36

KroneckerProduct will work with symbolic tensors, although it needs some help from TensorExpand. First, set some assumptions on your tensors:

\$Assumptions = (a | a1 | b | c) ∈ Matrices[{n, n}];


A = KroneckerProduct[a, IdentityMatrix[n], c];
B = KroneckerProduct[a1, b, IdentityMatrix[n]];

A.B


KroneckerProduct[a, IdentityMatrix[n], c].KroneckerProduct[a1, b, IdentityMatrix[n]]

Using TensorExpand produces your desired result:

TensorExpand[A.B]


KroneckerProduct[a.a1, b, c]

• Thank you very much!
– Net
Commented Jul 25, 2020 at 3:37