# How can I simulate Hamiltonians composed of Pauli matrices?

Suppose I want to perform the time-evolution simulation on the following Hamiltonians:

$$H_{1} = X_1+ Y_2 + Z_1\otimes Z_2 \\ H_{2} = X_1\otimes Y_2 + Z_1\otimes Z_2$$

Where $$X,Y,Z$$ are Pauli matrices. Since $$[X_1,Y_2] = 0$$, I can simultaneously perform the time evolution simulation of $$X_1$$ and $$Y_2$$. Thus, it seems like both Hamiltonians could be simulated using the following circuit ($$\pi$$ is just a random number):

Is this circuit looks right? If so, how can I tell the difference between these two Hamiltonians just by looking at the circuit?

• A related answer Nov 6, 2020 at 11:44
• Another point is that a tensor product in the Hamiltonian couples qubits together while the tensor product for gates does not. This means $H = X_{1}\otimes Y_{2}$ requires a two qubit gate to implement the associated evolution, while $H = X_{1} + Y_{2}$ can be implemented by two single qubit gates. In terms of circuit diagrams this means the tensor product $X_{1}\otimes Y_{2}$ should have a gate that connects $q_0$ and $q_1$, while the sum $X_{1} + Y_{2}$ would have separate gates for $q_0$ and $q_1$ (as you have in your figure above). Nov 6, 2020 at 13:26
• Note that what kind of two qubit gate(s) is used (and any other single qubit gates that are also used) depends on the hardware and how you implement the unitary. In the answer below these are the CNOT gates. Nov 6, 2020 at 13:29
• @Davit Khachatryan Thanks!!
– ZR-
Nov 6, 2020 at 14:06
• @N A McMahon Thank you so much, that's really helpful:)
– ZR-
Nov 6, 2020 at 14:15

The circuit to simulate the term $$e^{i Z \otimes Z t}$$ can be construct as

and the circuit to simulate the term $$e^{i X \otimes Y t}$$ can be construct as

Now to simulate $$H = X \otimes Y + Z \otimes Z$$, we can use Trotter approx with one time slice to get the following circuit to approximate $$e^{i (X \otimes Y + Z \otimes Z) t}$$ :

Now as commented by @tsgeorgios, in fact, $$X \otimes Y$$ and $$Z \otimes Z$$ are commute. That is,

$$[X\otimes Y, Z \otimes Z] = X\otimes Y \cdot Z \otimes Z - Z \otimes Z \cdot X\otimes Y = \boldsymbol{0}$$

you can see this explicitly as follows: $$X \otimes Y = \begin{pmatrix} 0 & 0 & 0 & -i\\ 0 & 0 & i & 0\\ 0 & -i & 0 & 0\\ i & 0 & 0 & 0\\ \end{pmatrix} \ \ \ \ \ \ \textrm{and} \ \ \ \ Z \otimes Z = \begin{pmatrix} 1 & 0 & 0 & 0\\ 0 & -1 & 0 & 0\\ 0 & 0 & -1 & 0\\ 0 & 0 & 0 & 1\\ \end{pmatrix}$$ hence you can see that $$X \otimes Y \cdot Z \otimes Z - Z \otimes Z \cdot X \otimes Y = \begin{pmatrix} 0 & 0 & 0 & 0\\ 0 & 0 & 0 & 0\\ 0 & 0 & 0 & 0\\ 0 & 0 & 0 & 0\\ \end{pmatrix}$$

that is they are commute with one another. This is important because if two matrix $$A$$ and $$B$$ are commute then we have that (See here. ) $$e^{A + B} = e^{A}e^{B}$$

What this tells us is that the above circuit is the exact representation of the term $$e^{i (X \otimes Y + Z \otimes Z) t}$$ and not just an approximation!

Now, the circuit to simulate $$e^{i X \otimes I t}$$ is:

and the circuit to simulate $$e^{i I \otimes Y t}$$ is:

As you can see, the Identity operator doesn't do anything! so you can ignore them out of the circuit.

Thus, the trotter approx circuit for $$e^{i (X \otimes I + I \otimes Y + Z \otimes Z) t}$$ is:

I would like to linked a very good and detail answer by @Davit Khachatryan to a similar question here.

• The paramters in $U3$ are fixed. They are meant to implement exactly that gate. The parameters in $R_Z$ gate is arbirary, depending on the coeffecient in the exponential. :) Nov 6, 2020 at 5:38
• It can be proven that if $t$ a real number and $P$ a matrix such that $P^2=I$ then $e^{iPt} = \cos(t) I + i\sin(t) P$. Hence if we have $P = I \otimes Y$ for instance, then we have $e^{i I \otimes Y t} = \cos(t) I \otimes I + i\sin(t) I \otimes Y = I \otimes \bigg[ \cos(t) I + i \sin(t) Y \bigg] = I \otimes e^{i Y t}$. This means we will only apply $e^{i Y t}$ operation to the second qubit, and the first qubit will be left alone. And we can decompose $e^{i Y t}$ into sequence of single qubit gates. Nov 6, 2020 at 6:07
• In fact, since $X \otimes Y$ and $Z \otimes Z$ commute, the first Trotter approx is exact. Nov 6, 2020 at 9:41
• Yes. Sorry about that. Nov 8, 2020 at 23:10
• Here is another good resource: github.com/DavitKhach/quantum-algorithms-tutorials/blob/master/… Nov 15, 2020 at 17:47