Efficient quantum algorithm for dissipative nonlinear differential equations

Jin-Peng Liu1,2,3 Herman Øie Kolden4,5 Hari K. Krovi6 Nuno F. Loureiro5 Konstantina Trivisa3,7 Andrew M. Childs1,2,8

1 Joint Center for Quantum Information and Computer Science, University of Maryland, MD 20742, USA 2 Institute for Advanced Computer Studies, University of Maryland, MD 20742, USA 3 Department of , University of Maryland, MD 20742, USA 4 Department of Physics, Norwegian University of Science and Technology, NO-7491 Trondheim, Norway 5 Plasma Science and Fusion Center, Massachusetts Institute of Technology, MA 02139, USA 6 Raytheon BBN Technologies, MA 02138, USA 7 Institute for Physical Science and Technology, University of Maryland, MD 20742, USA 8 Department of Computer Science, University of Maryland, MD 20742, USA

Abstract While there has been extensive previous work on efficient quantum algorithms for linear dif- ferential equations, analogous progress for nonlinear differential equations has been severely lim- ited due to the linearity of quantum mechanics. Despite this obstacle, we develop a quantum al- gorithm for initial value problems described by dissipative quadratic n-dimensional ordinary dif- ferential equations. Assuming R < 1, where R is a parameter characterizing the ratio of the non- linearity to the linear dissipation, this algorithm has complexity T 2 poly(log T, log n, log 1/)/, where T is the evolution time and  is the allowed error in the output quantum state. This is an exponential improvement over the best previous quantum algorithms, whose complexity is exponential in T . We achieve this improvement using the method of Carleman linearization, for which we give a novel convergence theorem. This method maps a system of nonlinear differential equations to an infinite-dimensional system of linear differential equations, which we discretize, truncate, and solve using the forward Euler method and the quantum linear system algorithm. We also provide a lower bound on the worst-case complexity of quantum algorithms√ for general quadratic differential equations, showing that the problem is intractable for R ≥ 2. Finally, we discuss potential applications of this approach to problems arising in biology as well as in fluid and plasma dynamics. arXiv:2011.03185v2 [quant-ph] 2 Mar 2021 1 Introduction

Models governed by both ordinary differential equations (ODEs) and partial differential equations (PDEs) arise extensively in natural and social science, medicine, and engineering. Such equations characterize physical and biological systems that exhibit a wide variety of complex phenomena, including turbulence and chaos. We focus here on differential equations with nonlinearities that can be expressed with quadratic polynomials. Note that polynomials of degree higher than two, and even more general nonlinearities, can be reduced to the quadratic case by introducing additional variables [31, 36]. The quadratic case also directly includes many archetypal models, such as the logistic equation in biology, the Lorenz system in atmospheric dynamics, and the Navier–Stokes equations in fluid dynamics.

1 Quantum algorithms offer the prospect of rapidly characterizing the solutions of high-dimensional systems of linear ODEs [8, 10, 20] and PDEs [16, 21, 23, 24, 29, 41, 44]. Such algorithms can produce a quantum state proportional to the solution of a sparse (or block-encoded) n-dimensional system of linear differential equations in time poly(log n) using the quantum linear system algorithm [34]. Early work on quantum algorithms for differential equations already considered the nonlinear case [40]. It gave a quantum algorithm for ODEs that simulates polynomial nonlinearities by storing multiple copies of the solution. The complexity of this approach is polynomial in the logarithm of the dimension but exponential in the evolution time, scaling as O(1/T ) due to exponentially increasing resources used to maintain sufficiently many copies of the solution to represent the nonlinearity throughout the evolution. Recently, heuristic quantum algorithms for nonlinear ODEs have been studied. Reference [35] explores a linearization technique known as the Koopman–von Neumann method that might be amenable to the quantum linear system algorithm. In [28], the authors provide a high-level de- scription of how linearization can help solve nonlinear equations on a quantum computer. However, neither paper makes precise statements about concrete implementations or running times of quan- tum algorithms. The recent preprint [42] also describes a quantum algorithm to solve a nonlinear ODE by linearizing it using a different approach from the one taken here. However, a proof of cor- rectness of their algorithm involving a bound on the condition number and probability of success is not given. The authors also do not describe how barriers such as those of [22] could be avoided in their approach. While quantum mechanics is described by linear dynamics, possible nonlinear modifications of the theory have been widely studied. Generically, such modifications enable quickly solving hard computational problems (e.g., solving unstructured search among n items in time poly(log n)), making nonlinear dynamics exponentially difficult to simulate in general [1,2, 22]. Therefore, con- structing efficient quantum algorithms for general classes of nonlinear dynamics has been considered largely out of reach. In this article, we design and analyze a quantum algorithm that overcomes this limitation using Carleman linearization [17, 31, 38]. This approach embeds polynomial nonlinearities into an infinite-dimensional system of linear ODEs, and then truncates it to obtain a finite-dimensional linear approximation. The Carleman method has previously been used in the analysis of dynamical systems [3, 43, 50] and the design of control systems [14, 32, 47], but to the best of our knowledge it has not been employed in the context of quantum algorithms. We discretize the finite ODE system in time using the forward Euler method and solve the resulting linear equations with the quantum linear system algorithm [19, 34]. We control the approximation error of this approach by combining a novel convergence theorem with a bound for the global error of the Euler method. Furthermore, we provide an upper bound for the condition number of the linear system and lower bound the success probability of the final measurement. Subject to the condition R < 1, where the quantity R (defined in Problem 1 below) characterizes the relative strength of the nonlinear and dissipative linear terms, we show that the total complexity of this quantum Carleman linearization algorithm is sT 2q poly(log T, log n, log 1/)/, where s is the sparsity, T is the evolution time, q quantifies the decay of the final solution relative to the initial condition, n is the dimension, and  is the allowed error (see Theorem 1). In the regime R < 1, this is an exponential improvement over [40], which has complexity exponential in T . Note that the solution cannot decay exponentially in T for the algorithm to be efficient, as captured by the dependence of the complexity on the parameter q. This is a known limitation of quantum ODE algorithms, even for linear ODEs (see [10, Section 8] and Section 7). For homoge- neous equations, dissipation ensures that the solution decays exponentially in the long-time limit, so our algorithm cannot be efficient in such cases. Note however that we still find an improvement

2 over the best previous result O(1/T )[40] for sufficiently small . Thus our algorithm might provide an advantage over classical computation for studying evolution for short times. More significantly, our algorithm can also handle inhomogeneous quadratic ODEs, for which it can remain efficient in the long-time limit since the solution can remain asymptotically nonzero, or can decay slowly (i.e., q can be poly(T )). We also provide a quantum lower bound for the worst-case complexity of simulating strongly nonlinear dynamics, showing that the algorithm’s condition R < 1 cannot be significantly improved in general (Theorem 2). Following the approach of [2, 22], we construct a protocol√ for distinguish- ing two states of a qubit driven by a certain quadratic ODE. Provided R ≥ 2, this procedure distinguishes states with overlap 1 −  in time poly(log(1/)). Since state distinguishability can be used to solve the unstructured search problem, the quantum search lower bound [7] thereby implies a lower bound on the complexity of the quantum ODE problem. Our quantum algorithm could potentially be applied to study models governed by quadratic ODEs arising in biology and epidemiology as well as in fluid and plasma dynamics. In particular, the celebrated Navier–Stokes equation with linear damping, which describes many physical phenomena, can be treated by our approach provided the Reynolds number is sufficiently small. We also note that while the formal validity of our arguments assumes R < 1, we find in one numerical experiment that our proposed approach remains valid for larger R (see Section 6). The remainder of this paper is structured as follows. Section 2 introduces the quantum quadratic ODE problem. Section 3 presents the Carleman linearization procedure and describes its per- formance. Section 4 gives a detailed analysis of the quantum Carleman linearization algorithm. Section 5 establishes a quantum lower bound for simulating quadratic ODEs. Section 6 describes how our approach could be applied to several well-known ODEs and PDEs and presents numerical results for the case of the viscous Burgers equation. Finally, we conclude with a discussion of the results and some possible future directions in Section 7.

2 Quadratic ODEs

We focus on an initial value problem described by the n-dimensional quadratic ODE du = F u⊗2 + F u + F (t), u(0) = u . (2.1) dt 2 1 0 in

T n ⊗2 2 2 T n2 Here u = [u1, . . . , un] ∈ R , u = [u1, u1u2, . . . , u1un, u2u1, . . . , unun−1, un] ∈ R , each uj = n×n2 n×n uj(t) is a function of t on the interval [0,T ] for j ∈ [n] := {1, . . . , n}, F2 ∈ R , F1 ∈ R are n 1 time-independent matrices, and the inhomogeneity F0(t) ∈ R is a C continuous function of t. We let k · k denote the spectral norm. The main computational problem we consider is as follows.

Problem 1. In the quantum quadratic ODE problem, we consider an n-dimensional quadratic ODE as in (2.1). We assume F2, F1, and F0 are s-sparse (i.e., have at most s nonzero entries in each row and column), F1 is diagonalizable, and that the eigenvalues λj of F1 satisfy Re (λn) ≤ · · · ≤ Re (λ1) < 0. We parametrize the problem in terms of the quantity   1 kF0k R := kuinkkF2k + . (2.2) | Re (λ1)| kuink

For some given T > 0, we assume the values Re (λ1), kF2k, kF1k, kF0(t)k for each t ∈ [0,T ], and 0 0 kF0k := maxt∈[0,T ] kF0(t)k, kF0k := maxt∈[0,T ] kF0(t)k are known, and that we are given oracles

3 OF2 , OF1 , and OF0 that provide the locations and values of the nonzero entries of F2, F1, and F0(t) for any specified t, respectively, for any desired row or column. We are also given the value kuink n and an oracle Ox that maps |00 ... 0i ∈ C to a quantum state proportional to uin. Our goal is to produce a quantum state proportional to u(T ) for some given T > 0 within some prescribed error tolerance  > 0.

kuinkkF2k When F0(t) = 0 (i.e., the ODE is homogeneous), the quantity R = is qualitatively | Re (λ1)| similar to the Reynolds number, which characterizes the ratio of the (nonlinear) convective forces to the (linear) viscous forces within a fluid [15, 39]. More generally, R quantifies the combined strength of the nonlinearity and the inhomogeneity relative to dissipation. Note that without loss of generality, given a quadratic ODE satisfying (2.1) with R < 1, we can modify it by rescaling u → γu with a suitable constant γ to satisfy

kF2k + kF0k < |Re (λ1)| (2.3) and kuink < 1, (2.4) with R left unchanged by the rescaling. We use this rescaling in our algorithm and its analysis. With this rescaling, a small R implies both small kuinkkF2k and small |F0k/kuink relative to |Re (λ1)|.

3 Quantum Carleman linearization

As discussed in Section 1, it is challenging to directly simulate quadratic ODEs using quantum computers, and indeed the complexity of the best known quantum algorithm is exponential in the evolution time T [40]. However, for a dissipative nonlinear ODE without a source, any quadratic nonlinear effect will only be significant for a finite time because of the dissipation. To exploit this, we can create a linear system that approximates the initial nonlinear evolution within some controllable error. After the nonlinear effects are no longer important, the linear system properly captures the almost-linear evolution from then on. We develop such a quantum algorithm using the concept of Carleman linearization [17, 31, 38]. Carleman linearization is a method for converting a finite-dimensional system of nonlinear differential equations into an infinite-dimensional linear one. This is achieved by introducing powers of the variables into the system, allowing it to be written as an infinite sequence of coupled linear differential equations. We then truncate the system to N equations, where the truncation level N depends on the allowed approximation error, giving a finite linear ODE system. Let us describe the Carleman linearization procedure in more detail. Given a system of quadratic ODEs (2.1), we apply the Carleman procedure to obtain the system of linear ODEs dˆy = A(t)ˆy + b(t), yˆ(0) =y ˆ (3.1) dt in with the tri-diagonal block structure

   1 1     yˆ1 A1 A2 yˆ1 F0(t) 2 2 2  yˆ2  A1 A2 A3  yˆ2   0     3 3 3     d  yˆ3   A2 A3 A4  yˆ3   0    =    +  , (3.2)  .   ......  .   .  dt .   . . .  .   .     N−1 N−1 N−1    yˆN−1  AN−2 AN−1 AN yˆN−1  0  N N yˆN AN−1 AN yˆN 0

4 ⊗j nj ⊗2 ⊗N j nj ×nj+1 j nj ×nj j wherey ˆj = u ∈ R ,y ˆin = [uin; uin ; ... ; uin ], and Aj+1 ∈ R , Aj ∈ R , Aj−1 ∈ nj ×nj−1 R for j ∈ [N] satisfying j ⊗j−1 ⊗j−2 ⊗j−1 Aj+1 = F2 ⊗ I + I ⊗ F2 ⊗ I + ··· + I ⊗ F2, (3.3) j ⊗j−1 ⊗j−2 ⊗j−1 Aj = F1 ⊗ I + I ⊗ F1 ⊗ I + ··· + I ⊗ F1, (3.4) j ⊗j−1 ⊗j−2 ⊗j−1 Aj−1 = F0(t) ⊗ I + I ⊗ F0(t) ⊗ I + ··· + I ⊗ F0(t). (3.5) Note that A is a (3Ns)-sparse matrix. The dimension of (3.1) is nN+1 − n ∆ := n + n2 + ··· + nN = = O(nN ). (3.6) n − 1 To construct a system of linear equations, we next divide [0,T ] into m = T/h time steps and apply the forward Euler method on (3.1), letting yk+1 = [I + A(kh)h]yk + b(kh) (3.7)

k ∆ 0 where y ∈ R approximatesy ˆ(kh) for each k ∈ [m + 1]0 := {0, 1, . . . , m}, with y = yin :=y ˆ(0) = k yˆin, and letting all y be equal for k ∈ [m + p + 1]0 \ [m + 1]0, for some sufficiently large integer p. This gives an (m + p + 1)∆ × (m + p + 1)∆ linear system L|Y i = |Bi (3.8) that encodes (3.7) and uses it to produce a numerical solution at time T , where

m+p m m+p X X X L = |kihk| ⊗ I − |kihk − 1| ⊗ [I + A((k − 1)h)h] − |kihk − 1| ⊗ I (3.9) k=0 k=1 h=m+1 and m 1  X  |Bi = √ kyink|0i ⊗ |yini + kb((k − 1)h)k|ki ⊗ |b((k − 1)h)i (3.10) B m k=1 with a normalizing factor Bm. Observe that the system (3.8) has the lower triangular structure      0 I y yin        1    −[I +A(0)h] I  y   b(0)        .. ..  .   .   . .  .   .         m     −[I +A((m − 1)h)h] I  y  = b((m − 1)h). (3.11)        m+1    −II y   0        .. ..  .   .   . .  .   .       −II ym+p 0

k k In the above system, the first n components of y for k ∈ [m + p + 1]0 (i.e., y1 ) approximate the exact solution u(T ), up to normalization. We apply the high-precision quantum linear system k k algorithm (QLSA) [19] to (3.8) and postselect on k to produce y1 /ky1 k for some k ∈ [m + p + 1]0 \ [m]0. The resulting error is at most u(T ) yk : 1  = max − k . (3.12) k∈[m+p+1]0\[m]0 ku(T )k ky1 k

5 This error includes contributions from both Carleman linearization and the forward Euler method. (The QLSA also introduces error, which we bound separately. Note that we could instead apply the original QLSA [34] instead of its subsequent improvement [19], but this would slightly complicate the error analysis and might perform worse in practice.) Now we state our main algorithmic result.

Theorem 1 (Quantum Carleman linearization algorithm). Consider an instance of the quantum quadratic ODE problem as defined in Problem 1, with its Carleman linearization as defined in (3.1). Assume R < 1. Let ku k g := ku(T )k, q := in . (3.13) ku(T )k

There exists a quantum algorithm producing a state that approximates u(T )/ku(T )k with error at most  ≤ 1, succeeding with probability Ω(1), with a flag indicating success, using at most

sT 2q[(kF k + kF k + kF k)2 + kF 0k]  sT kF kkF kkF kkF 0k  2 1 0 0 2 1 0 0 (3.14) 2 · poly log / log(1/kuink) (1 − kuink) (kF2k + kF0k)g (1 − kuink)g queries to the oracles OF2 , OF1 , OF0 and Ox. The gate complexity is larger than the query complexity 0  by a factor of poly log(nsT kF2kkF1kkF0kkF0k/(1 − kuink)g)/ log(1/kuink) . Furthermore, if the eigenvalues of F1 are all real, the query complexity is

sT 2q[(kF k + kF k + kF k)2 + kF 0k]  sT kF kkF kkF kkF 0k  2 1 0 0 · poly log 2 1 0 0 / log(1/ku k) (3.15) g g in

0  and the gate complexity is larger by a factor of poly log(nsT kF2kkF1kkF0kkF0k/g)/ log(1/kuink) .

4 Algorithm analysis

In this section we establish several lemmas and use them to prove Theorem 1.

4.1 Solution error The solution error has three contributions: the error from applying Carleman linearization to (2.1), the error in the time discretization of (3.1) by the forward Euler method, and the error from the QLSA. Since the QLSA produces a solution with error at most  with complexity poly(log(1/)) [19], we focus on bounding the first two contributions.

4.1.1 Error from Carleman linearization First, we provide an upper bound for the error from Carleman linearization for arbitrary evolution time T . To the best of our knowledge, the first and only explicit bound on the error of Carleman linearization appears in [31]. However, they only consider homogeneous quadratic ODEs; and fur- thermore, to bound the error for arbitrary T , they assume the logarithmic norm of F1 is negative (see Theorems 4.2 and 4.3 of [31]), which is too strong for our case. Instead, we give a novel anal- ysis under milder conditions, providing the first convergence guarantee for general inhomogeneous quadratic ODEs. We begin with a lemma that describes the decay of the solution of (2.1).

6 Lemma 1. Consider an instance of the quadratic ODE (2.1), and assume R < 1 as defined in (2.2). Let p 2 − Re(λ1) ± Re(λ1) − 4kF2kkF0k r± := . (4.1) 2kF2k

Then r± are distinct real numbers with 0 < r− < r+, and the solution u(t) of (2.1) satisfies ku(t)k < kuink < r+ for any t > 0. Proof. Consider the derivative of ku(t)k. We have dkuk2 = u†F (u ⊗ u) + (u† ⊗ u†)F †u + u†(F + F †)u + u†F (t) + F (t)†u, dt 2 2 1 1 0 0 3 2 ≤ 2kF2kkuk + 2 Re(λ1)kuk + 2kF0kkuk. (4.2) If kuk= 6 0, then dkuk ≤ kF kkuk2 + Re(λ )kuk + kF k. (4.3) dt 2 1 0 Letting a = kF2k > 0, b = Re(λ1) < 0, and c = kF0k > 0 with a, b, c > 0, we consider a 1-dimensional quadratic ODE dx = ax2 + bx + c, x(0) = ku k. (4.4) dt in c Since R < 1 ⇔ b > akuink + , the discriminant satisfies kuink  2  2 2 c c c b − 4ac > akuink + − 4akuink · ≥ akuink − ≥ 0. (4.5) kuink kuink kuink

2 b Thus, r± defined in (4.1) are distinct real roots of ax + bx + c. Since r− + r+ = − a > 0 and c r−r+ = a > 0, we have 0 < r− < r+. We can rewrite the ODE as dx = ax2 + bx + c = a(x − r )(x − r ), x(0) = ku k. (4.6) dt − + in

Letting y = x − r−, we obtain an associated homogeneous quadratic ODE dy = −a(r − r )y + ay2 = ay[y − (r − r )], y(0) = ku k − r . (4.7) dt + − + − in − Since the homogeneous equation has the closed-form solution r − r y(t) = + − , (4.8) a(r −r )t 1 − e + − [1 − (r+ − r−)/(kuink − r−)] the solution of the inhomogeneous equation can be obtained as r − r x(t) = + − + r . (4.9) a(r −r )t − 1 − e + − [1 − (r+ − r−)/(kuink − r−)] Therefore we have r − r ku(t)k ≤ + − + r . (4.10) a(r −r )t − 1 − e + − [1 − (r+ − r−)/(kuink − r−)] c 2 Since R < 1 ⇔ akuink + < −b ⇔ akuink + bkuink + c < 0, kuink is located between the two kuink roots r− and r+, and thus 1 − (r+ − r−)/(kuink − r−) < 0. This implies ku(t)k in (4.10) decreases from u(0) = kuink, so we have ku(t)k < kuink < r+ for any t > 0.

7 dkuk dkuk We remark that limt→∞ dt = 0 since dt < 0 and ku(t)k ≥ 0, so u(t) approaches to a stationary point of the right-hand side of (2.1) (called an attractor in the theory of dynamical systems). duj 2 As a simple example, consider a time-independent uncoupled system with dt = f2uj +f1uj +f0, j ∈ [n], with uj(0) = √x0 > 0, f2 > 0, f1 < 0, f0 > 0, and R < 1. We see that each uj(t) decreases 2 −f1− f1 −4f2f0 from x0 to x1 := > 0, with 0 < x1 < uj(t) < x0. Hence, the norm of u(t) is bounded √ 2f2 √ as 0 < nx1 < ku(t)k < nx0 for any t > 0. In general, it is hard to lower bound ku(t)k, but the above example shows that a nonzero inhomogeneity can prevent the norm of the solution from decreasing to zero. We now give an upper bound on the error of Carleman linearization. Lemma 2. Consider an instance of the quadratic ODE (2.1), with its corresponding Carleman linearization as defined in (3.1). As in Problem 1, assume that the eigenvalues λj of F1 satisfy Re (λn) ≤ · · · ≤ Re (λ1) < 0. Assume that R defined in (2.2) satisfies R < 1. Then for any j ∈ [N], ⊗j the error ηj(t) := u (t) − yˆj(t) satisfies N+1 kηj(t)k ≤ kη(t)k ≤ tNkF2kkuink . (4.11) Proof. The exact solution u(t) of the original quadratic ODE (2.1) satisfies   A1 A1     u 1 2 u F0(t) ⊗2 A2 A2 A2  ⊗2  u   1 2 3  u   0   ⊗3   A3 A3 A3  ⊗3     u   2 3 4  u   0  d  .   ......  .   .   .   . . .  .   .   .  =   .  +  . , (4.12) dt ⊗(N−1)  AN−1 AN−1 AN−1  ⊗(N−1)   u   N−2 N−1 N u   0   ⊗N  .  ⊗N     u   N N .. u   0     AN−1 AN     .  . .  ...... and the approximated solutiony ˆj(t) satisfies (3.2). Comparing these equations, we have dη = A(t)η + ˆb(t), η(0) = 0 (4.13) dt with the tri-diagonal block structure    1 1     η1 A1 A2 η1 0 2 2 2  η2  A1 A2 A3  η2   0     3 3 3     d  η3   A2 A3 A4  η3   0    =    +  , (4.14)  .   ......  .   .  dt .   . . .  .   .     N−1 N−1 N−1    ηN−1  AN−2 AN−1 AN ηN−1  0  N N N ⊗(N+1) ηN AN−1 AN ηN AN+1u Consider the derivative of kη(t)k. We have dkηk2 = η†(A(t) + A†(t))η + η†ˆb(t) + ˆb(t)†η. (4.15) dt For η†(A(t) + A†(t))η, we bound each term as † j † j † ηj Aj+1ηj+1 + ηj+1(Aj+1) ηj ≤ jkF2kkηj+1kkηjk, † j j † 2 ηj [Aj + (Aj) ]ηj ≤ 2j Re(λ1)kηjk , (4.16) † j † j † ηj Aj−1ηj−1 + ηj−1(Aj−1) ηj ≤ 2jkF0kkηj−1kkηjk.

8 n×n Define a matrix G ∈ R with nonzero entries Gj−1,j = jkF0k, Gj,j = j Re(λ1), and Gj+1,j = jkF2k. Then η†(A(t) + A†(t))η ≤ η†(G + G†)η. (4.17)

Since kF2k + kF0k < |Re (λ1)|, G is strictly diagonally dominant and thus the eigenvalues νj of G satisfy Re (νn) ≤ · · · ≤ Re (ν1) < 0. Thus we have † † 2 η (G + G )η ≤ 2 Re(ν1)kηk . (4.18) For η†ˆb(t) + ˆb(t)†η, we have †ˆ ˆ † ˆ N ⊗(N+1) η b(t) + b(t) η ≤ 2kbkkηk ≤ 2kAN+1kku kkηk. (4.19) N ⊗(N+1) N+1 N+1 Since kAN+1k = NkF2k, and ku k = kuk ≤ kuink by Lemma 1,

† † N+1 η ˆb(t) + ˆb(t) η ≤ 2NkF2kkuink kηk. (4.20) Overall, we have dkηk2 ≤ 2 Re(ν )kηk2 + 2NkF kku kN+1kηk, (4.21) dt 1 2 in so dkηk ≤ Re(ν )kηk + NkF kku kN+1. (4.22) dt 1 2 in Solving the differential inequality as an equation with η(0) = 0 gives us a bound on kηk: Z t Z t Re(ν1)(t−s) N+1 N+1 Re(ν1)(t−s) kη(t)k ≤ e NkF2kkuink ds ≤ NkF2kkuink e ds. (4.23) 0 0 Finally, using Z t 1 − eRe(ν1)t eRe(ν1)(t−s)ds = ≤ t (4.24) 0 |Re(ν1)| (where we used the inequality 1 − eat ≤ −at with a < 0), we have

N+1 kηj(t)k ≤ kη(t)k ≤ tNkF2kkuink (4.25) as claimed.

Note that (4.24) can be bounded alternatively by

Z t 1 − eRe(ν1)t 1 eRe(ν1)(t−s)ds = ≤ , (4.26) 0 |Re(ν1)| |Re(ν1)| and thus kη (t)k ≤ kη(t)k ≤ 1 NkF kku kN+1. We select (4.24) because it avoids including j |Re(ν1)| 2 in an additional parameter Re(ν1). We also give an improved analysis that works for homogeneous quadratic ODEs (F0(t) = 0) under milder conditions. This analysis follows the proof in [31] closely.

Corollary 1. Under the same setting of Lemma 2, assume F0(t) = 0 in (2.1). Then for any ⊗j j ∈ [N], the error ηj(t) := u (t) − yˆj(t) satisfies j N+1−j kηj(t)k ≤ kuink R . (4.27) For j = 1, we have the tighter bound

N Re(λ1)tN kη1(t)k ≤ kuink R 1 − e . (4.28)

9 Proof. We again consider η satisfying (4.13). Since F0(t) = 0, (4.13) reduces to a time-independent ODE with an upper triangular block structure, dη j = Ajη + Aj η , j ∈ [N − 1] (4.29) dt j j j+1 j+1 and dη N = AN η + AN u⊗(N+1). (4.30) dt N N N+1 We proceed by backward substitution. Since ηN (0) = 0, we have t Z N A (t−s0) N ⊗(N+1) ηN (t) = e N AN+1u (s0) ds0. (4.31) 0

j Aj t j Re(λ1)t j For j ∈ [N], (3.4) gives ke k = e and (3.3) gives kAj+1k = jkF2k. By Lemma 1, ⊗(N+1) N+1 N+1 ku k = kuk ≤ kuink . We can therefore upper bound (4.31) by t Z N A (t−s0) N ⊗(N+1) kηN (t)k ≤ ke N k · kAN+1u (s0)k ds0 0 (4.32) Z t N+1 N Re(λ1)(t−s0) ≤ NkF2kkuink e ds0. 0 For j = N − 1, we have dη N−1 = AN−1η + AN−1η . (4.33) dt N−1 N−1 N N Again, since ηN−1(0) = 0, we have

Z t N−1 AN−1(t−s1) N−1 ηN−1(t) = e AN ηN (s1) ds1 (4.34) 0 which has the upper bound

Z t N−1 AN−1(t−s1) N−1 kηN−1(t)k ≤ ke k · kAN ηN (s1)k ds1 0 Z t (N−1) Re(λ1)(t−s1) ≤ (N − 1)kF2k e kηN (s1)k ds1 (4.35) 0 Z t Z s1 2 N+1 (N−1) Re(λ1)(t−s1) N Re(λ1)(s1−s) ≤ N(N − 1)kF2k kuink e e ds0 ds1, 0 0 where we used (4.32) in the last step. Iterating this procedure for j = N − 2,..., 1, we find

N! Z t Z sN−j N+1−j N+1 j Re(λ1)(t−sN−j ) (j+1) Re(λ1)(sN−j −sN−1−j ) kηj(t)k ≤ kF2k kuink e e ··· (j − 1)! 0 0 Z s2 Z s1 (N−1) Re(λ1)(s2−s1) N Re(λ1)(s1−s0) e e ds0 ds1 ··· dsN−j−1 dsN−j 0 0 s s s N! Z N+1−j Z 2Z 1 PN−j+1 N+1−j N+1 Re(λ1)(−Ns0+ sk) = kF2k kuink ··· e k=1 ds0 ds1 ··· dsN−j. (j − 1)! 0 0 0 (4.36) Finally, using

Z sk+1 1 − e(N−k) Re(λ1)sk+1 1 (N−k) Re(λ1)(sk+1−sk) e dsk = ≤ (4.37) 0 (N − k)|Re(λ1)| (N − k)|Re(λ1)|

10 for k = 0,...,N − j, we have

N+1 N+1−j N! N+1−j N+1 (j − 1)! kuink kF2k j N+1−j kηj(t)k ≤ kF2k kuink N+1−j = N+1−j = kuink R . (j − 1)! N!|Re(λ1)| |Re(λ1)| (4.38) For j = 1, the bound can be further improved. By Lemma 5.2 of [31], if a 6= 0,

s s s as N Z N Z 2 Z 1 PN (e N − 1) a(−Ns0+ k=1 sk) ··· e ds0 ds1 ··· dsN−1 = N . (4.39) 0 0 0 N!a

With sN = t and a = Re(λ1), we find

s s s Z N Z 2 Z 1 PN N N+1 Re(λ1)(−Ns0+ sk) kη1(t)k ≤ N!kF2k kuink ··· e k=1 ds0 ds1 ··· dsN−1 0 0 0 Re(λ1)t N N N+1 (e − 1) (4.40) ≤ N!kF2k kuink N N! Re(λ1) N atN = kuink R 1 − e , which is tighter than the j = 1 case in (4.38).

While Problem 1 makes some strong assumptions about the system of differential equations, they appear to be necessary for our analysis. Specifically, the conditions Re (λ1) < 0 and R < 1 are required to ensure arbitrary-time convergence. Since the Euler method for (3.1) is unstable if Re (λ1) > 0 [8, 26], we only consider the case Re (λ1) ≤ 0. If Re (λ1) = 0, (4.39) reduces to

s s s N Z N Z 2 Z 1 PN t a(−Ns0+ sk) ··· e k=1 ds0 ds1 ··· dsN−1 = , (4.41) 0 0 0 N! giving the error bound N kη1(t)k ≤ kuink(kuinkkF2kt) (4.42) instead of (4.40). Then the error bound can be made arbitrarily small for a finite time by increasing N, but after t > 1/kuinkkF2k, the error bound diverges. Furthermore, if R ≥ 1, Bernoulli’s inequality gives

Re(λ1)t Re(λ1)t N Re(λ1)t N N kuink(1 − Ne ) ≤ kuink(1 − Ne )R ≤ kuink(1 − e ) R , (4.43) where the right-hand side upper bounds kη1(t)k as in (4.40). Assuming kη1(t)k = ku(t) − yˆ1(t)k is smaller than kuink, we require N = Ω(e| Re(λ1)|t). (4.44) In other words, to apply (4.28) for the Carleman linearization procedure, the truncation order given by Lemma 2 must grow exponentially with t. √ In fact, we prove in Section 5 that for R ≥ 2, no quantum algorithm (even one based on a technique other than Carleman linearization) can solve√ Problem 1 efficiently. It remains open to understand the complexity of the problem for 1 ≤ R < 2. On the other hand, if R < 1, both (4.27) and (4.28) decrease exponentially with N, making the truncation efficient. We discuss the specific choice of N in (4.129) below.

11 4.1.2 Error from forward Euler method Next, we provide an upper bound for the error incurred by approximating (3.1) with the forward dz Euler method. This problem has been well studied for general ODEs. Given an ODE dt = f(z) on [0,T ] with an inhomogenity f that is an L-Lipschitz continuous function of z, the global error of the solution is upper bounded by eLT , although in most cases this bound overestimates the actual error [4]. To remove the exponential dependence on T in our case, we derive a tighter bound for time discretization of (3.1) in Lemma 3 below. This lemma is potentially useful for other ODEs as well and can be straightforwardly adapted to other problems. Lemma 3. Consider an instance of the quantum quadratic ODE problem as defined in Problem 1, with R < 1 as defined in (2.2). Choose a time step   1 2(| Re(λ1)| − kF2k − kF0k) h ≤ min , 2 2 2 (4.45) NkF1k N(| Re(λ1)| − (kF2k + kF0k) + kF1k ) in general, or 1 h ≤ (4.46) NkF1k if the eigenvalues of F1 are all real. Suppose the error from Carleman linearization η(t) as defined in Lemma 2 is bounded by g kη(t)k ≤ , (4.47) 4 where g is defined in (3.13). Then the global error from the forward Euler method (3.7) on the interval [0,T ] for (3.1) satisfies

m m 2.5 2 0 kyˆ1(T ) − y1 k ≤ kyˆ(T ) − y k ≤ 3N T h[(kF2k + kF1k + kF0k) + kF0k]. (4.48) Proof. We define a linear system that locally approximates the initial value problem (3.1) on [kh, (k + 1)h] for k ∈ [m]0 as zk = [I + A((k − 1)h)h]ˆy((k − 1)h) + b((k − 1)h), (4.49) wherey ˆ(t) is the exact solution of (3.1). For k ∈ [m], we denote the local truncation error by

ek := kyˆ(kh) − zkk (4.50) and the global error by gk := kyˆ(kh) − ykk, (4.51) where yk in (3.7) is the numerical solution. Note that gm = kyˆ(T ) − ymk. For the local truncation error, we Taylor expandy ˆ((k − 1)h) with a second-order Lagrange remainder, giving yˆ00(ξ)h2 yˆ(kh) =y ˆ((k − 1)h) +y ˆ0((k − 1)h)h + (4.52) 2 for some ξ ∈ [(k − 1)h, kh]. Sincey ˆ0((k − 1)h) = A((k − 1)h)ˆy((k − 1)h) + b((k − 1)h) by (3.1), we have yˆ00(ξ)h2 yˆ00(ξ)h2 yˆ(kh) = [I + A((k − 1)h)h]ˆy((k − 1)h) + b((k − 1)h) + = zk + , (4.53) 2 2 and thus h2 Mh2 ek = kyˆ(kh) − zkk = kyˆ00(ξ)hk ≤ , (4.54) 2 2

12 00 where M := maxt∈[0,T ] kyˆ (τ)k. By the triangle inequality, gk = kyˆ(kh) − ykk ≤ kyˆ(kh) − zkk + kzk − ykk ≤ ek + kzk − ykk. (4.55) Since yk and zk are obtained by the same linear system with different right-hand sides, we have the upper bound kzk − ykk = k[I + A((k − 1)h)h][ˆy((k − 1)h) − yk−1]k ≤ kI + A((k − 1)h)hk · kyˆ((k − 1)h) − yk−1k (4.56) = kI + A((k − 1)h)hkgk−1. In order to provide an upper bound for kI + A(t)hk for all t ∈ [0,T ], we write

I + A(t)h = H2 + H1 + H0(t) (4.57) where N−1 X j H2 = |jihj + 1| ⊗ Aj+1h, (4.58) j=1 N X j H1 = I + |jihj| ⊗ Ajh, (4.59) j=1 N X j H0(t) = |jihj − 1| ⊗ Aj−1h. (4.60) j=2

We provide upper bounds separately for kH2k, kH1k, and kH0k := maxt∈[0,T ] kH0(t)k, and use the bound maxt∈[0,T ] kI + A(t)hk ≤ kH2k + kH1k + kH0k. j The eigenvalues of Aj consist of all j-term sums of the eigenvalues of F1. More precisely, they P j j are { `∈[j] λIj }Ij ∈[n]j where {λ`}`∈[n] are the eigenvalues of F1 and I ∈ [n] is a j-tuple of indices. ` P The eigenvalues of H1 are thus {1+h `∈[j] λ j }Ij ∈[n]j ,j∈[N]. With J := max`∈[n] | Im(λ`)|, we have I` X 2 X 2 X 2 1 + h λ j = 1 + h Re(λ j ) + h Im(λ j ) I` I` I` `∈[j] `∈[j] `∈[j] (4.61) 2 2 2 2 ≤ 1 − 2Nh| Re(λ1)| + N h (| Re(λ1)| + J ) where we used Nh| Re(λ1)| ≤ 1 by (4.45). Therefore

X p 2 2 2 2 kH1k = max max 1 + h λIj ≤ 1 − 2Nh| Re(λ1)| + N h (| Re(λ1)| + J ). (4.62) j∈[N] Ij ∈[n]j ` `∈[j] We also have N−1 X j j kH2k = |jihj + 1| ⊗ Aj+1h ≤ max kAj+1kh ≤ NkF2kh (4.63) j∈[N] j=1 and N−1 X j j kH0k = max |jihj01| ⊗ Aj−1h ≤ max max kAj−1kh ≤ N max kF0(t)kh ≤ NkF0kh. t∈[0,T ] t∈[0,T ] j∈[N] t∈[0,T ] j=1 (4.64)

13 Using the bounds (4.62) and (4.63), we aim to select the value of h to ensure

max kI + A(t)hk ≤ kH2k + kH1k + kH0k ≤ 1. (4.65) t∈[0,T ]

The assumption (4.45) implies

2(| Re(λ1)| − kF2k − kF0k) h ≤ 2 2 2 (4.66) N(| Re(λ1)| − (kF2k + kF0k) + J ) (note that the denominator is non-zero due to (2.3)). Then we have

2 2 2 2 2 N h (| Re(λ1)| − kF2k + J ) ≤ 2Nh(| Re(λ1)| − kF2k − kF0k) 2 2 2 2 2 2 2 =⇒ 1 − 2Nh| Re(λ1)| + N h (| Re(λ1)| + J ) ≤ 1 − 2N(kF2k + kF0k)h + N (kF2k + kF0k) h p 2 2 2 2 =⇒ 1 − 2Nh| Re(λ1)| + N h (| Re(λ1)| + J ) ≤ 1 − N(kF2k + kF0k)h, (4.67) so maxt∈[0,T ] kI + A(t)hk ≤ 1 as claimed. The choice (4.45) can be improved if an upper bound on J is known. In particular, if J = 0, (4.66) simplifies to 2 h ≤ , (4.68) N(|λ1| + kF2k + kF0k) which is satisfied by (4.46) using kF2k + kF0k < |λ1| ≤ kF1k. Using this in (4.56), we have

kzk − ykk ≤ kI + A((k − 1)h)hkgk−1 ≤ gk−1. (4.69)

Plugging (4.69) into (4.55) iteratively, we find

k k k−1 k k−2 k−1 k X j g ≤ g + e ≤ g + e + e ≤ · · · ≤ e , k ∈ [m + 1]0. (4.70) j=1

Using (4.54), this shows that the global error from the forward Euler method is bounded by

k X Mkh2 kyˆ1(kh) − ykk ≤ kyˆ(kh) − ykk = gk ≤ ej ≤ , (4.71) 1 2 j=1 and when k = m, mh = T ,

Mh2 MT h kyˆ1(T ) − ymk ≤ gm ≤ m = . (4.72) 1 2 2 Finally, we remove the dependence on M. Since

yˆ00(t) = [A(t)ˆy(t) + b(t)]0 = A(t)ˆy0(t) + A0(t)ˆy(t) + b0(t) (4.73) = A(t)[A(t)ˆy(t) + b(t)] + A0(t)ˆy(t) + b0(t), we have kyˆ00(t)k = kA(t)k2kyˆ(t)k + kA(t)kkb(t)k + kA0(t)kkyˆ(t)k + kb0(t)k. (4.74)

14 Maximizing each term for t ∈ [0,T ], we have

N−1 N N X j X j X j max kA(t)k = |jihj+1|⊗Aj+1+ |jihj|⊗Aj+ |jihj−1|⊗Aj−1 ≤ N(kF2k+kF1k+kF0k), t∈[0,T ] j=1 j=1 j=2 (4.75) N 0 X j 0 0 0 max kA (t)k = |jihj − 1| ⊗ (Aj−1) ≤ NkF0(t)k ≤ NkF0k, (4.76) t∈[0,T ] j=2

max kb(t)k = max kF0(t)k ≤ kF0k, (4.77) t∈[0,T ] t∈[0,T ] 0 0 0 max kb (t)k = max kF0(t)k ≤ kF0k, (4.78) t∈[0,T ] t∈[0,T ] and using kuk ≤ kuink < 1, kηj(t)k ≤ kη(t)k ≤ g/4 < kuink/4 by (4.47), and R < 1, we have

N N N 2 X 2 X ⊗j 2 X ⊗j 2 2 kyˆ(t)k ≤ kyˆj(t)k = ku (t) − ηj(t)k ≤ 2 (ku (t)k + kηj(t)k ) j=1 j=1 j=1 (4.79) N  2  N X kuink X 1 ≤ 2 ku k2j + < 2 (1 + )ku k2 < 4Nku k2 < 4N in 16 16 in in j=1 j=1 for all t ∈ [0,T ]. Therefore

M ≤ max kA(t)k2kyˆ(t)k + kA(t)kkb(t)k + kA0(t)kkyˆ(t)k + kb0(t)k t∈[0,T ] 2.5 2 1.5 0 0 (4.80) ≤ 2N (kF2k + kF1k + kF0k) + N(kF2k + kF1k + kF0k)kF0k + 2N kF0k + kF0k 2.5 2 0 ≤ 6N [(kF2k + kF1k + kF0k) + kF0k].

Thus, (4.72) gives

1 m 2.5 2 2 0 kyˆ (kh) − y1 k ≤ 3N kh [(kF2k + kF1k + kF0k) + kF0k], (4.81) and when k = m, mh = T ,

1 m 2.5 2 0 kyˆ (T ) − y1 k ≤ 3N T h[(kF2k + kF1k + kF0k) + kF0k] (4.82) as claimed.

4.2 Condition number Now we upper bound the condition number of the linear system.

Lemma 4. Consider an instance of the quantum quadratic ODE problem as defined in Problem 1. Apply the forward Euler method (3.7) with time step (4.45) to the Carleman linearization (3.1). Then the condition number of the matrix L defined in (3.8) satisfies

κ ≤ 3(m + p + 1). (4.83)

15 Proof. We begin by upper bounding kLk. We write

L = L1 + L2 + L3, (4.84) where m+p X L1 = |kihk| ⊗ I, (4.85) k=0 m X L2 = − |kihk − 1| ⊗ [I + A((k − 1)h)h], (4.86) k=1 m+p X L3 = − |kihk − 1| ⊗ I. (4.87) k=m+1

Clearly kL1k = kL3k = 1. Furthermore, kL2k ≤ maxt∈[0,T ] kI + A(t)hk ≤ 1 by (4.65), which follows from the choice of time step (4.45). Therefore,

kLk ≤ kL1k + kL2k + kL3k ≤ 3. (4.88) Next we upper bound kL−1k = sup kL−1|Bik. (4.89) k|Bik≤1 We express |Bi as m+p m+p X X k |Bi = βk|ki = |b i, (4.90) k=0 k=0 k where |b i := βk|ki satisfies m+p X k|bkik2 = k|Bik2 ≤ 1. (4.91) k=0 k Given any |b i for k ∈ [m + p + 1]0, we define m+p m+p k −1 k X k X k |Y i := L |b i = γl |li = |Yl i, (4.92) l=0 l=0 k k k −1 k where |Yl i := γl |li. We first upper bound k|Y ik = kL |b ik, and then use this to upper bound kL−1|Bik. k We consider two cases. First, for fixed k ∈ [m + 1]0, we directly calculate |Yl i for each l ∈ [m + p + 1]0 by the forward Euler method (3.7), giving  0, if l ∈ [k]0;  |bki, if l = k; |Y ki = (4.93) l Πl−1 [I + A(jh)h]|bki, if l ∈ [m + 1] \ [k + 1] ;  j=k 0 0  m−1 k Πj=k [I + A(jh)h]|b i, if l ∈ [m + p + 1]0 \ [m + 1]0.

Since maxt∈[0,T ] kI + A(t)hk| ≤ 1 by (4.65), we have

m+p m m+p k 2 X k 2 X k 2 X k 2 k|Y ik = k|Yl ik ≤ k|b ik + k|b ik l=0 l=k l=m+1 (4.94) ≤ (m + p + 1 − k)k|bkik2 ≤ (m + p + 1)k|bkik2.

16 k Second, for fixed k ∈ [m + p + 1]0 \[m + 1]0, similarly to (4.93), we directly calculate |Yl i using (3.7), giving ( 0, if l ∈ [k] ; |Y ki = 0 (4.95) l k |b i, if l ∈ [m + p + 1]0 \ [k]0. Similarly to (4.94), we have

m+p m+p k 2 X k 2 X k 2 k 2 k 2 k|Y ik = k|Yl ik = k|b ik = (m + p + 1 − k)k|b ik ≤ (m + p + 1)k|b ik . (4.96) l=0 l=k

Combining (4.94) and (4.96), for any k ∈ [m + p + 1]0, we have

k|Y kik2 = kL−1|bkik2 ≤ (m + p + 1)k|bkik2. (4.97)

By the definition of |Y ki in (4.92), (4.97) gives

kL−1k2 = sup kL−1|Bik2 ≤ (m + p + 1) sup kL−1|bkik2 ≤ (m + p + 1)2, (4.98) k|Bik≤1 k|bkik≤1 and therefore kL−1k ≤ (m + p + 1). (4.99) Finally, combining (4.88) with (4.99), we conclude

κ = kLkkL−1k ≤ 3(m + p + 1) (4.100) as claimed.

4.3 State preparation We now describe a procedure for preparing the right-hand side |Bi of the linear system (3.8), whose entries are composed of |yini and |b((k − 1)h)i for k ∈ [m]. The initial vector yin is a direct sum over spaces of different dimensions, which is cumbersome to prepare. Instead, we prepare an equivalent state that has a convenient tensor product structure. Specifically, we embed yin into a slightly larger space and prepare the normalized version of

N−1 ⊗2 N−2 ⊗N zin = [uin ⊗ v0 ; uin ⊗ v0 ; ... ; uin ], (4.101) where v0 is some standard vector (for simplicity, we take v0 = |0i). If uin lives in a vector space of N dimension n, then zin lives in a space of dimension Nn while yin lives in a slightly smaller space of dimension ∆ = n + n2 + ··· + nN = (nN+1 − n)/(n − 1). Using standard techniques, all the operations we would otherwise apply to yin can be applied instead to zin, with the same effect.

n Lemma 5. Assume we are given the value kuink, and let Ox be an oracle that maps |00 ... 0i ∈ C to a normalized quantum state |uini proportional to uin. Assume we are also given the values kF0(t)k for each t ∈ [0,T ], and let OF0 be an oracle that provides the locations and values of the nonzero entries of F0(t) for any specified t. Then the quantum state |Bi defined in (3.10) (with yin replaced by zin) can be prepared using O(N) queries to Ox and O(m) queries to OF0 , with gate complexity larger by a poly(log N, log n) factor.

17 Proof. We first show how to prepare the state N 1 X j ⊗j ⊗N−j |zini = √ kuink |ji|uini |0i , (4.102) V j=1 where N X 2j V := kuink . (4.103) j=1

This state can be prepared using N queries to the initial state oracle Ox applied in superposition to the intermediate state N 1 X j ⊗N |ψinti := √ kuink |ji ⊗ |0i . (4.104) V j=1

To efficiently prepare |ψinti, notice that 1 k−1 ku k ` in X Y j`2 ⊗N |ψinti = √ kuink |j0j1 . . . jk−1i ⊗ |0i , (4.105) V j0,j1,...,jk−1=0 `=0 where k := log2 N (assuming for simplicity that N is a power of 2) and jk−1 . . . j1j0 is the k-bit binary expansion of j − 1. Observe that k−1  1  1 ` O X j`2 ⊗N |ψinti = √ kuink |j`i ⊗ |0i (4.106) V` `=0 j`=0 where 2`+1 V` := 1 + kuink . (4.107) Qk−1 2 (Notice that `=0 V` = V/kuink .) Each tensor factor in (4.106) is a qubit that can be produced in constant time. Overall, we prepare these k = log2 N qubit states and then apply Ox N times. We now discuss how to prepare the state m 1  X  |Bi = √ kzink|0i ⊗ |zini + kb((k − 1)h)k|ki ⊗ |b((k − 1)h)i , (4.108) B m k=1 in which we replace yin by zin in (3.10), and define m 2 X 2 Bm := kzink + kb((k − 1)h)k . (4.109) k=1

This state can be prepared using the above procedure for |0i 7→ |zini and m queries to OF0 with t = (k − 1)h that implement |0i 7→ |b((k − 1)h)i for k ∈ {1, . . . , m}, applied in superposition to the intermediate state m 1  X  |φinti = √ kzink|0i ⊗ |0i + kb((k − 1)h)k|ki ⊗ |0i . (4.110) B m k=1

Here the queries are applied conditionally upon the value in the first register: we prepare |zini if the first register is |0i and |b((k −1)h)i if the first register is |ki for k ∈ {1, . . . , m}. We can prepare |φinti (i.e., perform a unitary transform mapping |0i|0i 7→ |φinti) in time complexity O(m)[49] using the known values of kuink and kb((k − 1)h)k.

Overall, we use O(N) queries to Ox and O(m) queries to OF0 to prepare |Bi. The gate com- plexity is larger by a poly(log N, log n) factor.

18 4.4 Measurement success probability After applying the QLSA to (3.8), we perform a measurement to extract a final state of the desired form. We now consider the probability of this measurement succeeding.

Lemma 6. Consider an instance of the quantum quadratic ODE problem defined in Problem 1, with the QLSA applied to the linear system (3.8) using the forward Euler method (3.7) with time g step (4.45). Suppose the error from Carleman linearization satisfies kη(t)k ≤ 4 as in (4.47), and the global error from the forward Euler method as defined in Lemma 3 is bounded by g kyˆ(T ) − ymk ≤ , (4.111) 4

k where g is defined in (3.13). Then the probability of measuring a state |y1 i for k = [m + p + 1]0 \ [m + 1]0 satisfies p + 1 P ≥ , (4.112) measure 9(m + p + 1)Nq2 where q is also defined in (3.13).

Proof. The idealized quantum state produced by the QLSA applied to (3.8) has the form

m+p m+p N X k X X k |Y i = |y i|ki = |yj i|ji|ki (4.113) k=0 k=0 j=1

k k where the states |y i and |yj i for k ∈ [m + p + 1]0 and j ∈ [N] are subnormalized to ensure k|Y ik = 1. We decompose the state |Y i as

|Y i = |Ybadi + |Ygoodi, (4.114) where m−1 N m+p N X X k X X k |Ybadi := |yj i|ji|ki + |yj i|ji|ki, k=0 j=1 k=m j=2 (4.115) m+p X k |Ygoodi := |y1 i|1i|ki. k=m k m Note that |y1 i = |y1 i for all k ∈ {m, m + 1, . . . , m + p}. We lower bound k|Y ik2 (p + 1)k|ymik2 P := good = 1 (4.116) measure k|Y ik2 k|Y ik2 by lower bounding the terms of the product

m 2 m 2 0 2 k|y1 ik k|y1 ik k|y1ik 2 = 0 2 · 2 . (4.117) k|Y ik k|y1ik k|Y ik

m First, according to (4.47) and (4.111), the exact solution u(T ) and the approximate solution y1 defined in (3.8) satisfy g ku(T ) − ymk ≤ ku(T ) − yˆ (T )k + kyˆ (T ) − ymk ≤ kη(t)k + kyˆ(T ) − ymk ≤ . (4.118) 1 1 1 1 2

19 0 Since y1 = (yin)1 = uin, using (4.118), we have m m m m k|y1 ik ky1 k ku(T )k − ku(T ) − y1 k g − ku(T ) − y1 k g 1 0 = ≥ = ≥ = . (4.119) k|y1ik kuink kuink kuink 2kuink 2q Second, we upper bound kykk2 by

kykk2 = kyˆ(kh) − [y(kh) − yk]k2 ≤ 2(kyˆ(kh)k2 + ky(kh) − ykk2). (4.120)

2 2 k m Using kyˆ(t)k < 4Nkuink by (4.79), and ky(kh) − y k ≤ kyˆ(T ) − y k ≤ g/4 < kuink/4 by (4.111), and R < 1, we have  ku k2  kykk2 ≤ 2 4Nku k2 + in < 9Nku k2. (4.121) in 16 in Therefore k|y0ik2 k|y0ik2 ku k2 1 1 = 1 ≥ in = . (4.122) k|Y ik2 Pm+p k 2 9N(m + p + 1)ku k2 9N(m + p + 1) k=0 k|y ik in Finally, using (4.119) and (4.122) in (4.117) and (4.116), we have p + 1 P ≥ (4.123) measure 9(m + p + 1)Nq2 as claimed. √ 2 Choosing m = p, we have Pmeasure = Ω(1/Nq ). Using amplitude amplification, O( Nq) iterations suffice to succeed with constant probability.

4.5 Proof of Theorem 1 Proof. We first present the quantum Carleman linearization (QCL) algorithm and then analyze its complexity. The QCL algorithm. We start by rescaling the system to satisfy (2.3) and (2.4). Given a quadratic ODE (2.1) satisfying R < 1 (where R is defined in (2.2)), we define a scaling factor γ > 0, and rescale u to u := γu. (4.124) Replacing u by u in (2.1), we have

du 1 ⊗2 = F2u + F1u + γF0(t), dt γ (4.125) u(0) = uin := γuin.

1 We let F 2 := γ F2, F 1 := F1, and F 0(t) := γF0(t) so that du = F u⊗2 + F u + F (t), dt 2 1 0 (4.126) u(0) = uin. Note that R is invariant under this rescaling, so R < 1 still holds for the rescaled equation. Concretely, we take1 1 γ = p . (4.127) kuinkr+

1In fact, one can show that any γ ∈ 1 , 1  suffices to satisfy (2.3) and (2.4). r+ kuink

20 2 After rescaling, the new quadratic ODE satisfies kuinkr+ = γ kuinkr+ = 1. Since kuink < r+ by Lemma 1, we have r− < kuink < 1 < r+, so (2.4) holds. Furthermore, 1 is located between the two 2 roots r− and r+, which implies kF 2k · 1 + |Re (λ1)| · 1 + kF 0k < 0 as shown in Lemma 1, so (2.3) holds for the rescaled problem. Having performed this rescaling, we henceforth assume that (2.3) and (2.4) are satisfied. We then introduce the choice of parameters as follows. Given g and an error bound  ≤ 1, we define g g δ := ≤ . (4.128) 1 +  2

Given kuink, kF2k, and Re(λ1) < 0, we choose

log(2T kF kk/δ) log(2T kF kk/δ) N = 2 = 2 . (4.129) log(1/kuink) log(r+)

Since kuink/δ > 1 by (4.128) and g < kuink, Lemma 2 gives

N+1 1 N+1 δ ku(T ) − yˆ1(T )k ≤ kη(T )k ≤ TNkF2kkuink = TNkF2k( ) ≤ . (4.130) r+ 2 Thus, (4.47) holds since δ ≤ g/2. Now we discuss the choice of h. On the one hand, h must satisfy (4.45) to satisfy the conditions of Lemma 3 and Lemma 4. On the other hand, Lemma 3 gives the upper bound g g δ kyˆ (T ) − ymk ≤ 3N 2.5T h[(kF k + kF k + kF k)2 + kF 0k] ≤ ≤ = . (4.131) 1 1 2 1 0 0 4 2(1 + ) 2

This also ensures that (4.111) holds since δ ≤ g/2. Thus, we choose

 g 1 h ≤ min 2.5 2 0 , , 12N T [(kF2k + kF1k + kF0k) + kF0k] NkF1k  (4.132) 2(| Re(λ1)| − kF2k − kF0k) 2 2 2 N(| Re(λ1)| − (kF2k + kF0k) + kF1k ) to satisfy (4.45) and (4.131). Combining (4.130) with (4.131), we have

m m ku(T ) − y1 k ≤ ku(T ) − yˆ1(T )k + kyˆ1(T ) − y1 k ≤ δ. (4.133)

Thus, (4.118) holds since δ ≤ g/2. Using

m m m u(T ) y1 ku(T ) − y1 k ku(T ) − y1 k − m ≤ m ≤ m (4.134) ku(T )k ky1 k min{ku(T )k, ky1 k} g − ku(T ) − y1 k and (4.133), we obtain m u(T ) y1 δ − m ≤ = , (4.135) ku(T )k ky1 k g − δ u(T ) i.e., the normalized output state is -close to ku(T )k . We follow the procedure in Lemma 5 to prepare the initial state |yˆini. We apply the QLSA [19] to the linear system (3.8) with m = p = dT/he, giving a solution |Y i. We then perform a k measurement to obtain a normalized state of |yj i for some k ∈ [m + p + 1]0 and j ∈ [N]. By

21 k Lemma 6, the probability of obtaining a state |y1 i for some k ∈ [m + p + 1]0 \ [m + 1]0, giving the m m normalized vector y1 /ky1 k, is p + 1 1 P ≥ ≥ . (4.136) measure 9(m + p + 1)Nq2 18Nq2 √ By amplitude amplification, we can achieve success probability Ω(1) with O( Nq) repetitions of the above procedure. Analysis of the complexity. By Lemma 5, the right-hand side |Bi in (3.8) can be prepared with

O(N) queries to Ox and O(m) queries to OF0 , with gate complexity larger by a poly(log N, log n) factor. The matrix L in (3.8) is an (m + p + 1)∆ × (m + p + 1)∆ matrix with O(Ns) nonzero entries in any row or column. By Lemma 4 and our choice of parameters, the condition number of L is at most 3(m + p + 1) N 2.5T 2[(kF k + kF k + kF k)2 + kF 0k] = O 2 1 0 0 + NT kF k δ 1 NT [| Re(λ )|2 − (kF k + kF k)2 + kF k2] + 1 2 0 1 2(| Re(λ1)| − kF2k − kF0k) (4.137)  2.5 2 2 0 2  N T [(kF2k + kF1k + kF0k) + kF0k] 1 NT kF1k = O + 2 · g (1 − kuink) kF2k + kF0k  2.5 2 2 0  N T [(kF2k + kF1k + kF0k) + kF0k] = O 2 . (1 − kuink) (kF2k + kF0k)g

Here we use kF2k + kF0k < | Re(λ1)| ≤ kF1k and 1 2(| Re(λ )| − kF k − kF k) > (ku k + − 2)(kF k + kF k) 1 2 0 in ku k 2 0 in (4.138) 1 2 2 = (1 − kuink) (kF2k + kF0k) > (1 − kuink) (kF2k + kF0k). kuink

The first inequality above is from the sum of | Re(λ1)| > kF2kkuink + kF0k/kuink and | Re(λ1)| = kF2kr+ + kF0k/r+, where r+ = 1/kuink. Consequently, by Theorem 5 of [19], the QLSA produces the state |Y i with

3.5 2 2 0  0  N sT [(kF2k + kF1k + kF0k) + kF0k] NsT kF2kkF1kkF0kkF0k 2 · poly log (1 − kuink) (kF2k + kF0k)g (1 − kuink)g 2 2 0  0  sT [(kF2k + kF1k + kF0k) + kF0k] sT kF2kkF1kkF0kkF0k = 2 · poly log / log(1/kuink) (1 − kuink) (kF2k + kF0k)g (1 − kuink)g √ (4.139) queries to the oracles OF2 , OF1 , OF0 , and Ox. Using O( Nq) steps of amplitude amplification to achieve success probability Ω(1), the overall query complexity of our algorithm is

4 2 2 0  0  N sT q[(kF2k + kF1k + kF0k) + kF0k] NsT kF2kkF1kkF0kkF0k 2 · poly log (1 − kuink) (kF2k + kF0k)g (1 − kuink)g 2 2 0  0  sT q[(kF2k + kF1k + kF0k) + kF0k] sT kF2kkF1kkF0kkF0k = 2 · poly log / log(1/kuink) (1 − kuink) (kF2k + kF0k)g (1 − kuink)g (4.140)

22 0 and the gate complexity exceeds this by a factor of poly log(nsT kF2kkF1kkF0kkF k/(1 − R)g)/  0 log(1/kuink) . If the eigenvalues λj of F1 are all real, by (4.46), the condition number of L is at most

N 2.5T 2[(kF k + kF k + kF k)2 + kF 0k]  3(m + p + 1) = O 2 1 0 0 + NT kF k δ 1 (4.141) N 2.5T 2[(kF k + kF k + kF k)2 + kF 0k] = O 2 1 0 0 . g

Similarly, the QLSA produces the state |Y i with

sT 2[(kF k + kF k + kF k)2 + kF 0k]  sT kF kkF kkF kkF 0k  2 1 0 0 · poly log 2 1 0 0 / log(1/ku k) (4.142) g g in

queries to the oracles OF2 , OF1 , OF0 , and Ox. Using amplitude amplification to achieve success probability Ω(1), the overall query complexity of the algorithm is

sT 2q[(kF k + kF k + kF k)2 + kF 0k]  sT kF kkF kkF kkF 0k  2 1 0 0 · poly log 2 1 0 0 / log(1/ku k) (4.143) g g in

0  and the gate complexity is larger by a factor of poly log(nsT kF2kkF1kkF0kkF0k/g)/ log(1/kuink) as claimed.

5 Lower bound

In this section, we establish a limitation on the ability of quantum computers to solve the quadratic ODE problem when the nonlinearity is sufficiently strong. We quantify the strength of the nonlin- earity in terms of the quantity R defined in (2.2). Whereas there is an efficient quantum algorithm√ for R < 1 (as shown in Theorem 1), we show here that the problem is intractable for R ≥ 2. √ Theorem 2. Assume R ≥ 2. Then there is an instance of the quantum quadratic ODE problem defined in Problem 1 such that any quantum algorithm for producing a quantum state approximating u(T )/ku(T )k with bounded error must have worst-case time complexity exponential in T .

We establish this result by showing how the nonlinear dynamics can be used to distinguish nonorthogonal quantum states, and thereby solve unstructured search in a time that violates the quantum search lower bound [7]. Note that since our algorithm only approximates the quantum state corresponding to the solution, we must lower bound the query complexity of approximating the solution of a quadratic ODE.

5.1 Unstructured search and state discrimination In the unstructured search problem, we aim to search the set [n] for a marked item, given the ability to query whether any given x ∈ [n] is marked. In the decision version of the problem, our goal is to determine whether there are any marked items. It is well known that the classical query √ complexity of unstructured search is Θ(n), while the quantum query complexity is Θ( n)[7, 33]. Previous work on the computational power of nonlinear quantum mechanics shows that the ability to distinguish non-orthogonal states can be applied to solve unstructured search (and other hard computational problems) [1,2, 22]. In particular, this connection shows the following.

23 Lemma 7 ([22]). Let |ψi, |φi be states of a qubit with |hψ|φi| = 1 − . Suppose we are either given a black box that prepares |ψi or a black box that prepares |φi, where a call to the black box takes time 1. Then any bounded-error protocol for determining whether the state is |ψi or |φi must take time Ω(1/1/4).

Proof. The claim follows from the construction in Section 3.1 of [22], taking t1 = π to consider the discrete quantum query model. Given a black box for the unstructured search problem, the Hadamard test circuit can be used to create a single-qubit state that is either |ψi = |0i (if there 1 4 are no marked items) or a state |φi that has overlap 1 −  with |0i, where  = 2n2 + O(1/n ). This preparation procedure succeeds with probability 1 − O(1/n), so it has negligible probability of ever failing in an algorithm that runs in time o(n). Since the bounded-error quantum query complexity √ of unstructured search is Ω( n)[7], any bounded-error algorithm for distinguishing the states must √ take time Ω( n) = Ω(1/1/4).

5.2 State discrimination with nonlinear dynamics Lemma 7 can be used to establish limitations on the ability of quantum computers to simulate nonlinear dynamics, since nonlinear dynamics can be used to distinguish nonorthogonal states. Whereas previous work considers models of nonlinear quantum dynamics (such as the Weinberg model [1,2] and the Gross-Pitaevskii equation [22]), here we aim to show the difficulty of efficiently simulating more general nonlinear ODEs—in particular, quadratic ODEs with dissipation—using quantum algorithms.

Lemma 8.√There exists an instance of the quantum quadratic ODE problem as defined in Problem 1 with R ≥ 2, and two states of a qubit with overlap 1 −  (for any sufficiently small  > 0) as possible initial conditions, such√ that the two final states after evolution time T = O(log(1/)) have an overlap no larger than 3/ 10. Proof. Consider a 2-dimensional system of the form

du1 2 = −u1 + ru1, dt (5.1) du 2 = −u + ru2, dt 2 2 for some r > 0, with an initial condition u(0) = [u1(0); u2(0)] = uin satisfying kuink = 1. According to the definition of R in (2.2), we have R = r, so henceforth we write this parameter as R. The analytic solution of (5.1) is 1 u (t) = , 1 R −et(R −1/u (0)) 1 (5.2) 1 u2(t) = t . R −e (R −1/u2(0))

When u2(0) > 1/ R, u2(t) is finite within the domain  R  0 ≤ t < t∗ := log ; (5.3) R −1/u2(0) when u2(0) = 1/ R, we have u2(t) = 1/ R for all t; and when u2(0) < 1/ R, u2(t) goes to 0 as t → ∞. The behavior of u1(t) depends similarly on u1(0). Without loss of generality, we assume u1(0) ≤ u2(0). For u2(0) ≥ u1(0) > 1/ R, both u1(t) and u2(t) are finite within the domain (5.3), which we consider as the domain of u(t).

24 Now we consider 1-qubit states that provide inputs to (5.1). Given a sufficiently small  > 0, we first define θ ∈ (0, π/4) by θ 2 sin2 = . (5.4) 2 We then construct two 1-qubit states with overlap 1 − , namely 1 |φ(0)i = √ (|0i + |1i) (5.5) 2 and  π   π  |ψ(0)i = cos θ + |0i + sin θ + |1i. (5.6) 4 4 Then the overlap between the two initial states is

hφ(0)|ψ(0)i = cos θ = 1 − . (5.7) √ √ The initial overlap (5.7) is larger than the target overlap 3/ 10 in Lemma 8 provided  < 1−3/ 10. For simplicity, we denote  π  v := cos θ + , 0 4  π  (5.8) w := sin θ + , 0 4 and let v(t) and w(t) denote solutions of (5.1) with initial conditions v(0) = v0 and w(0) = w0, respectively. Since w0 > 1/ R, we see that w(t) increases with t, satisfying 1 1 ≤ √ < w0 < w(t), (5.9) R 2 and v(t) < w(t) (5.10) for any time 0 < t < t∗, whatever the behavior of v(t). We√ now√ study the outputs of our problem. For the state |φ(0)i, the initial condition for (5.1) is [1/ 2; 1/ 2]. Thus, the output for any t ≥ 0 is 1 |φ(t)i = √ (|0i + |1i). (5.11) 2

For the state |ψ(0)i, the initial condition for (5.1) is [v0; w0]. We now discuss how to select a terminal time T to give a useful output state |ψ(T )i. For simplicity, we denote the ratio of w(t) and v(t) by w(t) K(t) := . (5.12) v(t) Noticing that w(t) goes to infinity as t approaches t∗, while v(t) remains finite within (5.3), there exists a terminal time T such that2 K(T ) ≥ 2. (5.13) The normalized output state at this time T is 1 |ψ(T )i = (|0i + K(T )|1i). (5.14) pK(T )2 + 1

2 ∗ ∗ ∗ More concretely, we take vmax = max{v0, v(t )} that upper bounds v(t) on the domain [0, t ), in which v(t ) is a finite value since v0 < w0. Then there exists a terminal time T such that w(T ) = 2vmax, and hence K(T ) = w(T )/v(T ) ≥ 2.

25 Combining (5.11) with (5.14), the overlap of |φ(T )i and |ψ(T )i is K(T ) + 1 3 hφ(T )|ψ(T )i = ≤ √ (5.15) p2K(T )2 + 2 10 using (5.13). Finally, we estimate the evolution time T , which is implicitly defined by (5.13). We can upper bound its value by t∗. According to (5.3), we have √  R   2  T < t∗ = log < log √ (5.16) R − 1 2 − 1 w0 w0 since the function log(x/(x − c)) decreases monotonically with x for x > c > 0. Using (5.7) and (5.8) to rewrite this expression in terms of , we have √ ! √ 2  sin θ + cos θ   2 − 2 + 1 −  T < t∗ < log √ = log = log √ . (5.17) 1 2 2 − π sin θ + cos θ − 1 2 −  −  sin(θ+ 4 ) For  sufficiently small, this implies T = O(log(1/)) as claimed.

5.3 Proof of Theorem 2 We now establish our main lower bound result.

Proof. As introduced in the proof of Lemma 8, consider the quadratic ODE (5.1); the two initial states of a qubit |φ(0)i and |ψ(0)i defined in (5.5) and (5.6), respectively; and the terminal time T defined in (5.13). Suppose we have a quantum algorithm that, given a black box to prepare a state that is either |φ(0)i or |ψ(0)i, can produce quantum states |φ0(T )i or |ψ0(T )i that are within distance δ of |φ(T )i and |ψ(T )i, respectively. Since by Lemma 8, |φ(T )i and |ψ(T )i have constant overlap, the overlap between |φ0(T )i and |ψ0(T )i is also constant for sufficiently small δ. More precisely, we have 3 hφ(T )|ψ(T )i ≤ √ (5.18) 10 by (5.15), which implies s  3  k|φ(T )i − |ψ(T )i k ≥ 2 1 − √ > 0.32. (5.19) 10 We also have k |φ(T )i − |φ0(T )i k ≤ δ, (5.20) and similarly for ψ(T ). These three inequalities give us k |φ0(T )i − |ψ0(T )i k = k(|φ(T )i − |ψ(T ))i − (|φ(T )i − |φ0(T ))i − (|ψ0(T )i − |ψ(T ))i k ≥ k(|φ(T )i − |ψ(T ))i k − k(|φ(T )i − |φ0(T ))i k − k(|ψ0(T )i − |ψ(T ))i k > 0.32 − 2δ, (5.21) which is at least a constant for (say) δ < 0.15. Lemma 7 therefore shows that preparing the states |φ0(T )i and |ψ0(T )i requires time Ω(1/1/4), as these states can be used to distinguish the two possibilities with bounded error. By Lemma 8, Ω(T ) this time is 2 . This shows that we need at least exponential simulation time to approximate√ the solution of arbitrary quadratic ODEs to within sufficiently small bounded error when R ≥ 2.

26 Note that exponential time is achievable since our QCL algorithm can solve the problem by taking N to be exponential in T , where N is the truncation level of Carleman linearization. (The algorithm of Leyton and Osborne also solves quadratic differential equations with complexity ex- ponential in T , but requires the additional assumptions that the quadratic polynomial is measure- preserving and Lipschitz continuous [40].)

6 Applications

Due to the assumptions of our analysis, our quantum Carleman linearization algorithm can only be applied to problems with certain properties. First, there are two requirements to guarantee convergence of the inhomogeneous Carleman linearization: the system must have linear dissipation, manifested by Re(λ1) < 0; and the dissipation must be sufficiently stronger than both the nonlinear and the forcing terms, so that R < 1. Dissipation typically leads to an exponentially decaying solution, but for the dependency on g and q in (4.140) to allow an efficient algorithm, the solution cannot exponentially approach zero. However, this issue does not arise if the forcing term F0 resists the exponential decay towards zero, instead causing the solution to decay towards some non-zero (possibly time-dependent) state. The norm of the state that is exponentially approached can possibly decay towards zero, but this decay itself must happen slower than exponentially for the algorithm to be efficient.3 We now investigate possible applications that satisfy these conditions. First we present an application governed by ordinary differential equations, and then we present possible applications in partial differential equations. Several physical systems can be represented in terms of quadratic ODEs. Examples include models of interacting populations of predators and prey [52], dynamics of chemical reactions [18, 45], and the spread of an epidemic [12]. We now give an example of the latter, based on the epidemiological model used in [53] to describe the early spread of the COVID-19 virus. The so-called SEIR model divides a population of P individuals into four components: suscep- tible (PS), exposed (PE), infected (PI ), and recovered (PR). We denote the rate of transmission from an infected to a susceptible person by rtra, the typical time until an exposed person becomes infectious by the latent time Tlat, and the typical time an infectious person can infect others by the infectious time Tinf. Furthermore we assume that there is a flux Λ of individuals constantly refreshing the population. This flux corresponds to susceptible individuals moving into, and indi- viduals of all components moving out of, the population, in such a way that the total population remains constant. To ensure that there is sufficiently strong linear decay to guarantee Carleman convergence, we also add a vaccination term to the PS component. We choose an approach similar to that of [54], but denote the vaccination rate, which is approximately equal to the fraction of susceptible

3Also note that the QCL algorithm might provide an advantage over classical computation for homogeneous equations in cases where only evolution for a short time is of interest.

27 individuals vaccinated each day, by rvac. The model is then dP P P S = −Λ S − r P + Λ − r P I (6.1) dt P vac S tra S P dPE PE PE PI = −Λ − + rtraPS (6.2) dt P Tlat P dP P P P I = −Λ I + E − I (6.3) dt P Tlat Tinf dPR PR PI = −Λ + rvacPS + . (6.4) dt P Tinf

Since the sum of equations (6.1)–(6.4) shows that I is a constant, we know that PR = P − PS − PE − PI . Hence we do not need to include the equation for PR in our analysis, which is crucial since the PR component would have introduced positive eigenvalues. The matrices corresponding to (2.1) are then

   Λ  Λ − P − rvac 0 0 Λ 1 F0 = 0 ,F1 =  0 − − , (6.5)    P Tlat  0 0 1 − Λ − 1 Tlat P Tinf  rtra  0 0 − P 0 0 0 0 0 0 rtra F2 = 0 0 P 0 0 0 0 0 0. (6.6) 0 0 0 0 0 0 0 0 0

Since F1 is a triangular matrix, its eigenvalues are located√ on its diagonal, so Re(λ1) = −Λ/P − √min{rvac, 1/Tlat, 1/Tinf}. Furthermore we can bound P/ 3 ≤ kuink ≤ P , kF0k = Λ, and kF2k = 2rtra/P , so √ √ 2r + 3Λ/P R ≤ tra . (6.7) min{rvac, 1/Tlat, 1/Tinf} + Λ/P √ We see that the condition√ for guaranteed convergence of Carleman linearization is 2rtra < min{rvac, 1/Tlat, 1/Tinf} − ( 3 − 1). Essentially, the Carleman method only converges if the (non- linear) transmission is sufficiently slower than the (linear) decay. To assess how restrictive this assumption is, we consider the SEIR parameters used in [53]. Note that they also included separate components for asymptomatic and hospitalized persons, but to simplify the analysis we include both of these components in the PI component. In their work, they considered a city with approximately P = 107 inhabitants. In a specific period, they estimated 4 a travel flux of Λ ≈ 0 individuals per day, latent time Tlat = 5.2 days, infectious time Tinf = 2.3 −1 days, and transmission rate rtra ≈ 0.13 days . We let the initial condition be dominated by the 5 −1 susceptible component so that kuink ≈ P , and we assume that rvac > 1/Tlat ≈ 0.19 days . With the stated parameters, a direct calculation gives R = 0.956, showing that the assumptions of our algorithm can correspond to some real-world problems that are only moderately nonlinear.

4Since we require that u(t) does not approach 0 exponentially, we can assume that the travel flux is some non-zero, but small, value, e.g., Λ = 1 individual per day. 5This example arguably corresponds to quite rapid vaccination, and is chosen here such that R remains smaller than one, as required to formally guarantee convergence of the Carleman method. However, as shown in the upcoming example of the Burgers equation, larger values of R might still allow for convergence in practice, suggesting that our algorithm could handle lower values of the vaccination rate.

28 While the example discussed above has only a constant number of variables, this example can be generalized to a high-dimensional system of ODEs that models the early spread over a large number of cities with interaction, similar to what is done in [11] and [46]. Other examples of high-dimensional ODEs arise from the discretization of certain PDEs. Con- sider, for example, equations for u(r, t) of the type

2 ∂tu + (u · ∇)u + βu = ν∇ u + f. (6.8) with the forcing term f being a function of both space and time. This equation can be cast in the form of (2.1) by using standard discretizations of space and time. Equations of the form (6.8) can represent Navier–Stokes-type equations, which are ubiquitous in fluid mechanics [39], and related models such as those studied in [37, 48, 51] to describe the formation of large-scale structure in the universe. Similar equations also appear in models of magnetohydrodynamics (e.g., [27]), or the motion of free particles that stick to each other upon collision [13]. In the inviscid case, ν = 0, the resulting Euler-type equations with linear damping are also of interest, both for modeling micromechanical devices [5] and for their intimate connection with viscous models [25]. As a specific example, consider the one-dimensional forced viscous Burgers equation

2 ∂tu + u∂xu = ν∂xu + f, (6.9) which is the one-dimensional case of equation (6.8) with β = 0. Equation (6.9) is often used as a simple model of convective flow [15]. For concreteness, let the initial condition be u(x, 0) = U0 sin(2πx/L0) on the domain x ∈ [−L0/2,L0/2], and use Dirichlet boundary conditions u(−L0/2, 0) = u(L0/2, 0) = 0. We force this equation using a localized off-center Gaussian with a sinusoidal 2 6  (x−L0/4)  time dependence, given by f(x, t) = U0 exp − 2 cos(2πt). To solve this equation using 2(L0/32) the Carleman method, we discretize the spatial domain into nx points and use central differences for the derivatives to get

u − 2u + u u2 − u2 ∂ u = ν i+1 i i−1 − i+1 i−1 + f (6.10) t i ∆x2 4∆x i with ∆x = L0/(nx − 1). This equation is of the form (2.1) and can thus generate the Carleman system (3.2). The resulting linear ODE can then be integrated using the forward Euler method, as shown in Figure 1. In this example, the viscosity ν is defined such that the Reynolds number Re := U0L0/ν = 20, and nx = 16 spatial discretization points were sufficient to resolve the solution. The figure compares the Carleman solution with the solution obtained via direct integration of (6.10) with the forward Euler method (i.e., without Carleman linearization). By inserting the matrices F0, F1, and F2 corresponding to equation (6.10) into the definition of R (2.2), we find that Re(λ1) is indeed negative as required, given Dirichlet boundary conditions, but the parameters used in this example result in R ≈ 44. Even though this does not satisfy the requirement R < 1 of the QCL algorithm, we see from the absolute error plot in Figure 1 that the maximum absolute error over time decreases exponentially as the truncation level N is incremented (in this example, the maximum Carleman truncation level considered is N = 4). Surprisingly, this suggests that in this example, the error of the classical Carleman method converges exponentially with N, even though R > 1. 6Note that this forcing does not satisfy the general conditions for efficient implementation of our algorithm since it is not sparse. However, we expect that the algorithm can still be implemented efficiently for a structured non-sparse forcing term such as in this example.

29 Figure 1: Integration of the forced viscous Burgers equation using Carleman linearization on a classical computer (source code available at https://github.com/hermankolden/CarlemanBurgers). The viscosity is set so that the Reynolds number Re = U0L0/ν = 20. The parameters nx = 16 and nt = 4000 are the number of spatial and temporal discretization intervals, respectively. The corresponding Carleman convergence parameter is R = 43.59. Top: Initial condition and solution plotted at a third of the nonlinear 1 L0 time Tnl = . Bottom: l2 norm of the absolute error between the Carleman solutions at various truncation 3 3U0 levels N (left), and the convergence of the corresponding time-maximum error (right).

30 7 Discussion

In this paper we have presented a quantum Carleman linearization (QCL) algorithm for a class of quadratic nonlinear differential equations. Compared to the previous approach of [40], our algorithm improves the complexity from an exponential dependence on T to a nearly quadratic dependence, under the condition R < 1 as defined in (2.2). Qualitatively, this means that the system must be dissipative and that the nonlinear and inhomogeneous effects must be small relative to the linear effects. We have also provided numerical results suggesting the classical Carleman method may work on certain PDEs that do not strictly satisfy the assumption R < 1. Furthermore,√ we established a lower bound showing that for general quadratic differential equations with R ≥ 2, quantum algorithms must have worst-case complexity exponential in T . We also discussed several potential applications arising in biology and fluid and plasma dynamics. It is natural to ask whether the result of Theorem 1 can be achieved with a classical algorithm, i.e., whether the assumption R < 1 makes differential equations classically tractable. Clearly a naive integration of the truncated Carleman system (3.2) is not efficient on a classical computer since the system size is Θ(nN ). But furthermore, it is unlikely that any classical algorithm for this problem can run in time polylogarithmic in n. If we consider Problem 1 with dissipation that is small compared to the total evolution time, but let the nonlinearity and forcing be even smaller such that R < 1, then in the asymptotic limit we have a linear differential equation with no dissipation. Hence any classical algorithm that could solve Problem 1 could also solve non- dissipative linear differential equations, which is a BQP-hard problem even when the dynamics are unitary [30]. In other words, an efficient classical algorithm for this problem would imply efficient classical algorithms for any problem that can be solved efficiently by a quantum computer, which is considered unlikely. √ Our upper and lower bounds leave a gap in the range 1 ≤ R < 2, for which we do not know the complexity of the quantum quadratic ODE problem. We hope that future work will close this gap and determine for which R the problem can be solved efficiently by quantum computers in the worst case. Furthermore, the complexity of our algorithm has nearly quadratic dependence on T , namely T 2 poly(log T ). It is unknown whether the complexity for quadratic ODEs must be at least linear or quadratic in T . Note that a sublinear complexity is unlikely because of the no-fast-forwarding theorem [9]. The complexity of our algorithm depends on the parameter q defined in (3.13), which charac- terizes the decay of the final solution relative to the initial condition. It is unlikely that such a dependence of q can be significantly improved, since renormalization of the state can be used to implement a procedure of postselection, which implies an unlikely consequence BQP = PP. For further discussion, see Section 8 of [10]. However, for inhomogeneous equations the final state may not be exponentially smaller than the initial state even in a long-time simulation. This suggests that our algorithm is suitable for simulating models with forcing terms. It is possible that variations of the Carleman linearization procedure could increase the accuracy of the result. For instance, instead of using just tensor powers of u as auxiliary variables, one could use other nonlinear functions. Several previous papers on Carleman linearization have suggested using multidimensional orthogonal polynomials [6, 31]. They also discuss approximating higher- order terms with lower-order ones in (3.2) instead of simply dropping them, possibly improving accuracy. Such changes would however alter the structure of the resulting linear ODE, which could affect the quantum implementation. The quantum part of the algorithm might also be improved. In this paper we limit ourselves to the first-order Euler method to discretize the linearized ODEs in time. This is crucial for the

31 analysis in Lemma 3, which states the global error increases at most linearly with T . To establish this result for the Euler method, it suffices to choose the time step (4.45) to ensure kI + Ahk ≤ 1, and then estimate the growth of global error by (4.72). However, it is unclear how to give a similar bound for higher-order numerical schemes. If this obstacle could be overcome, the error dependence of the complexity might be improved. It is also natural to ask whether our approach can be improved by taking features of partic- ular systems into account. Since the Carleman method has only received limited attention and has generally been used for purposes other than numerical integration, it seems likely that such improvements are possible. In fact, the numerical results discussed in Section 6 (see in particular Figure 1) suggest that the condition R < 1 is not a strict requirement for the viscous Burgers equation, since we observe convergence even though R ≈ 44. This suggests that some property of equation (6.9) makes it more amenable to Carleman linearization than our current analysis predicts. We leave a detailed investigation of this for future work. When contemplating applications, it should be emphasized that our approach produces a state vector that encodes the solution without specifying how information is to be extracted from that state. Simply producing a state vector is not enough for an end-to-end application since the full quantum state cannot be read out efficiently. In some cases in may be possible to extract useful information by sampling a simple observable, whereas in other cases, more sophisticated postprocessing may be required to infer a desired property of the solution. Our method does not address this issue, but can be considered as a subroutine whose output will be parsed by subsequent quantum algorithms. We hope that future work will address this issue and develop end-to-end applications of these methods. Finally, the algorithm presented in this paper might be extended to solve related mathematical problems on quantum computers. Obvious candidates include initial value problems with time- dependent coefficients and boundary value problems. Carleman methods for such problems are explored in [38], but it is not obvious how to implement those methods in a quantum algorithm. It is also possible that suitable formulations of problems in nonlinear optimization or control could be solvable using related techniques.

Acknowledgments

We thank Paola Cappellaro for valuable discussions and comments. JPL thanks Aaron Ostrander for inspiring discussions. HØK thanks Bernhard Paus Græsdal for introducing him to the Carleman method. HKK and NFL thank Seth Lloyd for preliminary discussions on nonlinear equations and the quantum linear systems algorithm. AMC and JPL did part of this work while visiting the Simons Institute for the Theory of Computing in Berkeley and gratefully acknowledge its hospitality. AMC and JPL acknowledge support from the Department of Energy, Office of Science, Office of Advanced Scientific Computing Research, Quantum Algorithms Teams and Accelerated Research in Quantum Computing programs, and from the National Science Foundation (CCF-1813814). HØK, HKK, and NFL were partially funded by award no. DE-SC0020264 from the Department of Energy.

References

[1] Scott Aaronson, NP-complete problems and physical reality, ACM SIGACT News 36 (2005), no. 1, 30–52, arXiv:quant-ph/0502072.

32 [2] Daniel S. Abrams and Seth Lloyd, Nonlinear quantum mechanics implies polynomial-time solution for NP-complete and #P problems, Physical Review Letters 81 (1998), no. 18, 3992, arXiv:quant-ph/9801041.

[3] Roberto F. S. Andrade, Carleman embedding and Lyapunov exponents, Journal of Mathemat- ical Physics 23 (1982), no. 12, 2271–2275.

[4] Kendall E. Atkinson, An introduction to numerical analysis, John Wiley & Sons, 2008.

[5] Min-Hang Bao, Micro mechanical transducers: pressure sensors, accelerometers and gyro- scopes, Elsevier, 2000.

[6] Richard Bellman and John M. Richardson, On some questions arising in the approximate solution of nonlinear differential equations, Quarterly of Applied Mathematics 20 (1963), 333– 339.

[7] Charles H. Bennett, Ethan Bernstein, Gilles Brassard, and Umesh Vazirani, Strengths and weaknesses of quantum computing, SIAM Journal on Computing 26 (1997), no. 5, 1510–1523, arXiv:quant-ph/9701001.

[8] Dominic W. Berry, High-order quantum algorithm for solving linear differential equa- tions, Journal of Physics A: Mathematical and Theoretical 47 (2014), no. 10, 105301, arXiv:1010.2745.

[9] Dominic W. Berry, Graeme Ahokas, Richard Cleve, and Barry C. Sanders, Efficient quantum algorithms for simulating sparse Hamiltonians, Communications in 270 (2007), 359–371, arXiv:quant-ph/0508139.

[10] Dominic W. Berry, Andrew M. Childs, Aaron Ostrander, and Guoming Wang, Quantum al- gorithm for linear differential equations with exponentially improved dependence on precision, Communications in Mathematical Physics 356 (2017), no. 3, 1057–1081, arXiv:1701.03684.

[11] Derdei Bichara, Yun Kang, Carlos Castillo-Ch´avez, Richard Horan, and Charles Perrings, SIS and SIR epidemic models under virtual dispersal, 03 2015.

[12] Fred Brauer and Carlos Castillo-Chavez, Mathematical models in population biology and epi- demiology, vol. 2, Springer, 2012.

[13] Yann Brenier and Emmanuel Grenier, Sticky particles and scalar conservation laws, SIAM Journal on Numerical Analysis 35 (1998), no. 6, 2317–2328.

[14] Roger Brockett, The early days of geometric nonlinear control, Automatica 50 (2014), no. 9, 2203–2224.

[15] Johannes M. Burgers, A mathematical model illustrating the theory of turbulence, Advances in Applied Mechanics, vol. 1, Elsevier, 1948, pp. 171–199.

[16] Yudong Cao, Anargyros Papageorgiou, Iasonas Petras, Joseph Traub, and Sabre Kais, Quan- tum algorithm and circuit design solving the Poisson equation, New Journal of Physics 15 (2013), no. 1, 013021, arXiv:1207.2485.

[17] Torsten Carleman, Application de la th´eoriedes ´equationsint´egrales lin´eaires aux syst`emes d’´equationsdiff´erentielles non lin´eaires, Acta Mathematica 59 (1932), no. 1, 63–87.

33 [18] Alessandro Ceccato, Paolo Nicolini, and Diego Frezzato, Recasting the mass-action rate equa- tions of open chemical reaction networks into a universal quadratic format, Journal of Math- ematical Chemistry 57 (2019), 1001–1018.

[19] Andrew M. Childs, Robin Kothari, and Rolando D. Somma, Quantum algorithm for systems of linear equations with exponentially improved dependence on precision, SIAM Journal on Computing 46 (2017), no. 6, 1920–1950, arXiv:1511.02306.

[20] Andrew M. Childs and Jin-Peng Liu, Quantum spectral methods for differential equations, Communications in Mathematical Physics 375 (2020), 1427–1457, arXiv:1901.00961.

[21] Andrew M. Childs, Jin-Peng Liu, and Aaron Ostrander, High-precision quantum algorithms for partial differential equations, 2020, arXiv:2002.07868.

[22] Andrew M. Childs and Joshua Young, Optimal state discrimination and unstructured search in nonlinear quantum mechanics, Physical Review A 93 (2016), no. 2, 022314, arXiv:1507.06334.

[23] B. David Clader, Bryan C. Jacobs, and Chad R. Sprouse, Preconditioned quantum linear system algorithm, Physical Review Letters 110 (2013), no. 25, 250504, arXiv:1301.2340.

[24] Pedro C. S. Costa, Stephen Jordan, and Aaron Ostrander, Quantum algorithm for simulating the wave equation, Physical Review A 99 (2019), no. 1, 012323, arXiv:1711.05394.

[25] Constantine M. Dafermos, Hyperbolic conservation laws in continuum physics, vol. 3, Springer, 2005.

[26] Germund G. Dahlquist, A special stability problem for linear multistep methods, BIT Numerical Mathematics 3 (1963), no. 1, 27–43.

[27] P. A. Davidson, An introduction to magnetohydrodynamics, Cambridge Texts in Applied Math- ematics, Cambridge University Press, 2001.

[28] Ilya Y. Dodin and Edward A. Startsev, On applications of quantum computing to plasma simulations, 2020, arXiv:2005.14369.

[29] Alexander Engel, Graeme Smith, and Scott E. Parker, Quantum algorithm for the Vlasov equation, Physical Review A 100 (2019), no. 6, 062315, arXiv:1907.09418.

[30] Richard P. Feynman, Quantum mechanical computers, Optics News 11 (1985), 11–20.

[31] Marcelo Forets and Amaury Pouly, Explicit error bounds for Carleman linearization, 2017, arXiv:1711.02552.

[32] Alfredo Germani, Costanzo Manes, and Pasquale Palumbo, Filtering of differential nonlinear systems via a Carleman approximation approach, Proceedings of the 44th IEEE Conference on Decision and Control, pp. 5917–5922, 2005.

[33] Lov K. Grover, Quantum mechanics helps in searching for a needle in a haystack, Physical Review Letters 79 (1997), no. 2, 325, arXiv:quant-ph/9706033.

[34] Aram W. Harrow, Avinatan Hassidim, and Seth Lloyd, Quantum algorithm for linear systems of equations, Physical Review Letters 103 (2009), no. 15, 150502, arXiv:0811.3171.

34 [35] Ilon Joseph, Koopman-von Neumann approach to quantum simulation of nonlinear classical dynamics, 2020, arXiv:2003.09980. [36] Edward H. Kerner, Universal formats for nonlinear ordinary differential systems, Journal of Mathematical Physics 22 (1981), no. 7, 1366–1371. [37] Lev Kofman, Dmitri Pogosian, and Sergei Shandarin, Structure of the universe in the two- dimensional model of adhesion, Monthly Notices of the Royal Astronomical Society 242 (1990), no. 2, 200–208. [38] Krzysztof Kowalski and Willi-Hans Steeb, Nonlinear dynamical systems and Carleman lin- earization, World Scientific, 1991. [39] Pierre Gilles Lemari´e-Rieusset, The Navier-Stokes problem in the 21st century, CRC Press, 2018. [40] Sarah K. Leyton and Tobias J. Osborne, A quantum algorithm to solve nonlinear differential equations, 2008, arXiv:0812.4423. [41] Noah Linden, Ashley Montanaro, and Changpeng Shao, Quantum vs. classical algorithms for solving the heat equation, arXiv:2004.06516. [42] Seth Lloyd, Giacomo De Palma, Can Gokler, Bobak Kiani, Zi-Wen Liu, Milad Marvian, Fe- lix Tennie, and Tim Palmer, Quantum algorithm for nonlinear differential equations, 2020, arXiv:2011.06571. [43] Gerasimos Lyberatos and Christos A. Tsiligiannis, A linear algebraic method for analysing Hopf bifurcation of chemical reaction systems, Chemical Engineering Science 42 (1987), no. 5, 1242–1244. [44] Ashley Montanaro and Sam Pallister, Quantum algorithms and the finite element method, Physical Review A 93 (2016), no. 3, 032324, arXiv:1512.05903. [45] Elliott W. Montroll, On coupled rate equations with quadratic nonlinearities, Proceedings of the National Academy of Sciences 69 (1972), no. 9, 2532–2536. [46] Rany Qurratu Aini, Deden Aldila, and Kiki Sugeng, Basic reproduction number of a multi- patch SVI model represented as a star graph topology, 10 2018, p. 020237. [47] Andreas Rauh, Johanna Minisini, and Harald Aschemann, Carleman linearization for control and for state and disturbance estimation of nonlinear dynamical processes, IFAC Proceedings Volumes 42 (2009), no. 13, 455–460. [48] Sergei F. Shandarin and Yakov B. Zeldovich, The large-scale structure of the universe: turbu- lence, intermittency, structures in a self-gravitating medium, Reviews of Modern Physics 61 (1989), no. 2, 185–220. [49] Vivek V. Shende, Stephen S. Bullock, and Igor L. Markov, Synthesis of quantum-logic circuits, IEEE Transactions on Computer-Aided Design of Integrated Circuits and Systems 25 (2006), no. 6, 1000–1010, arXiv:quant-ph/0406176. [50] Willi-Hans Steeb and F. Wilhelm, Non-linear autonomous systems of differential equations and Carleman linearization procedure, Journal of and Applications 77 (1980), no. 2, 601–611.

35 [51] Massimo Vergassola, B´ereng`ereDubrulle, Uriel Frisch, and Alain Noullez, Burgers’ equation, devil’s staircases and the mass distribution for large-scale structures, Astronomy and Astro- physics 289 (1994), 325–356.

[52] Paul Waltman, Competition models in population biology, SIAM, 1983.

[53] Chaolong Wang, Li Liu, Xingjie Hao, Huan Guo, Qi Wang, Jiao Huang, Na He, Hongjie Yu, Xihong Lin, An Pan, Sheng Wei, and Tangchun Wu, Evolving epidemiology and impact of non- pharmaceutical interventions on the outbreak of coronavirus disease 2019 in Wuhan, China, Journal of the American Medical Association 323 (2020), no. 19, 1915–1923.

[54] Gul Zaman, Yong Han Kang, and Il Hyo Jung, Stability analysis and optimal vaccination of an SIR epidemic model, Biosystems 93 (2008), no. 3, 240–249.

36