Variational Quantum Eigensolver (VQE)
Variational Quantum Eigensolver (VQE)
The Variational Quantum Eigensolver is the prototypical hybrid quantum-classical algorithm. It uses a quantum computer to evaluate an energy function and a classical optimizer to minimize it, finding the ground state of a Hamiltonian.
The Variational Principle
The key mathematical foundation is the Rayleigh–Ritz variational principle: for any normalized trial state ,
where is the true ground state energy. Minimizing over the parameters gives the best approximation within the ansatz family.
The Ansatz
For the simplest case , we use the single-parameter ansatz:
The gate rotates the Bloch vector within the -plane, covering all real-amplitude states from (at ) to (at ).
Energy Landscape
Substituting into the expectation value formula from the previous lesson:
The energy landscape is a simple cosine:
- Maximum at : (state , eigenvalue of )
- Minimum at : (state , eigenvalue of , the ground state)
Gradient Descent Optimization
The classical optimizer computes the gradient:
and updates:
Starting near and running gradient descent converges to .
Note: On a real quantum computer, the gradient is estimated using the parameter shift rule: , which requires only two extra circuit evaluations.
VQE Workflow
Initialize θ randomly
Repeat:
1. Prepare |ψ(θ)⟩ on quantum hardware
2. Measure ⟨H⟩ = E(θ) ← quantum step
3. Compute gradient classically
4. Update θ ← θ - η·∇E ← classical step
Until convergence
Scaling to Real Problems
For molecular Hamiltonians like , VQE expresses as a sum of Pauli strings (e.g., ) and measures each term separately. The ansatz uses chemically motivated circuits (UCCSD). VQE is expected to show quantum advantage for strongly correlated molecules beyond the reach of classical methods.
Your Task
Implement:
energy(theta)— returnvqe_minimize()— run gradient descent for 100 steps with learning rate 0.3 starting at , and return the minimized energy rounded to 4 decimal places