8
$\begingroup$

Suppose I have an arbitrary qiskit $U_3$ gate: $U_3(\theta,\phi,\lambda)$. Is there a way I can find which axis the gate is rotating around? In other words, given any real numbers $\theta,\phi,\lambda$, can I find the vector $\hat n = (n_x,n_y,n_z)$ that the gate corresponds to, so that I can plot the axis of rotation on the Bloch sphere? I'm thinking about the y-z decomposition, but I'm still unable to find out the elements of $\hat n$. How can I figure that out? Thanks a lot for the help:)

$\endgroup$
2
  • 3
    $\begingroup$ do you mean a single-qubit gate? If so, it's just the eigenvectors. Or even just a single eigenvector really (the two eigenvectors are orthogonal and thus collinear when represented on the Bloch sphere). For unitaries in larger dimensions, you can't, in general, understand the gate as a rotation around a specific axis in state space. $\endgroup$
    – glS
    Commented Mar 17, 2021 at 11:09
  • $\begingroup$ @glS Thanks for the comment! That helps:) $\endgroup$
    – ZR-
    Commented Mar 17, 2021 at 16:03

3 Answers 3

7
$\begingroup$

You can derive an expression for the rotation axis by combining (1) the decomposition of your unitary $O$ in the Pauli basis, and (2) by the representation of the general rotation operator $R_{\vec n}(\theta)$ in terms of Paulis.

Step (1)

Let $\{\sigma_0, \sigma_x, \sigma_y, \sigma_z \}$ describe the identity matrix ($\sigma_0 = \mathbb 1$) and Pauli matrices, which together form a basis of $U(2)$, which is the space of single-qubit gates. With the trace as dot-product you can write any matrix $O \in U(2)$ in the basis of Pauli matrices as \begin{equation} O = \frac{1}{2} \left(\text{Tr}(O) \sigma_0 + \text{Tr}(O\sigma_x)\sigma_x + \text{Tr}(O\sigma_y)\sigma_y + \text{Tr}(O\sigma_z)\sigma_z \right) \end{equation} This is looks like your typical decomposition of a vector into a basis $$ O = \sum_{\omega \in \{0, x, y, z\}} b_\omega \sigma_\omega, $$ where the basis coefficients are $b_\omega = \text{Tr}(O\sigma_\omega)/2$ and the basis "vector" (or here matrices) are $\sigma_\omega$.

Step (2)

We know that any single-qubit gate can be written as (see e.g. Nielsen & Chuang) $$ O = e^{i\alpha} R_{\vec n}(\theta) $$ where \begin{equation} \begin{aligned} R_{\vec n}(\theta) &= e^{i \theta/2 (n_x \sigma_x + n_y \sigma_y + n_z\sigma_z)} \\ &= \cos\frac{\theta}{2}\sigma_0 - i\sin\frac{\theta}{2}(n_x \sigma_x + n_y \sigma_y + n_z\sigma_z) \end{aligned} \end{equation}

The factor $e^{i\alpha}$ is fixed by the determinant of $O$. Since $R$ is a rotation the determinant is $1$, but $O$ might not have a determinant of $1$. So we know that \begin{equation} \begin{aligned} &\text{det}(O) = \text{det}(e^{i\alpha} R_{\vec n}) = e^{2i\alpha}\det(R_{\vec n}(\theta)) \\ &\Leftrightarrow e^{i\alpha} = \sqrt{\det(O)} \end{aligned} \end{equation}

Combining (1) and (2)

Now that we know $e^{i\alpha}$ we can match the entries of the Bloch vector $\vec n = (n_x, n_y, n_z)$ with the basis coefficients above! I'll leave the math now out because this post is long enough but if you match \begin{equation} \begin{aligned} \frac{1}{2}\text{Tr}(O) &= e^{i\alpha}\cos\frac{\theta}{2}\text{ and } \\ \frac{1}{2}\text{Tr}(O\sigma_\omega) &= -i\sin\frac{\theta}{2} \text{ for } \omega = x, y, z \end{aligned} \end{equation}

You finally obtain \begin{equation} \begin{aligned} \theta = 2\cos^{-1}\left(e^{-i\alpha}\frac{\text{Tr}(O)}{2}\right) \end{aligned} \end{equation} and \begin{equation} \begin{aligned} n_\omega = \frac{e^{-i\alpha}\text{Tr}(O\sigma_\omega)}{-2i \sin(\theta/2)} \end{aligned} \end{equation} which you could possibly simplify further by plugging in the expression for $\theta$, but, as many textbooks say, I'll leave that exercise for the motivated reader. :)

If you do this for e.g. $$ S = \begin{pmatrix} 1 & 0 \\ 0 & i \end{pmatrix} $$ you obtain $$ \alpha = \frac{\pi}{4}, \theta = \frac{\pi}{2} $$ and $$ \vec n = (0, 0, 1). $$

$\endgroup$
2
  • $\begingroup$ Thanks so much for the really detailed answer! Could you explain a little bit about what does $\Tr {O(\sigma_\omega)\sigma_\omega}$ mean? For a general $U_3\in SU(2)$, could the expression of $O$ be further simplified? $\endgroup$
    – ZR-
    Commented Mar 17, 2021 at 14:55
  • $\begingroup$ there is a little sign mistake. The correct formula would be $\begin{equation} \begin{aligned} R_{\vec n}(\theta) &= e^{i \theta/2 (n_x \sigma_x + n_y \sigma_y + n_z\sigma_z)} \\ &= \cos\frac{\theta}{2}\sigma_0 + i\sin\frac{\theta}{2}(n_x \sigma_x + n_y \sigma_y + n_z\sigma_z) \end{aligned} \end{equation}$. Check the derivation (2) on wikipedia: en.wikipedia.org/wiki/Pauli_matrices $\endgroup$ Commented Oct 7, 2023 at 16:58
9
$\begingroup$
  1. A generic $2\times2$ (special) unitary matrix decomposes in terms of Pauli matrices as $$U = a_0 I + i \sum_{j=1}^3 a_j \sigma_j,\tag U$$ for $a_j\in\mathbb R$ such that $\sum_{j=0}^3 a_j^2=1$. One way to write this condition is to parametrise the coefficients as $$a_0 = \cos(\theta), \qquad a_j = \sin(\theta) n_j$$ for any $\theta\in\mathbb R$ and $(n_1,n_2,n_3)\in\mathbb R^3$ such that $\|\vec n\|=1$. To be more explicit, this corresponds to the matrix $$U = \begin{pmatrix} a_0 + ia_3 & i(a_1-ia_2) \\ i(a_1+ia_2) & a_0 - ia_3\\ \end{pmatrix} = \begin{pmatrix} c+i sn_3 & is(n_1-in_2) \\ is(n_1+in_2) & c-is n_3 \end{pmatrix},$$ where $c\equiv \cos(\theta), s\equiv \sin(\theta)$. The eigenvectors of such a matrix are $$\frac{1}{\sqrt{2\|\vec a\|(\|\vec a\|\mp a_3)}}\begin{pmatrix}a_3 \mp \|\vec a\| \\ a_1 + i a_2\end{pmatrix},\tag1$$ where $\|\vec a\|^2\equiv \sum_{j=1}^3 a_j^2$.

  2. Given an arbitrary complex vector $(\alpha,\beta)\in\mathbb C^2$, you can get the corresponding vector in the Bloch sphere via the mapping (more precisely, this is a bijection $\mathbb{CP}^1\to S^2$): $$\begin{pmatrix}\alpha\\\beta\end{pmatrix} \longleftrightarrow \begin{pmatrix}2\operatorname{Re}(\bar\alpha\beta) \\ 2\operatorname{Im}(\bar\alpha\beta) \\ |\alpha|^2-|\beta|^2\end{pmatrix}.\tag2$$

Putting these facts together you can get the Bloch representation of the eigenvectors of a generic $2\times2$ special unitary matrix. More explicitly, using (1) and (2) together, we see that the Bloch representations of the two eigenvectors of the $U$ defined in $(\mathrm U)$ are precisely the (normalised versions of the) vectors $\pm(a_1,a_2,a_3)$, as one might have expected from the beginning.

$\endgroup$
4
  • $\begingroup$ Thanks for the answer, that helps a lot:) I'm just wondering does that matter if the sign in the expression of $U$ is changed to $-$? Parametrizing $a_0$ as $\cos(\theta/2)$ have the same effect, right? $\endgroup$
    – ZR-
    Commented Mar 17, 2021 at 22:21
  • $\begingroup$ what sign? Here $a_j$ are arbitrary real parameters, so $a_j\to -a_j$ gives another valid unitary, if that's what you are asking $\endgroup$
    – glS
    Commented Mar 17, 2021 at 22:24
  • $\begingroup$ Yeah that's what I was thinking. Thanks!! $\endgroup$
    – ZR-
    Commented Mar 17, 2021 at 22:29
  • $\begingroup$ also related: quantumcomputing.stackexchange.com/q/23351/55 $\endgroup$
    – glS
    Commented Feb 14, 2022 at 22:47
3
$\begingroup$

Thanks all for reading and answering the question, just a correction for the mapping: $$ \begin{pmatrix}\alpha\\\beta\end{pmatrix} \longleftrightarrow \begin{pmatrix}2\operatorname{Re}(\bar\alpha\beta) \\ 2\operatorname{Im}(\bar\alpha\beta)\\|\alpha|^2-|\beta|^2\end{pmatrix}. $$ This could be derived from the spherical-coordinate representation of $\hat n$ (note that $n_z=\cos\theta$) and the single-qubit representation:)

$\endgroup$
2
  • $\begingroup$ if you are referring to my answer, do you mean that I should have put the $n_z$ component in the third element of the vector? Well that depends on the conventions adopted in defining the Bloch sphere, but I suppose this way is more standard. I'll fix the post (btw, this should really be a comment, not an answer per se) $\endgroup$
    – glS
    Commented May 13, 2021 at 17:32
  • $\begingroup$ @glS Got it. Thanks:) $\endgroup$
    – ZR-
    Commented May 14, 2021 at 4:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.