From eqn. $(4.8)$ in Nielsen and Chuang, a general rotation by $\theta$ about the $\hat n$ axis is given by $$ R_\hat{n}(\theta)\equiv \exp(-i\theta\hat n\cdot\vec\sigma/2) = \cos(\theta/2)I-i\sin(\theta/2)(n_xX+n_yY+n_zZ). $$ From the qiskit textbook, a generic single-qubit gate is defined as $$ U(\theta, \phi, \lambda) = \begin{pmatrix} \cos\left(\frac{\theta}{2}\right) & -e^{i\lambda} \sin\left(\frac{\theta}{2}\right) \\ e^{i\phi} \sin\left(\frac{\theta}{2}\right) & e^{i(\lambda + \phi)} \cos\left(\frac{\theta}{2}\right) \end{pmatrix}. $$ I tried to work out the matrix representation of $R_\hat{n}(\theta)$ but it looks like the first entry of that should be $\cos(\theta/2)-i\sin(\theta/2)n_z$, which is different from that of $U(\theta,\phi,\lambda)$, i.e. $\cos(\theta/2)$.

I'm wondering how does $R_\hat{n}(\theta)$ related to $U_3$ gate? In other words, given a unit vector $\hat n$ and a rotation angle $\theta$, can we represent $R_\hat{n}(\theta)$ using $U_3$?


Any single-qubit gate can be expressed as $R_{\hat{n}}(\alpha)$ for some $\hat{n}$ and $\alpha$ and similarly any single-qubit gate can be expressed as $U(\theta, \phi, \lambda)$ for some $\theta$, $\phi$ and $\lambda$. In other words, the two generic gates provide different parametrizations for the group of single-qubit gates.

The reason that elementwise matrix comparison fails is that the two parametrizations differ by the unobservable global phase. Thus, instead of trying to solve

$$ R_\hat{n}(\alpha) = U_3(\theta, \phi, \lambda) $$

you should solve

$$ R_\hat{n}(\alpha) = e^{i\gamma}U_3(\theta, \phi, \lambda) $$

where $e^{i\gamma}$ is the unknown global phase. Optionally, you can first reduce the number of unknowns by guessing $\gamma$ from the properties of the two matrices.

For example, we observe that the two diagonal elements of $R_\hat{n}(\alpha)$ are complex conjugates of each other and so its trace is real. This suggests the guess $\gamma = -\frac{\lambda + \phi}{2}$ might work because it turns the trace of $U_3(\theta, \phi, \lambda)$ into a real number.

Note that unlike the global phase the relative phase cannot be ignored. Consequently, the above does not apply to controlled-$R_\hat{n}(\alpha)$ and controlled-$U_3(\theta, \phi, \lambda)$ gates.

  • $\begingroup$ Thanks a lot for the answer! For controlled $R_\hat{n}(\alpha)$ and controlled $U_3$, are they also different by a global phase? $\endgroup$ – ZR- Feb 28 at 3:21
  • 2
    $\begingroup$ Controlled-$R_\hat{n}(\alpha)$ and controlled-$U_3(\theta, \phi, \lambda)$ are different gates even if (for the given parameters $\hat{n}, \alpha, \theta, \phi$ and $\lambda$) $R_\hat{n}(\alpha)$ and $U_3(\theta, \phi, \lambda)$ are the same gate. $\endgroup$ – Adam Zalcman Feb 28 at 3:30
  • 2
    $\begingroup$ Specifically, $CR_\hat{n}(\alpha) \equiv R_Z(\gamma) CU_3(\theta, \phi, \lambda)$ where $R_Z(\gamma)$ is applied to the control qubit. $\endgroup$ – Adam Zalcman Feb 28 at 3:36
  • $\begingroup$ Thanks!! Then is there a way to perform the controlled $R_\hat{n}(\alpha)$ using qiskit? or can I relate them by adding some external gates? $\endgroup$ – ZR- Feb 28 at 3:38
  • 1
    $\begingroup$ Global phase is unobservable, so yes any two unitary matrices that differ by global phase only are the same gate. $\endgroup$ – Adam Zalcman Feb 28 at 20:21

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.