# How to obtain $Y$ rotation with only $X$ and $Z$ rotation gates on the Bloch sphere?

Let's say you have a system with which you can perform arbitrary rotations around the $$X$$ and $$Z$$ axis. How would you then be able to use these rotations to obtain an arbitrary rotation around the $$Y$$ axis?

I have seen somewhere that rotation around an arbitrary axis can be achieved by doing three rotations around two fixed axis. $$\hat{R}_\vec{n}(\theta)=R_Z(\gamma)R_X(\beta)R_Z(\alpha)$$ for some angles $$\gamma, \alpha, \beta$$. But how do you actually use this? What if I want to rotate around the Y axis with an angle of $$\theta$$ , $$\hat{R}_Y(\theta)$$, then how do I find the values of $$\gamma,\alpha,\beta$$.

Here it is in words, more details below.

1. Rotate by $$\alpha=-90^\circ$$ about $$z$$ so as to bring your $$y$$ axis around to point along the $$x$$ axis.
2. Rotate by desired angle $$\beta=\theta$$ about $$x$$.
3. Rotate by $$\gamma=90^\circ$$ about $$z$$ to put the $$y$$ axis back where it was.

The information you need for the more general case is on the Rotation formalisms Wikipedia page, and on the Euler angles Wikipedia page.

Your initial specification of the rotation is in the "angle-axis" form (rotating by angle $$\theta$$ about the axis $$(0,1,0)$$ in your case). This section describes how to convert from that to a $$3\times 3$$ rotation matrix. In your case $$\begin{pmatrix} A_{11} & A_{12} & A_{13} \\ A_{21} & A_{22} & A_{23} \\ A_{31} & A_{32} & A_{33} \end{pmatrix} = \begin{pmatrix} \cos\theta & 0 & \sin\theta \\ 0 & 1 & 0 \\ -\sin\theta & 0 & \cos\theta \end{pmatrix}$$

Then you need to convert the rotation matrix to Euler angles, and I'm guessing you want the $$z$$-$$x$$-$$z$$ extrinsic version in which the axes remain fixed, but you should check this carefully. This section describes how to do that. There are some caveats in that section about multiple solutions etc, which you should check. Anyway, in your case \begin{align*} \alpha &= \text{atan2}(-\sin\theta,0) = -90^\circ \\ \beta &= \arccos(\cos\theta) = \theta \\ \gamma &= -\text{atan2}(\sin\theta,0) = 90^\circ \end{align*}

Check also the sign conventions, it's a notorious minefield.

• Thank you for the elaborate answer. I wasn't expecting there to be so much behind this question. I've followed linear algebra 1 and 2 undergraduate courses but somehow have never encountered Euler angles, which were the missing pieces that answer the question. – PhysicsMan Nov 20 '18 at 12:53