Introduction
Systems of linear equations arise naturally in many real-life applications in a wide range of areas, such as in the solution of Partial Differential Equations, the calibration of financial models, fluid simulation or numerical field calculation. The problem can be defined as, given a m a t r i x A ∈ C N × N matrix A\in\mathbb{C}^{N\times N} matrixA∈CN×N and a vector b ⃗ ∈ C N \vec{b}\in\mathbb{C}^{N} b∈CN, find x ⃗ ∈ C N \vec{x}\in\mathbb{C}^{N} x∈CN satisfying A x ⃗ = b ⃗ A\vec{x}=\vec{b} Ax=b
For example, take N=2,
A = ( 1 − 1 / 3 − 1 / 3 1 ) , x ⃗ = ( x 1 x 2 ) and b ⃗ = ( 1 0 ) A = \begin{pmatrix}1 & -1/3\\-1/3 & 1 \end{pmatrix},\quad \vec{x}=\begin{pmatrix} x_{1}\\ x_{2}\end{pmatrix}\quad \text{and} \quad \vec{b}=\begin{pmatrix}1 \\ 0\end{pmatrix} A=(1−1/3−1/31),x=(x1x2)andb=(10)
Then the problem can also be written as find x 1 , x 2 ∈ C s u c h t h a t { x 1 − x 2 3 = 1 − x 1 3 + x 2 = 0 x_{1}, x_{2}\in\mathbb{C} such that \begin{cases}x_{1} - \frac{x_{2}}{3} = 1 \\ -\frac{x_{1}}{3} + x_{2} = 0\end{cases} x1,x2∈Csuchthat{ x1−3x2=1−3x1+x2=0
A system of linear equations is called s-sparse if A has at most s non-zero entries per row or column. Solving an s-sparse system of size N with a classical computer requires O ( N s κ log ( 1 / ϵ ) ) \mathcal{ O }(Ns\kappa\log(1/\epsilon)) O(Nsκlog(1/ϵ)) running time using the conjugate gradient method. Here κ \kappa κ denotes the condition number of the system and ϵ \epsilon ϵ the accuracy of the approximation.
The HHL is a quantum algorithm to estimate a function of the solution with running time complexity of O ( log ( N ) s 2 κ 2 / ϵ ) \mathcal{ O }(\log(N)s^{2}\kappa^{2}/\epsilon) O(log(N)s2κ2/ϵ) when A is a Hermitian matrix under the assumptions of efficient oracles for loading the data, Hamiltonian simulation and computing a function of the solution. This is an exponential speed up in the size of the system, however one crucial remark to keep in mind is that the classical algorithm returns the full solution, while the HHL can only approximate functions of the solution vector.
The HHL algorithm
Some mathematical background
The first step towards solving a system of linear equations with a quantum computer is to encode the problem in the quantum language. By rescaling the system, we can assume b ⃗ \vec{b} b and x ⃗ \vec{x} x to be normalised and map them to the respective quantum states ∣ b ⟩ |b\rangle ∣b⟩ and ∣ x ⟩ |x\rangle ∣x⟩. Usually the mapping used is such that i t h i^{th} ith component of b ⃗ \vec{b} b (resp. x ⃗ ) \vec{x}) x