Measuring Many Pauli Terms
Every VQE energy estimate requires computing for a molecular Hamiltonian that may contain dozens or even thousands of Pauli string terms. Measuring each term in its own dedicated circuit run is correct but wasteful. Commuting Pauli terms can be measured simultaneously, so grouping them reduces the total circuit count and shot budget.
Why commutativity enables simultaneous measurement
Two observables and can be measured simultaneously (in the same basis rotation circuit) if and only if they commute: . For two Pauli strings of the same length, commutativity has a simple combinatorial test: count the positions where the two strings differ and neither is . If that count is even the strings commute; if it is odd they anti-commute.
For example, on two qubits:
- and : they differ at every position, but at qubit 0 we have vs , and at qubit 1 we have vs — every discrepancy involves an , so the count of non-trivial differences is 0 (even). They commute.
- and : qubit 0 has vs (same), qubit 1 has vs — again the discrepancy involves . Count is 0 (even). They commute.
- and : qubit 0 has vs (both non-identity, a genuine conflict), qubit 1 has vs (involves , not counted). Count is 1 (odd). They anti-commute.
Because , , and all mutually commute they form a commuting group that can be measured in a single circuit — no basis-rotation overhead beyond the standard computational-basis measurement.
Measurement basis rotations
Each commuting group defines a shared measurement basis. The standard procedure is:
- Z terms require no rotation — measure directly in the computational basis.
- X terms require a Hadamard on each affected qubit before measurement, rotating and .
- Y terms require an (also written ) rotation before measurement.
For the term on a two-qubit state, after measuring bit string the contribution is:
The sign rule comes directly from and : each qubit contributes a factor of and the factors multiply.
From grouping to circuit count
Given a Hamiltonian with Pauli terms partitioned into commuting groups, you need exactly distinct measurement circuits per VQE iteration instead of . Grouping reduces the shot budget by a factor of roughly , which can be significant: a hydrogen molecule in the STO-3G basis has 15 Pauli terms but only 2 commuting groups, cutting the measurement circuits from 15 to 2.
The full VQE measurement loop becomes:
- Prepare with the ansatz.
- For each commuting group: apply the shared basis rotation, measure, collect statistics.
- From each group's measurement results extract for every term in the group.
- Return to the classical optimizer.
Try it
Consider the two-qubit Hamiltonian
Use the commutativity rule to identify how many distinct measurement circuits are needed. Return that number.
Sign in on the full site to ask questions and join the discussion.