# Why is $\langle \psi| \sigma_z |\psi \rangle=\cos(\phi_1)\cos(\phi_2)$ for $|\psi\rangle=R_y(\phi_2)R_x(\phi_1)|0\rangle$?

I'm trying some example with the rotation gates and stuck here:

$$\langle \psi| \sigma_z |\psi \rangle = \langle 0 | R_x(\phi_1)^\dagger R_y(\phi_2)^\dagger \sigma_z R_y(\phi_2) R_x(\phi_1) | 0 \rangle = \cos(\phi_1)\cos(\phi_2).$$

How did they get $$\cos(\phi_1)\cos(\phi_2)$$?

I pleased to know some clear steps to have an intuition about it. Thanks!

• Use Euler's formula: $e^{i\theta \hat{A}} = cos(\theta)I+isin(\theta)\hat{A}$, where $\hat{A}$ is the matrix satisfy $\hat{A}*\hat{A}=I$. Jun 24 at 12:44
• Thanks for your answer, I have just solved it your way but it's become complex quickly. Is there any short solution? Jun 24 at 15:35

Maybe it is best to just work out the calculation step-by-step.

First, let $$U = R_y(\phi_2) R_x(\phi_1)$$, and $$|\psi \rangle = U|0\rangle$$.

The goal is to calculate $$\langle \psi| \sigma_z |\psi \rangle$$ where $$\sigma_z = \begin{pmatrix} 1 & 0 \\ 0 & -1 \end{pmatrix}$$.

1. Computing $$|\psi \rangle$$ explicitly.

\begin{align} U|0 \rangle &= R_y(\phi_1)R_x(\phi_2) |0\rangle =\begin{pmatrix} \cos{\dfrac{\phi_1}{2}} & -\sin\dfrac{\phi_1}{2} \\ \sin\dfrac{\phi_1}{2} & \cos\dfrac{\phi_1}{2} \end{pmatrix} \begin{pmatrix} \cos\dfrac{\phi_2}{2} & -i\sin\dfrac{\phi_2}{2} \\ -i\sin\dfrac{\phi_2}{2} & \cos\dfrac{\phi_2}{2} \end{pmatrix} \begin{pmatrix}1 \\ 0 \end{pmatrix}\\ &= \begin{pmatrix} \cos{\dfrac{\phi_1}{2}} & -\sin\dfrac{\phi_1}{2} \\ \sin\dfrac{\phi_1}{2} & \cos\dfrac{\phi_1}{2} \end{pmatrix} \begin{pmatrix}\cos\dfrac{\phi_2}{2} \\ -i\sin\dfrac{\phi_2}{2} \end{pmatrix}\\ &= \begin{pmatrix} \cos\dfrac{\phi_1}{2}\cos\dfrac{\phi_2}{2} + i\sin\dfrac{\phi_1}{2}\sin\dfrac{\phi_2}{2} \\ \sin\dfrac{\phi_1}{2}\cos\dfrac{\phi_2}{2} - i\cos\dfrac{\phi_1}{2}\sin\dfrac{\phi_2}{2} \end{pmatrix} = |\psi\rangle\\ \end{align}

1. Compute $$\sigma_z|\psi\rangle$$ $$\sigma_z|\psi\rangle = \begin{pmatrix} 1 & 0 \\ 0 & -1 \end{pmatrix} \begin{pmatrix} \cos\dfrac{\phi_1}{2}\cos\dfrac{\phi_2}{2} + i\sin\dfrac{\phi_1}{2}\sin\dfrac{\phi_2}{2} \\ \sin\dfrac{\phi_1}{2}\cos\dfrac{\phi_2}{2} - i\cos\dfrac{\phi_1}{2}\sin\dfrac{\phi_2}{2} \end{pmatrix} = \begin{pmatrix} \cos\dfrac{\phi_1}{2}\cos\dfrac{\phi_2}{2} + i\sin\dfrac{\phi_1}{2}\sin\dfrac{\phi_2}{2} \\ -\sin\dfrac{\phi_1}{2}\cos\dfrac{\phi_2}{2} + i\cos\dfrac{\phi_1}{2}\sin\dfrac{\phi_2}{2} \end{pmatrix} = |\phi \rangle$$

2. Compute $$\langle \psi| \sigma_z |\psi \rangle = \langle \psi | \phi \rangle$$

\begin{align} \langle \psi | \phi \rangle &= \begin{pmatrix} \cos\dfrac{\phi_1}{2}\cos\dfrac{\phi_2}{2} - i\sin\dfrac{\phi_1}{2}\sin\dfrac{\phi_2}{2} & \sin\dfrac{\phi_1}{2}\cos\dfrac{\phi_2}{2} + i\cos\dfrac{\phi_1}{2}\sin\dfrac{\phi_2}{2} \end{pmatrix} \begin{pmatrix} \cos\dfrac{\phi_1}{2}\cos\dfrac{\phi_2}{2} + i\sin\dfrac{\phi_1}{2}\sin\dfrac{\phi_2}{2} \\ -\sin\dfrac{\phi_1}{2}\cos\dfrac{\phi_2}{2} + i\cos\dfrac{\phi_1}{2}\sin\dfrac{\phi_2}{2} \end{pmatrix} \\ &= \cos^2\dfrac{\phi_1}{2}\cos^2\dfrac{\phi_2}{2} + \sin^2\dfrac{\phi_1}{2}\sin^2\dfrac{\phi_2}{2} - \sin^2\dfrac{\phi_1}{2}\cos^2\dfrac{\phi_2}{2} - \cos^2\dfrac{\phi_1}{2}\sin^2\dfrac{\phi_2}{2} \\ &= \cos(\phi_1)\cos(\phi_2) \hspace{1 cm} \textrm{(Trig identities manipulation)} \end{align}

• If I follow this way, I can reduce the number of calculations as below: $\langle 0|M|0\rangle = a$ with a is the top-left element of $2x2$ $M$ matrix. So we can just focus on it. Jun 25 at 1:34