# How to find parameters for circuit decomposition of Hamiltonian simulation of any matrix $A$?

In version 2 of the paper Quantum Circuit Design for Solving Linear Systems of Equations by Cao et al., they have given circuit decomposition for $$e^{iA\frac{2\pi}{16}}$$, given a particular $$A_{4\times 4}$$ matrix, in Fig 4. I am trying to find equivalent decomposition for a $$2\times 2$$ matrix like $$A'=\begin{pmatrix} 1.5&0.5\\0.5&1.5 \end{pmatrix}$$. Can anyone explain and summarize the standard method for this?

• For a worked out circuit design involving a $2\times 2$ matrix, see the third version of the same paper. Also, please keep in mind that this is a rather homework-type question: you are asking us to do the complete circuit design for your specific matrix. It would be better for you to go through the steps highlighted in the v2 and v3 of the paper and try to design the circuit by yourself. We'll help you when you get stuck in specific steps or specific concepts. However, in its current form, the question seems too broad and homework-ish to me. – Sanchayan Dutta Nov 25 '18 at 6:17
• @Blue I was not able to find proper method for this. Thanks! – MeetR Nov 25 '18 at 6:37
• No problem. Welcome to Quantum Computing SE! In your current edit, you ask: "Can anyone recommend a standard method for this?". That standard method is already explained in v3 of the paper. In my opinion, it wouldn't be practically feasible for users to write a whole paper-length answer your question. So, it is much better if you ask for help when you get stuck in a specific step while reading the paper(s). Nevertheless, feel free to ask other specific questions regarding the paper. – Sanchayan Dutta Nov 25 '18 at 6:41

The simplest method to implement $$e^{iA\theta}$$ for a small, Hermitian matrix $$A$$ is to:

1. Find the eigenvectors $$|\lambda\rangle$$ and eigenvalues $$\lambda$$ of $$A$$.
2. Construct the unitary $$U=\sum_i|i\rangle\langle\lambda_i|$$.
3. Implement the gate sequence:
• $$U$$
• $$e^{i\theta\sum_i\lambda_i|i\rangle\langle i|}$$
• $$U^\dagger$$

Now, for one qubit, you have the middle term is equivalent to $$e^{i\theta(\lambda_0-\lambda_1) Z}$$, up to an irrelevant global phase.

Technically, this answers your question. However, this is a silly way of doing it for solving a system of linear equations. If you can find the eigenvectors of $$A$$, you might as well directly invert the linear system.

So, instead, you need to proceed as if you cannot directly calculate the eigenvalues/vectors, because you're going to use your implementation of $$A$$ within a phase estimation protocol to find these. There are various methods for Hamiltonian simulation. A very basic summary of one method (there are much more efficient methods available) is here. But your given example is kind of trivial: I decompose $$A'=\frac32\mathbb{I}+\frac12X,$$ and since you don't care about a global phase, one might as will implement $$e^{i\theta X}$$, for whatever the relevant $$X$$ is. Now it depends on what gates you're allowing in your quantum circuit as to how you decompose it. You might be able to implement it directly. Or, if you've only got a finite gate set such as $$H$$ and $$T$$, you might need to apply the Solovay-Kitaev algorithm to get a good decomposition.