|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)=e−iHtU(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:

e−iθP=cos⁡θ⋅I−isin⁡θ⋅P.e^{-i\theta P} = \cos\theta \cdot I - i\sin\theta \cdot P.

Comparing with the standard rotation gate definitions

Rx(λ)=e−iλX/2,Ry(λ)=e−iλY/2,Rz(λ)=e−iλ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

e−iθX=Rx(2θ),e−iθY=Ry(2θ),e−iθ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 Z⊗ZZ \otimes Z (often written ZZZZ), the eigenvalues of the operator determine the phase each basis state acquires:

(Z⊗Z)∣00⟩=+∣00⟩,(Z⊗Z)∣01⟩=−∣01⟩,(Z⊗Z)∣10⟩=−∣10⟩,(Z⊗Z)∣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)x⊕y(-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 ∣xy⟩→∣x, x⊕y⟩|xy\rangle \to |x,\, x \oplus y\rangle. Now qubit 1 alone carries the parity x⊕yx \oplus y, so an RzR_z on qubit 1 applies the correct phase:

e−iθ Z⊗Z=CNOT0→1⋅(I⊗Rz(2θ))⋅CNOT0→1.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 e−i(π/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.