# Expected value of Z operator in GHZ state

I'm following this notebook written using amazon-braket, and there's a statement I don't understand

... To reiterate, the following output is expected: $$\left|\mathrm{GHZ}\right> = \frac{1}{\sqrt{2}}\left(\left|0,0,0\right> + \left|1,1,1\right>\right) = \left[\frac{1}{\sqrt{2}},0,0,0,0,0,0,\frac{1}{\sqrt{2}}\right],$$ for which $$\color{red}{\left=0}$$ and $$\left<111|\mathrm{GHZ}\right>=\frac{1}{\sqrt{2}}$$.

The highlighted expression is the one I'm having troubles with. Isn't that expectation value $$1/2$$ instead?

$$\begin{eqnarray} \left<\mathrm{GHZ}|ZZZ|\mathrm{GHZ}\right> &=& \frac{1}{2}\left( \left<000|ZZZ|000\right> + \left<000|ZZZ|111\right> + \left<111|ZZZ|000\right> + \left<111|ZZZ|111\right> \right) \\ &=& \frac{1}{2}\left(0 + 0 + 0 + 1 \right) \\ &=& \frac{1}{2} \end{eqnarray}$$

Thanks!

Your off-diagonal contributions are correct, since $$Z$$ is diagonal in this basis, but your diagonal contributions seem to be taking the values of the kets to be the values of the $$Z$$ operator's diagonal. The $$Z$$ operator written in the basis of $$\{ |0\rangle, |1\rangle \}$$ is $$\begin{bmatrix} 1 & 0 \\ 0 & -1 \end{bmatrix}$$. So $$\langle iii|ZZZ|iii \rangle$$ is $$(+1)^3$$ for $$i=0$$ and $$(-1)^3$$ for $$i=1$$, yielding the stated result of 0.
• I'm such an idiot, I was assuming $\{|0\rangle, |1\rangle \}$ were the eigenstates of $Z$, $Z|z\rangle = z|z\rangle$, thanks for your help! Nov 22, 2021 at 13:26
• Oh, but $|0\rangle$ and $|1\rangle$ are the eigenstates of $Z$! However, the corresponding eigenvalues are not equal to the labels of the states. Instead, we have $Z|z\rangle=(-1)^z|z\rangle$. Nov 22, 2021 at 17:04