Solving partial differential equations (PDEs) is key to describing various issues in condensed matter physics, fluid simulation, electromagnetic field analysis, and other fields as mathematical models [1]. Therefore, identifying efficient algorithms for solving PDEs is crucial. Thus, numerous studies has explored the numerical analysis of PDEs.
Quantum algorithms (QAs), which are computational algorithms employing quantum computers, have attracted attention owing to their ability to solve specific issues more efficiently compared with classical computers. Notably, QAs have been demonstrated to outperform classical computers in solving certain problems. Hence, QAs have been deployed to solve problems in various fields such as machine learning [2,3], integer factorization [4], and combinatorial optimization [5]. Further, the Harrow–Hassidim–Lloyd (HHL) algorithm [6], a QA for solving linear equations, can solve linear equations obtained via PDEs discretization. However, the HHL algorithm requires a sufficient number of qubits and error correction techniques on quantum computers, which may require a long development time. To resolve this shortcoming, quantum-classical hybrid algorithms, employing noisy intermediate-scale quantum (NISQ) devices [7] with intermediate numbers of qubits, combined with classical computers, have gained attention. Among these quantum-classical hybrid algorithms, the variational quantum algorithms (VQAs) can operate on NISQ devices.
VQAs [8] are algorithms for minimizing objective functions containing approximate solution vectors. These approximate solution vectors are generated by quantum gates (ansatz gates) depending on parameters. The parameter updates are performed using iterative algorithms to minimize the objective function represented by approximate solution vectors. Thus, VQA is highly versatile and has been applied to various tasks such as solving eigenvalue problems using the variational quantum eigenvalue solver [9,10], quantum machine learning [2], and quantum approximate optimization algorithms [5].
To obtain the value of the objective function using VQA, the computation is performed by measuring the expectations. Furthermore, two conventional methods for calculating expectations on a quantum computer are projective measurements and the Hadamard test [11]. To compute expectations using projective measurement and the Hadamard test, the matrices involved must be measurement operators and unitary, respectively. Therefore, to implement VQAs, decomposing a matrix into a linear combination of unitary matrices and measurement operators represents a crucial challenge.
Many researchers have proposed methods for solving linear equations using VQAs [12–18]. Notably, Sato et al. proposed VQAs to solve linear equations obtained by the discretization of the Poisson equation [18]. To solve Ax = b for a symmetric positive definite matrix A, the minimizing problem for x†Ax/2 – x†f was solved using VQAs in the previous study, which was aimed at solving the Poisson equation, where x†denotes the conjugate transpose of x. Furthermore, the number of terms involving expectations in the objective function value was accelerated to O(1) regardless of the matrix size by decomposing the coefficient matrix into a linear combination of unitary matrices and measurement operators. However, A must be a symmetric positive definite to ensure its formulation as a convex quadratic programming problem. Additionally, as A in the Poisson equation exhibits a specific structure, extending the methods employed in previous studies to other PDEs may be challenging. For example, for differential equations containing advection terms in fluid simulations, A becomes non-symmetric, thereby complicating the use of existing VQAs to solve the problem.
Thus, we propose VQAs for solving general second-order linear differential equations containing constant coefficients, e.g., the Poisson equation. Generally, second-order linear differential equations containing constant coefficients include advection terms, thus yielding non-symmetric coefficient matrices when discretized. For example, A obtained from the discretization of the Poisson equation with the Dirichlet boundary condition represents a special tridiagonal Toeplitz matrix that is symmetric and positive definite. Conversely the A obtained by discretizing a second-order linear differential equation containing constant coefficients and the Dirichlet boundary condition is a general tridiagonal Toeplitz matrix. To handle the non-symmetric A, we considered the normal equation A†Ax = A†b for the original linear equation (Ax = b) because A†A is always a symmetric positive definite when A is a nonsingular, making it reducible to a convex quadratic programming problem1. Furthermore, solving the normal equation is equivalent to solving the least squares problem for minimizing the norm ∥Ax – b∥. Similar to previous study [18], as matrices A†A and A in the normal equation are not unitary matrices, they must be decomposed into linear combinations of unitary matrices and measurement operators. Thus, for A in second-order linear differential equations containing constant coefficients with the periodic boundary condition, we decomposed them into a linear combination of unitary matrices and measurement operators. Furthermore, by adding a correction term to A with the periodic boundary condition, we attempted the decomposition of the A for the case of the Dirichlet boundary condition. However, as the matrices employed for this correction do not possess unitarity and Hermiticity, we proposed a method for converting these correction matrices into projection operators or unitary matrices, ensuring it their applicability even under the Dirichlet boundary condition.
The remainder of this paper is structured as follows: Section 2 presents an overview of the extant studies on VQAs for solving the Poisson equation. Next, Section 3 reports the construction the objective function for the constantcoefficient second-order linear differential equations on the basis of VQAs. Thereafter, we demonstrated the decomposition method for the matrices included in the objective function under the periodic boundary condition. Next, we present the decomposition method for the correction matrices for cases involving the imposition of the Dirichlet boundary condition is imposed on section. Section 4 presents numerical examples using the proposed method implemented by Qiskit in this section. Finally, Section 5 concludes the paper and discussing the future directions.
Here, we describe VQA for solving the Poisson equation based on Sato et al.’s study [18]. For the domain Ω = (L, R)d, (L, R ∈ ℝ, L < R), the d-dimensional Poisson equation with a given function f : Ω → ℝ is given by the following equation:
To simply explain the previous study, we consider here the Dirichlet boundary condition:
For simplicity, we restrict the study to the case where d = 1. Thus, by discretizing Eq. (1) using the finite difference method with the interval-partition width h = (R – L)/(N + 1), we derive the following linear equation:
In the following sections of this paper, we will consider N = 2n with respect to the number of qubits n ∈ ℤ+.
To minimize Ev(ν), the vector ν is assumed to be represented as ν = r |ψ(θ)⟩ and determine νmin from this representation. Here, r ∈ ℝ is the norm of ν, and |ψ(θ)⟩ is a quantum state vector depending on the parameter θ. In this study, |ψ(θ)⟩ generated by unitary matrices U(θ) is conventionally referred to as an ansatz gate, which is constructed by stacking the layers of Ry gates and CNOT gates. Notably, the ansatz parameters θ is given by the following
On the basis of the foregoing, using r and θ, the objective function Ev (ν) is redefined as follows:
By minimizing ℱ(r, θ) with respect to r, we can reduce the problem to a minimization problem with respect to θ.
Furthermore, for any quantum state vector |φ⟩ or |ψ⟩, we define
Then, the following can be obtained using Eq. (4):
Furthermore, the quantum state |ϕ, ψ⟩ shown in Eq. (4) is constructed by the quantum circuit in Figure 1. Here, the unitary matrices Uϕ and Uψ satisfy |φ⟩ = Uφ|0⟩⊗n and |ϕ⟩ = Uϕ | 0⟩⊗n, respectively. The construction of multiple controlled-Uϕ and controlled-Uψ requires O(n2) quantum gates and a circuit depth of O(n) [20].

Quantum circuit diagram for generating |ϕ, ψ⟩.
The coefficient matrix A(d) in the d-dimensional Poisson equation is expressed using matrix A as follows:
Following Eq. (6), assuming a problem can be formulated in one dimension, it can also be formulated in higher dimensions. Therefore, in this paper, we will discuss the one-dimensional VQA in this paper.
We consider the following d-dimensional second-order linear PDEs:
This difference equation is represented by the following linear equation:
However, as M is not always a symmetric positive-definite matrix, VQA for the Poisson equation cannot be applied to the optimization problem. Hence, we solve the following normal equation:
Additionally, we obtain the following objective function ε(θ) by substituting Eq. (11) for Eq. (3)
Thus, Algorithm 1 expresses how to solve second-order linear PDEs using a VQA. Here, the formulation of the gradient of the objective function ▽ε (θ) is discussed in the Appendix A.
VQAs for second-order linear PDEs
Require: Objective function ε and gradient ▽ε;
an initial ansatz parameter θ0 ; a tolerant parameter of gradient norm ϵ
Ensure: Optimized ansatz parameter θopt and an optimized quantum state |ψ(θopt)⟩
1: while ∥▽ε (θ)∥ ≥ ϵ do
2: Encode |ψ(θ)⟩ on a quantum computer
3: Evaluate ε(θ) and ▽ε (θ) on a quantum computer
4: Update θ using a optimization method employing ε(θ) and ▽ε (θ) on a classical computer.
5: end while
As M is not unitary, we cannot directly calculate
Thus, matrix M†M is represented by
Employing Eq. (13). Let us denote
The second term ψ(θ)| (PP + P†P†) |ψ(θ) in Eq. (13) can be evaluated as
From the foregoing, the denominator in Eq. (3) can be decomposed to
Note that if |ψ(θ)⟩, |ψ+ (θ)⟩, |ψ–(θ)⟩ and |f⟩ are real-valued vector, then the inner products ψ(θ)|f⟩, ⟨ψ+(θ)|f⟩, ⟨ψ–(θ)|f⟩ are commutative.
The proposed method can be applied to the Dirichlet boundary condition. Notably, Md can also be decomposed into
Thus,
To calculate the expectation of Eq. (16) on a quantum computer, we decompose the matrix MBC into symmetric and non-symmetric matrices, ν and W, respectively.
Here, ν and W are given as follows:
To compute the numerator and denominator of ε(θ) (Eq. (12)) on a quantum computer, we introduce two decomposition methods for V and W.
Employing Eq. (16), the numerator of Eq. (12) is decomposed into the following terms:
The first term in Eq. (18) can be computed using the proposed method with the periodic boundary condition. Therefore, the second term in Eq. (18) is decomposed into
We perform the decomposition using Eq. (17). Afterward, we extract the following outer products with a computational basis from the matrix included in each term in Eq. (19):
To compute the expectations in a quantum computer, these outer products must be denoted as measurement operators. Further, by performing matrix decomposition using measurement operators, we localize the quantum circuits and reduce the number of measurements involved in expectation-value measurement.
Here, we define the measurement operators |GHZ⟩, |GHZ+⟩, and |GHZ–⟩, as
Here these unitary matrices, UGHZ, UGHZ+, UGHZ– ∈ ℝN×N are equivalent to the quantum circuits shown in Figures 2, 3 and 4, respectively: these quantum circuits are constructed using 𝒪(n) fundamental quantum gates.

Quantum circuit diagram for UGHZ

Quantum circuit diagram for UGHZ+

Quantum circuit diagram for UGHZ–
Furthermore, these outer products can be introduced as projection operators using Eqs. (20) and (21) and (22).
From the above, Eq. (19) is given as follows, and the expectation can be obtained from the projection measurement for each term.
The third term of Eq. (18) is given as follows:
From the above, Eq. (18) is decomposed into the following terms:
Employing Eq. (15), we decomposed the denominator of Eq. (12) as follows:
The given matrix factorization is limited to cases where V and W could be decomposed into measurement operators, represented as the expected values of V and W, respectively. Alternatively, we consider the decomposition method for calculation using a quantum computer. Furthermore, matrices V and W can be decomposed as follows:
From the above, the expectation (23) is decomposed into the linear combination of the expectation of VBC and WBC.
Furthermore, the quantum circuits corresponding to VBC and WBC are shown in Figures 5 and 6, respectively. The quantum circuits of VBC and WBC comprise n – 1 control bits and one target multi-Toffoli gate. Since VBC and WBC include multi-controlled Toffoli gates, they require a circuit depth of O(n) and are composed of O(n) elementary quantum gates, with an ancilla qubit [21]. Furthermore, considering the circuit cost of Eq. (4), one can see that a total of O(n2) elementary quantum gates is required. Therefore, from the perspective of gate implementation costs [22], decomposing into projection operators is effective for obtaining the expected values of matrices

Quantum circuit diagram of VBC.

Quantum circuit diagram of WBC.
Classical shadows are a useful technique for efficiently estimating expectation values [23]. In particular, by using random Clifford circuits, it is possible to compute expectation values with respect to arbitrary matrices. However, since the upper bound of the variance for random Clifford measurements scales as O(tr(M2)), the variance depends on the values of α, β, and γ. That is, as these values increase, the variance also increases. In contrast, in our method, the error in the expectation value does not depend on the magnitude of the individual matrix components (α, β, and γ). Therefore, when tr(M) is large, our method can be considered advantageous
Additionally, expectation value estimation using the Extended Bell Measurement (XBM) is also a useful approach [24]. XBM is a technique for estimating expectation values of banded matrices and can compute expectation values involving tridiagonal matrices using O(n) measurement operators. The measurement operators used in XBM consist of at most n – 1 CNOT gates and one Hadamard gate. XBM is applicable to general problems including Eq. (7). However, simultaneous measurements using XBM yield not only the matrix elements required for computation but also additional and irrelevant elements, which may lead to a higher number of shots required to compute the expectation values. In contrast, our method, particularly with the periodic boundary condition, is tailored for second-order linear differential equations with constant coefficients, and therefore avoids computing irrelevant elements. We will investigate the relationship between the number of unnecessary elements and the required number of shots elsewhere in the future.
In this section, we present numerical-analysis experiments using the proposed method. In this experiment, a quantum computing simulation is performed using a classical computer. Further, Qiskit (version 0.38.0) is used as the quantum computation library [25], and Qiskit provided a simulator backend. In this experiment, we exclusively employed the Qiskit StatevectorSimulator. As StatevectorSimulator performed matrix-vector operations internally, it does not account for the sampling errors that may arise in the calculation of the expectation value.
The initial values of the variational parameters were randomly selected from the
Further, we constructed a specific ansatz gate layer (Figure 7) and the number of the ansatz-gate layer m was 3.

Quantum circuit diagram for the ansatz gate U(θ).
To compare the numerical solutions obtained with the proposed method, the solutions obtained using LU decomposition for the linear equation (Eq. (8)) were utilized.
The following PDEs was considered for the numerical calculations:
Figure 8 shows that the solution obtained using the proposed method was plotted, exhibiting significant agreement with the analytical solution. Furthermore, Table 1 shows that regardless of the increase in the number of qubits, ϵc and ϵq exhibited nearly identical values, indicating that the solution obtained using the proposed method performed at a comparable level with that obtained via classical computation. Therefore, we concluded that the proposed method functioned appropriately as a method for solving second-order linear differential equations with constant coefficients.

Plot of the analytical solution of Eq. (24) for 5 qubits, and the solution obtained using the proposed method.
Relative errors, ϵc and ϵ for n = 3, 4 and 5 qubit cases.
| the number of qubits | the relative error ϵc | the relative error ϵq |
|---|---|---|
| 3 qubits | 7.8455 × 10−4 | 7.8478 × 10−4 |
| 4 qubits | 2.2014 × 10−4 | 2.2027 × 10−4 |
| 5 qubits | 5.8441 × 10−5 | 4.4997 × 10−4 |
In this study, we proposed a VQA for solving constant-coefficient second-order linear differential equations with the periodic and the Dirichlet boundary condition, and our finding contributed the following two points to the extant literature:
We provided ε(θ) for the normal equations corresponding to the discretized linear equations and demonstrated a matrix decomposition method for reducing them to a computationally feasible form on a quantum computer.
For the case involving the imposition of the Dirichlet boundary condition, we proposed a method that focused on the difference between the matrices obtained with the periodic and Dirichlet boundary condition, following by decomposing this difference into a linear combination of unitary matrices and measurement operators.
To solve the linear equation, Mu = f, the condition number is given by
When the condition number κ was large, the numerical solution tended to be unstable. Particularly, as κ of the normal equations M†Mu = M†f(κ(M†M) was approximately the square of κ(M), directly solving the normal equations presented a numerically unstable problem. In classical computation, preconditioning is conventionally performed to improve κ. Therefore, QAs that improve κ of the coefficient matrices and reduce the computational cost of the objective function. However, studying the preconditioning matrices for efficient quantum computation is a challenging task, requiring entirely different approaches from the existing preconditioning methods [19]. In VQAs, It is important to avoid barren plateaus when computing the objective function is an important issue. Barren plateaus refer to the phenomenon where the gradient of the objective function vanishes exponentially with respect to the number of qubits. This issue arises due to the execution of deep quantum circuits or measurements involving global quantum operations [26]. Although a complete solution to the barren plateaus problem has not yet been discovered, strategies that mitigate its effects are preferable. For example, designing ansatz gates specialized for specific problems has been proposed as a potential approach [27].