# How do I calculate the position on the Bloch sphere of a quantum gate with a given diagonal matrix?

In quantum computation there are several principal quantum gates that have corresponding matrix representations. One of these is the Z gate, whose matrix is $\left[\begin{smallmatrix} 1 & 0 \\ 0 & -1 \end{smallmatrix}\right]$.

... anyway, I've found the eigenvalues (equal to +1, -1) using the characteristic equation, and used them to derive the corresponding eigenvectors, which come together quite nicely in a 2×2 matrix $\left[\begin{smallmatrix} 1 & 0 \\ 0 & 1\end{smallmatrix}\right]$, equal to the identity. So, in diagonalizing this matrix, I find that the diagonal matrix $D$ is the same matrix as the one for gate $Z$.

... the next step and where I'm stuck is to find the corresponding point on the Bloch sphere for this gate. In order to do that, I need to compute how to take the diagonalized matrix call it $D_z$ and derive two things: (a) its diagonal representation $| 0 \rangle \langle 0 | - | 1 \rangle \langle 1 |$, and (b) the normalized eigenvalues $a, b$ for $Z$, where $Z = a|0\rangle + b|1\rangle$ and must be orthonormal i.e. $a^2 + b^2 = 1$. The $a$ and $b$ terms correspond to the probabilities of measuring 0 or 1 for the state, respectively (I think).

After I have the values for $a$ and $b$, I'll be able to locate the gate on the Bloch sphere because the calculation of its coordinates on the sphere is straightforward: $a = \cos(\theta / 2)$, and $b = e^{i\phi}\sin(\theta/2)$.

-

## 2 Answers

There's actually an extremely nice way to uncover the Bloch sphere representation for any density operator. (Pure states are just a special case.)

Definition.

I'm not sure how your (lecturer? book? other learning source?) defines the Bloch sphere, but the definition that makes the most sense from a fundamental perspective is that, for any density operator ρ, the point on (or inside) the Bloch sphere corresponding to ρ is the vector (rxryrz) such that $$\rho = \tfrac{1}{2}( I + r_x X + r_y Y + r_z Z )$$ where $I$ is the identity and $X, Y, Z$ are the (other) 2×2 Pauli operators.

Proof sketch.

It's easy to show that the operators $I, X, Y, Z$ are linearly independent (what linear combinations of them add to the zero operator?) and are Hermitian (each is equal to it's own conjugate-transpose). From this you can show that they span the set of all 2×2 Hermitian operators; and as they are linearly independent, they're actually a basis set for those operators. So any density operator — which is also Hermitian — will decompose into $I, X, Y, Z$ in a unique way. (It's possible to show that it's coefficient in $I$ is always ½ by considering the trace. Do you see how?)

Answer.

You should try to prove the things I've said above — it isn't hard, and it's using math that will be useful to you later anyway — but for the problem of finding the Bloch sphere representation, all you need to do is solve for (rxryrz) in the equation above.

If you like, you can even obtain these coefficients by a simple formula. (Hint: what is the trace of the product of two different matrices chosen from $I,X,Y,Z$? What does this mean for $\mathrm{tr}(\rho P)$ for $P \in \{I,X,Y,Z\}$?)

Another remark —

In the future, you don't have to really do any work to find the eigenvalues of a diagonal matrix $D$. It's easy to show that he standard basis vectors $\mathbf e_j = [\; 0 \; \cdots \; 0 \;\; 1 \;\; 0 \; \cdots \; 0 \;]^\top$ are eigenvectors for any diagonal matrix, and that the eigenvalues are exactly the coefficients on the diagonal (with multiplicity given by how often each is repeated). It's also easy to show that $D - \lambda I$ is invertible for any other $\lambda$, so that these are all the eigenvalues.

-
Niel this is great stuff! Since you asked, I'm teaching myself Q.I.C. from Nielson and Chuang a.k.a. "mike and ike". My hope is that within a year I can get to a point where I can design quantum circuits that are useful. –  user756 Oct 8 '11 at 15:22
@bwkaplan: Best of luck in your studies! –  Niel de Beaudrap Oct 8 '11 at 15:33
I'm having some trouble finding any pure states e.g. such as the Z gate on the Bloch sphere representation you've provided. Someone in chat pointed to theorem 2.5 in Nielsen and Chuang providing a reason as to why. Pure states fail both criteria for density operators. Perhaps I've misinterpreted your reasoning and ask that you please clarify. –  user756 Oct 13 '11 at 21:18
The Bloch sphere representation only holds for 2x2 density operators, which are positive semidefinite and have trace 1. The Z operator fails both of these criteria. Because it does not have trace 1, the coefficient of the identity matrix will not be 1/2; in fact, it will be zero, as the trace of Z is zero. (Note: can you derive what properties hold for the coefficients of a 2x2 positive semidefinite matrix when it is decomposed as a linear combination of the operators I, X, Y, and Z?) For an arbitrary Hermitian matrix, you need instead a vector $(r_I, r_X, r_Y, r_Z)$ with real coefficients. –  Niel de Beaudrap Oct 13 '11 at 23:06

Adding some more to Niel's post, let $\vec{u} = (u_x,u_y,u_z)$ be a unit vector. Then $\sigma_u = u_x\sigma_x+u_y\sigma_y+u_z\sigma_z$ is the Pauli spin operator in the $\vec{u}$ direction.

As with any Pauli spin operator, $\sigma_u^2 = 1$. This is because $\sigma_x,\sigma_y$, and $\sigma_z$ square to 1, and all cross terms cancel by anticommutativity. Therefore $(1+\sigma_u)/2$ is easily shown to be idempotent and since it has trace 1, it is the pure density matrix of a state. But the state has to be spin in the $\vec{u}$ direction because it is an eigenoperator of spin in the u direction (with eigenvalue 1): $\sigma_u\;\;(1+\sigma_u)/2 = 1\;\; (1+\sigma_u)/2$. Thus to get the corresponding state (spinor), take any nonzero column vector of $(1+\sigma_u)/2$ and normalize.

-