Simple Algorithm
Quantum Computing · Rydberg State · 26 min

Euler Decompositions

Every single-qubit unitary is three rotations: proof and practice.

Three angles and a phase pin down every single-qubit gate. The Z–Y–Z Euler decomposition is the first theorem of quantum compilation: you will prove it two ways, extract the angles from a matrix, see exactly where the coordinates break down, and derive the two-pulse form that superconducting compilers actually emit.

What you’ll learn

  • State and prove U=eiαRz(β)Ry(γ)Rz(δ)U=e^{i\alpha}R_z(\beta)R_y(\gamma)R_z(\delta), algebraically and through SO(3)SO(3).
  • Extract Euler angles from a matrix and characterize the gimbal-lock singularities at γ∈{0,π}\gamma\in\{0,\pi\}.
  • Prove that every rotation factors as Rn^(β)Rm^(γ)Rn^(δ)\mathsf{R}_{\hat n}(\beta)\mathsf{R}_{\hat m}(\gamma)\mathsf{R}_{\hat n}(\delta) if and only if m^⊥n^\hat m\perp\hat n.
  • Derive the virtual-ZZ form U≃Rz(β)X Rz(π−γ)X Rz(δ−π)U\simeq R_z(\beta)\sqrt X\,R_z(\pi-\gamma)\sqrt X\,R_z(\delta-\pi) and the corollary U=eiαAXBXCU=e^{i\alpha}AXBXC with ABC=IABC=\id.

The theorem and two proofs

DerivationAlgebraic proof
  1. U=eiαV,e2iα=det⁡U,V=(a−b∗ba∗)∈SU(2)U=e^{i\alpha}V,\qquad e^{2i\alpha}=\det U,\qquad V=\begin{pmatrix}a&-b^*\\b&a^*\end{pmatrix}\in SU(2)

    Factor out the determinant phase; every element of SU(2)SU(2) has this form, with ∣a∣2+∣b∣2=1\abs a^2+\abs b^2=1.

  2. Rz(β)Ry(γ)Rz(δ)=(e−i(β+δ)/2cos⁡γ2−e−i(β−δ)/2sin⁡γ2ei(β−δ)/2sin⁡γ2ei(β+δ)/2cos⁡γ2)R_z(\beta)R_y(\gamma)R_z(\delta)=\begin{pmatrix}e^{-i(\beta+\delta)/2}\cos\frac\gamma2&-e^{-i(\beta-\delta)/2}\sin\frac\gamma2\\[2pt]e^{i(\beta-\delta)/2}\sin\frac\gamma2&e^{i(\beta+\delta)/2}\cos\frac\gamma2\end{pmatrix}

    Multiply out. The product has the same SU(2)SU(2) shape, with a=e−i(β+δ)/2cos⁡γ2a=e^{-i(\beta+\delta)/2}\cos\frac\gamma2 and b=ei(β−δ)/2sin⁡γ2b=e^{i(\beta-\delta)/2}\sin\frac\gamma2.

  3. cos⁡γ2=∣a∣,sin⁡γ2=∣b∣,γ=2atan2⁡(∣b∣,∣a∣)∈[0,π]\cos\tfrac\gamma2=\abs a,\qquad\sin\tfrac\gamma2=\abs b,\qquad\gamma=2\operatorname{atan2}\big(\abs b,\abs a\big)\in[0,\pi]

    Match the moduli; ∣a∣2+∣b∣2=1\abs a^2+\abs b^2=1 guarantees a solution.

  4. β=arg⁡b−arg⁡a,δ=−arg⁡a−arg⁡b\beta=\arg b-\arg a,\qquad\delta=-\arg a-\arg b

    Match the phases, −β+δ2=arg⁡a-\tfrac{\beta+\delta}{2}=\arg a and β−δ2=arg⁡b\tfrac{\beta-\delta}{2}=\arg b. If b=0b=0 (or a=0a=0), arg⁡b\arg b (or arg⁡a\arg a) is undefined and can be anything: that freedom is gimbal lock.

  5. Substituting back gives V=Rz(β)Ry(γ)Rz(δ)V=R_z(\beta)R_y(\gamma)R_z(\delta), hence U=eiαRz(β)Ry(γ)Rz(δ)U=e^{i\alpha}R_z(\beta)R_y(\gamma)R_z(\delta). ∎

Check your understanding

What do the Z–Y–Z angles of T=diag⁡(1,eiπ/4)T=\diag(1,e^{i\pi/4}) look like?

  1. γ=π/4\gamma=\pi/4 and β=δ=0\beta=\delta=0
  2. γ=0\gamma=0 and β+δ=π/4\beta+\delta=\pi/4, with β\beta and δ\delta individually arbitrary
  3. γ=π\gamma=\pi and β−δ=π/4\beta-\delta=\pi/4
  4. They are unique: β=δ=π/8\beta=\delta=\pi/8 and γ=0\gamma=0
Show the answer

B. γ=0\gamma=0 and β+δ=π/4\beta+\delta=\pi/4, with β\beta and δ\delta individually arbitrary

T=eiπ/8Rz(π/4)T=e^{i\pi/8}R_z(\pi/4) is diagonal, so b=0b=0, γ=0\gamma=0, and Rz(β)Rz(δ)=Rz(β+δ)R_z(\beta)R_z(\delta)=R_z(\beta+\delta): only the sum β+δ=π/4\beta+\delta=\pi/4 is fixed. A whole line of angle triples gives the same gate. That is gimbal lock.

Practice: compiling with two axes

Now compile them yourself. The widget checks the whole operator through its Choi state: the gate UU you build on qubit 1 acts on half of a Bell pair, producing (I⊗U)∣Φ+⟩=12∑j∣j⟩⊗U∣j⟩(\id\otimes U)\ket{\Phi^+}=\tfrac{1}{\sqrt2}\sum_j\ket j\otimes U\ket j, which determines UU up to a global phase (the Choi–Jamiołkowski correspondence).

Predict before you look

Suppose RzR_z rotations are free and the only physical pulse is X\sqrt X. What is the smallest number of X\sqrt X pulses that suffices for every single-qubit gate?

Show the answer

2 pulses

Two. With no pulses you only get zz-rotations. With one, Rz(a)XRz(b)R_z(a)\sqrt X R_z(b) always sends z^\hat z onto the equator (X\sqrt X tips z^\hat z to −y^-\hat y, and zz-rotations keep it there), so for example Ry(π/3)R_y(\pi/3) is out of reach. Two suffice, by the identity derived on the next screen.

Which axes work, and the hardware form

With non-parallel but non-orthogonal axes, longer alternating products still reach every rotation; the number of factors needed grows as the angle between the axes shrinks. Compilers, however, care about a different question: which rotations are cheap on the hardware.

DerivationThe virtual-Z form
  1. Rx(π2) Rz(θ) Rx(−π2)=R−y^(θ)=Ry(−θ)R_x(\tfrac\pi2)\,R_z(\theta)\,R_x(-\tfrac\pi2)=R_{-\hat y}(\theta)=R_y(-\theta)

    Conjugation rotates the axis, and Rx(π/2)R_x(\pi/2) tips z^\hat z to −y^-\hat y.

  2. Rx(−π2)=Rz(π) Rx(π2) Rz(−π)R_x(-\tfrac\pi2)=R_z(\pi)\,R_x(\tfrac\pi2)\,R_z(-\pi)

    Conjugating by a half-turn about zz reverses the xx-axis.

  3. Ry(γ)=Rx(π2) Rz(π−γ) Rx(π2) Rz(−π)R_y(\gamma)=R_x(\tfrac\pi2)\,R_z(\pi-\gamma)\,R_x(\tfrac\pi2)\,R_z(-\pi)

    Set θ=−γ\theta=-\gamma in the first line, substitute the second, and merge Rz(−γ)Rz(π)=Rz(π−γ)R_z(-\gamma)R_z(\pi)=R_z(\pi-\gamma).

  4. U≃Rz(β) X Rz(π−γ) X Rz(δ−π)U\simeq R_z(\beta)\,\sqrt X\,R_z(\pi-\gamma)\,\sqrt X\,R_z(\delta-\pi)

    Insert into Z–Y–Z and use X=eiπ/4Rx(π/2)\sqrt X=e^{i\pi/4}R_x(\pi/2); here ≃\simeq means equality up to a global phase.

On superconducting processors, RzR_z is usually implemented virtually, by shifting the phase reference of all later microwave pulses on that qubit. It takes no time and adds essentially no error (McKay et al., 2017). Any single-qubit gate then costs at most two calibrated X\sqrt X pulses, and the compiler's job reduces to tracking and merging zz-rotations.

Corollaries: AXBXC and beyond one qubit

DerivationProof
  1. A=Rz(β)Ry(γ2),B=Ry(−γ2)Rz(−δ+β2),C=Rz(δ−β2)A=R_z(\beta)R_y(\tfrac\gamma2),\qquad B=R_y(-\tfrac\gamma2)R_z(-\tfrac{\delta+\beta}{2}),\qquad C=R_z(\tfrac{\delta-\beta}{2})

    Build the factors from the Euler angles of UU.

  2. ABC=Rz(β)Ry(γ2)Ry(−γ2)Rz(−δ+β2)Rz(δ−β2)=Rz(β)Rz(−β)=IABC=R_z(\beta)R_y(\tfrac\gamma2)R_y(-\tfrac\gamma2)R_z(-\tfrac{\delta+\beta}{2})R_z(\tfrac{\delta-\beta}{2})=R_z(\beta)R_z(-\beta)=\id

    Adjacent rotations about one axis merge.

  3. X Ry(θ) X=Ry(−θ),X Rz(θ) X=Rz(−θ)X\,R_y(\theta)\,X=R_y(-\theta),\qquad X\,R_z(\theta)\,X=R_z(-\theta)

    XX anticommutes with YY and ZZ, which flips the angle.

  4. AXBXC=Rz(β)Ry(γ2) Ry(γ2)Rz(δ+β2) Rz(δ−β2)=Rz(β)Ry(γ)Rz(δ)AXBXC=R_z(\beta)R_y(\tfrac\gamma2)\,R_y(\tfrac\gamma2)R_z(\tfrac{\delta+\beta}{2})\,R_z(\tfrac{\delta-\beta}{2})=R_z(\beta)R_y(\gamma)R_z(\delta)

    So eiαAXBXC=Ue^{i\alpha}AXBXC=U. ∎ Replace the two XX's by CNOTs and you get a controlled-UU from two CNOTs: the subject of Building Controlled-U: the ABC Construction.

Key takeaways

  • Every U∈U(2)U\in U(2) equals eiαRz(β)Ry(γ)Rz(δ)e^{i\alpha}R_z(\beta)R_y(\gamma)R_z(\delta); the angles follow from ∣a∣\abs a, ∣b∣\abs b, arg⁡a\arg a and arg⁡b\arg b of its SU(2)SU(2) part.
  • The parametrization is singular at γ∈{0,π}\gamma\in\{0,\pi\} (gimbal lock), where only β+δ\beta+\delta or β−δ\beta-\delta is determined.
  • Three-factor Euler decompositions about n^,m^,n^\hat n,\hat m,\hat n exist exactly when m^⊥n^\hat m\perp\hat n; with virtual RzR_z, any gate costs at most two X\sqrt X pulses.
  • The corollary U=eiαAXBXCU=e^{i\alpha}AXBXC with ABC=IABC=\id underlies controlled-UU synthesis; for two qubits the analogue is the KAK decomposition, with at most three CNOTs.

Check yourself

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

Question 1

Which is a valid Z–Y–Z decomposition of Rx(θ)R_x(\theta)?

  1. Rz(π2) Ry(θ) Rz(−π2)R_z(\tfrac\pi2)\,R_y(\theta)\,R_z(-\tfrac\pi2)
  2. Ry(θ)R_y(\theta)
  3. Rz(−π2) Ry(θ) Rz(π2)R_z(-\tfrac\pi2)\,R_y(\theta)\,R_z(\tfrac\pi2)
  4. Rz(θ) Ry(π2) Rz(−θ)R_z(\theta)\,R_y(\tfrac\pi2)\,R_z(-\theta)
Show the answer

C. Rz(−π2) Ry(θ) Rz(π2)R_z(-\tfrac\pi2)\,R_y(\theta)\,R_z(\tfrac\pi2)

Rz(φ)Ry(θ)Rz(φ)†=RRz(φ)y^(θ)R_z(\varphi)R_y(\theta)R_z(\varphi)^\dagger=R_{\mathsf{R}_z(\varphi)\hat y}(\theta), and Rz(−π2)y^=x^\mathsf{R}_z(-\tfrac\pi2)\hat y=\hat x. Hence Rx(θ)=Rz(−π2)Ry(θ)Rz(π2)R_x(\theta)=R_z(-\tfrac\pi2)R_y(\theta)R_z(\tfrac\pi2).

Question 2

For which axis pairs does every rotation factor as Rn^(β) Rm^(γ) Rn^(δ)\mathsf{R}_{\hat n}(\beta)\,\mathsf{R}_{\hat m}(\gamma)\,\mathsf{R}_{\hat n}(\delta)?

  1. Any non-parallel n^,m^\hat n,\hat m
  2. Exactly when m^⊥n^\hat m\perp\hat n
  3. Only n^=z^\hat n=\hat z with m^=y^\hat m=\hat y
  4. Whenever the angle between them is at least π/4\pi/4
Show the answer

B. Exactly when m^⊥n^\hat m\perp\hat n

Orthogonal axes reduce to Z–Y–Z by a change of frame. If the lines meet at ϑ<π/2\vartheta<\pi/2, the image of n^\hat n stays within 2ϑ<π2\vartheta<\pi of n^\hat n, so half-turns about axes perpendicular to n^\hat n are never reached.

Question 3

At γ=π\gamma=\pi, which combination of the Z–Y–Z angles does UU determine?

  1. β+δ\beta+\delta
  2. β\beta and δ\delta separately
  3. Neither
  4. β−δ\beta-\delta
Show the answer

D. β−δ\beta-\delta

Ry(π)=−iYR_y(\pi)=-iY and YRz(δ)=Rz(−δ)YYR_z(\delta)=R_z(-\delta)Y, so Rz(β)Ry(π)Rz(δ)=−iRz(β−δ) YR_z(\beta)R_y(\pi)R_z(\delta)=-iR_z(\beta-\delta)\,Y: only β−δ\beta-\delta survives.

Question 4

Parameter counting gives ⌈14(4n−3n−1)⌉\lceil\tfrac14(4^n-3n-1)\rceil CNOTs as a lower bound for a generic nn-qubit unitary. What is it for n=3n=3?

  1. 14
  2. 9
  3. 20
  4. 64
Show the answer

A. 14

14(64−9−1)=13.5\tfrac14(64-9-1)=13.5, so at least 14. The reasoning: SU(8)SU(8) has 63 real parameters, one layer of single-qubit gates supplies 3n=93n=9, and each CNOT together with the rotations it enables adds at most 4 more.

Further reading

  • M. A. Nielsen & I. L. Chuang, Quantum Computation and Quantum Information, Theorem 4.1 and Corollary 4.2 (Cambridge, 10th anniv. ed., 2010).
  • A. Barenco, C. H. Bennett, R. Cleve, D. P. DiVincenzo, N. Margolus, P. Shor, T. Sleator, J. A. Smolin & H. Weinfurter, "Elementary gates for quantum computation", Phys. Rev. A 52, 3457 (1995).
  • D. C. McKay, C. J. Wood, S. Sheldon, J. M. Chow & J. M. Gambetta, "Efficient Z gates for quantum computing", Phys. Rev. A 96, 022330 (2017).
  • N. Khaneja & S. J. Glaser, "Cartan decomposition of SU(2n)SU(2^n) and control of spin systems", Chem. Phys. 267, 11 (2001).
  • V. V. Shende, S. S. Bullock & I. L. Markov, "Synthesis of quantum-logic circuits", IEEE Trans. Comput.-Aided Des. Integr. Circuits Syst. 25, 1000 (2006).