|q⟩ Bad Qubits

intermediate · Programming · Variational Quantum Eigensolver (VQE)

The Variational Principle

Every quantum algorithm that finds a ground state energy must start from one fundamental inequality — the variational principle — which guarantees that any state you prepare gives an upper bound on the true ground energy.

The variational bound

Let HH be a Hamiltonian with eigenstates ∣Ek⟩|E_k\rangle and eigenvalues E0≤E1≤⋯E_0 \leq E_1 \leq \cdots ordered from lowest to highest. For an arbitrary normalized trial state ∣ψ⟩|\psi\rangle the expectation value satisfies

⟨ψ∣H∣ψ⟩  ≥  E0.\langle \psi | H | \psi \rangle \;\geq\; E_0.

Proof. Expand ∣ψ⟩=∑kck∣Ek⟩|\psi\rangle = \sum_k c_k |E_k\rangle with ∑k∣ck∣2=1\sum_k |c_k|^2 = 1. Then

⟨ψ∣H∣ψ⟩=∑k∣ck∣2Ek≥E0∑k∣ck∣2=E0.\langle \psi | H | \psi \rangle = \sum_k |c_k|^2 E_k \geq E_0 \sum_k |c_k|^2 = E_0.

Equality holds if and only if ∣ψ⟩=∣E0⟩|\psi\rangle = |E_0\rangle — the true ground state.

A concrete example: H=ZH = Z

The single-qubit Pauli-ZZ operator has matrix

Z=(100−1).Z = \begin{pmatrix} 1 & 0 \\ 0 & -1 \end{pmatrix}.

Its eigenvalues are +1+1 (eigenvector ∣0⟩|0\rangle) and −1-1 (eigenvector ∣1⟩|1\rangle), so the ground state energy is E0=−1E_0 = -1.

The variational principle guarantees that for any single-qubit state ∣ψ⟩=α∣0⟩+β∣1⟩|\psi\rangle = \alpha|0\rangle + \beta|1\rangle,

⟨ψ∣Z∣ψ⟩=∣α∣2(1)+∣β∣2(−1)=∣α∣2−∣β∣2  ≥  −1,\langle \psi | Z | \psi \rangle = |\alpha|^2 (1) + |\beta|^2 (-1) = |\alpha|^2 - |\beta|^2 \;\geq\; -1,

with equality only when α=0\alpha = 0, i.e.\ ∣ψ⟩=∣1⟩|\psi\rangle = |1\rangle.

Energy landscape across trial states

Parametrize a family of trial states as ∣ψ(θ)⟩=cos⁡(θ/2)∣0⟩+sin⁡(θ/2)∣1⟩|\psi(\theta)\rangle = \cos(\theta/2)|0\rangle + \sin(\theta/2)|1\rangle (a rotation from ∣0⟩|0\rangle toward ∣1⟩|1\rangle). The expectation value is

E(θ)=⟨ψ(θ)∣Z∣ψ(θ)⟩=cos⁡2(θ/2)−sin⁡2(θ/2)=cos⁡θ.E(\theta) = \langle \psi(\theta) | Z | \psi(\theta) \rangle = \cos^2(\theta/2) - \sin^2(\theta/2) = \cos\theta.

This function is minimized at θ=π\theta = \pi, where E(π)=−1=E0E(\pi) = -1 = E_0. VQE would discover this minimum by evaluating E(θ)E(\theta) on the quantum device and updating θ\theta classically (a hybrid loop).

Why this matters for VQE

VQE replaces "solve H∣ψ⟩=E0∣ψ⟩H|\psi\rangle = E_0|\psi\rangle analytically" with "prepare ∣ψ(θ)⟩|\psi(\theta)\rangle on a quantum processor, measure ⟨H⟩\langle H \rangle, pass that number to a classical optimizer, and repeat." The variational principle is the guarantee that the optimizer's objective — the energy expectation value — is always an upper bound on E0E_0, so the algorithm can only improve.

Try it

The Pauli-ZZ Hamiltonian has eigenvalues +1+1 and −1-1. The variational principle says ⟨ψ∣Z∣ψ⟩≥−1\langle \psi | Z | \psi \rangle \geq -1 for all ∣ψ⟩|\psi\rangle. Return the expectation value of ZZ in the state ∣1⟩|1\rangle to confirm that the bound is tight for the true ground state.

Run your code to see the quantum state.

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