I was following the Qiskit textbook and wanted to show that $R_z (\pi/4) = e^{i \pi/8 Z}$.

Plugging $\pi/4$ in for $\theta$ in the matrix from this page $ \begin{bmatrix} e^{-i \pi/8} & 0 \\ 0 & e^{i \pi/8} \end{bmatrix}$, I end up with $\begin{bmatrix} \frac{1}{\sqrt{2}}-\frac{i}{\sqrt{2}} & 0 \\ 0 & \frac{1}{\sqrt{2}}+\frac{i}{\sqrt{2}} \end{bmatrix} $.

However, when I use the Euler's formula to go from $R_z (\pi/4) = e^{i \pi/8 Z}$ to $\cos(\pi/8)+i\sin(\pi/8)$, the matrix I end up with is $\begin{bmatrix} \frac{1}{\sqrt{2}}+\frac{i}{\sqrt{2}} & 0 \\ 0 & \frac{1}{\sqrt{2}}-\frac{i}{\sqrt{2}} \end{bmatrix} $.

It appears that one rotation is the opposite of the other. The way the Euler's formula is defined, is the rotational direction opposite of the other?

  • 1
    $\begingroup$ Is $\cos(\pi/8)$ really $\frac{1}{\sqrt{2}}$? $\endgroup$ Sep 23 at 4:43

The two pages you link are using opposite conventions, the first defines \begin{align} R_z(\theta) &:= \exp(i \theta Z /2)\\ &= \cos (\theta/2) + i \sin (\theta/2)Z\\ &= \begin{pmatrix} \exp(i \theta /2) & 0 \\ 0 & \exp(-i \theta /2) \end{pmatrix} \end{align}

The second page implies the definition \begin{align} R_z(\theta) &:= \exp(-i \theta Z /2)\\ &= \cos (\theta/2) - i \sin (\theta/2)Z\\ &= \begin{pmatrix} \exp(-i \theta /2) & 0 \\ 0 & \exp(i \theta /2) \end{pmatrix} \end{align}

The difference of the minus sign in the exponent does mean that these two definitions will describe a rotation about the $Z$-axis of the Bloch sphere in opposite directions (clockwise in the first case, counterclockwise in the second case).

While this is just a matter of conventions, the second definition $R_z(\theta) := \exp(-i \theta Z /2)$ is certainly the more common of the two and so the use of the first definition can lead to confusion (evidently). It might even be that the definition in the first page is a typo, given that qiskit defines $R_z$ using the second definition elsewhere.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.