Skip to content
Current section
The Quantum Computing Enthusiast’s Hub
Saved
All sections

All sections

Saved
Skip Learn navigation
Encyclopedia
Topic

Quantum linear systems and HHL

Quantum algorithms that encode a solution of Ax=b into a quantum state under specified matrix-access and conditioning assumptions.

Also called HHL, quantum linear-system algorithm

Edition released Coverage: Overview · Technical
On this page

Definition and significance

The HHL algorithm prepares a state proportional to A inverse times |b> and enables selected observables of that state to be estimated. It does not generally print all entries of a long classical solution vector in logarithmic time. The input-access model, condition number, state-preparation cost and desired output are part of the scientific claim.

For a Hermitian invertible matrix, the spectral decomposition supplies the mechanism. Non-Hermitian problems can be embedded or treated by other constructions, with additional assumptions and resources. Modern quantum linear-system algorithms can improve aspects of the original complexity, so the original HHL result and contemporary best bounds require distinct records.

Mechanism and mathematical treatment

Write A=sum_j lambda_j |u_j><u_j| and |b>=sum_j beta_j|u_j>. The desired normalized state is |x> proportional to sum_j beta_j/lambda_j |u_j>. Phase estimation approximately records lambda_j, a controlled ancilla rotation introduces a factor C/lambda_j, and uncomputation removes the eigenvalue register. Conditioning on the ancilla's success branch gives the inverse-weighted state.

The constant C must be small enough that |C/lambda_j|<=1 on the relevant spectrum. Small eigenvalues enlarge normalization and conditioning costs. Finite eigenvalue precision must be tight enough for reciprocal errors, which grow rapidly near zero.

Fully worked reference example

Let A=diag(1,2) and |b>=(|0>+|1>)/sqrt(2). The unnormalized inverse vector is (|0>+(1/2)|1>)/sqrt(2). Its norm squared is 5/8, and the normalized solution is |x>=(2|0>+|1>)/sqrt(5). Multiplying the unnormalized vector by A returns |b>.

With C=1, the successful ancilla branch has probability (1/2)(1^2+(1/2)^2)=5/8. On that branch, measuring Z gives expectation 4/5-1/5=3/5. This output is a property of the normalized solution; it does not by itself reveal its original classical scale. The norm or another calibration quantity is needed for a classical quadratic form involving an unnormalized x.

Limitations and common misconceptions

Dense unstructured classical data can be expensive to load. A poor condition number can erase an apparent advantage. Classical iterative, sparse and randomized methods must be compared under matched access and accuracy. Claims of exponential speedup should state the task and assumptions rather than applying the phrase to every linear system.

Scientific relationships

The original HHL construction resolves eigenvalues before reciprocal weighting.

Preparing the right-hand-side state and matrix access can dominate resources.

Historical source context

The HHL preprint began on 19 November 2008 and reached its final published-version revision on 30 September 2009. The original algorithm and later improved linear-system methods have different complexity statements.

A nondiagonal system with a fully normalized answer

Let A=[[3,1],[1,3]] and b=|0>. Its eigenvectors are |+> and |->, with eigenvalues four and two. The input decomposes as (|+>+|->)/sqrt(2). Applying the inverse spectrally gives |+>/(4sqrt(2))+|->/(2sqrt(2))=(3|0>-|1>)/8. Direct multiplication by A returns |0>, so the unnormalized solution is verified without relying on its quantum preparation.

The squared norm is 10/64=5/32. The normalized solution state is |x>=(3|0>-|1>)/sqrt(10). It has <Z>=4/5 and <X>=-3/5. These two expectations determine useful directional information, but the classical solution vector is (3/8,-1/8), not the normalized pair (3/sqrt(10),-1/sqrt(10)). Recovering its scale requires the solution norm or equivalent information.

Choose the reciprocal-rotation constant C=2. The factors C/lambda are one-half on |+> and one on |->, so they are valid amplitudes. The successful branch is 2A^(-1)|b>=(3|0>-|1>)/4, with probability 10/16=5/8. Conditional normalization yields the same |x>. This success probability depends on both the spectrum and the input overlap, not solely on the condition number two.

Why signs of eigenvalues must survive

For a Hermitian but indefinite matrix A=diag(-1,2), the inverse acting on |+> is (-|0>+|1>/2)/sqrt(2). The normalized solution is (-2|0>+|1>)/sqrt(5). Replacing the eigenvalues by their absolute values instead gives (2|0>+|1>)/sqrt(5), a different state with opposite X expectation. Both have the same computational probabilities, so a Z-basis check would miss the error.

A reciprocal routine must therefore encode a signed inverse or otherwise restore the eigenvalue sign coherently. Phase estimation of exp(i A t) reports phases modulo one, so the mapping from phase labels to positive and negative eigenvalues requires a declared spectral interval and time scale. The controlled rotation and subsequent uncomputation must use that same interpretation.

For a non-Hermitian matrix, one possible Hermitian embedding is [[0,A],[A dagger,0]]. Its spectrum is related to positive and negative singular values, and its dimension doubles. The right-hand-side embedding and the interpretation of the output registers must be chosen consistently. The embedding is a construction with costs, not permission to apply the Hermitian formula unchanged to an arbitrary nonsymmetric matrix.

Reciprocal sensitivity and an explicit perturbation

If an eigenvalue lambda is approximated by lambda+delta, the reciprocal error is 1/(lambda+delta)-1/lambda=-delta/[lambda(lambda+delta)]. Provided |delta|<|lambda|, its magnitude is at most |delta|/[|lambda|(|lambda|-|delta|)]. This exact expression shows why resolving small eigenvalues is expensive: a uniform absolute eigenvalue error becomes a large inverse error near zero.

For lambda=0.01 and delta=0.001, the true reciprocal is 100 and the approximate reciprocal is about 90.9091. A ten-percent eigenvalue perturbation causes about a 9.09-percent reciprocal error. If delta approached -0.01, the approximate reciprocal would diverge. A spectral lower bound is therefore part of the problem specification, not merely a technical detail in a proof.

For the nondiagonal two-by-two example, both eigenvalues are comfortably separated from zero. A classical Cholesky factorization solves the positive-definite system efficiently, while conjugate-gradient methods are relevant for larger sparse positive-definite systems. Comparing a quantum state-preparation routine only against dense inversion can overstate its usefulness when the classical matrix has exploitable structure.

Output, normalization and resources

Suppose the desired classical quantity is x dagger Z x for the unnormalized solution x=A^(-1)b. It equals ||x||^2 <Z>_(normalized). In the worked example this is (5/32)(4/5)=1/8, which also follows directly from (3/8)^2-(-1/8)^2. Reporting only the normalized expectation 4/5 would answer a different question. The success probability p=C^2||x||^2 allows the norm to be inferred if p and C are known accurately.

Estimating p introduces its own sampling or amplitude-estimation cost. Preparing b, implementing matrix access, resolving eigenvalues or implementing an alternative polynomial inverse, amplifying success, and measuring the desired observable all contribute. Printing both solution entries is trivial here; printing an arbitrary N-entry solution in a larger problem requires at least an output proportional to N. The input/output contract should be established before quoting an exponential dimension dependence.

Sources