Skip to content

CHAPTER 04

# Gates, observables, and the Bloch sphere

Learning goals. Multiply gate matrices, distinguish active transformations from coordinates, derive Bloch coordinates, and understand rotations and noncommuting operations.

## 4.1 Matrices act on vectors

A matrix is determined by what it does to basis vectors. Its first column is the output for |0⟩|0\rangle; its second is the output for |1⟩|1\rangle. Linearity then fixes the output for every superposition:

U(α|0⟩+β|1⟩)=α U|0⟩+β U|1⟩.U(\alpha|0\rangle+\beta|1\rangle)=\alpha U|0\rangle+\beta U|1\rangle.

For U=(a b c d)U=\begin{pmatrix}a&b\\c&d\end{pmatrix} the result is (a α+b β)|0⟩+(c α+d β)|1⟩(a\alpha+b\beta)|0\rangle+(c\alpha+d\beta)|1\rangle. Every row forms one output amplitude. A valid closed-system gate preserves all inner products, so it satisfies U†U=I U^\dagger U=I. Such a matrix is unitary, with inverse U†U^\dagger.

The Pauli gates and Hadamard are

X=(0 1 1 0),Y=(0−i i 0),Z=(1 0 0−1),X=\begin{pmatrix}0&1\\1&0\end{pmatrix},\quad Y=\begin{pmatrix}0&-i\\i&0\end{pmatrix},\quad Z=\begin{pmatrix}1&0\\0&-1\end{pmatrix}, H=1 2(1 1 1−1).H=\frac1{\sqrt2}\begin{pmatrix}1&1\\1&-1\end{pmatrix}.

X swaps the amplitudes, Z changes their relative sign, and Y combines a swap with phases. H maps |0⟩|0\rangle to |+⟩|+\rangle and |1⟩|1\rangle to |−⟩|-\rangle. These matrices are Hermitian as well as unitary; not every gate is Hermitian.

The phase gates are

S=(1 0 0 i),T=(1 0 0 e i π/4),S=T 2.S=\begin{pmatrix}1&0\\0&i\end{pmatrix},\qquad T=\begin{pmatrix}1&0\\0&e^{i\pi/4}\end{pmatrix},\qquad S=T^2.

S has inverse S†=diag(1,−i)S^\dagger=\operatorname{diag}(1,-i), not S itself.

## 4.2 Gate order is matrix order in reverse time

If U acts first and V second, the output is V U|ψ⟩VU|\psi\rangle. The rightmost matrix acts first. A circuit is conventionally read left to right, which is why translating circuits into matrix products requires care.

Worked example. Apply H to α|0⟩+β|1⟩\alpha|0\rangle+\beta|1\rangle:

H|ψ⟩=(α+β)|0⟩+(α−β)|1⟩2.H|\psi\rangle=\frac{(\alpha+\beta)|0\rangle+(\alpha-\beta)|1\rangle}{\sqrt2}.

Applying H again gives

H 2|ψ⟩=(α+β+α−β)|0⟩+(α+β−α+β)|1⟩2=α|0⟩+β|1⟩.H^2|\psi\rangle =\frac{(\alpha+\beta+\alpha-\beta)|0\rangle +(\alpha+\beta-\alpha+\beta)|1\rangle}{2} =\alpha|0\rangle+\beta|1\rangle.

The cancellations show H 2=I H^2=I. They also explain interference: the first H creates alternatives, and the second recombines them.

By contrast, X Z=−Z X XZ=-ZX. For instance, X Z|0⟩=|1⟩XZ|0\rangle=|1\rangle but Z X|0⟩=−|1⟩ZX|0\rangle=-|1\rangle. The minus sign is a global phase when these are complete single-qubit operations. In controlled versions, a phase confined to one control branch becomes relative and can matter. Never discard a phase before checking its role in a larger circuit.

## 4.3 Implementing a measurement basis

To measure X with a Z detector, apply H first, because ⟨0|H=⟨+|\langle0|H=\langle+| and ⟨1|H=⟨−|\langle1|H=\langle-|. To measure Y, apply S†S^\dagger and then H, so the total matrix is H S†HS^\dagger:

⟨0|H S†=⟨0|−i⟨1|2=⟨+i|.\langle0|HS^\dagger =\frac{\langle0|-i\langle1|}{\sqrt2}=\langle+i|.

Using SH instead produces a different operation. Writing the bra of the actual measurement is an effective way to verify a basis-rotation circuit.

## 4.4 Bloch coordinates from amplitudes

Remove a global phase so the first nonzero coefficient is real. Every pure qubit can then be written

|ψ⟩=cos θ 2|0⟩+e i ϕ sin θ 2|1⟩,0≤θ≤π.|\psi\rangle=\cos\frac\theta2|0\rangle+ e^{i\phi}\sin\frac\theta2|1\rangle,\quad 0\le\theta\le\pi.

Define x=⟨X⟩x=\langle X\rangle, y=⟨Y⟩y=\langle Y\rangle, and z=⟨Z⟩z=\langle Z\rangle. Matrix multiplication gives

x=α*β+β*α=2 Re(α*β),x=\alpha^*\beta+\beta^*\alpha=2\operatorname{Re}(\alpha^*\beta), y=−i α*β+i β*α=2 Im(α*β),y=-i\alpha^*\beta+i\beta^*\alpha=2\operatorname{Im}(\alpha^*\beta), z=|α|2−|β|2.z=|\alpha|^2-|\beta|^2.

Substituting the angular form yields

(x,y,z)=(sin θ cos ϕ,sin θ sin ϕ,cos θ).(x,y,z)=(\sin\theta\cos\phi,\sin\theta\sin\phi,\cos\theta).

Its length is one. The north and south poles are |0⟩,|1⟩|0\rangle,|1\rangle; the positive x and y directions are |+⟩,|+i⟩|+\rangle,|+i\rangle. The sphere represents pure qubit states modulo global phase, not the physical path or shape of a particle.

For (2|0⟩+3 i|1⟩)/13(2|0\rangle+3i|1\rangle)/\sqrt{13},

(x,y,z)=(0,12/13,−5/13),x 2+y 2+z 2=(144+25)/169=1.(x,y,z)=(0,12/13,-5/13),\quad x^2+y^2+z^2=(144+25)/169=1.

Thus equal X probabilities do not place the state at the sphere’s center. They only imply its x coordinate is zero.

Figure 4.1. Bloch coordinates and the three measurement axes.

## 4.5 Rotations and generators

For a unit vector 𝐧\boldsymbol n, let A=n x X+n y Y+n z Z A=n_xX+n_yY+n_zZ. Since A 2=I A^2=I, the exponential series separates into even and odd powers:

e−i θ A/2=I cos(θ/2)−i A sin(θ/2).e^{-i\theta A/2} =I\cos(\theta/2)-iA\sin(\theta/2).

This is R 𝐧(θ)R_{\boldsymbol n}(\theta), rotating the Bloch vector by angle θ\theta about 𝐧\boldsymbol n. For example,

R y(θ)=(cos(θ/2)−sin(θ/2)sin(θ/2)cos(θ/2)),R_y(\theta)= \begin{pmatrix}\cos(\theta/2)&-\sin(\theta/2)\\ \sin(\theta/2)&\cos(\theta/2)\end{pmatrix}, R z(θ)=diag(e−i θ/2,e i θ/2).R_z(\theta)=\operatorname{diag}(e^{-i\theta/2},e^{i\theta/2}).

The half-angle is necessary: a 2 π 2\pi rotation gives −I-I, physically the same pure state but a different vector representative. H corresponds to a half-turn about (x+z)/2(x+z)/\sqrt2, up to global phase; it is not simply a quarter-turn about y.

## 4.6 Observables and uncertainty

An observable is Hermitian: A†=A A^\dagger=A. Its eigenvalues are real, and its orthonormal eigenvectors specify a projective measurement. A gate is unitary. Some matrices, including the Paulis, serve both roles, but “apply Z” and “measure Z” are different physical instructions.

The commutator is [A,B]=A B−B A[A,B]=AB-BA. Since [X,Y]=2 i Z[X,Y]=2iZ, the uncertainty relation gives Δ X Δ Y≥|⟨Z⟩|\Delta X\Delta Y\ge|\langle Z\rangle|. In |0⟩|0\rangle, both X and Y outcomes are random, so Δ X=Δ Y=1\Delta X=\Delta Y=1, saturating the bound. This is a statement about measurement distributions across identically prepared copies.

Laboratory L05 — Bloch sphere and gates. Adjust θ,ϕ\theta,\phi, rotate the view, and apply H, X, Y, Z, S, or a rotation. Read all three expectations and basis probabilities. Check the recurring example’s coordinates.

## 4.7 Exercises

4.1. Verify H Z H=X HZH=X using the matrix columns or its action on both basis states.

Show solution / guidance

H|0⟩=|+⟩H|0\rangle=|+\rangle, Z|+⟩=|−⟩Z|+\rangle=|-\rangle, H|−⟩=|1⟩H|-\rangle=|1\rangle. The other input maps to |0⟩|0\rangle. These outputs are exactly X’s columns.

4.2. Calculate Z probabilities after H S H|0⟩HSH|0\rangle.

Show solution / guidance

The intermediate state is (|0⟩+i|1⟩)/2(|0\rangle+i|1\rangle)/\sqrt2. The final amplitudes are (1+i)/2,(1−i)/2(1+i)/2,(1-i)/2. Each has squared modulus 2/4=1/2 2/4=1/2.

4.3. Find the Bloch coordinates of (|0⟩+e i π/3|1⟩)/2(|0\rangle+e^{i\pi/3}|1\rangle)/\sqrt2.

Show solution / guidance

θ=π/2,ϕ=π/3\theta=\pi/2,\phi=\pi/3, so (x,y,z)=(1/2,3/2,0)(x,y,z)=(1/2,\sqrt3/2,0).

4.4. Derive Z probabilities after R y(θ)|0⟩R_y(\theta)|0\rangle and verify normalization.

Show solution / guidance

The state is cos(θ/2)|0⟩+sin(θ/2)|1⟩\cos(\theta/2)|0\rangle+\sin(\theta/2)|1\rangle. The probabilities are cos 2(θ/2),sin 2(θ/2)\cos^2(\theta/2),\sin^2(\theta/2) and sum to one.

4.5. Why can a unitary not reset both |0⟩|0\rangle and |1⟩|1\rangle to |0⟩|0\rangle?

Show solution / guidance

The input overlap is zero; the proposed output overlap is one. Reset is possible as an open-system process that exports information, not as a unitary on the qubit alone.

IN THIS CHAPTER