Overview
Harrow, Hassidim and Lloyd (HHL, 2009) showed that a quantum computer can prepare a state proportional to the solution of a sparse, well-conditioned linear system in time polynomial in and the condition number , where classical algorithms need time at least linear in to write the solution down. The result started the field of quantum linear algebra: algorithms that apply matrix functions such as , or projections onto eigenspaces to quantum states.
The speed-up comes with conditions that decide whether it is real: the matrix must be accessible through an efficient oracle or block encoding, the right-hand side must be preparable as a quantum state, the condition number must be small, and the user must want a property of the solution state rather than the solution vector. Aaronson (2015) listed these caveats. When they hold for sparse matrices, the problem is BQP-complete, so no efficient classical algorithm is expected; when the input is a dense, low-rank matrix stored in a sampling data structure, classical dequantized algorithms match the quantum ones up to polynomial factors.
Intuition
In the eigenbasis of a Hermitian , inverting means dividing the component along each eigenvector by its eigenvalue. HHL does this without knowing the eigenbasis: phase estimation of writes each eigenvalue into a register next to its eigenvector component, a rotation conditioned on that register puts an amplitude proportional to on a flag qubit, and undoing phase estimation leaves the flagged branch proportional to . The price is paid twice in : eigenvalues as small as must be resolved, and the flagged branch has probability as small as order . Later algorithms remove one of the two factors by replacing phase estimation with polynomial approximations of (QSVT) or with adiabatic paths, and by amplifying more cleverly.
Prerequisites
Quantum phase estimation, Hamiltonian simulation, amplitude amplification and block encodings.
Mathematical Definitions
Let , let be invertible with and condition number at most , that is, all singular values of lie in , and let be nonzero. Write and
Given
- matrix access: an oracle for , either in the sparse model (for each row, the positions and values of its at most nonzero entries) or as a block encoding of with known normalisation, and
- vector access: a unitary with ,
the quantum linear systems problem with precision is to output a state with , with probability at least a constant (or to output a flag and such a state, with the flag indicating success). Complexity is counted in uses of the two oracles and in additional gates, as a function of , , and .
The output is a quantum state: reading out all amplitudes needs copies, so useful applications measure an observable or sample from . Hermitian can be assumed without loss of generality by passing to , as in Harrow, Hassidim and Lloyd. The formulation with explicit precision and oracle model follows Childs, Kothari and Somma, who state it for Hermitian with in the sparse model and measure the error as , which implies the trace-distance bound above.
Theorems
Let be a unit vector and let be the controlled rotation on clock and flag registers. Apply , then , then to and measure the flag. Outcome 1 occurs with probability
and the post-measurement state of the system is exactly , with the clock register returned to . With , , and amplitude amplification succeeds with rounds.
The error analysis of Harrow, Hassidim and Lloyd shows how this ideal behaviour degrades when phase estimation is approximate; this record isolates the exact mechanism.
- is Hermitian with eigen-decomposition and .
- Idealisation - a unitary (exact phase estimation) maps for every , with the clock register holding an exact binary label of .
- so that .
Proof · Proof of exact eigenvalue inversion by post-selection
Expand with . Registers are written in the order system, clock, flag.
After : .
After : ; the square root is real because .
After , which acts on system and clock only and maps back to (as is unitary and maps to it):
The flag-one branch is . Its squared norm is the probability of outcome 1, , and the normalised post-measurement system state is with the clock in . Since when every , . The number of amplitude-amplification rounds follows from the amplitude amplification theorem with : . This is the idealised core of the algorithm of Harrow, Hassidim and Lloyd.
For the matrix inversion task in the assumptions:
- if a quantum algorithm solves it in time for some , then ;
- no relativizing quantum algorithm (one that works with given by an oracle) runs in time ;
- if a classical algorithm solves it in time , then .
The reduction encodes an -qubit, -gate circuit into an -sparse matrix of dimension whose inverse applied to produces a history state containing the circuit output, with (or if must be positive definite). Together with the HHL algorithm this makes the task -complete. This is Theorem 4 of Harrow, Hassidim and Lloyd; later algorithms with cost meet the linear-in- barrier.
- Matrix inversion task: input an O(1)-sparse Hermitian matrix with , given by an oracle or a poly(log N)-time row computation; output a bit equal to 1 with probability for a fixed constant , where and measures the first qubit.
Let be the projector onto the span of the right singular vectors of with singular value or at least , and the analogous projector for the left singular vectors. There is and an efficiently computable such that
where is the Moore–Penrose pseudoinverse and "block of " is the real-part combination of the QSVT theorem (one extra ancilla, measured in ). The circuit uses and a total of times. The polynomial behind it is an odd polynomial of degree that approximates for and is bounded by 1 on . For an invertible with condition number and , taking gives a block encoding of with uses of .
This is Theorem 41 of Gilyén, Su, Low and Wiebe.
- , , as in the QSVT theorem, , and .
- The guarantee holds on the subspaces spanned by right singular vectors with singular value or at least (and the corresponding left ones); singular values in are not controlled.
Under the assumptions, for a matrix , a vector and a suitable function applied to singular values, there is a classical algorithm that outputs a description of a vector close to which supports sampling and entry queries, in time polynomial in the stable-rank-type ratios, the inverse precision and the parameters of , and independent of the dimension apart from the cost of the sampling operations (Chia, Gilyén, Li, Lin, Tang and Wang). The framework recovers and often improves earlier dequantizations: recommendation systems (Tang, STOC 2019), low-rank regression and matrix inversion (Gilyén, Lloyd and Tang, preprint), and principal component analysis and nearest-centroid clustering (Tang, PRL 2021), and adds low-rank Hamiltonian simulation and discriminant analysis.
The classical algorithms are polynomially slower than the quantum ones, so polynomial quantum speed-ups may remain. The results say nothing about sparse, full-rank, well-conditioned matrices, the regime of the BQP-complete linear-systems problem.
- Sample-and-query access: the classical algorithm can query entries of and and draw row indices with probability proportional to squared row norms, and entries within a row proportionally to their squared magnitudes, together with the norms involved - the classical counterpart of QRAM-based state preparation.
- The matrix is close to low rank (its Frobenius norm is not much larger than its operator norm), and the function applied to the singular values is smooth enough; running times are polynomial in these ratios and in the inverse precision.
- Outputs are samples from, and query access to, the result vector, matching what the quantum algorithm provides.
Worked Examples
A two-by-two system with exact eigenvalues
Let , with eigenvalues (eigenvector ) and (eigenvector ), so , and let . Directly, and , of squared norm .
In HHL, take : has eigenphases , that is and , which three clock qubits represent exactly, so phase estimation is exact and the ideal analysis applies. With , the flag branch has amplitudes : on and on . The success probability is , and the post-selected state is , the normalised solution. A measurement in the computational basis then returns 0 with probability : one number about , which is the kind of output the algorithm provides.
Algorithms and Implementations
Write in the eigenbasis of , , so that .
Procedure.
- Prepare in the system register.
- Run phase estimation of the unitary (by Hamiltonian simulation) into a clock register, approximately producing with .
- Controlled on , rotate an ancilla: with .
- Undo phase estimation to clear the clock register.
- Measure the ancilla; on outcome 1 the system holds (approximately) . Repeat, or use amplitude amplification, until success.
Cost. With the eigenvalue estimates are accurate enough for output error ; the success probability is and amplitude amplification needs rounds. Harrow, Hassidim and Lloyd state a total running time of , where suppresses more slowly growing factors.
Output. A state close to , from which expectation values are estimated by repetition; the paper frames the task this way and compares with classical algorithms that find and estimate in time for sparse systems. Non-Hermitian is handled by the Hermitian dilation, and ill-conditioned parts of the spectrum can be filtered out with a flag qubit (also discussed in the paper).
- is Hermitian, -sparse with efficiently computable entries, and its eigenvalues satisfy .
- A unitary preparing in time is available.
Improved solvers
| Year | Method | Cost for the QLSP | Source |
|---|---|---|---|
| 2009 | phase estimation + post-selection (HHL) | Harrow, Hassidim, Lloyd | |
| 2012 | variable-time amplitude amplification | -dependence (times ) | Ambainis |
| 2017 | Fourier or Chebyshev series via LCU | polynomial in , similar dependence on other parameters | Childs, Kothari, Somma |
| 2019 | randomized adiabatic evolution | Subaşı, Somma, Orsucci | |
| 2019 | QSVT pseudoinverse (block encoding) | per application of | Gilyén et al. |
| 2020 | adiabatic or Zeno path + eigenstate filtering | queries, -sparse | Lin and Tong |
| 2022 | time-optimal adiabatic schedule | An and Lin | |
| 2022 | discrete adiabatic theorem + filtering | , optimal | Costa et al. |
| 2024 (preprint) | kernel reflection, no adiabatic theorem | , explicit bound | Dalzell |
Costs are as stated in each source, in that source's access model (sparse oracle or block encoding with normalisation absorbed into ). The linear dependence on cannot be improved for relativizing algorithms, and scaling would imply (HHL, Theorem 4).
Applications
Proposals include estimating properties of solutions of discretised differential equations, least-squares fitting (dequantized in the low-rank case by Gilyén, Lloyd and Tang), and quantum machine learning tasks such as recommendation systems (Kerenidis and Prakash, 2017). Each must be checked against the caveats below; the recommendation-system speed-up, for example, was dequantized by Tang (2019).
Limitations and Common Pitfalls
- Input loading. Preparing for arbitrary classical data and providing oracle access to a dense require a quantum random-access memory or equivalent; if loading costs , the exponential speed-up disappears (Aaronson).
- Output model. The algorithm outputs , not . Reading out all entries costs at least order repetitions; only global properties such as come cheaply.
- Condition number. Cost grows at least linearly in , so an application whose condition number grows with the problem size (as it does for many discretised differential equations when the grid is refined) can lose most of the advantage.
- Dequantization covers low rank, not sparsity. Quantum-inspired classical algorithms (Chia et al.) remove exponential speed-ups for close-to-low-rank matrices in the sampling input model, but not for sparse, high-rank, well-conditioned matrices given by efficient oracles, where the problem is BQP-complete.
- Compare with the right classical baseline. Harrow, Hassidim and Lloyd compare with classical algorithms that solve sparse systems and estimate in time ; a fair comparison fixes the same output (a sample or an expectation value) and the same input model.
State of the Art
As of 2026-11, the optimal query complexity for the quantum linear systems problem is achieved by the discrete-adiabatic solver of Costa et al. (PRX Quantum 2022), and a simpler solver with the same scaling and explicit constants is given in a 2024 preprint by Dalzell. The dequantization line (Tang; Chia et al., STOC 2020) established that the low-rank QRAM setting does not yield exponential speed-ups.
Related Research
Quantum singular value transformation, quantum machine learning, quantum complexity theory, and the lesson Complexity and advantage.