Back to Curriculum
Algorithms

The Variational Quantum Eigensolver (VQE)

A hybrid quantum-classical loop for finding a molecule's ground-state energy

By the end of this topic you'll be able to

Explain the hybrid quantum-classical loop VQE runs
State what problem VQE targets and why the variational principle makes its objective sound
Explain why VQE is considered well-suited to today's noisy hardware

Shor's and Grover's algorithms both need long, precise, effectively error-free circuits that today's hardware cannot yet reliably run. Variational algorithms take a more pragmatic approach, deliberately designed around the noisy, qubit-limited devices actually available in the current 'NISQ' era of quantum hardware.

The Variational Quantum Eigensolver (VQE) is the flagship example. A parameterized quantum circuit, called an ansatz, with tunable angles θ, prepares a candidate state |ψ(θ)⟩ on the quantum computer.

θ = 0°θ = 360°
Ansatz parameter θ30°

Current cost: E(θ) = -0.87. The minimum sits at θ = 180°.

Dragging θ is you, by hand, doing what the classical optimizer does automatically: nudge the angle, re-measure the cost on the quantum computer, and repeat until it stops improving.

The quantum computer then measures the energy expectation value ⟨ψ(θ)|H|ψ(θ)⟩ for the Hamiltonian H of interest — most often the electronic Hamiltonian of a molecule, making VQE one of the leading near-term approaches to quantum chemistry simulation.

A classical optimizer running on an ordinary computer looks at that estimated energy, adjusts θ in an attempt to lower it further, and the loop repeats: quantum hardware handles the expensive part, evaluating the energy on a genuinely quantum state, while classical hardware handles the comparatively cheap part, deciding how to adjust the parameters.

The objective is sound precisely because of the variational principle: for any candidate state |ψ(θ)⟩ whatsoever, ⟨ψ(θ)|H|ψ(θ)⟩ is guaranteed to be greater than or equal to the true ground-state energy. So driving the measured energy down, however the optimizer chooses to do it, can never overshoot past the real answer — the classical loop is always searching in the right direction.

This hybrid division of labor is exactly why VQE tolerates substantially more noise than Shor's or Grover's algorithms: a somewhat noisy energy estimate still nudges the classical optimizer in roughly the right direction, whereas an algorithm like Shor's needs its entire long circuit to be essentially error-free from start to finish.

The ansatz's design is itself an active research question: a chemically-motivated ansatz (built from the molecule's known orbital structure) tends to need fewer parameters but more circuit depth, while a hardware-efficient ansatz (built from whatever gates a given chip runs natively and cheaply) needs less depth but often more parameters to reach the same accuracy — the right tradeoff depends on both the target molecule and the specific hardware available.

Try It Yourself

Worked Example

A VQE run tries three values of a single ansatz parameter θ and measures energies E(0°) = -0.3, E(90°) = -0.9, E(180°) = -1.0 (in some energy units). Which θ should the classical optimizer move toward next, and why?

  1. 1The variational principle says every one of these measured values is an upper bound on the true ground-state energy — the true answer is ≤ -1.0, possibly lower still.
  2. 2The optimizer's job is to minimize the measured energy, and lower (more negative) is better here, since it's a tighter upper bound on the ground state.
  3. 3Among the three samples, θ=180° gives the lowest energy (-1.0), and the trend from 0°→90°→180° (-0.3 → -0.9 → -1.0) is monotonically decreasing.
  4. 4A reasonable next step for the classical optimizer is to keep moving past 180° in the same direction — or, if this is close to a minimum, to sample more finely near 180° to look for a value even lower than -1.0.
Answer

The optimizer should push θ further in the direction it's already been moving (toward or past 180°), since energy has been dropping monotonically that way — exactly the 'nudge and re-measure' loop described in the lesson.

Reference

AnsatzA parameterized quantum circuit whose angles θ get optimized
VQE objectiveEstimate a Hamiltonian's ground-state energy
Variational principleAny candidate state's energy upper-bounds the true ground state E₀
Hybrid loopQuantum hardware measures; classical hardware decides the next θ

Quick Check

In VQE's hybrid loop, what runs on the quantum computer and what runs on the classical computer?

Why is it sound for the classical optimizer to simply try to minimize the measured energy ⟨ψ(θ)|H|ψ(θ)⟩?