Checkpoint: Run a VQE
You have worked through every building block of the Variational Quantum Eigensolver: the variational principle, parameterized ansatz circuits, Pauli-string measurements, classical optimization, convergence, and initialization. This checkpoint asks you to put them together and prepare the ground state of a two-qubit Hamiltonian.
The Hamiltonian
The system is described by
where is the Pauli- operator. To find the ground state we need the lowest eigenvalue of this matrix.
The operator swaps pairs of basis states: it maps and . All four Bell states are eigenstates of :
Multiplying by the minus sign in , eigenstates with eigenvalue get eigenvalue and those with eigenvalue get eigenvalue . The ground energy is , and it is doubly degenerate: both and are ground states.
You can confirm this satisfies the variational bound: any two-qubit state obeys , with equality for any state in the ground subspace.
What VQE does (conceptually)
A real VQE run would:
- Initialize a hardware-efficient ansatz, e.g.\ followed by a CNOT.
- Measure the energy by sampling in the basis (basis-change circuit: Hadamard before measurement).
- Optimize with a classical optimizer (COBYLA, gradient descent via the parameter-shift rule, etc.) until stops decreasing.
- The final circuit at convergence prepares the ground state.
For this two-qubit problem, the optimizer converges to a circuit whose output is . That circuit is simply a Hadamard followed by a CNOT — the same Bell-state preparation you first built in module 4.
Why the Bell circuit reaches the target state
The specific ground state the exercise grader checks for is , which is maximally entangled: it cannot be written as a product . Reaching in particular therefore requires an entangling gate.
It is worth noting that the ground energy is not unique to entangled states. For example, the product state satisfies , so it also achieves energy and lies in the ground subspace. The ground subspace is two-dimensional, spanned by and , and contains both entangled and product-state representatives.
A single CNOT layer is sufficient to reach exactly (the target of this checkpoint), which is why the Bell circuit is the natural choice.
Energies of all basis states
To build intuition, compare the energy of the VQE result with the energy of a random guess. For any computational basis state the expectation value of is
where is the bit-flipped state. Since in the computational basis, all basis states give zero energy — much worse than the ground state energy of . Ground states achieve their energy precisely because of quantum superposition: the off-diagonal action of on a superposition produces a non-zero overlap with the original state, yielding a negative energy. The Bell state additionally relies on entanglement, but any state in the two-dimensional ground subspace will do.
Try it
The classical optimizer has converged and found that the optimal circuit is . Build that circuit to prepare the ground state of . The grader checks the full statevector, so a blank circuit or a computational basis state will not pass.
After running, inspect the statevector: you should see amplitudes on and , and zero on and . This is , a ground state of the Hamiltonian (ground energy ), achieved by the VQE at its convergence point.
Sign in on the full site to ask questions and join the discussion.