← Back to section · Quantum Computing
The HHL Algorithm: Exponential Speedup for Linear Systems — With All the Fine Print
Under specific conditions, the HHL algorithm prepares the solution state of a linear system in time logarithmic in the dimension, and it is often cited as the emblem of exponential quantum speedup. But it outputs a quantum state rather than a list of numbers, and its fine print — input, output, and condition number — defines where it actually applies.
Linear systems: the bedrock problem of scientific computing
Solving A x = b is one of the most fundamental problems in scientific computing: finite-element simulation, circuit analysis, statistical regression, and the numerical solution of differential equations mostly reduce to it in the end. Classical algorithms for a dense N-dimensional system need about O(N³) operations, and even exploiting sparsity, one must at least write down every unknown — Ω(N) is an unavoidable floor, because the answer itself consists of N numbers.
In 2008, Harrow, Hassidim, and Lloyd proposed the HHL algorithm, claiming that under certain conditions the “solving” can be done in time of order O(log N). That claim needs careful unpacking: what the algorithm prepares is not a table of numbers but the state |x⟩, which encodes the solution in its amplitudes. Understanding HHL means understanding everything this output format gives — and everything it takes away.
Three steps: estimate eigenvalues, rotate by their reciprocals, uncompute
HHL assumes the vector b can be prepared as a quantum state |b⟩, and that the unitary evolution e^{iAt} generated by the matrix A can be simulated efficiently — which requires A to be Hermitian and sufficiently sparse, or simulable by some other efficient means. In the first step, |b⟩ is expanded in A’s eigenbasis and quantum phase estimation is run on each eigencomponent, writing the corresponding eigenvalue λ into an auxiliary register. In the second step, a controlled rotation conditioned on the register’s λ multiplies each component by a factor proportional to 1/λ — this is the actual solving, since x = A⁻¹b is precisely “divide each eigencomponent by its eigenvalue.” In the third step, phase estimation is run in reverse to clear the auxiliary register, leaving a state whose amplitudes are proportional to the solution vector. Measuring a flag qubit then isolates the branch where the rotation succeeded, and amplitude amplification can boost that success probability if needed.
The whole chain is polynomial in log N, but it depends polynomially on several other parameters: the condition number κ (the ratio of the largest to the smallest eigenvalue), the sparsity s, and the phase-estimation precision ε. HHL’s overall complexity scales roughly with κ² and 1/ε, which fixes its operating window: κ must be small, or the speedup is eaten away.
An intuitive sense of the scale
Imagine a system from a fluid-dynamics simulation with dimension N on the order of a hundred million. Even the best classical iterative solvers must sweep over enormous numbers of matrix entries, running for hours. The HHL picture is different: about 27 qubits (2^27 ≈ 10⁸) carry the solution vector; phase estimation and controlled rotations on logarithmically sized registers do the “solving”; and a handful of measurements extract what engineering actually cares about — the average pressure on some cross-section, say, or the energy share of a particular mode. If all four premises hold (sparse, well-conditioned, preparable input, small readout), the gap between classical and quantum is one of orders of magnitude.
The same example shows how demanding the premises are. Real simulation matrices often have large condition numbers, and κ grows as the mesh is refined. Loading boundary conditions into the input state requires an efficient preparation circuit. And engineers often want a picture of the solution over the whole domain — exactly the “read out all the numbers” case. Much of the research after the original HHL paper consists of relaxing these premises one by one: preconditioning to reduce the effective condition number, block encodings and QSVT to improve the precision dependence, and provably efficient state-preparation methods for specific problems. In judging a concrete HHL application proposal, how honestly it handles the premises matters more than its complexity formula.
The output is a quantum state: the advantage holds in specific scenarios
The biggest misreading of HHL is that “it solves equations exponentially fast.” If you need all N numbers of the solution, you must rerun the algorithm and estimate amplitudes one by one, and the total cost returns to exponential — the speedup evaporates on the spot. HHL is genuinely useful for problems that need only some global property of the solution: the projection of x onto some direction, an expectation value such as x†Mx, or feeding |x⟩ directly into the next quantum algorithm. Only when a few observables need measuring does the log N advantage stand.
The input side has the same kind of gate. If loading classical data b into |b⟩ takes O(N) time, the advantage disappears just the same. HHL presupposes an efficient state-preparation mechanism — for instance, b produced by an earlier quantum process, or hardware such as quantum random access memory (QRAM), which remains hypothetical. This makes HHL more like a middle stage of a “quantum data processing pipeline” than a general-purpose accelerator for classical data.
Dequantization: drawing the boundary of the exponential speedup
Around 2018, Ewin Tang and others proved that if classical algorithms are granted sampling access to data in a form corresponding to QRAM, then for problems such as recommendation systems with low-rank matrices, classical algorithms can also achieve complexities within a polynomial factor of the quantum ones — the exponential speedups claimed for those specific problems do not hold. This line of “dequantization” results does not refute HHL itself, which targets sparse, full-rank, well-conditioned systems, but it draws the boundary precisely: the quantum advantage lives in the window where the matrix has no structure like low rank for classical algorithms to exploit, and where the input and output conditions are both met.
How to evaluate HHL correctly
HHL’s historical standing is secure: it opened the entire line of phase-estimation-based linear algebra, and the later quantum singular value transformation (QSVT) unified HHL and many other algorithms into a single framework with improved dependence on κ and ε. But when evaluating any “HHL-based application,” four things should be checked one by one: whether the matrix is sparse and efficiently simulable, how large the condition number is, how the input state is prepared, and how much information must finally be read out. If all four pass, the speedup is real; if any one fails, claims of exponential speedup deserve a question mark. This is also a general checklist for reading any quantum speedup claim.
Tags: HHL algorithmLinear systemsQuantum machine learningCondition number