# Converting $H$ gate to $R_x$ and $R_z$

EDIT: My solution is supposed to work for $$|1\rangle$$ state too. See https://imgur.com/a/7F1cHu4

Right of the bat the answer is $$H=R_z(\pi/2)R_x(\pi/2)R_z(\pi/2)\,.$$ My question is, I cannot reach the same answer using the Bloch sphere.

Clearly, $$H$$ transform $$|0\rangle$$ to the position below.

One would think that he can do a $$R_x(\pi/2)R_z(\pi/2)$$ to get the same result. However

\begin{align} R_x(\pi/2)R_z(\pi/2)&=\begin{pmatrix} \cos\left(\pi/4\right) & -i\sin\left(\pi/4\right) \\ -i\sin\left(\pi/4\right) & \cos\left(\pi/4\right) \end{pmatrix}\begin{pmatrix} e^{-i\frac{\pi}{4}} & 0 \\ 0 & e^{i\frac{\pi}{4}} \end{pmatrix}\\ &=\begin{pmatrix}\frac{1}{2}-i\frac{1}{4}&\frac{1}{}-i\frac{1}{2}\\-\frac{1}{2}-i\frac{1}{2}&\frac{1}{2}+i\frac{1}{2}\end{pmatrix} \end{align}

The visualization also confirms this

There's about three little niggles here. First, order of calculation. If you want to get rid of the first $$Z$$ rotation from your calculation, then that is the right-most one in the product, not the left-most one.
Next, your multiplication of the matrices seems a bit dodgy. You want $$\frac{1}{\sqrt{2}}\begin{bmatrix} e^{-i\pi/4} & 0 \\ 0 & e^{i\pi/4} \end{bmatrix}\begin{bmatrix} 1 & -i \\ -i & 1 \end{bmatrix} =\frac{e^{-i\pi/4}}{\sqrt{2}}\begin{bmatrix} 1 & -i \\1 & i \end{bmatrix}.$$
Finally, maybe you're thinking "this still isn't Hadamard". But it isn't supposed to be Hadamard. It's only supposed to be equivalent to Hadamard when acting on the $$|0\rangle$$ state. So look at the first column. This describes the output that you're expecting.
• Agree that this should be the matrix I get. Just like you I used to think that it only works on the $|0\rangle$ state, but turned out it works for the $|1\rangle$ state too. See imgur.com/a/7F1cHu4. Therefore something is still wrong here :\ Commented Mar 4 at 9:55
• Yes, it also works for the $|1\rangle$ state, just with a different global phase. It only fails if you try a superposition, because the two different "global" phases on the 0 and 1 terms become a relative phase that makes a big difference. Commented Mar 4 at 11:49