Simple Algorithm
Quantum Computing · Excited State · 22 min

Single-Qubit Gates as Rotations

Pauli, Hadamard, phase and rotation gates on the Bloch sphere.

Every single-qubit gate, from a textbook XX to an arbitrary microwave pulse, is a rotation of the Bloch sphere times a phase nobody can observe. In this lesson you will prove that, derive the rotation formula e−iθ n^⋅σ⃗/2e^{-i\theta\,\hat n\cdot\vec\sigma/2} from the Pauli algebra, and learn to read HH, SS and TT as rotations.

What you’ll learn

  • Show that every 2×22\times2 unitary is eiαe^{i\alpha} times an element of SU(2)SU(2), and explain why the phase is unobservable for a standalone gate.
  • Derive Rn^(θ)=cos⁡θ2 I−isin⁡θ2 n^⋅σ⃗R_{\hat n}(\theta)=\cos\tfrac\theta2\,\id-i\sin\tfrac\theta2\,\hat n\cdot\vec\sigma from the Pauli product rule.
  • Prove that Rn^(θ)R_{\hat n}(\theta) rotates the Bloch vector by θ\theta about n^\hat n.
  • Express HH, SS, TT and X\sqrt X as rotations and use conjugation identities such as HZH=XHZH=X and TXT†=(X+Y)/2TXT^\dagger=(X+Y)/\sqrt2.

Unitaries, determinants and phases

A single-qubit gate is a 2×22\times2 unitary matrix, U†U=IU^\dagger U=\id. Unitarity says the columns of UU are orthonormal, which is exactly what it takes to map normalized states to normalized states and to preserve every inner product ⟨ϕ∣ψ⟩\braket{\phi|\psi}. Taking determinants of U†U=IU^\dagger U=\id gives ∣det⁡U∣2=1\abs{\det U}^2=1, so det⁡U=e2iα\det U=e^{2i\alpha} for some real α\alpha.

DerivationThe shape of every single-qubit gate
  1. V=e−iαU,det⁡V=e−2iαdet⁡U=1V=e^{-i\alpha}U,\qquad \det V=e^{-2i\alpha}\det U=1

    Strip off a phase so that the determinant is 1: VV lies in the special unitary group SU(2)SU(2).

  2. V=(acbd),∣a∣2+∣b∣2=1V=\begin{pmatrix}a&c\\b&d\end{pmatrix},\qquad \abs{a}^2+\abs{b}^2=1

    The first column is a unit vector.

  3. (cd)=λ(−b∗a∗),∣λ∣=1\begin{pmatrix}c\\d\end{pmatrix}=\lambda\begin{pmatrix}-b^*\\a^*\end{pmatrix},\qquad\abs{\lambda}=1

    In C2\C^2, the unit vectors orthogonal to (a,b)(a,b) are exactly the phase multiples of (−b∗,a∗)(-b^*,a^*).

  4. det⁡V=λ(∣a∣2+∣b∣2)=λ=1\det V=\lambda\left(\abs{a}^2+\abs{b}^2\right)=\lambda=1

    The determinant condition fixes that phase.

  5. U=eiα(a−b∗ba∗),∣a∣2+∣b∣2=1U=e^{i\alpha}\begin{pmatrix}a&-b^*\\b&a^*\end{pmatrix},\qquad\abs{a}^2+\abs{b}^2=1

    One phase plus three real parameters (a point of the unit sphere S3⊂C2S^3\subset\C^2).

The factor eiαe^{i\alpha} is a global phase: U∣ψ⟩U\ket\psi and V∣ψ⟩V\ket\psi differ by an overall phase, so every measurement gives identical statistics. For a standalone gate only V∈SU(2)V\in SU(2) matters. Keep the phase in mind, though: it becomes physical as soon as the gate is controlled by another qubit.

Check your understanding

Which statement about U=eiπ/3XU=e^{i\pi/3}X is true?

  1. It is not unitary, because of the complex prefactor
  2. As a standalone gate it is indistinguishable from XX: every measurement statistic agrees on every input
  3. It differs from XX by a relative phase, which an interference experiment on one qubit could reveal
  4. It agrees with XX only on the input ∣0⟩\ket0
Show the answer

B. As a standalone gate it is indistinguishable from XX: every measurement statistic agrees on every input

eiπ/3X∣ψ⟩e^{i\pi/3}X\ket\psi and X∣ψ⟩X\ket\psi differ by the same factor eiπ/3e^{i\pi/3} for every ∣ψ⟩\ket\psi, and that factor has modulus 1, so all probabilities agree. (If the gate were controlled, the same factor would become a relative phase between the control's branches.)

The Pauli algebra

X=(0110),Y=(0−ii0),Z=(100−1)X=\begin{pmatrix}0&1\\1&0\end{pmatrix},\qquad Y=\begin{pmatrix}0&-i\\i&0\end{pmatrix},\qquad Z=\begin{pmatrix}1&0\\0&-1\end{pmatrix}
The Pauli matrices, also written σ1,σ2,σ3\sigma_1,\sigma_2,\sigma_3.

Each Pauli is both hermitian and unitary, so each squares to the identity and has eigenvalues ±1\pm1. Their eigenstates are the six cardinal points of the Bloch sphere: ∣0⟩,∣1⟩\ket0,\ket1 for ZZ, ∣±⟩\ket\pm for XX and ∣±i⟩\ket{\pm i} for YY. All of their algebra is packed into a single product rule:

σjσk=δjk I+i ϵjkl σl\sigma_j\sigma_k=\delta_{jk}\,\id+i\,\epsilon_{jkl}\,\sigma_l
So XY=iZXY=iZ, YZ=iXYZ=iX, ZX=iYZX=iY. Distinct Paulis anticommute, {σj,σk}=2δjkI\acomm{\sigma_j}{\sigma_k}=2\delta_{jk}\id, and [σj,σk]=2iϵjklσl\comm{\sigma_j}{\sigma_k}=2i\epsilon_{jkl}\sigma_l.

Contracting the product rule with real vectors a⃗,b⃗\vec a,\vec b gives the identity that drives everything below:

(a⃗⋅σ⃗)(b⃗⋅σ⃗)=(a⃗⋅b⃗) I+i (a⃗×b⃗)⋅σ⃗(\vec a\cdot\vec\sigma)(\vec b\cdot\vec\sigma)=(\vec a\cdot\vec b)\,\id+i\,(\vec a\times\vec b)\cdot\vec\sigma
In particular (n^⋅σ⃗)2=I(\hat n\cdot\vec\sigma)^2=\id for every unit vector n^\hat n.

Together with I\id, the Paulis form a basis of all 2×22\times2 matrices that is orthogonal in the trace inner product Tr⁡(A†B)\Tr(A^\dagger B): every M=12(Tr⁡M I+∑jTr⁡(Mσj) σj)M=\tfrac12\big(\Tr M\,\id+\sum_j\Tr(M\sigma_j)\,\sigma_j\big). A state's Bloch vector is just its list of Pauli coordinates, ∣ψ⟩ ⁣⟨ψ∣=12(I+r⃗⋅σ⃗)\dyad{\psi}=\tfrac12(\id+\vec r\cdot\vec\sigma).

Think first Why does (n^⋅σ⃗)2=I(\hat n\cdot\vec\sigma)^2=\id make exponentials of Paulis easy?

Every power collapses: even powers equal I\id and odd powers equal n^⋅σ⃗\hat n\cdot\vec\sigma. The exponential series therefore splits into two scalar series, which turn out to be cosine and sine. That is the next derivation.

Rotation gates

Physically, gates are generated by Hamiltonians: a constant drive ω2 n^⋅σ⃗\tfrac\omega2\,\hat n\cdot\vec\sigma applied for a time tt produces e−iωt n^⋅σ⃗/2e^{-i\omega t\,\hat n\cdot\vec\sigma/2} (with ℏ=1\hbar=1). So the natural family of gates is the exponentials of Paulis, the rotation gates Rn^(θ)R_{\hat n}(\theta) with θ=ωt\theta=\omega t.

DerivationExponentiating a Pauli
  1. Rn^(θ)≡e−iθ n^⋅σ⃗/2=∑k=0∞1k!(−iθ2)k(n^⋅σ⃗)kR_{\hat n}(\theta)\equiv e^{-i\theta\,\hat n\cdot\vec\sigma/2}=\sum_{k=0}^{\infty}\frac{1}{k!}\Big(\frac{-i\theta}{2}\Big)^{k}(\hat n\cdot\vec\sigma)^{k}

    Definition, as a power series.

  2. (n^⋅σ⃗)2m=I,(n^⋅σ⃗)2m+1=n^⋅σ⃗(\hat n\cdot\vec\sigma)^{2m}=\id,\qquad(\hat n\cdot\vec\sigma)^{2m+1}=\hat n\cdot\vec\sigma

    Use (n^⋅σ⃗)2=I(\hat n\cdot\vec\sigma)^2=\id.

  3. Rn^(θ)=(∑m(−1)m(2m)!(θ2)2m)I−i(∑m(−1)m(2m+1)!(θ2)2m+1) n^⋅σ⃗R_{\hat n}(\theta)=\Big(\sum_{m}\frac{(-1)^m}{(2m)!}\big(\tfrac\theta2\big)^{2m}\Big)\id-i\Big(\sum_{m}\frac{(-1)^m}{(2m+1)!}\big(\tfrac\theta2\big)^{2m+1}\Big)\,\hat n\cdot\vec\sigma

    Split even and odd terms, using (−i)2m=(−1)m(-i)^{2m}=(-1)^m and (−i)2m+1=−i(−1)m(-i)^{2m+1}=-i(-1)^m.

  4. Rn^(θ)=cos⁡θ2 I−isin⁡θ2 n^⋅σ⃗R_{\hat n}(\theta)=\cos\tfrac\theta2\,\id-i\sin\tfrac\theta2\,\hat n\cdot\vec\sigma

    Recognize the cosine and sine series.

Rx(θ)=(cos⁡θ2−isin⁡θ2−isin⁡θ2cos⁡θ2),Ry(θ)=(cos⁡θ2−sin⁡θ2sin⁡θ2cos⁡θ2),Rz(θ)=(e−iθ/200eiθ/2)R_x(\theta)=\begin{pmatrix}\cos\frac\theta2&-i\sin\frac\theta2\\-i\sin\frac\theta2&\cos\frac\theta2\end{pmatrix},\quad R_y(\theta)=\begin{pmatrix}\cos\frac\theta2&-\sin\frac\theta2\\\sin\frac\theta2&\cos\frac\theta2\end{pmatrix},\quad R_z(\theta)=\begin{pmatrix}e^{-i\theta/2}&0\\0&e^{i\theta/2}\end{pmatrix}
Check your understanding

What is Rn^(2π)R_{\hat n}(2\pi)?

  1. I\id
  2. −I-\id
  3. n^⋅σ⃗\hat n\cdot\vec\sigma
  4. −i n^⋅σ⃗-i\,\hat n\cdot\vec\sigma
Show the answer

B. −I-\id

cos⁡π I−isin⁡π n^⋅σ⃗=−I\cos\pi\,\id-i\sin\pi\,\hat n\cdot\vec\sigma=-\id. A full turn returns every Bloch vector but multiplies the state by −1-1; only a 4π4\pi turn gives +I+\id. This is the two-to-one map SU(2)→SO(3)SU(2)\to SO(3). The sign is invisible for a lone gate, but a controlled Rz(2π)R_z(2\pi) acts as ZZ on the control.

H, S, T and friends as rotations

Every named gate is a rotation up to a global phase. Use Rn^(π)=−i n^⋅σ⃗R_{\hat n}(\pi)=-i\,\hat n\cdot\vec\sigma for half-turns and Rz(φ)=e−iφ/2diag⁡(1,eiφ)R_z(\varphi)=e^{-i\varphi/2}\diag(1,e^{i\varphi}) for phase gates:

GateMatrixAs a rotation
XX, YY, ZZthe PaulisiRx(π)iR_x(\pi), iRy(π)iR_y(\pi), iRz(π)iR_z(\pi): half-turns
HH12(111−1)=X+Z2\tfrac{1}{\sqrt2}\begin{pmatrix}1&1\\1&-1\end{pmatrix}=\tfrac{X+Z}{\sqrt2}iRh^(π)iR_{\hat h}(\pi) with h^=(x^+z^)/2\hat h=(\hat x+\hat z)/\sqrt2
P(φ)P(\varphi)diag⁡(1,eiφ)\diag(1,e^{i\varphi})eiφ/2Rz(φ)e^{i\varphi/2}R_z(\varphi)
S=P(π/2)S=P(\pi/2)diag⁡(1,i)\diag(1,i)eiπ/4Rz(π/2)e^{i\pi/4}R_z(\pi/2)
T=P(π/4)T=P(\pi/4)diag⁡(1,eiπ/4)\diag(1,e^{i\pi/4})eiπ/8Rz(π/4)e^{i\pi/8}R_z(\pi/4), hence the old name "π/8\pi/8 gate"
X\sqrt X12(1+i1−i1−i1+i)\tfrac12\begin{pmatrix}1+i&1-i\\1-i&1+i\end{pmatrix}eiπ/4Rx(π/2)=HSHe^{i\pi/4}R_x(\pi/2)=HSH

Conjugation moves rotation axes. If a unitary VV acts on Bloch vectors as the rotation V\mathsf{V}, the theorem above gives V(n^⋅σ⃗)V†=(Vn^)⋅σ⃗V(\hat n\cdot\vec\sigma)V^\dagger=(\mathsf{V}\hat n)\cdot\vec\sigma, and hence:

V Rn^(θ) V†=RVn^(θ)V\,R_{\hat n}(\theta)\,V^\dagger=R_{\mathsf{V}\hat n}(\theta)
Conjugating a rotation rotates its axis. HH swaps x^↔z^\hat x\leftrightarrow\hat z and sends y^→−y^\hat y\to-\hat y, so HXH=ZHXH=Z, HZH=XHZH=X, HYH=−YHYH=-Y. SS turns x^\hat x into y^\hat y, so SXS†=YSXS^\dagger=Y and SYS†=−XSYS^\dagger=-X.

How can you check that a gate sequence UU equals XX on every input with a single circuit? Feed it half of a Bell pair. Applying UU to qubit 1 of ∣Φ+⟩=12(∣00⟩+∣11⟩)\ket{\Phi^+}=\tfrac{1}{\sqrt2}(\ket{00}+\ket{11}) gives 12(∣0⟩⊗U∣0⟩+∣1⟩⊗U∣1⟩)\tfrac{1}{\sqrt2}\big(\ket0\otimes U\ket0+\ket1\otimes U\ket1\big), which records both columns of UU. So the output equals (I⊗X)∣Φ+⟩=12(∣01⟩+∣10⟩)(\id\otimes X)\ket{\Phi^+}=\tfrac{1}{\sqrt2}(\ket{01}+\ket{10}), up to phase, exactly when U=eiγXU=e^{i\gamma}X.

Check your understanding

Which rotation is TXT†TXT^\dagger?

  1. A half-turn about x^\hat x
  2. A half-turn about (x^+y^)/2(\hat x+\hat y)/\sqrt2
  3. A half-turn about (x^+z^)/2(\hat x+\hat z)/\sqrt2
  4. A quarter-turn about z^\hat z
Show the answer

B. A half-turn about (x^+y^)/2(\hat x+\hat y)/\sqrt2

T=eiπ/8Rz(π/4)T=e^{i\pi/8}R_z(\pi/4) and phases cancel in a conjugation, so TXT†=Rz(π4) X Rz(π4)†=cos⁡π4 X+sin⁡π4 Y=X+Y2TXT^\dagger=R_z(\tfrac\pi4)\,X\,R_z(\tfrac\pi4)^\dagger=\cos\tfrac\pi4\,X+\sin\tfrac\pi4\,Y=\tfrac{X+Y}{\sqrt2}: the xx-axis turned 45° toward yy. This is not a Pauli, which is why TT is not a Clifford gate.

Every gate is a rotation

Counting parameters: one phase and three rotation parameters, matching dim⁡U(2)=4\dim U(2)=4. Preparing a state needs only two of them: every pure state equals Rz(φ)Ry(θ)∣0⟩R_z(\varphi)R_y(\theta)\ket0 up to a global phase, as you just did with the ghost arrow.

python
from math import pi
from qiskit import QuantumCircuit

qc = QuantumCircuit(1)
qc.ry(pi / 3, 0)        # latitude:  theta = pi/3
qc.rz(3 * pi / 4, 0)    # longitude: phi = 3pi/4

# The general gate U(theta, phi, lam) equals Rz(phi) Ry(theta) Rz(lam)
# up to a global phase; U(pi/2, 0, pi) is exactly the Hadamard.
qc.u(pi / 2, 0, pi, 0)

SDKs expose the same decomposition. Libraries differ in their global-phase conventions, which only matter once a gate is controlled.

Key takeaways

  • Every single-qubit gate is U=eiαRn^(θ)U=e^{i\alpha}R_{\hat n}(\theta): an unobservable global phase times a rotation of the Bloch sphere.
  • Rn^(θ)=e−iθ n^⋅σ⃗/2=cos⁡θ2 I−isin⁡θ2 n^⋅σ⃗R_{\hat n}(\theta)=e^{-i\theta\,\hat n\cdot\vec\sigma/2}=\cos\tfrac\theta2\,\id-i\sin\tfrac\theta2\,\hat n\cdot\vec\sigma, because (n^⋅σ⃗)2=I(\hat n\cdot\vec\sigma)^2=\id; it rotates Bloch vectors by θ\theta about n^\hat n.
  • Up to phase, the Paulis are half-turns, HH is a half-turn about (x^+z^)/2(\hat x+\hat z)/\sqrt2, SS and TT are zz-rotations by π/2\pi/2 and π/4\pi/4, and X=HSH\sqrt X=HSH is an xx-rotation by π/2\pi/2.
  • Conjugation rotates axes, VRn^(θ)V†=RVn^(θ)VR_{\hat n}(\theta)V^\dagger=R_{\mathsf{V}\hat n}(\theta), giving HZH=XHZH=X, SXS†=YSXS^\dagger=Y and TXT†=(X+Y)/2TXT^\dagger=(X+Y)/\sqrt2.
  • Rn^(2π)=−IR_{\hat n}(2\pi)=-\id: invisible for a lone gate, but a sign of the SU(2)→SO(3)SU(2)\to SO(3) double cover that matters once gates are controlled.

Check yourself

In the interactive lesson these are scored with your confidence, and what you miss comes back for review.

Question 1

What is Ry(π/2)∣0⟩R_y(\pi/2)\ket0?

  1. ∣+i⟩\ket{+i}
  2. ∣−⟩\ket-
  3. ∣+⟩\ket+
  4. ∣1⟩\ket1
Show the answer

C. ∣+⟩\ket+

Ry(π2)∣0⟩=cos⁡π4∣0⟩+sin⁡π4∣1⟩=∣+⟩R_y(\tfrac\pi2)\ket0=\cos\tfrac\pi4\ket0+\sin\tfrac\pi4\ket1=\ket+: a quarter-turn about yy tips the north pole onto +x^+\hat x.

Question 2

Which of these equals the Hadamard gate exactly, with no extra phase?

  1. Ry(π/2)R_y(\pi/2)
  2. Ry(π/2) ZR_y(\pi/2)\,Z
  3. Rz(π/2) Ry(π/2)R_z(\pi/2)\,R_y(\pi/2)
  4. Rx(π/2)R_x(\pi/2)
Show the answer

B. Ry(π/2) ZR_y(\pi/2)\,Z

Ry(π2)Z=12(1−111)(100−1)=12(111−1)=HR_y(\tfrac\pi2)Z=\tfrac{1}{\sqrt2}\begin{pmatrix}1&-1\\1&1\end{pmatrix}\begin{pmatrix}1&0\\0&-1\end{pmatrix}=\tfrac{1}{\sqrt2}\begin{pmatrix}1&1\\1&-1\end{pmatrix}=H: first a half-turn about zz, then a quarter-turn about yy.

Question 3

Which property makes e−iθP/2=cos⁡θ2 I−isin⁡θ2 Pe^{-i\theta P/2}=\cos\tfrac\theta2\,\id-i\sin\tfrac\theta2\,P hold for a Pauli matrix PP?

  1. PP is traceless
  2. PP has real entries
  3. PP is Hermitian
  4. P2=IP^2=\id
Show the answer

D. P2=IP^2=\id

With P2=IP^2=\id, every even power of PP is I\id and every odd power is PP, so the exponential series splits into the cosine and sine series. Any matrix with A2=IA^2=\id obeys the same formula.

Question 4

How many real parameters does a general gate U∈U(2)U\in U(2) have, and how many of them affect the measurement statistics of a standalone gate?

  1. 4 and 3
  2. 3 and 2
  3. 8 and 4
  4. 4 and 4
Show the answer

A. 4 and 3

U=eiαRn^(θ)U=e^{i\alpha}R_{\hat n}(\theta): a phase plus three rotation parameters (axis and angle). The phase is global, so only the three rotation parameters matter for an uncontrolled gate.

Go deeper

Further reading

  • M. A. Nielsen & I. L. Chuang, Quantum Computation and Quantum Information, §4.2 (Cambridge, 10th anniv. ed., 2010).
  • J. Preskill, Lecture Notes for Ph219/CS219: Quantum Information and Computation, Caltech (online lecture notes).
  • A. Barenco et al., "Elementary gates for quantum computation", Phys. Rev. A 52, 3457 (1995).