Measuring Energy Expectation
The Variational Quantum Eigensolver (VQE) finds the ground-state energy of a molecule by minimizing over circuit parameters . On real quantum hardware you cannot read off the full state vector; instead you must measure each Pauli term separately and add up the contributions.
Decomposing the Hamiltonian
Any Hermitian operator on qubits can be written as a weighted sum of Pauli tensor-products:
By linearity,
This means you only need to measure for each Pauli string and then form the weighted sum classically.
Measuring a single Pauli term
Z terms are the easiest: measure in the computational basis and compute
For a qubit in state this gives , which is exactly the diagonal matrix element .
X and Y terms require a basis rotation before measurement. To measure apply a Hadamard to rotate and , then measure in the basis. To measure apply first.
Multi-qubit Pauli strings
For a product operator like (often written ) the expectation value factors only when the state is a product state. In general,
where is the probability of measuring the bit string . The sign rule follows from the fact that and : the contribution of a bit string is the product of the signs of each individual bit under its Pauli.
Putting it together in VQE
A single VQE energy estimate proceeds as follows:
- Prepare with the parametrized ansatz circuit.
- For each Pauli term : rotate the state to the measurement basis for , measure, collect shot statistics, compute .
- Return to the classical optimizer.
- The optimizer proposes a new and the loop repeats until convergence.
On a simulator the expectation values can be computed exactly from the statevector; on hardware you average over many shots, so statistical noise limits precision.
Try it
For the product state (qubit 0 in , qubit 1 in ), what is the expectation value of the Pauli-Z operator acting on qubit 1? Compute the exact value and return it.
Sign in on the full site to ask questions and join the discussion.