A Note on "Quantum Algorithm for Linear Systems of Equations"
aa r X i v : . [ qu a n t - ph ] F e b A Note on “Quantum Algorithm for Linear Systems of Equations”
Yong-Zhen Xu , Yifan Huang , Zekun Ye and Lvzhou Li , , ∗ Institute of Computer Science Theory, School of Data and Computer Science,Sun Yat-sen University, Guangzhou 510006, China and The Key Laboratory of Machine Intelligence and Advanced Computing(Sun Yat-sen University) Ministry of Education, Guangzhou 510006, China (Dated: February 21, 2018)Recently, an efficient quantum algorithm for linear systems of equations introduced by Harrow,Hassidim, and Lloyd, has received great concern from the academic community. However, the errorand complexity analysis for this algorithm seems so complicated that it may not be applicable toother filter functions for other tasks. In this note, a concise proof is proposed. We hope that it mayinspire some novel HHL-based algorithms that can compute F ( A ) | b i for any computable F . Solving linear systems of equations has been a centralproblem in virtually all field of science and engineering.Recently, an efficient quantum algorithm for the problemwas proposed by Harrow, Hassidim, and Lloyd [1] (calledHHL algorithm for short), which shows an exponentialspeed-up over the best known classical algorithm undercertain conditions. This algorithm has been considered toa new template showing how quantum computers mightbe used to exponentially speed up certain problems, andmay bring a series of applications, especially in the fieldof machine learning and big data [2–4]. Actually, basedon this seminal work [1], some novel quantum algorithmswere proposed, including Least-squares fitting [5], Quan-tum support vector machine [6], Quantum PCA [7], solv-ing linear differential equations [8], and so on. It seemsthat how to find more nontrivial applications and furthergeneralizations of the work [1] has attracted much atten-tion from the academic community. In addition, someother quantum algorithms using different ideas have alsobeen presented for the linear systems problem [9–13].Note that a full version of the paper [1] is Ref. [14]. Forconsistency, we use the same symbols from Ref. [14]. It isreadily seen that the second inequality (A5) of Theorem1 in Ref. [14] is a core result for the error and complexityanalysis of the HHL algorithm. In the process of provingthis result, Lemma 3 in Ref. [14] plays a crucial role.However, both the proof for Lemma 3 and the proof for(A5) based on Lemma 3 seem too complicated, and theymay not be applicable to other filter functions for othertasks. By the way, the proof of Lemma 3 was incompletesince ˜ g > λ ≥ /κ . A com-plete proof is given in the appendix which comfirms thecorrectness of Lemma 3. In this note, we propose a con-cise proof for (A5) based on Lemma 2 given by us. Thisnew proof can alleviate the difficulties caused by the fil-ter functions f and g in error analysis [14]. We hope thatit may inspire some novel HHL-based algorithms which ∗ Electronic mail: [email protected] (L.Li) can compute F ( A ) | x i for any computable F .We start with two lemmas to be needed later. Lemma 1.
The functions f and g are O ( κ ) -Lipschitz,meaning that for any λ = λ , | f ( λ ) − f ( λ ) | ≤ c κ | λ − λ | , (1) and | g ( λ ) − g ( λ ) | ≤ c κ | λ − λ | , (2) for some c = O (1) .Proof. The two functions f and g are continuous and dif-ferentiable except at κ and κ , so we need only prove thatthe absolute value of the two derivatives are bounded.For all cases, the upper bounds of (cid:12)(cid:12) ddx f ( x ) (cid:12)(cid:12) and (cid:12)(cid:12) ddx g ( x ) (cid:12)(cid:12) are πκ . Thus, c ≥ π . This completes the proof. Lemma 2. | f ( λ ) − f ( λ ) | + | g ( λ ) − g ( λ ) | ≤ c κ ( λ − λ ) | f ( λ ) + f ( λ ) + g ( λ ) + g ( λ ) | , (3) for some c = O (1) .Proof. We need to consider nine cases since f and g arepiecewise functions. However, since this inequality (3)has symmetry about λ and λ , we only need to considerthe following six cases when λ > λ , case 1: λ ≥ /κ, λ ≥ /κ, case 2: λ ≥ /κ, / κ ≤ λ < /κ, case 3: λ ≥ /κ, λ < / κ, case 4: 1 / κ ≤ λ < /κ, / κ ≤ λ < /κ, case 5: 1 / κ ≤ λ < /κ, λ < / κ, case 6: λ < / κ, λ < / κ. Case 1: we have | f ( λ ) − f ( λ ) | + | g ( λ ) − g ( λ ) | = 14 k (cid:18) λ − λ (cid:19) = 14 k ( λ − λ ) λ λ ≤
14 ( λ − λ ) λ λ (4) ≤
18 ( λ − λ ) (cid:18) λ + 1 λ (cid:19) (5)= k λ − λ ) (cid:12)(cid:12) f ( λ ) + f ( λ ) + g ( λ ) + g ( λ ) (cid:12)(cid:12) , where Ineq. (4) follows from κ ≤ λ λ and Ineq. (5)follows from λ λ ≤ (cid:16) λ + λ (cid:17) . Cases 2-6:
In these cases, by Lemma 1, we have | f ( λ ) − f ( λ ) | + | g ( λ ) − g ( λ ) | ≤ c κ ( λ − λ ) . (6)In addition, the lower bound of c κ ( λ − λ ) (cid:12)(cid:12) f ( λ ) + f ( λ ) + g ( λ ) + g ( λ ) (cid:12)(cid:12) in these cases is c κ ( λ − λ ) . To prove the inequality(3), we only need c ≥ c .In summary, c ≥ c . This completes the proof.Now we give the proof for (A5) based on Lemma 2. Proof.
Recall that ˜ λ k := 2 πk/t , and δ jk = t ( λ j − ˜ λ k ).We also abbreviate f := f ( λ j ), ˜ f := f (˜ λ k ), g := g ( λ j )and ˜ g = g (˜ λ k ). We define p := E [ f + g ] and ˜ p := E [ ˜ f + ˜ g ].In order to obtain an upper bound for k| x i − | ˜ x ik , itsuffices to give a lower bound for h x | ˜ x i , since it holds that k| x i − | ˜ x ik = p − Re h x | ˜ x i ). First, we have h x | ˜ x i = E [ f ˜ f + g ˜ g ] √ p ˜ p ≥ E [ f ˜ f + g ˜ g ] p + ˜ p , (7)where the inequality follows from √ p ˜ p ≤ p +˜ p . Notethat the inequality used here is different from one in[14], which together with Lemma 2 actually simplifiesthe proof of (A5).Now we have( p + ˜ p ) − E h f ˜ f + g ˜ g i = E h | f − ˜ f | + | g − ˜ g | i (8) ≤ c κ t E h δ jk (cid:16) f + ˜ f + g + ˜ g (cid:17)i (9) ≤ c c κ t E h(cid:16) f + ˜ f + g + ˜ g (cid:17)i (10)= c c κ t ( p + ˜ p ) , (11) where Eq. (8) follows from direct calculation, Ineq. (9)follows from Lemma 2, and Ineq. (10) holds because thefact that each δ jk is upper bounded by c with c = O (1).Therefore, we have2 E h f ˜ f + g ˜ g i ≥ (cid:18) − c c κ t (cid:19) ( p + ˜ p ) . (12)Substituting (12) into (7), we get Re h x | ˜ x i ≥ − O ( κ /t ). Hence, k| ˜ x i − | x ik ≤ ǫ . This completes theproof. [1] A. W. Harrow, A. Hassidim, and S. Lloyd, Phys. Rev.Lett. , 150502 (2009).[2] A. M. Childs, Nat. Phys. , 861 (2009).[3] S. Aaronson, Nat. Phys. , 291 (2015).[4] J. Biamonte, P. Wittek, N. Pancotti, P. Rebentrost, N.Wiebe, and S. Lloyd, Nature , 195 (2017).[5] N. Wiebe, D. Braun, and S. Lloyd, Phys. Rev. Lett. ,050505 (2012).[6] P. Rebentrost, M. Mohseni, and S. Lloyd, Phys. Rev.Lett. , 130503 (2014).[7] S. Lloyd, M. Mohseni, and P. Rebentrost, Nat. Phys. ,631 (2014).[8] D. Berry, J. Phys. A: Math. Theor. , 47, 105301 (2014).[9] B. Clader, B. Jacobs, and C. Sprouse, Phys. Rev. Lett. , 250504 (2013).[10] A. Ambainis, in Proceedings of the 29th InternationalSymposium on Theoretical Aspects of Computer Science ,(Paris, France, 2012), LIPIcs, 14, pp.636-647.[11] A. M. Childs, R. Kothari, and R. Somma, SIAM J. Com-put. , 1920 (2017).[12] I. Kerenidis, A. Prakash, arXiv:1704.04992 (2017).[13] L. Wossnig, Z. Zhao, and A. Prakash, Phys. Rev. Lett. , 050502 (2018).[14] A. W. Harrow, A. Hassidim, and S. Lloyd, arXiv:0811.3171v3 (2009). APPENDIX
In this appendix, a detail proof for the Lemma 3 ofRef. [14] is given. The Jordan’s inequality to be usedreads that π ≤ sin xx < < | x | < π . Proof.
We prove the Lemma 3 by considering nine casesas follows.
Case 1: λ ≥ /κ and ˜ λ ≥ /κ . | f − ˜ f | + | g − ˜ g | = 14 κ λ ˜ λ (cid:18) δt (cid:19) ≤ κ λ κ (cid:18) δt (cid:19) (13)= κ t δ (cid:12)(cid:12) f + g (cid:12)(cid:12) , (14)where Ineq. (13) follows from λ ≤ κ . Case 2: λ ≥ /κ and 1 / κ ≤ ˜ λ < /κ . Let β = π (2 κ ˜ λ −
1) and θ = κπ ( k − ˜ λ ), that is β = π − θ . Thus,sin β = cos θ and cos β = sin θ . We have | f − ˜ f | + | g − ˜ g | = 14 (cid:18) κ λ − κλ sin β + 1 (cid:19) = 14 (cid:18) κλ sin β − (cid:19) + 1 κ λ cos β ! = 14 κ λ (cid:0) ( κλ − cos θ ) + sin θ (cid:1) = 14 κ λ (cid:0) ( κλ − − cos θ ) + sin θ (cid:1) ≤ κ λ (cid:0) κλ − + 2(1 − cos θ ) + sin θ (cid:1) ≤ κ λ (cid:18) κλ − + 8(sin θ + sin θ (cid:19) ≤ κ λ (cid:18) κλ − + θ θ (cid:19) = 14 κ λ (cid:18) κλ − + π − κ ˜ λ ) + π (1 − κ ˜ λ ) (cid:19) ≤ κ λ (cid:18) κλ − + π − κ ˜ λ ) + π (1 − κ ˜ λ ) (cid:19) ≤ κ λ (cid:18) π π (cid:19) (cid:16) ( κλ − + (1 − κ ˜ λ ) (cid:17) ≤ κ λ (cid:18) π π (cid:19) (cid:16) ( κλ − κ ˜ λ ) (cid:17) = (cid:18) π π (cid:19) κ t δ (cid:12)(cid:12) f + g (cid:12)(cid:12) , (15)where the second inequality follows from the half-angleformula for cosine functions , the third inequality followsfrom Jordan’s inequality and others follow from directcalculation. Case 3: λ ≥ /κ and ˜ λ < / κ . We have κ λ + 1 κ ( λ − ˜ λ ) ≤ κ λ κ ( λ − ˜ λ ) = 2( 11 − ˜ λλ ) ≤ , (16)where the first inequality follows from 1 ≤ κ λ and thesecond inequality follows from ˜ λλ < . Thus, we have (1 + κ λ ) ≤ κ ( λ − ˜ λ ) κ λ . That is, | f − ˜ f | + | g − ˜ g | < κ t δ (cid:12)(cid:12) f + g (cid:12)(cid:12) . (17) Case 4: / κ ≤ λ < /κ and ˜ λ ≥ /κ . Similar to case2, we have the same result. Case 5: / κ ≤ λ < /κ and 1 / κ ≤ ˜ λ < /κ . | f − ˜ f | + | g − ˜ g | = 12 (cid:16) − cos (cid:16) πκ ( λ − ˜ λ ) (cid:17)(cid:17) = sin πκ ( λ − ˜ λ )2 ! (18) < π κ (cid:16) λ − ˜ λ (cid:17) (19)= π κ t δ (cid:12)(cid:12) f + g (cid:12)(cid:12) , (20)where Eq. (18) is based on the half-angle formula forcosine functions and Ineq. (19) follows from Jordan’sinequality. Case 6: / κ ≤ λ < /κ and ˜ λ < / κ . | f − ˜ f | + | g − ˜ g | = 12 (cid:16) − cos (cid:16) π κλ − (cid:17)(cid:17) = sin (cid:16) π κλ − (cid:17) (21) ≤ (cid:16) π κλ − (cid:17) (22)= (cid:16) π κλ − / (cid:17) ≤ (cid:16) π κλ − κ ˜ λ ) (cid:17) (23)= π κ (cid:16) λ − ˜ λ (cid:17) = π κ t δ (cid:12)(cid:12) f + g (cid:12)(cid:12) , (24)where Eq. (21) holds on account of the half-angle formulafor cosine functions, Ineq. (22) follows from Jordan’sinequality and Eq. (23) follows from κ ˜ λ < / Case 7: λ < / κ and ˜ λ ≥ /κ . Similar to case 3, wehave the same result. Case 8: λ < / κ and 1 / κ ≤ ˜ λ < /κ . Similar tocase 6, we have the same result. Case 9: λ < / κ and ˜ λ < / κ . The Lemma 3 holdsfor c ≥ c ≥ π2
1) and θ = κπ ( k − ˜ λ ), that is β = π − θ . Thus,sin β = cos θ and cos β = sin θ . We have | f − ˜ f | + | g − ˜ g | = 14 (cid:18) κ λ − κλ sin β + 1 (cid:19) = 14 (cid:18) κλ sin β − (cid:19) + 1 κ λ cos β ! = 14 κ λ (cid:0) ( κλ − cos θ ) + sin θ (cid:1) = 14 κ λ (cid:0) ( κλ − − cos θ ) + sin θ (cid:1) ≤ κ λ (cid:0) κλ − + 2(1 − cos θ ) + sin θ (cid:1) ≤ κ λ (cid:18) κλ − + 8(sin θ + sin θ (cid:19) ≤ κ λ (cid:18) κλ − + θ θ (cid:19) = 14 κ λ (cid:18) κλ − + π − κ ˜ λ ) + π (1 − κ ˜ λ ) (cid:19) ≤ κ λ (cid:18) κλ − + π − κ ˜ λ ) + π (1 − κ ˜ λ ) (cid:19) ≤ κ λ (cid:18) π π (cid:19) (cid:16) ( κλ − + (1 − κ ˜ λ ) (cid:17) ≤ κ λ (cid:18) π π (cid:19) (cid:16) ( κλ − κ ˜ λ ) (cid:17) = (cid:18) π π (cid:19) κ t δ (cid:12)(cid:12) f + g (cid:12)(cid:12) , (15)where the second inequality follows from the half-angleformula for cosine functions , the third inequality followsfrom Jordan’s inequality and others follow from directcalculation. Case 3: λ ≥ /κ and ˜ λ < / κ . We have κ λ + 1 κ ( λ − ˜ λ ) ≤ κ λ κ ( λ − ˜ λ ) = 2( 11 − ˜ λλ ) ≤ , (16)where the first inequality follows from 1 ≤ κ λ and thesecond inequality follows from ˜ λλ < . Thus, we have (1 + κ λ ) ≤ κ ( λ − ˜ λ ) κ λ . That is, | f − ˜ f | + | g − ˜ g | < κ t δ (cid:12)(cid:12) f + g (cid:12)(cid:12) . (17) Case 4: / κ ≤ λ < /κ and ˜ λ ≥ /κ . Similar to case2, we have the same result. Case 5: / κ ≤ λ < /κ and 1 / κ ≤ ˜ λ < /κ . | f − ˜ f | + | g − ˜ g | = 12 (cid:16) − cos (cid:16) πκ ( λ − ˜ λ ) (cid:17)(cid:17) = sin πκ ( λ − ˜ λ )2 ! (18) < π κ (cid:16) λ − ˜ λ (cid:17) (19)= π κ t δ (cid:12)(cid:12) f + g (cid:12)(cid:12) , (20)where Eq. (18) is based on the half-angle formula forcosine functions and Ineq. (19) follows from Jordan’sinequality. Case 6: / κ ≤ λ < /κ and ˜ λ < / κ . | f − ˜ f | + | g − ˜ g | = 12 (cid:16) − cos (cid:16) π κλ − (cid:17)(cid:17) = sin (cid:16) π κλ − (cid:17) (21) ≤ (cid:16) π κλ − (cid:17) (22)= (cid:16) π κλ − / (cid:17) ≤ (cid:16) π κλ − κ ˜ λ ) (cid:17) (23)= π κ (cid:16) λ − ˜ λ (cid:17) = π κ t δ (cid:12)(cid:12) f + g (cid:12)(cid:12) , (24)where Eq. (21) holds on account of the half-angle formulafor cosine functions, Ineq. (22) follows from Jordan’sinequality and Eq. (23) follows from κ ˜ λ < / Case 7: λ < / κ and ˜ λ ≥ /κ . Similar to case 3, wehave the same result. Case 8: λ < / κ and 1 / κ ≤ ˜ λ < /κ . Similar tocase 6, we have the same result. Case 9: λ < / κ and ˜ λ < / κ . The Lemma 3 holdsfor c ≥ c ≥ π2 + π2