|q⟩ Bad Qubits

intermediate · Programming · Hamiltonian Simulation & Trotterization

Measuring Observables After Evolution

Hamiltonian simulation does not end at the last gate. To extract physical information — an energy, a magnetisation, or a correlation function — you must measure an observable on the evolved state. This lesson explains how observables connect to circuit measurements and how to estimate expectation values.

Observables and expectation values

An observable is a Hermitian operator OO with real eigenvalues. When the system is in state ψ|\psi\rangle, the expectation value (average measurement outcome) is

O=ψOψ.\langle O \rangle = \langle\psi|O|\psi\rangle.

After time evolution under Hamiltonian HH, the state is ψ(t)=eiHtψ0|\psi(t)\rangle = e^{-iHt}|\psi_0\rangle, so the expectation value of OO at time tt is

O(t)=ψ0eiHtOeiHtψ0.\langle O(t)\rangle = \langle\psi_0|\,e^{iHt}\,O\,e^{-iHt}\,|\psi_0\rangle.

Measuring Pauli observables in the circuit model

Quantum circuits measure in the computational (Z) basis. To estimate the expectation value of a Pauli observable, you rotate the state so the observable's eigenstates align with the measurement basis:

| Observable | Basis rotation before ZZ-measurement | |---|---| | ZZ | none (already in ZZ basis) | | XX | apply HH | | YY | apply SHS^\dagger H |

For the ZZ observable on a single qubit with probabilities P(0)P(0) and P(1)P(1):

Z=P(0)P(1).\langle Z \rangle = P(0) - P(1).

This follows directly from the Born rule: the eigenvalues of ZZ are +1+1 (for 0|0\rangle) and 1-1 (for 1|1\rangle), so the average outcome is (+1)P(0)+(1)P(1)(+1)\cdot P(0) + (-1)\cdot P(1).

A worked example

Consider a single qubit initialised in 0|0\rangle and evolved under the Hamiltonian H=XH = X for time tt. The evolution operator is

eitX=costIisintX=Rx(2t).e^{-itX} = \cos t\cdot I - i\sin t\cdot X = R_x(2t).

The resulting state is Rx(2t)0=cost0isint1R_x(2t)|0\rangle = \cos t\,|0\rangle - i\sin t\,|1\rangle, so

P(0)=cos2t,P(1)=sin2t,P(0) = \cos^2 t, \quad P(1) = \sin^2 t,

and the expectation value of ZZ is

Z(t)=cos2tsin2t=cos(2t).\langle Z(t)\rangle = \cos^2 t - \sin^2 t = \cos(2t).

This is the Larmor precession of the Bloch vector about the xx-axis: the ZZ-component oscillates sinusoidally, starting at +1+1 (all probability on 0|0\rangle) and crossing zero at t=π/4t = \pi/4.

At t=π/6t = \pi/6 specifically:

Z(π/6)=cos(π/3)=12.\langle Z(\pi/6)\rangle = \cos(\pi/3) = \tfrac{1}{2}.

We can verify this numerically: P(0)=cos2(π/6)=3/4P(0) = \cos^2(\pi/6) = 3/4 and P(1)=sin2(π/6)=1/4P(1) = \sin^2(\pi/6) = 1/4, giving Z=3/41/4=1/2\langle Z\rangle = 3/4 - 1/4 = 1/2. \checkmark

Multi-qubit observables

For a two-qubit observable such as ZZZ\otimes Z (written ZZZZ), the eigenvalues are (1)xy(-1)^{x\oplus y} for basis state xy|xy\rangle. The expectation value is

ZZ=P(00)+P(11)P(01)P(10).\langle ZZ \rangle = P(|00\rangle) + P(|11\rangle) - P(|01\rangle) - P(|10\rangle).

No additional gates are required: a simultaneous ZZ-measurement on both qubits suffices. For a Y0Z1Y_0 Z_1 observable you would apply SHS^\dagger H to qubit 0 and nothing to qubit 1 before measuring both.

Try it

Starting from 0|0\rangle, evolve under H=XH = X for time t=π/6t = \pi/6 by applying Rx(π/3)R_x(\pi/3), then measure and return Z=P(0)P(1)\langle Z\rangle = P(0) - P(1). The grader checks that your answer equals 0.50.5.

Run your code to see the quantum state.

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