The Variational Quantum Eigensolver: A Complete Mathematical Derivation
A deep dive into the VQE algorithm — mapping its execution on NISQ hardware and providing a step-by-step derivation of the cost function gradient
Introduction
The Variational Quantum Eigensolver (VQE) is the algorithm that launched the field of near-term quantum computing as a serious research discipline. Proposed by Peruzzo et al. in 2014 [1], it was the first algorithm designed specifically to run on Noisy Intermediate-Scale Quantum (NISQ) hardware — devices that have too many errors for fault-tolerant computation but are real, programmable, and available today.
The problem VQE solves: find the ground state energy of a quantum system described by a Hamiltonian . This is the central computational problem in quantum chemistry. The ground state energy determines molecular geometry, reaction rates, bond strengths, and material properties. Classical computers can solve it exactly only for very small molecules — the computational cost scales exponentially with system size.
VQE offers a path to solving larger instances using quantum hardware. Whether it will achieve practical quantum advantage is still an open question — we will be honest about that at the end. But the algorithm itself is mathematically beautiful and worth understanding completely.
1. The Variational Principle
VQE is grounded in the variational principle of quantum mechanics, which we state and prove here.
1.1 Statement
Theorem (Variational Principle). Let be a Hermitian operator with ground state energy (the smallest eigenvalue). For any normalized quantum state :
with equality if and only if is the ground state .
1.2 Proof
Let be the complete orthonormal eigenbasis of with eigenvalues . Any normalized state can be expanded as:
Then:
Since for all :
Therefore . Equality holds iff for all , i.e., .
1.3 The Variational Strategy
The variational principle gives us an optimization strategy: introduce a parameterized family of trial states and minimize the expectation value:
The minimum over is an upper bound on . The tighter the family, the closer we get.
2. The Molecular Hamiltonian
To apply VQE to chemistry, we need the electronic structure Hamiltonian. Starting from first principles, the non-relativistic molecular Hamiltonian (in atomic units, ) is:
where the four terms are: electron kinetic energy, electron-nucleus attraction, electron-electron repulsion, and constant nuclear repulsion .
2.1 Second Quantization
For quantum computing, we express in second quantization using fermionic creation () and annihilation () operators:
where and are one- and two-electron integrals computed classically from the molecular orbital basis. These integrals are computable efficiently — the hard part is finding the ground state of the resulting operator.
2.2 Jordan-Wigner Transformation
To run on a qubit-based quantum computer, fermionic operators must be mapped to Pauli operators via the Jordan-Wigner transformation:
After applying this transformation, becomes a sum of Pauli strings:
where are coefficients and are tensor products of single-qubit Pauli operators. For example, for the hydrogen molecule in a minimal basis, the qubit Hamiltonian has the form:
where the coefficients depend on the bond length and are computed classically.
3. The Ansatz: Parameterized Trial State
The quantum circuit that prepares is called the ansatz. Its design is critical — it must be both expressive enough to capture the ground state and shallow enough to run on noisy hardware.
3.1 The Unitary Coupled Cluster Ansatz
The chemically motivated ansatz is Unitary Coupled Cluster Singles and Doubles (UCCSD):
where is the Hartree-Fock reference state (computable classically) and:
The first sum runs over single excitations (moving one electron from occupied orbital to virtual orbital ) and the second over double excitations.
After Jordan-Wigner transformation, the unitary decomposes into a product of Pauli rotation gates implementable on quantum hardware.
3.2 Hardware-Efficient Ansatz
For current devices, hardware-efficient ansätze are often used instead — alternating layers of single-qubit rotations and entangling gates chosen to match device connectivity:
These are cheaper to run but less physically motivated, potentially requiring more parameters to reach chemical accuracy.
4. Cost Function and Measurement
4.1 Expectation Value as Cost
The VQE cost function is:
Each term is a Pauli expectation value. This is the key insight: we never measure directly. We measure each Pauli string separately and combine classically.
4.2 Measuring Pauli Strings
For a Pauli string where :
- terms: contribute 1, no measurement needed
- terms: measure in the computational basis
- terms: apply Hadamard before measuring
- terms: apply before measuring
The expectation value is estimated from repeated circuit executions (shots):
Statistical error: , so total shots needed scales with the number and magnitude of Hamiltonian terms.
5. Gradient Computation: The Parameter-Shift Rule
To minimize with gradient descent, we need .
5.1 Derivation
Each parameterized gate has the form where is a Pauli operator with eigenvalues . The cost function is therefore:
for constants , , (holding all other parameters fixed). This is exactly sinusoidal in , so the derivative is:
Evaluating at :
Subtracting:
This is the parameter-shift rule [Mitarai et al., 2018; Schuld et al., 2019]. It gives the exact gradient using only two additional circuit evaluations. No finite differences, no approximation.
5.2 Full Gradient Cost
For parameters and Pauli terms in , each with shots:
- Cost per gradient: circuit evaluations
- For : , , → ~24,000 evaluations per gradient step
6. The Classical Optimization Loop
VQE is a hybrid quantum-classical algorithm. The quantum processor evaluates the cost function; a classical optimizer updates the parameters.
6.1 Algorithm
Initialize: θ⁽⁰⁾ randomly or from chemical heuristics
Repeat until convergence:
1. Prepare |ψ(θ⁽ᵗ⁾)⟩ on quantum hardware
2. Measure each Pauli term Pₖ to estimate E(θ⁽ᵗ⁾)
3. Compute gradient ∇E(θ⁽ᵗ⁾) via parameter-shift
4. Update: θ⁽ᵗ⁺¹⁾ = θ⁽ᵗ⁾ − η∇E(θ⁽ᵗ⁾)
Until |E(θ⁽ᵗ⁺¹⁾) − E(θ⁽ᵗ⁾)| < ε
6.2 Chemical Accuracy
The target for quantum chemistry is chemical accuracy: Hartree ( kcal/mol). This is the threshold below which predicted reaction energies are trustworthy.
VQE on achieves chemical accuracy on current hardware with UCCSD ansatz [Peruzzo et al., 2014]. Larger molecules remain out of reach due to noise.
7. Results on Real Hardware
7.1 What Has Been Demonstrated
| Molecule | Qubits | Hardware | Accuracy | Reference |
|---|---|---|---|---|
| 2 | Photonic chip | Chemical accuracy | Peruzzo et al. (2014) | |
| 4 | Superconducting | Near chemical accuracy | Kandala et al. (2017) | |
| 6 | Superconducting | Near chemical accuracy | Kandala et al. (2017) | |
| 8 | Ion trap | Within Hartree | Nam et al. (2020) |
7.2 The Honest Assessment
For molecules beyond qubits, current NISQ hardware cannot achieve chemical accuracy. Two fundamental barriers:
Noise: Gate errors accumulate through the UCCSD circuit. For with two-qubit gates at 99.5% fidelity: — the circuit is essentially decoherent.
Barren plateaus: As the ansatz depth grows, gradients vanish exponentially (see our article on QNN convergence). The classical optimizer cannot find the direction of steepest descent.
Classical competition: For molecules up to electrons, classical methods like CCSD(T) achieve chemical accuracy efficiently. VQE would need to reach + active orbitals to outperform classical methods — requiring fault-tolerant quantum computers, not NISQ devices.
VQE remains the foundational proof-of-concept for hybrid quantum-classical algorithms. Practical quantum advantage in chemistry is a long-term goal contingent on fault-tolerant hardware.
Conclusion
VQE is mathematically elegant: it combines the variational principle with parameterized quantum circuits and classical optimization into a coherent algorithm that runs on today’s hardware. The derivations — from the variational principle through second quantization, Jordan-Wigner transformation, and the parameter-shift rule — are all rigorous and connected.
The honest position in 2026: VQE has demonstrated proof-of-concept results on small molecules. It has not yet demonstrated practical quantum advantage over classical chemistry methods. That remains the frontier this algorithm was designed to eventually cross.
References
-
Peruzzo, A., McClean, J., Shadbolt, P., Yung, M.-H., Zhou, X.-Q., Love, P. J., Aspuru-Guzik, A., & O’Brien, J. L. (2014). A variational eigenvalue solver on a photonic quantum processor. Nature Communications, 5(1), 4213. https://doi.org/10.1038/ncomms5213
-
Kandala, A., Mezzacapo, A., Temme, K., Takita, M., Brink, M., Chow, J. M., & Gambetta, J. M. (2017). Hardware-efficient variational quantum eigensolver for small molecules and quantum magnets. Nature, 549(7671), 242–246. https://doi.org/10.1038/nature23879
-
Mitarai, K., Negoro, M., Kitagawa, M., & Fujii, K. (2018). Quantum circuit learning. Physical Review A, 98(3), 032309. https://doi.org/10.1103/PhysRevA.98.032309
-
Schuld, M., Bergholm, V., Gogolin, C., Izaac, J., & Killoran, N. (2019). Evaluating analytic gradients on quantum hardware. Physical Review A, 99(3), 032331. https://doi.org/10.1103/PhysRevA.99.032331
-
Nam, Y., Chen, J.-S., Pisenti, N. C., Wright, K., Delaney, C., Maslov, D., Brown, K. R., Allen, S., Amini, J. M., Apisdorf, J., et al. (2020). Ground-state energy estimation of the water molecule on a trapped-ion quantum computer. npj Quantum Information, 6(1), 33. https://doi.org/10.1038/s41534-020-0259-3
-
Tilly, J., Chen, H., Cao, S., Picozzi, D., Setia, K., Li, Y., Grant, E., Wossnig, L., Rungger, I., Booth, G. H., & Tennyson, J. (2022). The variational quantum eigensolver: A review of methods and best practices. Physics Reports, 986, 1–128. https://doi.org/10.1016/j.physrep.2022.08.003
Rashan is a Data Science Professional and Quantum AI Researcher, and the Founder & CEO of Intellit — an AI automation agency building intelligent systems across fintech, banking, and enterprise sectors.
The Quantum Intelligence Digest
Join researchers and engineers who read Quaniq.