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):

Enter image description here

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


Posted 2020-11-06T03:55:49.567

Reputation: 988


A related answer

– Davit Khachatryan – 2020-11-06T11:44:56.130

1Another 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). – N A McMahon – 2020-11-06T13:26:48.577

1Note 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. – N A McMahon – 2020-11-06T13:29:35.337

1@Davit Khachatryan Thanks!! – Zhengrong – 2020-11-06T14:06:59.707

@N A McMahon Thank you so much, that's really helpful:) – Zhengrong – 2020-11-06T14:15:38.180



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

enter image description here

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

enter image description here

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}$ :

enter image description here

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:

enter image description here

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

enter image description here

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:

enter image description here

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


Posted 2020-11-06T03:55:49.567

Reputation: 6 322

Thank you so much for the reply! Are all the parameters in U3 and Rz gates random variables? – Zhengrong – 2020-11-06T05:36:02.403

1The 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. :) – KAJ226 – 2020-11-06T05:38:21.840

Thanks! I'm kind of new to quantum computing, could you give me some suggestions on how I can come up with ideas in constructing the circuit for ^⊗ and ^⊗t? – Zhengrong – 2020-11-06T05:45:21.653

1It 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. – KAJ226 – 2020-11-06T06:07:08.110

Thank you so much:) – Zhengrong – 2020-11-06T06:21:22.327

1In fact, since $ X \otimes Y $ and $ Z \otimes Z $ commute, the first Trotter approx is exact. – tsgeorgios – 2020-11-06T09:41:55.650

@tsgeorgios Thanks for the comment! Could you explain a bit about how can I understand they are commute? – Zhengrong – 2020-11-06T14:25:00.393

@KAJ226 Thanks for the update, that's really helpful:) – Zhengrong – 2020-11-06T16:20:21.253

@KAJ226 Should the gates designed for $ ^{⊗}$ be on q1 and $^{⊗}$ on q0? Thanks:) – Zhengrong – 2020-11-08T22:50:25.770

1Yes. Sorry about that. – KAJ226 – 2020-11-08T23:10:20.600

@KAJ226 Could you explain a bit about how the circuit for $e^{iX\otimes Yt}$ is constructed? Like why there are two $U_3$ gates on the two sides? (Or are there any relevant resources?) Thank you so much:) – Zhengrong – 2020-11-15T06:01:31.213

Yes. The idea is that it comes down to the fact that: $X = HZH$ and $Y = U_3(\pi/2, \pi/2, \pi/2) Z U_3(-\pi/2, \pi/2, \pi/2)$. And we already know how to implement the circuit to represent the evolution $e^{i t Z \otimes Z }$, so if $Z$ is now switched to $X$ then we placed the $H$ gate infront... and if $Z$ was instead replaced with $Y$ then we placed $U_3(\pi/2, \pi/2, \pi/2) $ in front and its inverse $U_3(-\pi/2, \pi/2, \pi/2)$ at the end.... This extends to higher number of qubit as well. – KAJ226 – 2020-11-15T17:46:18.830


Here is another good resource:

– KAJ226 – 2020-11-15T17:47:12.347