# Is there a way of calculating Expectation Values of tensor operators in Mathematica?

This Wikipedia article in on Bell's Theorem lists a whole bunch of expectation values for Bell states: $$\langle A_0 \otimes B_0 \rangle = \frac{1}{\sqrt{2}}, \langle A_0 \otimes B_1 \rangle = \frac{1}{\sqrt{2}}, \langle A_1 \otimes B_0 \rangle = \frac{1}{\sqrt{2}}, \langle A_1 \otimes B_1 \rangle = -\frac{1}{\sqrt{2}} \, .$$ The state to which these operators are applied, the "Bell state", is given as: $$\psi\rangle = \frac{|01\rangle - |10\rangle}{\sqrt{2}} .$$ |01> refers to a two particle system with the first particle spin down and the second particle spin up. So the tensor operators would apply the left hand of the tensor product to particle 1, and the right side of the tensor product to particle 2.

The Operators are given by: $$A_0 = \sigma_z = \begin{pmatrix}1 & 0 \\ 0 & -1\end{pmatrix},\ A_1 = \sigma_x = \begin{pmatrix}0 & 1 \\ 1 & 0 \end{pmatrix};$$

and

$$B_0 = -\frac{\sigma_x + \sigma_z}{\sqrt{2}},\ B_1 = \frac{\sigma_x - \sigma_z}{\sqrt{2}} .$$

I find the prospect of calculating these expectation values by hand pretty horrific. Can Mathematica do this in some way?

• What have you tried so far? There are many possible routes to solve this question, using any number of available packages. It would be helpful to yourself and others if you have an attempted solution, i.e., some code, that you can share in your question post. Oct 9, 2022 at 1:20
• I would personally recommend stripping away the physics context and notation and translating what you what into mathematics which is a language that probably more people are familiar with here. Other than making your question open to a wider community, it also makes it quicker to understand what you would like. Oct 9, 2022 at 1:53
• Also the physics tab does not seem really important for finding a solution to this question. Not too sure about the probability-or-statistics one either as the question basically boils down to a tensor product and linear algebra. Oct 9, 2022 at 2:12

One could use

(* operators *)
A0=PauliMatrix[3];
A1=PauliMatrix[1];
B0=-(PauliMatrix[1]+PauliMatrix[3])/Sqrt[2];
B1=(PauliMatrix[1]-PauliMatrix[3])/Sqrt[2];

(* Bell state *)
PsiKet={0,1,-1,0}/Sqrt[2]; (* see Note at the end *)
PsiBra=Conjugate[PsiKet];

(* expectation values *)
PsiBra.KroneckerProduct[A0,B0].PsiKet
PsiBra.KroneckerProduct[A0,B1].PsiKet
PsiBra.KroneckerProduct[A1,B0].PsiKet
PsiBra.KroneckerProduct[A1,B1].PsiKet


which returns

1/Sqrt[2]
1/Sqrt[2]
1/Sqrt[2]
-1/Sqrt[2]


Note: Given two $$2\times 2$$ matrices, each relative to the ordered basis $$|0\rangle$$, $$|1\rangle$$, the KroneckerProduct produces a four by four matrix relative to the ordered basis $$|00\rangle$$, $$|01\rangle$$, $$|10\rangle$$, $$|11\rangle$$.