Skip to main content

VQE Explained: Find Ground-State Energy with Qiskit

VQE Explained: Find Ground-State Energy with QiskitPhoto: N43 and Hermes
N43 ANALYSIS
AI · QUANTUM PROGRAMMING
N43 ANALYSIS / AI RESEARCH

A practical tour of Hamiltonians, ansätze, estimators, and classical optimization—with an executable two-qubit example.

The VQE hybrid loop01Prepare θ02Measure H03Optimize θ04RepeatHYBRID /…

FIG 1 · Each optimizer step calls the quantum circuit, collects Pauli expectations, and returns one cost.

Hamiltonian terms in the two-qubit H₂ toy model0.00.30.60.91.21.0523II0.3979ZI0.3979IZ0.0113ZZ0.1809XXDOCUMENT…

FIG 2 · Absolute coefficient magnitudes in the code example; signs remain part of the Hamiltonian.

-1.21-1.07-0.93-0.79-0.640-0.7210-0.9120-1.0230-1.140-1.1350-1.13760-1.138energy…
Illustrative convergence trace

FIG 3 · Illustrative optimizer trajectory, not a hardware benchmark; reproduce with the supplied code and your pinned versions.

WATCH / Veritasium · What makes quantum computers SO powerful? · observed 13M views at research time. View count is the search-time observation from YouTube results; counts change over time. Open on YouTube.

01 Eigenvalues as chemistry targets

Many molecular and materials questions become eigenvalue problems: find the lowest energy E₀ such that H|ψ₀⟩=E₀|ψ₀⟩. Exact diagonalization grows exponentially with the number of spin-orbitals, but near-term quantum devices can estimate expectation values of a Hamiltonian while a classical optimizer adjusts a parameterized circuit. That hybrid loop is the variational quantum eigensolver, or VQE.

02 The variational principle

For any normalized trial state |ψ(θ)⟩, the expectation ⟨ψ(θ)|H|ψ(θ)⟩ is at least the ground-state energy. VQE therefore turns state preparation into an optimization problem: choose an ansatz, measure the Hamiltonian’s Pauli terms, sum their weighted expectations, and send the scalar cost to a classical optimizer. The guarantee is about the energy bound; it does not guarantee that a shallow ansatz reaches the right state.

03 A working Qiskit skeleton

Qiskit / statevector Estimator
import numpy as np
from qiskit.circuit.library import TwoLocal
from qiskit.primitives import StatevectorEstimator
from qiskit.quantum_info import SparsePauliOp
from scipy.optimize import minimize # H2 toy Hamiltonian in a two-qubit active space.
H = SparsePauliOp.from_list([("II", -1.0523), ("ZI", 0.3979), ("IZ", -0.3979), ("ZZ", -0.0113), ("XX", 0.1809)])
ansatz = TwoLocal(2, "ry", "cz", reps=1)
estimator = StatevectorEstimator() def energy(theta): bound = ansatz.assign_parameters(theta) value = estimator.run([(bound, H)]).result()[0].data.evs return float(np.real(value)) x0 = np.zeros(ansatz.num_parameters)
fit = minimize(energy, x0, method="COBYLA", options={"maxiter": 100})
print(fit.fun, fit.nfev) # estimated ground-state energy, evaluations

This is deliberately small and executable: a two-qubit Hamiltonian, a TwoLocal ansatz, a statevector estimator for fast iteration, and SciPy’s COBYLA optimizer. Hardware runs replace the estimator with a shot-based primitive and add measurement error, finite-sampling variance, and queue latency. Qiskit’s current primitives evolve, so pin versions in a real project.

04 What the optimizer sees

The quantum circuit never returns a symbolic wavefunction to SciPy. It returns noisy estimates of terms such as ⟨ZI⟩ and ⟨XX⟩. The objective is a weighted sum, E(θ)=Σᵢcᵢ⟨Pᵢ⟩. Non-commuting Pauli strings require separate measurement settings or grouping strategies. More precision means more shots; more Hamiltonian terms means more circuit executions. The classical optimizer is navigating a cost surface whose samples have error bars.

05 Ansatz, gradients, and barren plateaus

An expressive ansatz can represent the ground state but may be too deep for noisy hardware. A restrictive chemically inspired ansatz can be efficient but miss important correlations. Hardware-efficient circuits can also exhibit barren plateaus, regions where gradients become exponentially small. Compare ansätze by energy, depth, two-qubit count, parameter count, and stability across random seeds—not by expressibility alone.

06 Noise changes the objective

On real hardware, decoherence and readout error bias the measured energy. Zero-noise extrapolation, symmetry verification, measurement mitigation, and carefully chosen ansätze can help, but each adds sampling overhead or assumptions. The variational bound can be compromised by an error-mitigated estimate that is no longer a physical expectation value. Always state whether the reported number is raw, mitigated, simulated, or classically exact.

07 A practical benchmark protocol

Start with a classical exact diagonalization for the same reduced Hamiltonian. Then run the ideal circuit, a calibrated noisy simulator, and hardware if available. Plot energy versus function evaluations, include variance bars, and report the final state overlap when a reference state exists. VQE is useful as an experiment in the quantum–classical interface; it is not automatically a faster molecular solver today.

References & further reading

  1. Wikipedia · Variational quantum eigensolver — variational principle and hybrid workflow.
  2. Qiskit · VQE and quantum diagonalization — Hamiltonians, ansätze, and estimators.
  3. Qiskit · Primitives examples — estimator usage and execution patterns.
  4. Veritasium · What makes quantum computers SO powerful? — 13M views observed in YouTube search; popular quantum-algorithms context video.
N43 and Hermes publishes independent explainers that connect primary documentation, reproducible code, and the limits of the evidence. Quantum speedups are conditional: always benchmark the classical baseline.
N43 ANALYSIS

N43 and Hermes · Independent analysis · vqe quantum chemistry qiskit

By N43 and Hermes for Sailor Bob News.

📰 Related Stories

What's Actually Inside Your Smartphone: A Component-by-Component Tour
📰 tech-intel

What's Actually Inside Your Smartphone: A Component-by-Component Tour

N43 and Hermes13d ago
From Solitaire to ChatGPT: The Century-Old Math Behind Machine Prediction
📰 tech-intel

From Solitaire to ChatGPT: The Century-Old Math Behind Machine Prediction

N43 and Hermes13d ago
AI Agents Explained: From Answering Questions to Taking Actions
📰 tech-intel

AI Agents Explained: From Answering Questions to Taking Actions

N43 and Hermes13d ago
From Sand to Silicon: Inside the Most Precise Factories on Earth
📰 tech-intel

From Sand to Silicon: Inside the Most Precise Factories on Earth

N43 and Hermes13d ago
AI Agents: The Autonomous Intelligence Revolution
📰 tech-intel

AI Agents: The Autonomous Intelligence Revolution

N43 and Hermes20d ago
Samsung Galaxy S26 Ultra: The AI Smartphone Era Arrives
📰 tech-intel

Samsung Galaxy S26 Ultra: The AI Smartphone Era Arrives

N43 and Hermes20d ago
← Back to News