QuantumCore

Lesson 20 · 75 min · core

Rotation Gates & ZYZ Euler Decomposition

Loading progress…

The rotation gates Rn^(θ)=e−iθ n^⋅σ⃗/2R_{\hat n}(\theta)=e^{-i\theta\,\hat n\cdot\vec\sigma/2} are the single-qubit unitaries that turn the Bloch sphere rigidly by the angle θ\theta about the axis n^\hat n. We derive their closed form cos⁡θ2I−isin⁡θ2 n^⋅σ⃗\cos\tfrac\theta2I-i\sin\tfrac\theta2\,\hat n\cdot\vec\sigma from the power series, verify by explicit 2×22\times2 products that conjugation by RZ(θ)R_Z(\theta) rotates the Pauli operators (and hence the Bloch vector) about zz, and prove the ZYZ Euler theorem: 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). Two consequences follow: any Bloch state is prepared from ∣0⟩\lvert0\rangle by RZ(ϕ)RY(θ)R_Z(\phi)R_Y(\theta), and the hardware gate U3(θ,ϕ,λ)U_3(\theta,\phi,\lambda) is a ZYZ product up to the global phase ei(ϕ+λ)/2e^{i(\phi+\lambda)/2}.

Prerequisites: Hadamard, S and T Gates, Spectral Theorem & Functions of Operators

Objectives and key results
  • Derive Rn^(θ)=cos⁡θ2I−isin⁡θ2 n^⋅σ⃗R_{\hat n}(\theta)=\cos\tfrac\theta2I-i\sin\tfrac\theta2\,\hat n\cdot\vec\sigma from (n^⋅σ⃗)2=I(\hat n\cdot\vec\sigma)^2=I and write out RXR_X, RYR_Y, RZR_Z as explicit matrices.

  • Show by matrix multiplication that RZ(θ)XRZ(θ)†=cos⁡θX+sin⁡θYR_Z(\theta)XR_Z(\theta)^\dagger=\cos\theta X+\sin\theta Y and interpret Rn^(θ)R_{\hat n}(\theta) as a rotation of the Bloch vector by θ\theta about n^\hat n.

  • Prove the ZYZ theorem U=eiαRZ(β)RY(γ)RZ(δ)U=e^{i\alpha}R_Z(\beta)R_Y(\gamma)R_Z(\delta) and compute the four angles of a given unitary, including HH and TT.

  • Prepare any Bloch state (θ,ϕ)(\theta,\phi) from ∣0⟩\lvert0\rangle with RY(θ)R_Y(\theta) followed by RZ(ϕ)R_Z(\phi), and explain why the opposite order fails.

  • Relate U3(θ,ϕ,λ)U_3(\theta,\phi,\lambda) to the ZYZ product: U3=ei(ϕ+λ)/2RZ(ϕ)RY(θ)RZ(λ)U_3=e^{i(\phi+\lambda)/2}R_Z(\phi)R_Y(\theta)R_Z(\lambda).

formula · Rotation operator
Rn^(θ)=e−iθ n^⋅σ⃗/2=cos⁡θ2 I−isin⁡θ2 n^⋅σ⃗,Rn^(2π)=−IR_{\hat n}(\theta)=e^{-i\theta\,\hat n\cdot\vec\sigma/2}=\cos\tfrac\theta2\,I-i\sin\tfrac\theta2\,\hat n\cdot\vec\sigma,\qquad R_{\hat n}(2\pi)=-I
identity · Rotation action on the Paulis
RZ(θ)XRZ(θ)†=cos⁡θ X+sin⁡θ Y,RZ(θ)YRZ(θ)†=cos⁡θ Y−sin⁡θ XR_Z(\theta)XR_Z(\theta)^\dagger=\cos\theta\,X+\sin\theta\,Y,\qquad R_Z(\theta)YR_Z(\theta)^\dagger=\cos\theta\,Y-\sin\theta\,X
theorem · ZYZ Euler decomposition
∀ U∈U(2) ∃ α,β,γ,δ∈R:U=eiαRZ(β)RY(γ)RZ(δ)\forall\,U\in U(2)\ \exists\,\alpha,\beta,\gamma,\delta\in\mathbb R:\quad U=e^{i\alpha}R_Z(\beta)R_Y(\gamma)R_Z(\delta)
formula · State preparation
RZ(ϕ)RY(θ)∣0⟩=e−iϕ/2(cos⁡θ2∣0⟩+eiϕsin⁡θ2∣1⟩)R_Z(\phi)R_Y(\theta)\lvert0\rangle=e^{-i\phi/2}\big(\cos\tfrac\theta2\lvert0\rangle+e^{i\phi}\sin\tfrac\theta2\lvert1\rangle\big)
identity · U3 as a ZYZ product
U3(θ,ϕ,λ)=ei(ϕ+λ)/2RZ(ϕ)RY(θ)RZ(λ)U_3(\theta,\phi,\lambda)=e^{i(\phi+\lambda)/2}R_Z(\phi)R_Y(\theta)R_Z(\lambda)

Rotation operators as matrix exponentials#

For a real unit vector n^=(nx,ny,nz)\hat n=(n_x,n_y,n_z), nx2+ny2+nz2=1n_x^2+n_y^2+n_z^2=1, define n^⋅σ⃗=nxX+nyY+nzZ\hat n\cdot\vec\sigma=n_xX+n_yY+n_zZ. This matrix is Hermitian, so e−iθ n^⋅σ⃗/2e^{-i\theta\,\hat n\cdot\vec\sigma/2} is unitary for every real θ\theta (it is the time-evolution operator of the Hamiltonian 12n^⋅σ⃗\tfrac12\hat n\cdot\vec\sigma for time θ\theta). The rotation gate about n^\hat n is Rn^(θ)=exp⁡(−iθ2 n^⋅σ⃗)=∑k=0∞1k!(−iθ2)k(n^⋅σ⃗)k.R_{\hat n}(\theta)=\exp\Big(-\tfrac{i\theta}{2}\,\hat n\cdot\vec\sigma\Big)=\sum_{k=0}^{\infty}\frac{1}{k!}\Big(-\tfrac{i\theta}2\Big)^k(\hat n\cdot\vec\sigma)^k . The lesson on the spectral theorem computed such exponentials by diagonalising; here we use a shortcut that works because n^⋅σ⃗\hat n\cdot\vec\sigma squares to the identity.

Derivation

Closed form of Rn^(θ)R_{\hat n}(\theta)

  1. Step 1:
    (n^⋅σ⃗)2=∑j,knjnk σjσk=∑j,knjnk(δjkI+iϵjklσl)(\hat n\cdot\vec\sigma)^2=\sum_{j,k}n_jn_k\,\sigma_j\sigma_k=\sum_{j,k}n_jn_k\big(\delta_{jk}I+i\epsilon_{jkl}\sigma_l\big)
    Expand the square and insert the Pauli product rule σjσk=δjkI+i∑lϵjklσl\sigma_j\sigma_k=\delta_{jk}I+i\sum_l\epsilon_{jkl}\sigma_l.
  2. Step 2:
    =(∑jnj2)I+i∑l(∑j,kϵjklnjnk)σl=∥n^∥2I=I=\Big(\sum_jn_j^2\Big)I+i\sum_l\Big(\sum_{j,k}\epsilon_{jkl}n_jn_k\Big)\sigma_l=\lVert\hat n\rVert^2I=I
    njnkn_jn_k is symmetric in (j,k)(j,k) while ϵjkl\epsilon_{jkl} is antisymmetric, so each inner sum over (j,k)(j,k) vanishes; n^\hat n is a unit vector.
  3. Step 3:
    (n^⋅σ⃗)2m=I,(n^⋅σ⃗)2m+1=n^⋅σ⃗(m≥0)(\hat n\cdot\vec\sigma)^{2m}=I,\qquad(\hat n\cdot\vec\sigma)^{2m+1}=\hat n\cdot\vec\sigma\qquad(m\ge0)
    Induction on mm from (n^⋅σ⃗)2=I(\hat n\cdot\vec\sigma)^2=I.
  4. Step 4:
    (−iθ2)2m=(−1)m(θ2)2m,(−iθ2)2m+1=−i (−1)m(θ2)2m+1\Big(-\tfrac{i\theta}2\Big)^{2m}=(-1)^m\Big(\tfrac\theta2\Big)^{2m},\qquad\Big(-\tfrac{i\theta}2\Big)^{2m+1}=-i\,(-1)^m\Big(\tfrac\theta2\Big)^{2m+1}
    (−i)2=−1(-i)^2=-1, so (−i)2m=(−1)m(-i)^{2m}=(-1)^m and (−i)2m+1=−i(−1)m(-i)^{2m+1}=-i(-1)^m.
  5. Step 5:
    Rn^(θ)=[∑m=0∞(−1)m(2m)!(θ2)2m]I−i[∑m=0∞(−1)m(2m+1)!(θ2)2m+1]n^⋅σ⃗R_{\hat n}(\theta)=\Big[\sum_{m=0}^\infty\frac{(-1)^m}{(2m)!}\Big(\tfrac\theta2\Big)^{2m}\Big]I-i\Big[\sum_{m=0}^\infty\frac{(-1)^m}{(2m+1)!}\Big(\tfrac\theta2\Big)^{2m+1}\Big]\hat n\cdot\vec\sigma
    Split the exponential series into even k=2mk=2m and odd k=2m+1k=2m+1 terms; this regrouping is legitimate because the series converges absolutely in any matrix norm.
  6. Step 6:
    Rn^(θ)=cos⁡θ2 I−isin⁡θ2 n^⋅σ⃗R_{\hat n}(\theta)=\cos\tfrac\theta2\,I-i\sin\tfrac\theta2\,\hat n\cdot\vec\sigma
    The two bracketed series are the Taylor series of cos⁡θ2\cos\tfrac\theta2 and sin⁡θ2\sin\tfrac\theta2.
  7. Step 7:
    Rn^(θ)=(cos⁡θ2−inzsin⁡θ2−(inx+ny)sin⁡θ2(−inx+ny)sin⁡θ2cos⁡θ2+inzsin⁡θ2)R_{\hat n}(\theta)=\begin{pmatrix}\cos\frac\theta2-in_z\sin\frac\theta2&-(in_x+n_y)\sin\frac\theta2\\(-in_x+n_y)\sin\frac\theta2&\cos\frac\theta2+in_z\sin\frac\theta2\end{pmatrix}
    Insert n^⋅σ⃗=(nznx−inynx+iny−nz)\hat n\cdot\vec\sigma=\begin{pmatrix}n_z&n_x-in_y\\n_x+in_y&-n_z\end{pmatrix} and use −i(nx∓iny)=−inx∓ny-i(n_x\mp in_y)=-in_x\mp n_y.
  8. Step 8:
    det⁡Rn^(θ)=cos⁡2θ2+nz2sin⁡2θ2+(nx2+ny2)sin⁡2θ2=1\det R_{\hat n}(\theta)=\cos^2\tfrac\theta2+n_z^2\sin^2\tfrac\theta2+(n_x^2+n_y^2)\sin^2\tfrac\theta2=1
    The diagonal product is cos⁡2θ2+nz2sin⁡2θ2\cos^2\tfrac\theta2+n_z^2\sin^2\tfrac\theta2 and the off-diagonal product is (−inx−ny)(−inx+ny)sin⁡2θ2=−(nx2+ny2)sin⁡2θ2(-in_x-n_y)(-in_x+n_y)\sin^2\tfrac\theta2=-(n_x^2+n_y^2)\sin^2\tfrac\theta2; hence Rn^(θ)∈SU(2)R_{\hat n}(\theta)\in SU(2).

Result

Rn^(θ)=e−iθ n^⋅σ⃗/2=cos⁡θ2 I−isin⁡θ2 n^⋅σ⃗∈SU(2)\boxed{R_{\hat n}(\theta)=e^{-i\theta\,\hat n\cdot\vec\sigma/2}=\cos\tfrac\theta2\,I-i\sin\tfrac\theta2\,\hat n\cdot\vec\sigma\in SU(2)}

Taking n^\hat n along the three coordinate axes gives the three standard rotation gates (the conventions of the simulator, qubit 0 = most significant bit): 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},\qquad R_Y(\theta)=\begin{pmatrix}\cos\frac\theta2&-\sin\frac\theta2\\\sin\frac\theta2&\cos\frac\theta2\end{pmatrix},\qquad R_Z(\theta)=\begin{pmatrix}e^{-i\theta/2}&0\\0&e^{i\theta/2}\end{pmatrix}. For RZR_Z the diagonal entries are cos⁡θ2∓isin⁡θ2=e∓iθ/2\cos\tfrac\theta2\mp i\sin\tfrac\theta2=e^{\mp i\theta/2} by Euler's formula. RYR_Y is the only one of the three with real entries: it is an ordinary rotation matrix of the plane spanned by ∣0⟩,∣1⟩\lvert0\rangle,\lvert1\rangle, but by the half angle θ2\tfrac\theta2.

Periodicity. At θ=2π\theta=2\pi the closed form gives Rn^(2π)=cos⁡π I−isin⁡π n^⋅σ⃗=−IR_{\hat n}(2\pi)=\cos\pi\,I-i\sin\pi\,\hat n\cdot\vec\sigma=-I, and at θ=4π\theta=4\pi it gives Rn^(4π)=cos⁡2π I=IR_{\hat n}(4\pi)=\cos2\pi\,I=I. A full turn of the Bloch sphere multiplies every state by the global phase −1-1; only two full turns return the operator to II. Since −I-I is invisible in every measurement, the angles θ\theta and θ+2π\theta+2\pi prepare physically identical states.

RY(2π3)=(cos⁡π3−sin⁡π3sin⁡π3cos⁡π3)=(12−323212)R_Y\big(\tfrac{2\pi}3\big)=\begin{pmatrix}\cos\frac\pi3&-\sin\frac\pi3\\\sin\frac\pi3&\cos\frac\pi3\end{pmatrix}=\begin{pmatrix}\frac12&-\frac{\sqrt3}2\\\frac{\sqrt3}2&\frac12\end{pmatrix}
R_Y(2π/3)2×2

Unitary verified: U†U=IU^\dagger U = I (max deviation 1.1e-16)

RZ(π4)=(e−iπ/800eiπ/8)≈(0.9239−0.3827i000.9239+0.3827i)R_Z\big(\tfrac\pi4\big)=\begin{pmatrix}e^{-i\pi/8}&0\\0&e^{i\pi/8}\end{pmatrix}\approx\begin{pmatrix}0.9239-0.3827i&0\\0&0.9239+0.3827i\end{pmatrix}
R_Z(π/4)2×2

Unitary verified: U†U=IU^\dagger U = I (max deviation 0.0e+0)

Quick check

What is RX(2π)R_X(2\pi)?

Select one answer

Why R_n(θ) rotates the Bloch sphere#

A state with Bloch vector r⃗=(x,y,z)\vec r=(x,y,z) has density operator ρ=12(I+xX+yY+zZ)\rho=\tfrac12(I+xX+yY+zZ). A gate UU maps it to UρU†=12(I+xUXU†+yUYU†+zUZU†)U\rho U^\dagger=\tfrac12\big(I+xUXU^\dagger+yUYU^\dagger+zUZU^\dagger\big), so to know what UU does to r⃗\vec r it suffices to know how conjugation by UU transforms the three Pauli matrices. For U=RZ(θ)U=R_Z(\theta) we compute the three products explicitly.

Derivation

Conjugating the Paulis by RZ(θ)R_Z(\theta)

  1. Step 1:
    RZ(θ)XRZ(θ)†=(e−iθ/200eiθ/2)(0110)(eiθ/200e−iθ/2)R_Z(\theta)XR_Z(\theta)^\dagger=\begin{pmatrix}e^{-i\theta/2}&0\\0&e^{i\theta/2}\end{pmatrix}\begin{pmatrix}0&1\\1&0\end{pmatrix}\begin{pmatrix}e^{i\theta/2}&0\\0&e^{-i\theta/2}\end{pmatrix}
    RZ(θ)†=diag(eiθ/2,e−iθ/2)R_Z(\theta)^\dagger=\mathrm{diag}(e^{i\theta/2},e^{-i\theta/2}) is the complex conjugate of the diagonal.
  2. Step 2:
    =(0e−iθ/2eiθ/20)(eiθ/200e−iθ/2)=(0e−iθeiθ0)=\begin{pmatrix}0&e^{-i\theta/2}\\e^{i\theta/2}&0\end{pmatrix}\begin{pmatrix}e^{i\theta/2}&0\\0&e^{-i\theta/2}\end{pmatrix}=\begin{pmatrix}0&e^{-i\theta}\\e^{i\theta}&0\end{pmatrix}
    Left multiplication by a diagonal matrix scales the rows, right multiplication scales the columns: entry (0,1)(0,1) becomes e−iθ/2⋅e−iθ/2e^{-i\theta/2}\cdot e^{-i\theta/2} and entry (1,0)(1,0) becomes eiθ/2⋅eiθ/2e^{i\theta/2}\cdot e^{i\theta/2}.
  3. Step 3:
    =(0cos⁡θ−isin⁡θcos⁡θ+isin⁡θ0)=cos⁡θ(0110)+sin⁡θ(0−ii0)=cos⁡θ X+sin⁡θ Y=\begin{pmatrix}0&\cos\theta-i\sin\theta\\\cos\theta+i\sin\theta&0\end{pmatrix}=\cos\theta\begin{pmatrix}0&1\\1&0\end{pmatrix}+\sin\theta\begin{pmatrix}0&-i\\i&0\end{pmatrix}=\cos\theta\,X+\sin\theta\,Y
    Euler's formula, then split into the real-coefficient combination of XX and Y=(0−ii0)Y=\begin{pmatrix}0&-i\\i&0\end{pmatrix}.
  4. Step 4:
    RZ(θ)YRZ(θ)†=(0−ie−iθieiθ0)=(0−sin⁡θ−icos⁡θ−sin⁡θ+icos⁡θ0)R_Z(\theta)YR_Z(\theta)^\dagger=\begin{pmatrix}0&-ie^{-i\theta}\\ie^{i\theta}&0\end{pmatrix}=\begin{pmatrix}0&-\sin\theta-i\cos\theta\\-\sin\theta+i\cos\theta&0\end{pmatrix}
    The same row and column scaling applied to YY, whose off-diagonal entries are −i-i and ii; then −i(cos⁡θ−isin⁡θ)=−sin⁡θ−icos⁡θ-i(\cos\theta-i\sin\theta)=-\sin\theta-i\cos\theta and i(cos⁡θ+isin⁡θ)=−sin⁡θ+icos⁡θi(\cos\theta+i\sin\theta)=-\sin\theta+i\cos\theta.
  5. Step 5:
    =cos⁡θ(0−ii0)−sin⁡θ(0110)=cos⁡θ Y−sin⁡θ X=\cos\theta\begin{pmatrix}0&-i\\i&0\end{pmatrix}-\sin\theta\begin{pmatrix}0&1\\1&0\end{pmatrix}=\cos\theta\,Y-\sin\theta\,X
    Collect the imaginary parts into cos⁡θ Y\cos\theta\,Y and the real parts into −sin⁡θ X-\sin\theta\,X.
  6. Step 6:
    RZ(θ)ZRZ(θ)†=ZR_Z(\theta)ZR_Z(\theta)^\dagger=Z
    RZ(θ)R_Z(\theta) and ZZ are both diagonal, so they commute, and RZ(θ)RZ(θ)†=IR_Z(\theta)R_Z(\theta)^\dagger=I.
  7. Step 7:
    RZ(θ)ρRZ(θ)†=12(I+(xcos⁡θ−ysin⁡θ)X+(xsin⁡θ+ycos⁡θ)Y+zZ)R_Z(\theta)\rho R_Z(\theta)^\dagger=\tfrac12\Big(I+(x\cos\theta-y\sin\theta)X+(x\sin\theta+y\cos\theta)Y+zZ\Big)
    Substitute the three results into 12(I+xX+yY+zZ)\tfrac12(I+xX+yY+zZ) and collect the coefficients of XX and YY.

Result

r⃗ ⟼ (cos⁡θ−sin⁡θ0sin⁡θcos⁡θ0001)r⃗(rotation by θ about z^)\boxed{\vec r\ \longmapsto\ \begin{pmatrix}\cos\theta&-\sin\theta&0\\\sin\theta&\cos\theta&0\\0&0&1\end{pmatrix}\vec r\qquad\text{(rotation by }\theta\text{ about }\hat z)}

The new Bloch vector is the old one turned counter-clockwise (seen from +z+z) by the full angle θ\theta, although the matrix entries contain only θ2\tfrac\theta2: the two half-angle phases add up in the conjugation UρU†U\rho U^\dagger. For the other two axes one has, with cyclic relabelling x→y→z→xx\to y\to z\to x: RX(θ) X RX(θ)†=X,RX(θ) Y RX(θ)†=cos⁡θ Y+sin⁡θ Z,RX(θ) Z RX(θ)†=cos⁡θ Z−sin⁡θ Y,R_X(\theta)\,X\,R_X(\theta)^\dagger=X,\quad R_X(\theta)\,Y\,R_X(\theta)^\dagger=\cos\theta\,Y+\sin\theta\,Z,\quad R_X(\theta)\,Z\,R_X(\theta)^\dagger=\cos\theta\,Z-\sin\theta\,Y, RY(θ) Y RY(θ)†=Y,RY(θ) Z RY(θ)†=cos⁡θ Z+sin⁡θ X,RY(θ) X RY(θ)†=cos⁡θ X−sin⁡θ Z.R_Y(\theta)\,Y\,R_Y(\theta)^\dagger=Y,\quad R_Y(\theta)\,Z\,R_Y(\theta)^\dagger=\cos\theta\,Z+\sin\theta\,X,\quad R_Y(\theta)\,X\,R_Y(\theta)^\dagger=\cos\theta\,X-\sin\theta\,Z. We derive the RYR_Y case algebraically from the closed form, which avoids multiplying matrices and works for any axis.

Derivation

Conjugating ZZ and XX by RY(θ)R_Y(\theta)

  1. Step 1:
    RY(θ)=cI−isY,RY(θ)†=cI+isY,c=cos⁡θ2, s=sin⁡θ2R_Y(\theta)=cI-isY,\qquad R_Y(\theta)^\dagger=cI+isY,\qquad c=\cos\tfrac\theta2,\ s=\sin\tfrac\theta2
    Closed form with n^=y^\hat n=\hat y; the adjoint conjugates −i-i because YY is Hermitian.
  2. Step 2:
    RYZRY†=c2Z+ics ZY−ics YZ+s2 YZYR_Y ZR_Y^\dagger=c^2Z+ics\,ZY-ics\,YZ+s^2\,YZY
    Expand (cI−isY)Z(cI+isY)(cI-isY)Z(cI+isY) into four terms.
  3. Step 3:
    ZY=−iX,YZ=iX,YZY=−ZYY=−ZZY=-iX,\qquad YZ=iX,\qquad YZY=-ZYY=-Z
    Pauli products YZ=iXYZ=iX, ZY=−iXZY=-iX (anticommutation YZ=−ZYYZ=-ZY) and Y2=IY^2=I.
  4. Step 4:
    RYZRY†=c2Z+ics(−iX)−ics(iX)−s2Z=(c2−s2)Z+2cs X=cos⁡θ Z+sin⁡θ XR_Y ZR_Y^\dagger=c^2Z+ics(-iX)-ics(iX)-s^2Z=(c^2-s^2)Z+2cs\,X=\cos\theta\,Z+\sin\theta\,X
    i⋅(−i)=1i\cdot(-i)=1 and −i⋅i=1-i\cdot i=1, then the double-angle formulas c2−s2=cos⁡θc^2-s^2=\cos\theta, 2cs=sin⁡θ2cs=\sin\theta.
  5. Step 5:
    RYXRY†=c2X+ics XY−ics YX+s2 YXY=c2X+ics(iZ)−ics(−iZ)−s2XR_Y XR_Y^\dagger=c^2X+ics\,XY-ics\,YX+s^2\,YXY=c^2X+ics(iZ)-ics(-iZ)-s^2X
    Same expansion with XY=iZXY=iZ, YX=−iZYX=-iZ and YXY=−XYY=−XYXY=-XYY=-X.
  6. Step 6:
    =(c2−s2)X−2cs Z=cos⁡θ X−sin⁡θ Z=(c^2-s^2)X-2cs\,Z=\cos\theta\,X-\sin\theta\,Z
    i⋅i=−1i\cdot i=-1 and −i⋅(−i)=−1-i\cdot(-i)=-1, then the double-angle formulas.
  7. Step 7:
    RY(θ)ρRY(θ)†=12(I+(xcos⁡θ+zsin⁡θ)X+yY+(−xsin⁡θ+zcos⁡θ)Z)R_Y(\theta)\rho R_Y(\theta)^\dagger=\tfrac12\Big(I+(x\cos\theta+z\sin\theta)X+yY+(-x\sin\theta+z\cos\theta)Z\Big)
    YY commutes with RY(θ)R_Y(\theta), so the yy component is unchanged; collect the coefficients of XX and ZZ.

Result

r⃗ ⟼ (cos⁡θ0sin⁡θ010−sin⁡θ0cos⁡θ)r⃗(rotation by θ about y^)\boxed{\vec r\ \longmapsto\ \begin{pmatrix}\cos\theta&0&\sin\theta\\0&1&0\\-\sin\theta&0&\cos\theta\end{pmatrix}\vec r\qquad\text{(rotation by }\theta\text{ about }\hat y)}

Quick check

The state ∣+⟩\lvert+\rangle has Bloch vector (1,0,0)(1,0,0). What is the Bloch vector of RZ(π2)∣+⟩R_Z(\tfrac\pi2)\lvert+\rangle?

Select one answer

The ZYZ Euler decomposition#

A rotation of three-dimensional space can be written as a rotation about zz, then about yy, then about zz again (Euler angles). Because single-qubit gates act on the Bloch sphere as rotations, the same should hold for 2×22\times2 unitaries, up to the one parameter that rotations cannot see: a global phase. U(2)U(2) has four real parameters, and the decomposition below has exactly four: α,β,γ,δ\alpha,\beta,\gamma,\delta.

Theorem

ZYZ decomposition of a single-qubit unitary

For every unitary U∈U(2)U\in U(2) there exist real numbers α,β,γ,δ\alpha,\beta,\gamma,\delta with U=eiαRZ(β)RY(γ)RZ(δ)U=e^{i\alpha}R_Z(\beta)R_Y(\gamma)R_Z(\delta). One may take γ∈[0,π]\gamma\in[0,\pi] with cos⁡γ2=∣a∣\cos\tfrac\gamma2=\lvert a\rvert, sin⁡γ2=∣b∣\sin\tfrac\gamma2=\lvert b\rvert, β+δ=−2arg⁡a\beta+\delta=-2\arg a and β−δ=2arg⁡b\beta-\delta=2\arg b, where det⁡U=e2iα\det U=e^{2i\alpha} and (a,b)T(a,b)^{\mathsf T} is the first column of e−iαUe^{-i\alpha}U.

Proof (12 steps)
  1. Step 1:
    ∣det⁡U∣2=det⁡(U†)det⁡(U)=det⁡(U†U)=det⁡I=1 ⇒ det⁡U=e2iα for some α∈R\lvert\det U\rvert^2=\det(U^\dagger)\det(U)=\det(U^\dagger U)=\det I=1\ \Rightarrow\ \det U=e^{2i\alpha}\ \text{for some }\alpha\in\mathbb R
    det⁡(U†)=det⁡U‾\det(U^\dagger)=\overline{\det U} and det⁡\det is multiplicative, so det⁡U\det U lies on the unit circle; write its argument as 2α2\alpha.
  2. Step 2:
    V:=e−iαU,V†V=I,det⁡V=e−2iαdet⁡U=1V:=e^{-i\alpha}U,\qquad V^\dagger V=I,\qquad\det V=e^{-2i\alpha}\det U=1
    Multiplying a 2×22\times2 matrix by a scalar λ\lambda multiplies its determinant by λ2\lambda^2; a phase keeps VV unitary. Hence V∈SU(2)V\in SU(2).
  3. Step 3:
    V=(acbd),∣a∣2+∣b∣2=1,aˉc+bˉd=0V=\begin{pmatrix}a&c\\b&d\end{pmatrix},\qquad\lvert a\rvert^2+\lvert b\rvert^2=1,\qquad\bar ac+\bar bd=0
    V†V=IV^\dagger V=I says the columns of VV 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\begin{pmatrix}c\\d\end{pmatrix}=\mu\begin{pmatrix}-\bar b\\\bar a\end{pmatrix}\quad\text{for some }\mu\in\mathbb C
    (−bˉ,aˉ)(-\bar b,\bar a) is orthogonal to (a,b)(a,b) because aˉ(−bˉ)+bˉ aˉ=0\bar a(-\bar b)+\bar b\,\bar a=0, and it is non-zero; the orthogonal complement of a non-zero vector in C2\mathbb C^2 is one-dimensional, so (c,d)(c,d) is a multiple of it.
  5. Step 5:
    1=det⁡V=a⋅μaˉ−b⋅(−μbˉ)=μ(∣a∣2+∣b∣2)=μ ⇒ V=(a−bˉbaˉ)1=\det V=a\cdot\mu\bar a-b\cdot(-\mu\bar b)=\mu\big(\lvert a\rvert^2+\lvert b\rvert^2\big)=\mu\ \Rightarrow\ V=\begin{pmatrix}a&-\bar b\\b&\bar a\end{pmatrix}
    Compute the determinant and use the normalisation of the first column.
  6. Step 6:
    cos⁡γ2=∣a∣,sin⁡γ2=∣b∣,γ∈[0,π]\cos\tfrac\gamma2=\lvert a\rvert,\quad\sin\tfrac\gamma2=\lvert b\rvert,\qquad\gamma\in[0,\pi]
    (∣a∣,∣b∣)(\lvert a\rvert,\lvert b\rvert) lies on the unit circle in the closed first quadrant, so it equals (cos⁡t,sin⁡t)(\cos t,\sin t) for a unique t∈[0,π2]t\in[0,\tfrac\pi2]; set γ=2t\gamma=2t.
  7. Step 7:
    β+δ=−2arg⁡a,β−δ=2arg⁡b   ⟺   β=arg⁡b−arg⁡a,δ=−arg⁡a−arg⁡b\beta+\delta=-2\arg a,\quad\beta-\delta=2\arg b\ \iff\ \beta=\arg b-\arg a,\quad\delta=-\arg a-\arg b
    Two linear equations for two unknowns. If b=0b=0 then arg⁡b\arg b is undefined and any value works (take arg⁡b=0\arg b=0); likewise if a=0a=0 take arg⁡a=0\arg a=0.
  8. Step 8:
    a=e−i(β+δ)/2cos⁡γ2,b=ei(β−δ)/2sin⁡γ2a=e^{-i(\beta+\delta)/2}\cos\tfrac\gamma2,\qquad b=e^{i(\beta-\delta)/2}\sin\tfrac\gamma2
    Polar form a=∣a∣eiarg⁡aa=\lvert a\rvert e^{i\arg a} with eiarg⁡a=e−i(β+δ)/2e^{i\arg a}=e^{-i(\beta+\delta)/2}, and b=∣b∣eiarg⁡bb=\lvert b\rvert e^{i\arg b} with eiarg⁡b=ei(β−δ)/2e^{i\arg b}=e^{i(\beta-\delta)/2}.
  9. Step 9:
    RY(γ)RZ(δ)=(cos⁡γ2−sin⁡γ2sin⁡γ2cos⁡γ2)(e−iδ/200eiδ/2)=(e−iδ/2cos⁡γ2−eiδ/2sin⁡γ2e−iδ/2sin⁡γ2eiδ/2cos⁡γ2)R_Y(\gamma)R_Z(\delta)=\begin{pmatrix}\cos\frac\gamma2&-\sin\frac\gamma2\\\sin\frac\gamma2&\cos\frac\gamma2\end{pmatrix}\begin{pmatrix}e^{-i\delta/2}&0\\0&e^{i\delta/2}\end{pmatrix}=\begin{pmatrix}e^{-i\delta/2}\cos\frac\gamma2&-e^{i\delta/2}\sin\frac\gamma2\\e^{-i\delta/2}\sin\frac\gamma2&e^{i\delta/2}\cos\frac\gamma2\end{pmatrix}
    Right multiplication by the diagonal RZ(δ)R_Z(\delta) scales column 0 by e−iδ/2e^{-i\delta/2} and column 1 by eiδ/2e^{i\delta/2}.
  10. Step 10:
    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\\e^{i(\beta-\delta)/2}\sin\frac\gamma2&e^{i(\beta+\delta)/2}\cos\frac\gamma2\end{pmatrix}
    Left multiplication by RZ(β)R_Z(\beta) scales row 0 by e−iβ/2e^{-i\beta/2} and row 1 by eiβ/2e^{i\beta/2}; add the exponents entry by entry.
  11. Step 11:
    =(a−bˉbaˉ)=V=\begin{pmatrix}a&-\bar b\\b&\bar a\end{pmatrix}=V
    Entry (0,0)(0,0) is aa and entry (1,0)(1,0) is bb by the previous choice; entry (0,1)(0,1) is −ei(β−δ)/2sin⁡γ2‾=−bˉ-\overline{e^{i(\beta-\delta)/2}\sin\frac\gamma2}=-\bar b and entry (1,1)(1,1) is e−i(β+δ)/2cos⁡γ2‾=aˉ\overline{e^{-i(\beta+\delta)/2}\cos\frac\gamma2}=\bar a.
  12. Step 12:
    U=eiαV=eiαRZ(β)RY(γ)RZ(δ)U=e^{i\alpha}V=e^{i\alpha}R_Z(\beta)R_Y(\gamma)R_Z(\delta)
    Undo the phase of the second step. ■\blacksquare

∎

Derivation

Worked example: H=eiπ/2RZ(0)RY(π2)RZ(π)H=e^{i\pi/2}R_Z(0)R_Y(\tfrac\pi2)R_Z(\pi)

  1. Step 1:
    det⁡H=12(1⋅(−1)−1⋅1)=−1=eiπ ⇒ α=π2\det H=\tfrac12\big(1\cdot(-1)-1\cdot1\big)=-1=e^{i\pi}\ \Rightarrow\ \alpha=\tfrac\pi2
    H=12(111−1)H=\tfrac1{\sqrt2}\begin{pmatrix}1&1\\1&-1\end{pmatrix}, so 2α=π2\alpha=\pi.
  2. Step 2:
    V=e−iπ/2H=−iH=12(−i−i−ii),a=−i2,b=−i2V=e^{-i\pi/2}H=-iH=\tfrac1{\sqrt2}\begin{pmatrix}-i&-i\\-i&i\end{pmatrix},\qquad a=-\tfrac{i}{\sqrt2},\quad b=-\tfrac{i}{\sqrt2}
    Check the SU(2)SU(2) form: −bˉ=−i2-\bar b=-\tfrac{i}{\sqrt2} and aˉ=i2\bar a=\tfrac{i}{\sqrt2} are indeed the second column.
  3. Step 3:
    cos⁡γ2=sin⁡γ2=12 ⇒ γ=π2\cos\tfrac\gamma2=\sin\tfrac\gamma2=\tfrac1{\sqrt2}\ \Rightarrow\ \gamma=\tfrac\pi2
    ∣a∣=∣b∣=12\lvert a\rvert=\lvert b\rvert=\tfrac1{\sqrt2}.
  4. Step 4:
    arg⁡a=arg⁡b=−π2 ⇒ β=arg⁡b−arg⁡a=0,δ=−arg⁡a−arg⁡b=π\arg a=\arg b=-\tfrac\pi2\ \Rightarrow\ \beta=\arg b-\arg a=0,\quad\delta=-\arg a-\arg b=\pi
    Both entries equal 12e−iπ/2\tfrac1{\sqrt2}e^{-i\pi/2}.
  5. Step 5:
    RY(π2)RZ(π)=12(1−111)(−i00i)=12(−i−i−ii)=−iHR_Y\big(\tfrac\pi2\big)R_Z(\pi)=\tfrac1{\sqrt2}\begin{pmatrix}1&-1\\1&1\end{pmatrix}\begin{pmatrix}-i&0\\0&i\end{pmatrix}=\tfrac1{\sqrt2}\begin{pmatrix}-i&-i\\-i&i\end{pmatrix}=-iH
    Verification by multiplication: RZ(0)=IR_Z(0)=I, RZ(π)=diag(e−iπ/2,eiπ/2)=diag(−i,i)R_Z(\pi)=\mathrm{diag}(e^{-i\pi/2},e^{i\pi/2})=\mathrm{diag}(-i,i), and the diagonal factor scales the columns.
  6. Step 6:
    eiπ/2 RZ(0)RY(π2)RZ(π)=i⋅(−iH)=He^{i\pi/2}\,R_Z(0)R_Y\big(\tfrac\pi2\big)R_Z(\pi)=i\cdot(-iH)=H
    i⋅(−i)=1i\cdot(-i)=1.

Result

H=eiπ/2RY(π2)RZ(π),(α,β,γ,δ)=(π2,0,π2,π)\boxed{H=e^{i\pi/2}R_Y\big(\tfrac\pi2\big)R_Z(\pi),\qquad(\alpha,\beta,\gamma,\delta)=\big(\tfrac\pi2,0,\tfrac\pi2,\pi\big)}

Circuit · 1 qubit

Quantum circuit on 1 qubitRZ(π) on q0; RY(π/2) on q0q0RZ(π)RY(π/2)

The ZYZ circuit for HH without its global phase: on the wire RZ(π)R_Z(\pi) acts first and RY(π2)R_Y(\tfrac\pi2) second, so the circuit unitary is RY(π2)RZ(π)=−iHR_Y(\tfrac\pi2)R_Z(\pi)=-iH. The unitary view shows every entry of HH multiplied by −i-i, which no measurement can detect.

U=(−12 i−12 i−12 i12 i)U = \begin{pmatrix} -\tfrac{1}{\sqrt{2}}\,i & -\tfrac{1}{\sqrt{2}}\,i \\ -\tfrac{1}{\sqrt{2}}\,i & \tfrac{1}{\sqrt{2}}\,i \end{pmatrix}
Derivation

Worked example: T=eiπ/8RZ(π4)T=e^{i\pi/8}R_Z(\tfrac\pi4)

  1. Step 1:
    T=(100eiπ/4),det⁡T=eiπ/4 ⇒ α=π8T=\begin{pmatrix}1&0\\0&e^{i\pi/4}\end{pmatrix},\qquad\det T=e^{i\pi/4}\ \Rightarrow\ \alpha=\tfrac\pi8
    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=0V=e^{-i\pi/8}T=\begin{pmatrix}e^{-i\pi/8}&0\\0&e^{i\pi/8}\end{pmatrix},\qquad a=e^{-i\pi/8},\quad b=0
    Scale both diagonal entries by e−iπ/8e^{-i\pi/8}.
  3. Step 3:
    cos⁡γ2=1, sin⁡γ2=0 ⇒ γ=0,RY(0)=I\cos\tfrac\gamma2=1,\ \sin\tfrac\gamma2=0\ \Rightarrow\ \gamma=0,\qquad R_Y(0)=I
    ∣a∣=1\lvert a\rvert=1, ∣b∣=0\lvert b\rvert=0.
  4. Step 4:
    β+δ=−2arg⁡a=π4,β−δ=0 ⇒ β=δ=π8\beta+\delta=-2\arg a=\tfrac\pi4,\qquad\beta-\delta=0\ \Rightarrow\ \beta=\delta=\tfrac\pi8
    b=0b=0, so β−δ\beta-\delta is free; the proof's convention arg⁡b=0\arg b=0 gives β−δ=0\beta-\delta=0.
  5. Step 5:
    RZ(π8)RZ(π8)=diag(e−iπ/16e−iπ/16, eiπ/16eiπ/16)=RZ(π4)R_Z\big(\tfrac\pi8\big)R_Z\big(\tfrac\pi8\big)=\mathrm{diag}\big(e^{-i\pi/16}e^{-i\pi/16},\,e^{i\pi/16}e^{i\pi/16}\big)=R_Z\big(\tfrac\pi4\big)
    Rotations about the same axis add their angles; for diagonal matrices this is multiplication of the phases.
  6. Step 6:
    eiπ/8RZ(π4)=(eiπ/8e−iπ/800eiπ/8eiπ/8)=(100eiπ/4)=Te^{i\pi/8}R_Z\big(\tfrac\pi4\big)=\begin{pmatrix}e^{i\pi/8}e^{-i\pi/8}&0\\0&e^{i\pi/8}e^{i\pi/8}\end{pmatrix}=\begin{pmatrix}1&0\\0&e^{i\pi/4}\end{pmatrix}=T
    Verification by multiplying the global phase into the diagonal.

Result

T=eiπ/8RZ(π4),(α,β,γ,δ)=(π8,π8,0,π8)\boxed{T=e^{i\pi/8}R_Z\big(\tfrac\pi4\big),\qquad(\alpha,\beta,\gamma,\delta)=\big(\tfrac\pi8,\tfrac\pi8,0,\tfrac\pi8\big)}

Euler angles on demand. The widget below runs the constructive proof with γ∈[0,π]\gamma\in[0,\pi] and α,β,δ∈(−π,π]\alpha,\beta,\delta\in(-\pi,\pi]. On the preset HH it prints (α,β,γ,δ)=(π2,0,π2,π)(\alpha,\beta,\gamma,\delta)=(\tfrac\pi2,0,\tfrac\pi2,\pi), the worked example above, and the axis–angle form H=eiπ/2(cos⁡π2 I−isin⁡π2 n^⋅σ⃗)H=e^{i\pi/2}\big(\cos\tfrac\pi2\,I-i\sin\tfrac\pi2\,\hat n\cdot\vec\sigma\big) with n^=12(1,0,1)\hat n=\tfrac1{\sqrt2}(1,0,1), ϑ=π\vartheta=\pi (at ϑ=π\vartheta=\pi the pair (eiπ/2,n^)(e^{i\pi/2},\hat n) may equally be reported as (e−iπ/2,−n^)(e^{-i\pi/2},-\hat n)). At the degenerate angles γ∈{0,π}\gamma\in\lbrace0,\pi\rbrace it sets δ=0\delta=0: the preset TT then gives (π8,π4,0,0)(\tfrac\pi8,\tfrac\pi4,0,0) instead of (π8,π8,0,π8)(\tfrac\pi8,\tfrac\pi8,0,\tfrac\pi8) (only β+δ=π4\beta+\delta=\tfrac\pi4 is fixed), and XX gives (−π2,π,π,0)(-\tfrac\pi2,\pi,\pi,0).

Derivation

Worked example: RX(π2)R_X(\tfrac\pi2) followed by RZ(π3)R_Z(\tfrac\pi3)

  1. Step 1:
    RZ(−π2) Y RZ(−π2)†=cos⁡(−π2) Y−sin⁡(−π2) X=XR_Z(-\tfrac\pi2)\,Y\,R_Z(-\tfrac\pi2)^\dagger=\cos(-\tfrac\pi2)\,Y-\sin(-\tfrac\pi2)\,X=X
    The RZR_Z conjugation rule of the previous section at θ=−π2\theta=-\tfrac\pi2.
  2. Step 2:
    RZ(−π2)RY(θ)RZ(π2)=e−iθ RZ(−π/2)YRZ(−π/2)†/2=e−iθX/2=RX(θ)R_Z(-\tfrac\pi2)R_Y(\theta)R_Z(\tfrac\pi2)=e^{-i\theta\,R_Z(-\pi/2)YR_Z(-\pi/2)^\dagger/2}=e^{-i\theta X/2}=R_X(\theta)
    VeAV†=eVAV†Ve^{A}V^\dagger=e^{VAV^\dagger} for unitary VV (term by term in the series), with RZ(−π2)†=RZ(π2)R_Z(-\tfrac\pi2)^\dagger=R_Z(\tfrac\pi2).
  3. Step 3:
    U=RZ(π3)RX(π2)=RZ(π3)RZ(−π2)RY(π2)RZ(π2)=RZ(−π6)RY(π2)RZ(π2)U=R_Z(\tfrac\pi3)R_X(\tfrac\pi2)=R_Z(\tfrac\pi3)R_Z(-\tfrac\pi2)R_Y(\tfrac\pi2)R_Z(\tfrac\pi2)=R_Z(-\tfrac\pi6)R_Y(\tfrac\pi2)R_Z(\tfrac\pi2)
    The circuit applies RXR_X first; ZZ rotations add their angles.
  4. Step 4:
    U=12(e−iπ/6−ie−iπ/6e−iπ/3eiπ/6),det⁡U=1,a=e−iπ/62,b=e−iπ/32U=\tfrac1{\sqrt2}\begin{pmatrix}e^{-i\pi/6}&-ie^{-i\pi/6}\\e^{-i\pi/3}&e^{i\pi/6}\end{pmatrix},\qquad\det U=1,\quad a=\tfrac{e^{-i\pi/6}}{\sqrt2},\quad b=\tfrac{e^{-i\pi/3}}{\sqrt2}
    Proof check: α=0\alpha=0, ∣a∣=∣b∣\lvert a\rvert=\lvert b\rvert gives γ=π2\gamma=\tfrac\pi2, β=arg⁡b−arg⁡a=−π6\beta=\arg b-\arg a=-\tfrac\pi6 and δ=−arg⁡a−arg⁡b=π2\delta=-\arg a-\arg b=\tfrac\pi2.
  5. Step 5:
    U=(32I−i2Z)12(I−iX)=322 I−i22(3 X+Y+Z)U=\big(\tfrac{\sqrt3}2I-\tfrac i2Z\big)\tfrac1{\sqrt2}(I-iX)=\tfrac{\sqrt3}{2\sqrt2}\,I-\tfrac{i}{2\sqrt2}\big(\sqrt3\,X+Y+Z\big)
    Axis–angle form from the closed forms; the cross term uses ZX=iYZX=iY.
  6. Step 6:
    cos⁡ϑ2=64,ϑ=2arccos⁡64≈1.8235,n^=15(3,1,1)\cos\tfrac\vartheta2=\tfrac{\sqrt6}4,\qquad\vartheta=2\arccos\tfrac{\sqrt6}4\approx1.8235,\qquad\hat n=\tfrac1{\sqrt5}\big(\sqrt3,1,1\big)
    sin⁡ϑ2=522\sin\tfrac\vartheta2=\tfrac{\sqrt5}{2\sqrt2} is the length of 122(3,1,1)\tfrac1{2\sqrt2}(\sqrt3,1,1), and 616+1016=1\tfrac6{16}+\tfrac{10}{16}=1.

Result

RZ(π3)RX(π2)=RZ(−π6)RY(π2)RZ(π2),(α,β,γ,δ)=(0,−π6,π2,π2)\boxed{R_Z(\tfrac\pi3)R_X(\tfrac\pi2)=R_Z(-\tfrac\pi6)R_Y(\tfrac\pi2)R_Z(\tfrac\pi2),\qquad(\alpha,\beta,\gamma,\delta)=\big(0,-\tfrac\pi6,\tfrac\pi2,\tfrac\pi2\big)}

This second widget starts from the gate sequence RX(π2)R_X(\tfrac\pi2), RZ(π3)R_Z(\tfrac\pi3) 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)R_Z(-\tfrac\pi3) undoes the last rotation and leaves RX(π2)R_X(\tfrac\pi2) with (α,β,γ,δ)=(0,−π2,π2,π2)(\alpha,\beta,\gamma,\delta)=(0,-\tfrac\pi2,\tfrac\pi2,\tfrac\pi2).

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)U_3(1.1,0.4,-0.7) and on HH, rebuilds eiαRZ(β)RY(γ)RZ(δ)e^{i\alpha}R_Z(\beta)R_Y(\gamma)R_Z(\delta) and compares it with the original matrix entry by entry. For U3U_3 it recovers (β,γ,δ)=(0.4,1.1,−0.7)(\beta,\gamma,\delta)=(0.4,1.1,-0.7) and α=0.4−0.72=−0.15\alpha=\tfrac{0.4-0.7}2=-0.15, in agreement with the U3U_3 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));
}

Expected output

U3(1.1,0.4,-0.7): alpha=-0.1500 beta=0.4000 gamma=1.1000 delta=-0.7000 max|U-W|<1e-12: true
H: alpha=1.5708 beta=0.0000 gamma=1.5708 delta=3.1416 max|U-W|<1e-12: true

Quick check

In the ZYZ decomposition of X=(0110)X=\begin{pmatrix}0&1\\1&0\end{pmatrix} given by the proof, what is γ\gamma? Give a decimal.

tolerance ±0.001

Preparing any Bloch state with R_Y and R_Z#

Derivation

RZ(ϕ)RY(θ)∣0⟩R_Z(\phi)R_Y(\theta)\lvert0\rangle is the Bloch state (θ,ϕ)(\theta,\phi)

  1. Step 1:
    RY(θ)∣0⟩=(cos⁡θ2−sin⁡θ2sin⁡θ2cos⁡θ2)(10)=cos⁡θ2∣0⟩+sin⁡θ2∣1⟩R_Y(\theta)\lvert0\rangle=\begin{pmatrix}\cos\frac\theta2&-\sin\frac\theta2\\\sin\frac\theta2&\cos\frac\theta2\end{pmatrix}\begin{pmatrix}1\\0\end{pmatrix}=\cos\tfrac\theta2\lvert0\rangle+\sin\tfrac\theta2\lvert1\rangle
    A matrix applied to ∣0⟩=(1,0)T\lvert0\rangle=(1,0)^{\mathsf T} returns its first column.
  2. Step 2:
    RZ(ϕ)∣0⟩=e−iϕ/2∣0⟩,RZ(ϕ)∣1⟩=eiϕ/2∣1⟩R_Z(\phi)\lvert0\rangle=e^{-i\phi/2}\lvert0\rangle,\qquad R_Z(\phi)\lvert1\rangle=e^{i\phi/2}\lvert1\rangle
    ∣0⟩\lvert0\rangle and ∣1⟩\lvert1\rangle are the eigenvectors of the diagonal matrix RZ(ϕ)R_Z(\phi).
  3. Step 3:
    RZ(ϕ)RY(θ)∣0⟩=e−iϕ/2cos⁡θ2∣0⟩+eiϕ/2sin⁡θ2∣1⟩R_Z(\phi)R_Y(\theta)\lvert0\rangle=e^{-i\phi/2}\cos\tfrac\theta2\lvert0\rangle+e^{i\phi/2}\sin\tfrac\theta2\lvert1\rangle
    Linearity: apply RZ(ϕ)R_Z(\phi) to each basis term.
  4. Step 4:
    =e−iϕ/2(cos⁡θ2∣0⟩+eiϕsin⁡θ2∣1⟩)=e^{-i\phi/2}\Big(\cos\tfrac\theta2\lvert0\rangle+e^{i\phi}\sin\tfrac\theta2\lvert1\rangle\Big)
    Factor out e−iϕ/2e^{-i\phi/2}, using eiϕ/2=e−iϕ/2eiϕe^{i\phi/2}=e^{-i\phi/2}e^{i\phi}.

Result

RZ(ϕ)RY(θ)∣0⟩=e−iϕ/2(cos⁡θ2∣0⟩+eiϕsin⁡θ2∣1⟩)≃∣θ,ϕ⟩\boxed{R_Z(\phi)R_Y(\theta)\lvert0\rangle=e^{-i\phi/2}\Big(\cos\tfrac\theta2\lvert0\rangle+e^{i\phi}\sin\tfrac\theta2\lvert1\rangle\Big)\simeq\lvert\theta,\phi\rangle}

Circuit · 1 qubit

Quantum circuit on 1 qubitRY(2π/3) on q0; RZ(π/4) on q0q0RY(2π/3)RZ(π/4)

RY(2π3)R_Y(\tfrac{2\pi}3) then RZ(π4)R_Z(\tfrac\pi4) on ∣0⟩\lvert0\rangle. The statevector is e−iπ/8(12∣0⟩+32eiπ/4∣1⟩)≈(0.4619−0.1913i)∣0⟩+(0.8001+0.3314i)∣1⟩e^{-i\pi/8}\big(\tfrac12\lvert0\rangle+\tfrac{\sqrt3}2e^{i\pi/4}\lvert1\rangle\big)\approx(0.4619-0.1913i)\lvert0\rangle+(0.8001+0.3314i)\lvert1\rangle: the amplitudes carry the common phase e−iπ/8e^{-i\pi/8}, while the relative phase is eiπ/4e^{i\pi/4}, so the Bloch angles are θ=2π3\theta=\tfrac{2\pi}3, ϕ=π4\phi=\tfrac\pi4.

∣ψ⟩=(0.4619−0.1913i)∣0⟩+(0.8001+0.3314i)∣1⟩\lvert\psi\rangle = \left(0.4619 - 0.1913i\right)\lvert 0\rangle + \left(0.8001 + 0.3314i\right)\lvert 1\rangle
RZ(π4)RY(2π3)=(12e−iπ/8−32e−iπ/832eiπ/812eiπ/8)R_Z\big(\tfrac\pi4\big)R_Y\big(\tfrac{2\pi}3\big)=\begin{pmatrix}\frac12e^{-i\pi/8}&-\frac{\sqrt3}2e^{-i\pi/8}\\\frac{\sqrt3}2e^{i\pi/8}&\frac12e^{i\pi/8}\end{pmatrix}
R_Z(π/4) R_Y(2π/3)2×2

Unitary verified: U†U=IU^\dagger U = I (max deviation 2.2e-16)

Quick check

What does RZ(ϕ)R_Z(\phi) do to the state ∣0⟩\lvert0\rangle?

Select one answer

The U3 gate as a ZYZ product#

Hardware toolkits expose a general single-qubit gate U3(θ,ϕ,λ)U_3(\theta,\phi,\lambda) (Qiskit's U, PennyLane's U3), whose first column is the Bloch state (θ,ϕ)(\theta,\phi) and whose top-left entry is real: U3(θ,ϕ,λ)=(cos⁡θ2−eiλsin⁡θ2eiϕsin⁡θ2ei(ϕ+λ)cos⁡θ2).U_3(\theta,\phi,\lambda)=\begin{pmatrix}\cos\frac\theta2&-e^{i\lambda}\sin\frac\theta2\\e^{i\phi}\sin\frac\theta2&e^{i(\phi+\lambda)}\cos\frac\theta2\end{pmatrix}. By the ZYZ theorem it must be a product of ZZ and YY rotations; the next identity identifies the angles and the phase.

Proposition

U3 is a ZYZ rotation up to global phase

For all real θ,ϕ,λ\theta,\phi,\lambda: U3(θ,ϕ,λ)=ei(ϕ+λ)/2RZ(ϕ)RY(θ)RZ(λ)U_3(\theta,\phi,\lambda)=e^{i(\phi+\lambda)/2}R_Z(\phi)R_Y(\theta)R_Z(\lambda). In particular every single-qubit unitary equals U3U_3 up to a global phase, and det⁡U3=ei(ϕ+λ)\det U_3=e^{i(\phi+\lambda)}.

Proof (6 steps)
  1. Step 1:
    RZ(ϕ)RY(θ)RZ(λ)=(e−i(ϕ+λ)/2cos⁡θ2−e−i(ϕ−λ)/2sin⁡θ2ei(ϕ−λ)/2sin⁡θ2ei(ϕ+λ)/2cos⁡θ2)R_Z(\phi)R_Y(\theta)R_Z(\lambda)=\begin{pmatrix}e^{-i(\phi+\lambda)/2}\cos\frac\theta2&-e^{-i(\phi-\lambda)/2}\sin\frac\theta2\\e^{i(\phi-\lambda)/2}\sin\frac\theta2&e^{i(\phi+\lambda)/2}\cos\frac\theta2\end{pmatrix}
    The product formula from the ZYZ proof with (β,γ,δ)=(ϕ,θ,λ)(\beta,\gamma,\delta)=(\phi,\theta,\lambda).
  2. Step 2:
    (0,0): ei(ϕ+λ)/2e−i(ϕ+λ)/2cos⁡θ2=cos⁡θ2(0,0):\ e^{i(\phi+\lambda)/2}e^{-i(\phi+\lambda)/2}\cos\tfrac\theta2=\cos\tfrac\theta2
    Multiply the entry by the global phase ei(ϕ+λ)/2e^{i(\phi+\lambda)/2}; the exponents cancel.
  3. Step 3:
    (0,1): −ei(ϕ+λ)/2e−i(ϕ−λ)/2sin⁡θ2=−eiλsin⁡θ2(0,1):\ -e^{i(\phi+\lambda)/2}e^{-i(\phi-\lambda)/2}\sin\tfrac\theta2=-e^{i\lambda}\sin\tfrac\theta2
    ϕ+λ2−ϕ−λ2=λ\tfrac{\phi+\lambda}2-\tfrac{\phi-\lambda}2=\lambda.
  4. Step 4:
    (1,0): ei(ϕ+λ)/2ei(ϕ−λ)/2sin⁡θ2=eiϕsin⁡θ2(1,0):\ e^{i(\phi+\lambda)/2}e^{i(\phi-\lambda)/2}\sin\tfrac\theta2=e^{i\phi}\sin\tfrac\theta2
    ϕ+λ2+ϕ−λ2=ϕ\tfrac{\phi+\lambda}2+\tfrac{\phi-\lambda}2=\phi.
  5. Step 5:
    (1,1): ei(ϕ+λ)/2ei(ϕ+λ)/2cos⁡θ2=ei(ϕ+λ)cos⁡θ2(1,1):\ e^{i(\phi+\lambda)/2}e^{i(\phi+\lambda)/2}\cos\tfrac\theta2=e^{i(\phi+\lambda)}\cos\tfrac\theta2
    The two half phases add.
  6. Step 6:
    ei(ϕ+λ)/2RZ(ϕ)RY(θ)RZ(λ)=U3(θ,ϕ,λ),det⁡U3=(ei(ϕ+λ)/2)2⋅1=ei(ϕ+λ)e^{i(\phi+\lambda)/2}R_Z(\phi)R_Y(\theta)R_Z(\lambda)=U_3(\theta,\phi,\lambda),\qquad\det U_3=\big(e^{i(\phi+\lambda)/2}\big)^2\cdot1=e^{i(\phi+\lambda)}
    All four entries agree with the definition of U3U_3; the determinant of a 2×22\times2 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(γ,β,δ)U=e^{i\alpha}R_Z(\beta)R_Y(\gamma)R_Z(\delta)=e^{i(\alpha-(\beta+\delta)/2)}U_3(\gamma,\beta,\delta). ■\blacksquare

∎

Quick check

Which global phase relates U3(θ,ϕ,λ)U_3(\theta,\phi,\lambda) to RZ(ϕ)RY(θ)RZ(λ)R_Z(\phi)R_Y(\theta)R_Z(\lambda)?

Select one answer

References

  1. 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
  2. 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
  3. 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(cos⁡θ2∣0⟩+eiϕsin⁡θ2∣1⟩)R_Z(\phi)R_Y(\theta)\lvert0\rangle=e^{-i\phi/2}\big(\cos\tfrac\theta2\lvert0\rangle+e^{i\phi}\sin\tfrac\theta2\lvert1\rangle\big) to prepare the state with Bloch angles θ=2π3\theta=\tfrac{2\pi}3, ϕ=π4\phi=\tfrac\pi4 from ∣0⟩\lvert0\rangle with at most two rotation gates.

    Open lab