|q⟩ Bad Qubits

intermediate · Programming · Hamiltonian Simulation & Trotterization

Evolving Under a Single Pauli

The time-evolution operator for a Hamiltonian HH is the unitary U(t)=eiHtU(t) = e^{-iHt}. When HH is a single Pauli operator or a tensor product of Paulis (a Pauli string), the exponential has a closed form that maps directly to standard rotation gates.

Single-qubit Pauli rotations

For each single-qubit Pauli P{X,Y,Z}P \in \{X, Y, Z\} we use the fact that P2=IP^2 = I and expand the matrix exponential as a Taylor series:

eiθP=cosθIisinθP.e^{-i\theta P} = \cos\theta \cdot I - i\sin\theta \cdot P.

Comparing with the standard rotation gate definitions

Rx(λ)=eiλX/2,Ry(λ)=eiλY/2,Rz(λ)=eiλZ/2,R_x(\lambda) = e^{-i\lambda X/2}, \quad R_y(\lambda) = e^{-i\lambda Y/2}, \quad R_z(\lambda) = e^{-i\lambda Z/2},

we see that

eiθX=Rx(2θ),eiθY=Ry(2θ),eiθZ=Rz(2θ).e^{-i\theta X} = R_x(2\theta), \quad e^{-i\theta Y} = R_y(2\theta), \quad e^{-i\theta Z} = R_z(2\theta).

The angle passed to the rotation gate is twice the physical evolution parameter θ\theta.

Two-qubit Pauli strings

For a two-qubit Pauli string such as ZZZ \otimes Z (often written ZZZZ), the eigenvalues of the operator determine the phase each basis state acquires:

(ZZ)00=+00,(ZZ)01=01,(ZZ)10=10,(ZZ)11=+11.(Z \otimes Z)|00\rangle = +|00\rangle, \quad (Z \otimes Z)|01\rangle = -|01\rangle, \quad (Z \otimes Z)|10\rangle = -|10\rangle, \quad (Z \otimes Z)|11\rangle = +|11\rangle.

Because the ZZZZ eigenvalue of xy|xy\rangle is (1)xy(-1)^{x \oplus y}, we can reduce the two-qubit problem to a single-qubit one: apply a CNOT from qubit 0 to qubit 1, which maps xyx,xy|xy\rangle \to |x,\, x \oplus y\rangle. Now qubit 1 alone carries the parity xyx \oplus y, so an RzR_z on qubit 1 applies the correct phase:

eiθZZ=CNOT01(IRz(2θ))CNOT01.e^{-i\theta\, Z \otimes Z} = \mathrm{CNOT}_{0\to1} \cdot \bigl(I \otimes R_z(2\theta)\bigr) \cdot \mathrm{CNOT}_{0\to1}.

The circuit has just three gates:

  1. cx(0, 1) — parity-encode qubit 0 into qubit 1
  2. rz(2 * theta, 1) — rotate by the interaction angle
  3. cx(0, 1) — undo the encoding

This pattern generalises: for a kk-qubit Pauli string, use a ladder of CNOTs to collect the parity onto one qubit, apply RzR_z, then reverse the ladder.

Try it

Implement ei(π/4)ZZe^{-i(\pi/4)\, ZZ} on two qubits. The grader checks the full unitary matrix, so an empty circuit will not pass.

Run your code to see the quantum state.

Sign in on the full site to ask questions and join the discussion.