The rotation gates Rn^(θ)=e−iθn^⋅σ/2 are the single-qubit unitaries that turn the Bloch sphere rigidly by the angle θ about the axis n^. We derive their closed form cos2θI−isin2θn^⋅σ from the power series, verify by explicit 2×2 products that conjugation by RZ(θ) rotates the Pauli operators (and hence the Bloch vector) about z, and prove the ZYZ Euler theorem: every U∈U(2) equals eiαRZ(β)RY(γ)RZ(δ). Two consequences follow: any Bloch state is prepared from ∣0⟩ by RZ(ϕ)RY(θ), and the hardware gate U3(θ,ϕ,λ) is a ZYZ product up to the global phase ei(ϕ+λ)/2.
For a real unit vector n^=(nx,ny,nz), nx2+ny2+nz2=1, define n^⋅σ=nxX+nyY+nzZ. This matrix is Hermitian, so e−iθn^⋅σ/2 is unitary for every real θ (it is the time-evolution operator of the Hamiltonian 21n^⋅σ for time θ). The rotation gate about n^ is
Rn^(θ)=exp(−2iθn^⋅σ)=∑k=0∞k!1(−2iθ)k(n^⋅σ)k.
The lesson on the spectral theorem computed such exponentials by diagonalising; here we use a shortcut that works because n^⋅σ squares to the identity.
Split the exponential series into even k=2m and odd k=2m+1 terms; this regrouping is legitimate because the series converges absolutely in any matrix norm.
6
Step 6:
Rn^(θ)=cos2θI−isin2θn^⋅σ
The two bracketed series are the Taylor series of cos2θ and sin2θ.
The diagonal product is cos22θ+nz2sin22θ and the off-diagonal product is (−inx−ny)(−inx+ny)sin22θ=−(nx2+ny2)sin22θ; hence Rn^(θ)∈SU(2).
Result
Rn^(θ)=e−iθn^⋅σ/2=cos2θI−isin2θn^⋅σ∈SU(2)
Taking n^ along the three coordinate axes gives the three standard rotation gates (the conventions of the simulator, qubit 0 = most significant bit):
RX(θ)=(cos2θ−isin2θ−isin2θcos2θ),RY(θ)=(cos2θsin2θ−sin2θcos2θ),RZ(θ)=(e−iθ/200eiθ/2).
For RZ the diagonal entries are cos2θ∓isin2θ=e∓iθ/2 by Euler's formula. RY is the only one of the three with real entries: it is an ordinary rotation matrix of the plane spanned by ∣0⟩,∣1⟩, but by the half angle 2θ.
Periodicity. At θ=2π the closed form gives Rn^(2π)=cosπI−isinπn^⋅σ=−I, and at θ=4π it gives Rn^(4π)=cos2πI=I. A full turn of the Bloch sphere multiplies every state by the global phase −1; only two full turns return the operator to I. Since −I is invisible in every measurement, the angles θ and θ+2π prepare physically identical states.
A state with Bloch vector r=(x,y,z) has density operator ρ=21(I+xX+yY+zZ). A gate U maps it to UρU†=21(I+xUXU†+yUYU†+zUZU†), so to know what U does to r it suffices to know how conjugation by U transforms the three Pauli matrices. For U=RZ(θ) we compute the three products explicitly.
RZ(θ)†=diag(eiθ/2,e−iθ/2) is the complex conjugate of the diagonal.
2
Step 2:
=(0eiθ/2e−iθ/20)(eiθ/200e−iθ/2)=(0eiθe−iθ0)
Left multiplication by a diagonal matrix scales the rows, right multiplication scales the columns: entry (0,1) becomes e−iθ/2⋅e−iθ/2 and entry (1,0) becomes eiθ/2⋅eiθ/2.
Substitute the three results into 21(I+xX+yY+zZ) and collect the coefficients of X and Y.
Result
r⟼cosθsinθ0−sinθcosθ0001r(rotation by θ about z^)
The new Bloch vector is the old one turned counter-clockwise (seen from +z) by the full angle θ, although the matrix entries contain only 2θ: the two half-angle phases add up in the conjugation UρU†. For the other two axes one has, with cyclic relabelling x→y→z→x:
RX(θ)XRX(θ)†=X,RX(θ)YRX(θ)†=cosθY+sinθZ,RX(θ)ZRX(θ)†=cosθZ−sinθY,RY(θ)YRY(θ)†=Y,RY(θ)ZRY(θ)†=cosθZ+sinθX,RY(θ)XRY(θ)†=cosθX−sinθZ.
We derive the RY case algebraically from the closed form, which avoids multiplying matrices and works for any axis.
Derivation
Conjugating Z and X by RY(θ)
1
Step 1:
RY(θ)=cI−isY,RY(θ)†=cI+isY,c=cos2θ,s=sin2θ
Closed form with n^=y^; the adjoint conjugates −i because Y is Hermitian.
2
Step 2:
RYZRY†=c2Z+icsZY−icsYZ+s2YZY
Expand (cI−isY)Z(cI+isY) into four terms.
3
Step 3:
ZY=−iX,YZ=iX,YZY=−ZYY=−Z
Pauli products YZ=iX, ZY=−iX (anticommutation YZ=−ZY) and Y2=I.
A rotation of three-dimensional space can be written as a rotation about z, then about y, then about z again (Euler angles). Because single-qubit gates act on the Bloch sphere as rotations, the same should hold for 2×2 unitaries, up to the one parameter that rotations cannot see: a global phase. U(2) has four real parameters, and the decomposition below has exactly four: α,β,γ,δ.
Theorem
ZYZ decomposition of a single-qubit unitary
For every unitary U∈U(2) there exist real numbers α,β,γ,δ with U=eiαRZ(β)RY(γ)RZ(δ). One may take γ∈[0,π] with cos2γ=∣a∣, sin2γ=∣b∣, β+δ=−2arga and β−δ=2argb, where detU=e2iα and (a,b)T is the first column of e−iαU.
Proof (12 steps)
1
Step 1:
∣detU∣2=det(U†)det(U)=det(U†U)=detI=1⇒detU=e2iαfor some α∈R
det(U†)=detU and det is multiplicative, so detU lies on the unit circle; write its argument as 2α.
2
Step 2:
V:=e−iαU,V†V=I,detV=e−2iαdetU=1
Multiplying a 2×2 matrix by a scalar λ multiplies its determinant by λ2; a phase keeps V unitary. Hence V∈SU(2).
3
Step 3:
V=(abcd),∣a∣2+∣b∣2=1,aˉc+bˉd=0
V†V=I says the columns of V are orthonormal: the first has unit norm, and the inner product of the first with the second vanishes.
4
Step 4:
(cd)=μ(−bˉaˉ)for some μ∈C
(−bˉ,aˉ) is orthogonal to (a,b) because aˉ(−bˉ)+bˉaˉ=0, and it is non-zero; the orthogonal complement of a non-zero vector in C2 is one-dimensional, so (c,d) is a multiple of it.
Verification by multiplication: RZ(0)=I, RZ(π)=diag(e−iπ/2,eiπ/2)=diag(−i,i), and the diagonal factor scales the columns.
6
Step 6:
eiπ/2RZ(0)RY(2π)RZ(π)=i⋅(−iH)=H
i⋅(−i)=1.
Result
H=eiπ/2RY(2π)RZ(π),(α,β,γ,δ)=(2π,0,2π,π)
Circuit · 1 qubit
The ZYZ circuit for H without its global phase: on the wire RZ(π) acts first and RY(2π) second, so the circuit unitary is RY(2π)RZ(π)=−iH. The unitary view shows every entry of H multiplied by −i, which no measurement can detect.
U=(−21i−21i−21i21i)
Derivation
Worked example: T=eiπ/8RZ(4π)
1
Step 1:
T=(100eiπ/4),detT=eiπ/4⇒α=8π
The determinant of a diagonal matrix is the product of the diagonal entries.
2
Step 2:
V=e−iπ/8T=(e−iπ/800eiπ/8),a=e−iπ/8,b=0
Scale both diagonal entries by e−iπ/8.
3
Step 3:
cos2γ=1,sin2γ=0⇒γ=0,RY(0)=I
∣a∣=1, ∣b∣=0.
4
Step 4:
β+δ=−2arga=4π,β−δ=0⇒β=δ=8π
b=0, so β−δ is free; the proof's convention argb=0 gives β−δ=0.
Verification by multiplying the global phase into the diagonal.
Result
T=eiπ/8RZ(4π),(α,β,γ,δ)=(8π,8π,0,8π)
Euler angles on demand. The widget below runs the constructive proof with γ∈[0,π] and α,β,δ∈(−π,π]. On the preset H it prints (α,β,γ,δ)=(2π,0,2π,π), the worked example above, and the axis–angle form H=eiπ/2(cos2πI−isin2πn^⋅σ) with n^=21(1,0,1), ϑ=π (at ϑ=π the pair (eiπ/2,n^) may equally be reported as (e−iπ/2,−n^)). At the degenerate angles γ∈{0,π} it sets δ=0: the preset T then gives (8π,4π,0,0) instead of (8π,8π,0,8π) (only β+δ=4π is fixed), and X gives (−2π,π,π,0).
Derivation
Worked example: RX(2π) followed by RZ(3π)
1
Step 1:
RZ(−2π)YRZ(−2π)†=cos(−2π)Y−sin(−2π)X=X
The RZ conjugation rule of the previous section at θ=−2π.
This second widget starts from the gate sequence RX(2π), RZ(3π) in time order and should print the angles and axis just derived. Append or remove gate chips to decompose your own sequences; for instance, appending RZ(−3π) undoes the last rotation and leaves RX(2π) with (α,β,γ,δ)=(0,−2π,2π,2π).
The constructive proof is an algorithm. The snippet below runs it numerically with the simulator's complex-number helpers on the fixed unitary U3(1.1,0.4,−0.7) and on H, rebuilds eiαRZ(β)RY(γ)RZ(δ) and compares it with the original matrix entry by entry. For U3 it recovers (β,γ,δ)=(0.4,1.1,−0.7) and α=20.4−0.7=−0.15, in agreement with the U3 identity proved at the end of this lesson.
TypeScriptrunnable
import { cabs, carg, cexpi, cmul, csub, HADAMARD, matrix, ryMatrix, rzMatrix, u3Matrix } from '@/lib/quantum-simulator';
// ZYZ Euler angles of a 2x2 unitary U, following the constructive proof:
// det U = e^{2i alpha}; V = e^{-i alpha} U = [[a, -conj(b)], [b, conj(a)]];
// cos(gamma/2) = |a|, sin(gamma/2) = |b|, beta + delta = -2 arg a, beta - delta = 2 arg b.
const cases = [
{ name: 'U3(1.1,0.4,-0.7)', U: u3Matrix(1.1, 0.4, -0.7) },
{ name: 'H', U: HADAMARD },
];
for (const { name, U } of cases) {
const det = csub(cmul(matrix.get(U, 0, 0), matrix.get(U, 1, 1)), cmul(matrix.get(U, 0, 1), matrix.get(U, 1, 0)));
const alpha = carg(det) / 2;
const a = cmul(cexpi(-alpha), matrix.get(U, 0, 0));
const b = cmul(cexpi(-alpha), matrix.get(U, 1, 0));
const gamma = 2 * Math.atan2(cabs(b), cabs(a));
const argA = cabs(a) > 1e-12 ? carg(a) : 0; // a = 0: only beta - delta is fixed
const argB = cabs(b) > 1e-12 ? carg(b) : 0; // b = 0: only beta + delta is fixed
const beta = argB - argA;
const delta = -argA - argB;
// Rebuild W = e^{i alpha} R_Z(beta) R_Y(gamma) R_Z(delta) and compare entry by entry.
const W = matrix.scale(matrix.mulAll(rzMatrix(beta), ryMatrix(gamma), rzMatrix(delta)), cexpi(alpha));
console.log(name + ': alpha=' + alpha.toFixed(4) + ' beta=' + beta.toFixed(4) + ' gamma=' + gamma.toFixed(4)
+ ' delta=' + delta.toFixed(4) + ' max|U-W|<1e-12: ' + (matrix.maxAbsDiff(U, W) < 1e-12));
}
RY(32π) then RZ(4π) on ∣0⟩. The statevector is e−iπ/8(21∣0⟩+23eiπ/4∣1⟩)≈(0.4619−0.1913i)∣0⟩+(0.8001+0.3314i)∣1⟩: the amplitudes carry the common phase e−iπ/8, while the relative phase is eiπ/4, so the Bloch angles are θ=32π, ϕ=4π.
Hardware toolkits expose a general single-qubit gate U3(θ,ϕ,λ) (Qiskit's U, PennyLane's U3), whose first column is the Bloch state (θ,ϕ) and whose top-left entry is real:
U3(θ,ϕ,λ)=(cos2θeiϕsin2θ−eiλsin2θei(ϕ+λ)cos2θ).
By the ZYZ theorem it must be a product of Z and Y rotations; the next identity identifies the angles and the phase.
Proposition
U3 is a ZYZ rotation up to global phase
For all real θ,ϕ,λ: U3(θ,ϕ,λ)=ei(ϕ+λ)/2RZ(ϕ)RY(θ)RZ(λ). In particular every single-qubit unitary equals U3 up to a global phase, and detU3=ei(ϕ+λ).
All four entries agree with the definition of U3; the determinant of a 2×2 matrix scales with the square of a scalar factor and the rotations have determinant 1. Combined with the ZYZ theorem, U=eiαRZ(β)RY(γ)RZ(δ)=ei(α−(β+δ)/2)U3(γ,β,δ). ■
∎
Quick check
Which global phase relates U3(θ,ϕ,λ) to RZ(ϕ)RY(θ)RZ(λ)?
References
M. A. Nielsen and I. L. Chuang, Quantum Computation and Quantum Information, 10th anniversary ed., Cambridge University Press (2010), §4.2 (single qubit operations) and Theorem 4.1 (Z–Y decomposition for a single qubit).doi:10.1017/CBO9780511976667
A. Barenco, C. H. Bennett, R. Cleve, D. P. DiVincenzo, N. Margolus, P. Shor, T. Sleator, J. A. Smolin and H. Weinfurter, Elementary gates for quantum computation, Physical Review A 52, 3457 (1995).doi:10.1103/PhysRevA.52.3457
D. C. McKay, C. J. Wood, S. Sheldon, J. M. Chow and J. M. Gambetta, Efficient Z gates for quantum computing, Physical Review A 96, 022330 (2017).doi:10.1103/PhysRevA.96.022330
Hands-on labs
Prepare a Bloch state with R_Y and R_Z
1 step · auto-graded
Use the identity RZ(ϕ)RY(θ)∣0⟩=e−iϕ/2(cos2θ∣0⟩+eiϕsin2θ∣1⟩) to prepare the state with Bloch angles θ=32π, ϕ=4π from ∣0⟩ with at most two rotation gates.