# Implementation of the HHL Algorithm for Solving the Poisson Equation on Quantum Simulators
## 2 Materials and Methods
### HHL Algorithm
The operator applied in this step is a controlled unitary operator acting on two qubits: the first qubit is in the state \(\left|1\right\rangle\), and the second qubit corresponds to the matrix element \(A\). The operator \(\left|1\right\rangle\)U is needed to apply the matrix \(A\) only when the first qubit is in the state \(\left|1\right\rangle\). If the first qubit is in the state \(\left|0\right\rangle\), then the second qubit remains in the same state. Thus, using this operator, one can effectively apply the matrix \(A\) to the state \(\left|1\right\rangle\), resulting in the state \(\left|1\right\rangle\left|1\right\rangle\). As a result of this step, the state of the system is described by the vector \(\left|1\right\rangle\left|1\right\rangle\), where \(\left|1\right\rangle\) is some quantum vector encoding the matrix \(A\). After these steps, the quantum circuit looks like the one shown in Figure 5.  
Figure 4: Block diagram of the solution and creation of a quantum circuit. Then, the QFT is performed on the qubits corresponding to the vector and matrix \(A\) on the right side. In this step, the transfer is performed, which allows us to transfer the states of the qubits corresponding to the vector on the right side and the matrix \(A\) from the measurement basis (for which measurements are obtained in the previous stages) to a basis that allows us to observe something like the eigenvalues of the matrix \(A\) and the right side of Equation (5). In quantum computing, the states of qubits are represented as a superposition of states, where each state represents one of the possible values that can be obtained by measuring the qubit. Thus, when a qubit is measured, different values are obtained with a certain probability depending on the state of the qubit. However, using the Fourier transform, one can transfer the states of qubits to another basis, to the Fourier basis. On this basis, the states of the qubits are represented by superpositions, where each state represents one of the possible values of the \"frequency\". This base represents the \"eigenvalues\" of the matrix \(A\) and the vector \(b\), which constitute the solution to Equation (5). So, using the QFT, the results of measurements of qubits in the Fourier basis are obtained, where there are \"frequency\" values of the matrix \(A\) and vector \(\mathsf{b}\), and the measurement operation is applied to obtain a solution to the equation. To achieve this, the Hadamard transform is used. The Hadamard transform is one of the fundamental transforms in quantum computing and it is widely used in various quantum algorithms. In particular, the Hadamard transform can be used to solve the Poisson equation on a quantum computer. The Hadamard transform is applied to a state of \(\mathsf{n}\) qubits and transforms it into a superposition of all possible states \(\mathsf{1}x\), where \(x\) is a binary representation of a number from \(0\) to \(2^{n-1}\). Mathematically, this can be expressed as follows:  
\[\mathsf{H}\otimes\mathsf{n}\ |\ 0\rangle=2\mathsf{n}-1\!\sum_{\mathsf{x}=0}^{2 \mathsf{n}-1}|\ \mathsf{x}\rangle \tag{10}\]  
The next step is to measure the qubit corresponding to the vector on the right. In this case, it is the probability of obtaining \(0\) or \(1\). This step applies the measurement operation to the first qubit in the quantum circuit. This means that the first qubit is measured, and the result is a classical bit, which can be either \(0\) or \(1\). When the first qubit is measured, the wave function of the system \"collapses\" into one of two ground states: \(\mathsf{1}0\rangle\) or \(\mathsf{1}1\rangle\). The first qubit is measured to determine how close the state vector of the quantum system, which is  
Figure 5: Quantum circuit after converting \(A\) and \(b\) into quantum states. the right-hand side of the equation, is to the \(\ket{10}\) basis vector.