## 2.9 Any unitary operation on a single qubit

There are infinitely many unitary operations that can be performed on a single qubit. In general, any complex (n\times n) matrix has n^2 complex entries, and can thus be specified by 2n^2 real independent parameters. The unitarity constraint removes n^2 of these, and so any unitary (n\times n) matrix has n^2 real independent parameters. In particular, we need four real parameters to specify a (2\times 2) unitary matrix. If we are prepared to ignore global phase factors (which we are) then there are only three real parameters left. So, with this in mind, can we construct and implement any unitary on a single qubit in some simple way?

Yes, we can.

Any unitary operation on a qubit (up to an overall multiplicative phase factor) can be implemented by a circuit containing just two Hadamards and three phase gates, with adjustable phase settings, as in Figure 2.2.

If we multiply the matrices corresponding to each gate in the network (remember that the order of matrix multiplication is reversed) we obtain U(\alpha,\beta,\varphi) =\begin{bmatrix} e^{-i\left(\frac{\alpha+\beta}{2}\right)}\cos\varphi/2 & -ie^{i\left(\frac{\alpha-\beta}{2}\right)}\sin\varphi/2 \\-ie^{-i\left(\frac{\alpha-\beta}{2}\right)}\sin\varphi/2 & e^{i\left(\frac{\alpha+\beta}{2}\right)}\cos\varphi/2 \end{bmatrix}. Any (2\times 2) unitary matrix (up to global phase) can be expressed in this form using the three independent real parameters, \alpha, \beta, and \varphi, which take values in [0,2\pi]. In order to see that this construction does what it claims, let us explore an intriguing mathematical connection between single qubit unitaries and rotations in three dimensions.