# How to calculate tensor product for the magic square

The magic square game is a two-player pseudo-telepathy game that was presented by Padmanabhan Aravind, who built on work by Mermin. In the magic square we have ones in columns (odd number) and rows (even number).

According to https://arxiv.org/abs/quant-ph/0407221v3

$$A2= \frac12\left[ {\begin{array}{ccccc} i & 1 & 1 & i \\-i & 1 & -1 & i\\i & 1 & -1 & -i\\-i & 1 & 1 & -i \end{array} } \right]$$

$$B3= \frac1{\sqrt{2}}\left[ {\begin{array}{ccccc} 1 & 0 & 0 & 1 \\-1 & 0 & 0 & 1\\0 & 1 & 1 & 0\\0 & 1 & -1 & 0 \end{array} } \right]$$

We have an input the entangled state shared by Alice and Bob

$\mid \psi \rangle = \frac{1}{2}\mid0011 \rangle -\frac{1}{2}\mid0110 \rangle -\frac{1}{2}\mid1001 \rangle +\frac{1}{2}\mid1100 \rangle$

Consider for example inputs x =2 and y =3. After Alice and Bob apply A2 and B3 respectively, the state evolves to $$A2 \otimes B3 \mid \psi\rangle = \frac{1}{2\sqrt{2}} \left[\mid0000\rangle -\mid0010\rangle -\mid0101\rangle +\mid 0111\rangle +\mid 1001\rangle +\mid 1011\rangle -\mid 1100\rangle -\mid 1110\rangle \right]$$

Question is how to obtain this result. I did multiplication of the matrices

$+(A2 \otimes B3) \mid 00 \rangle \otimes \mid 11 \rangle$

$-(A2 \otimes B3) \mid 01 \rangle \otimes \mid 10 \rangle$

$-(A2 \otimes B3) \mid 10 \rangle \otimes \mid 01 \rangle$

$+(A2 \otimes B3) \mid 11 \rangle \otimes \mid 00 \rangle$

Calculate the tensor product

$+(A2 \mid 00 \rangle \otimes B3\mid 11 \rangle$ part 1

$-(A2 \mid 01 \rangle \otimes B3\mid 10 \rangle$ part 2

$-(A2 \mid 10 \rangle \otimes B3\mid 01 \rangle$ part 3

$+(A2 \mid 11 \rangle \otimes B3\mid 00 \rangle$ part 4

Let's calculate part 2 with step 1 and step 2

$$step 1 = A2 | 01 \rangle = \left[ {\begin{array}{ccccc} i & 1 & 1 & 1 \\-i & 1 & -1 & 1\\i & 1 & -1 & -i\\-i & 1 & 1 & -i \end{array} } \right] \left[ {\begin{array}{c} 0 \\ 1 \\ 0 \\ 0\end{array}} \right] = \left[ {\begin{array}{c} 1 \\ 1 \\ 1 \\ 1\end{array}} \right]$$

$$step 2 = B3 | 10 \rangle = \left[ {\begin{array}{ccccc} 1 & 0 & 0 & 1 \\-1 & 0 & 0 & 1\\0 & 1 & 1 & 0\\0 & 1 & -1 & 0 \end{array} } \right] \left[ {\begin{array}{c} 0 \\ 0 \\ 1 \\ 0\end{array}} \right] = \left[ {\begin{array}{c} 0 \\ 0 \\ 1 \\ -1\end{array}} \right]$$

$step1 \otimes step2 = \left[ {\begin{array}{c} 0 \\ 0 \\ 1 \\ -1 \\ 0 \\ 0 \\ 1 \\ -1 \\ 0 \\ 0 \\ 1 \\ -1 \\0 \\ 0\\ 1 \\ -1 \end{array}} \right]$

Is this the way to go?

• You entered the matrix A2 incorrectly (last element in first two rows should be $i$ not 1). I've corrected that, but you probably want to check how that follows through your calculation, which I haven't checked. – DaftWullie Aug 29 '18 at 10:00
• Thanks for checking, maybe the correction gives even more clarification – Bram Aug 29 '18 at 19:46

That is certainly one direction to go, which should ultimately lead to the right answer. Frankly, I'd just throw it into something like Mathematica and get it to calculate KroneckerProduct[A2,B3], and complete the calculation that way.
However, if you want to continue by hand, there are probably a few tricks that you can use in this special case. For example, take the two components $$|00\rangle|11\rangle+|11\rangle|00\rangle$$ Ignoring normalisation for now, you can write these as $$(|00\rangle+|11\rangle)(|00\rangle+|11\rangle)-(|00\rangle-|11\rangle)(|00\rangle-|11\rangle).$$ (You can do something similar for the $|01\rangle|10\rangle$ terms). Why does this help? The components on Bob's space (the last 2 qubits) transform really nicely under $B3$, so the maths suddenly gets a whole lot easier (Alice's get better as well). Indeed, each of the 4 terms (corresponding to Bell states on Bob's qubits) will map to a different basis state on Bob's system, so you'll be able to check the correct outcome term by term, instead of having to wait for the whole calculation and seeing what things cancel.
At first glance, the claimed output doesn't look right. According to Mathematica, the output should be $$\left\{\frac{i}{2 \sqrt{2}},0,-\frac{1}{2 \sqrt{2}},0,0,-\frac{i}{2 \sqrt{2}},0,\frac{1}{2 \sqrt{2}},0,\frac{i}{2 \sqrt{2}},0,\frac{1}{2 \sqrt{2}},-\frac{i}{2 \sqrt{2}},0,-\frac{1}{2 \sqrt{2}},0\right\}.$$ Note the complex phases.