# The general form of unitary operations on a single qubit

I want to understand the relation between the following two ways of deriving a (unitary) matrix that corresponds to the action of a gate on a single qubit:

1) HERE, in IBM's tutorial, they represent the general unitary matrix acting on a qubit as: $$U = \begin{pmatrix} \cos(\theta/2) & -e^{i\lambda}\sin(\theta/2) \\ e^{i\phi}\sin(\theta/2) & e^{i\lambda+i\phi}\cos(\theta/2) \end{pmatrix},$$ where $0\leq\theta\leq\pi$, $0\leq \phi<2\pi$, and $0\leq \lambda<2\pi$.

This is derived algebraically using the definition of a unitary operator $U$ to be: $UU^{\dagger}=I$.

2) HERE (pdf), similar to Kaye's book An Introduction Quantum Computing, the same operator is calculated to be: $$U=e^{i\gamma}\,R_{\hat n}(\alpha).$$ Here, $R_{\hat n}(\alpha)$ is the rotation matrix around an arbitrary unit vector (a vector on the Bloch sphere) as the axis of rotation for an angle $\alpha$. Also, $e^{i\gamma}$ gives the global phase factor to the formula(which is not observable after all). The matrix corresponding to this way of deriving $U$ is: $$e^{i\gamma}\cdot\begin{pmatrix} cos\frac{\alpha}{2}-i\,sin\frac{\alpha}{2}\,cos\frac{\theta}{2}&-i\,sin\frac{\alpha}{2}\,e^{-i\phi}\\ -i\,sin \frac{\alpha}{2}e^{i\phi}&cos\frac{\alpha}{2}+i\,sin\frac{\alpha}{2}\,cos\theta\end{pmatrix}.$$

This derivation is clearer to me since it gives a picture of these gates in terms of rotating the qubits on the Bloch sphere, rather than just algebraic calculations as in 1.

Question: How do these angles correlate in 1 and 2? I was expecting these two matrix to be equal to each other up to a global phase factor.

P.S.: This correspondence seems instrumental to me for understanding the U-gates defined in the tutorial (IBM).

Your second unitary isn't quite right, it's not even unitary! I think it should be: $$e^{i\gamma}\cdot\begin{pmatrix} \cos\frac{\alpha}{2}-i\,\sin\frac{\alpha}{2}\,\cos\frac{\theta}{2}&-i\,\sin\frac{\alpha}{2}\sin\frac{\theta}{2}\,e^{-i\phi}\\ -i\,\sin \frac{\alpha}{2}\sin\frac{\theta}{2}e^{i\phi}&\cos\frac{\alpha}{2}+i\,\sin\frac{\alpha}{2}\,\cos\frac{\theta}{2}\end{pmatrix}.$$
This may make is easier to find the correspondence. Let me put $\tilde\$ over the entities from the first unitary in order to distinguish them.
Let's define $\tan(\beta)=\tan\frac{\alpha}{2}\cos\frac{\theta}{2}$. This is the phase of the first matrix element, so $$\cos\frac{\alpha}{2}-i\,\sin\frac{\alpha}{2}\,\cos\frac{\theta}{2}=e^{i\beta}\cos\frac{\tilde\theta}{2},$$ where we're allowing equality between the two unitaries to be up to a global phase $e^{i(\gamma+\beta)}$. In other words, $$\cos^2\frac{\tilde\theta}{2}=\cos^2\frac{\alpha}{2}+\sin^2\frac{\alpha}{2}\cos^2\frac{\theta}{2}=\cos^2\frac{\alpha}{2}\sec^2\beta.$$
For the off-diagonal entries, recall that a unitary matrix must have columns whose sum-mod-square must be 1. Thus, the off-diagonal entries must be $\sin\frac{\tilde\theta}{2}$ up to some phase which we have to fix. We need $$-\beta+\phi-\frac{\pi}{2}=\tilde\phi\qquad -\beta-\phi-\frac{\pi}{2}=\tilde\lambda+\pi,$$ where I've incorporated the $i$ and $-1$ factors using phases $\pi/2$ and $\pi$. That perfectly fixes the relations between those two.
Now we only have to get the bottom-right matrix element correct. Again, we've already got the weight correct by unitarity, it's just the phase that we need. This is $-2\beta$, which from adding together the above two relations gives $\tilde\phi+\tilde\lambda+2\pi\equiv\tilde\phi+\tilde\lambda$, exactly as required.
• Yes, thank you. The correct version of the second matrix is what you wrote, just with $\theta$ instead of $\theta/2$, which is not that important. Aside from that, I don't understand this: If $-\beta+\phi-\frac{\pi}{2}=\tilde\phi$, then comparing the third entries of the matrices: $e^{i\tilde\phi}\,sin(\tilde\theta/2)=e^{i(-\beta+\phi-\frac{\pi}{2})}\,sin(\frac{\tilde\theta}{2})=(-i)e^{i\phi}\,e^{-i\beta}\,sin(\frac{\tilde\theta}{2})$ equals to $-i\,\sin \frac{\alpha}{2}\sin\frac{\theta}{2}e^{i\phi}$, which implies: $e^{-i\beta}=sin\frac{\alpha}{2}$, which is not right. Where is the issue? – Mathophile-Mathochist Jun 29 '18 at 15:51
• The $e^{-i\beta}$ cancels with the $e^{i\beta}$ that needs to be a global phase in order to get the top-left entry correct, so you just end up with $\sin\frac{\tilde\theta}{2}=\sin\frac{\alpha}{2}\sin\frac{\theta}{2}$ (you cancelled two $\sin\frac{\theta}{2}$ terms, but one had a $\tilde\$ which means you can't cancel them directly). – DaftWullie Jun 29 '18 at 15:58