# Solving Multidimensional Partial Differential Equations Using Efficient Quantum Circuits
## 4 Materials and Methods
### Proposed Methodology: Scalable and Accurate PDE Solver Algorithm  
The high-level overview of the proposed PDE solver algorithm for Variant 1 and Variant 2 is shown in Figure 4a,b.  
By applying FDM, a partial differential equation (PDE) can be converted into a system of linear equations, see (2):  
\[A\vec{u}=\vec{b} \tag{2}\]  
As stated earlier, our proposed algorithm needs a preprocessing step of polar decomposition and SVD. We apply polar decomposition to the matrix \(A\), see (2) to factor it into a unitary matrix \(U\) and a positive semi-definite symmetric matrix \(P\), see (3).  
\[(PU)\vec{u}=\vec{b} \tag{3}\]  
By rearranging (3), we can obtain (4), which can be further rearranged into (5). We then divide both sides of (5) with the normalization factor \(||P^{-1}\vec{b}||\) to obtain (6).  
\[U\vec{u}=P^{-1}\vec{b} \tag{4}\]  
\[\vec{u}=U^{\intercal}P^{-1}\vec{b} \tag{5}\]  
\[\frac{\vec{u}}{\left\|P^{-1}\vec{b}\right\|}=U^{\intercal}\cdot\left(\frac{P ^{-1}\vec{b}}{\left\|P^{-1}\vec{b}\right\|}\right) \tag{6}\]  
We can rewrite (6) in the form shown in (7), where \(|\psi_{in}\rangle\) is the input quantum state encoded using C2Q encoding [21], and \(|\psi_{out}\rangle\) is the corresponding output state after applying \(U^{\intercal}\) to \(|\psi_{in}\rangle\). Converting \(U^{\intercal}\) into a quantum circuit is accomplished using the approach of numerical instantiation [22] in Variant 1, and using CCD [23; 24] in Variant 2.  
\[|\psi_{out}\rangle=U^{\intercal}\cdot|\psi_{in}\rangle\text{, where }|\psi_{ out}\rangle=\frac{\vec{u}}{\left\|P^{-1}\vec{b}\right\|}\text{, and }|\psi_{in}\rangle=\frac{P^{-1}\vec{b}}{\left\|P^{-1}\vec{b}\right\|} \tag{7}\]  
Figure 4: Proposed PDE solver algorithm (**a**) Variant 1 (**b**) Variant 2.  
To solve (7), we require \(U\)\({}^{\dagger}\) and \(P^{-1}\). Both can be derived by applying the Singular Value Decomposition (SVD) [38] to \(A\), as specified in (8). In this decomposition, \(\Sigma\) is a diagonal matrix, and \(W\) and \(V\) are unitary matrices.  
\[A=PU=W\Sigma V^{\dagger}\text{, where }P=W\Sigma W^{\dagger}\text{, and }U=WV^{\dagger} \tag{8}\]  
The value of \(P^{-1}\) and \(U\)\({}^{\dagger}\) can be obtained using (9) and (10), respectively.  
\[P^{-1}=W\Sigma^{-1}W^{\dagger} \tag{9}\]  
\[U^{\dagger}=VW^{\dagger} \tag{10}\]  
The value of \(|\psi_{in}\rangle\), as shown in (11), can be obtained by using (9) in (7).  
\[|\psi_{in}\rangle=\frac{W\Sigma^{-1}W^{\dagger}\overline{b}}{\left\|W\Sigma^{ -1}W^{\dagger}\overline{b}\right\|} \tag{11}\]  
The quantum circuit generated using the numerical instantiation technique [22] in Variant 1 and using CCD [23; 24] in Variant 2 circuit receives \(|\psi_{in}\rangle\) as its input state and generates \(|\psi_{out}\rangle\) as an output state, see (7). By measuring \(|\psi_{out}\rangle\), we recover the classical vector \(\overrightarrow{\psi}_{out}\) as given in (12) [39]. The unknown vector \(\vec{u}\) can then finally be obtained using (13) [39].  
\[\overrightarrow{\psi}_{out}\approx U^{\dagger}|\psi_{in}\rangle \tag{12}\]  
\[\vec{u}=\overrightarrow{\psi}_{out}\left\|W\Sigma^{-1}W^{\dagger}\overline{b}\right\| \tag{13}\]