# Question Regarding Simulating Hamiltonian With Quantum Circuit

There have been a few other questions about this section of Nielsen and Chuang, but when working through the output of the circuit, there are some inconsistencies that are probably due to some mistep/false assumption of mine, and I can't seem to figure it out.

Suppose we have the Hamiltonian $$H = Z_1 ⊗ Z_2 ⊗ \cdots ⊗ Z_n,\tag{4.113}$$ which acts on an $$n$$ qubit system. Despite this being an interaction involving all of the system, indeed, it can be simulated efficiently. What we desire is a simple quantum circuit which implements $$e^{-iH\Delta t}$$, for arbitrary values of $$\Delta t$$. A circuit doing precisely this, for $$n = 3$$, is shown in Figure 4.19. The main insight is that although the Hamiltonian involves all the qubits in the system, it does so in a classical manner: the phase shift applied to the system is $$e^{-i\Delta t}$$ if the parity of the $$n$$ qubits in the computational basis is even; otherwise, the phase shift should be $$e^{i\Delta t}$$. Thus, simple simulation of $$H$$ is possible by first classically computing the parity (storing the result in an ancilla qubit), then applying the appropriate phase shift conditioned on the parity, then uncomputing the parity (to erase the ancilla).

Considering the case of n=3, let's say we had $$|\psi\rangle = a|000\rangle + b|110\rangle$$. The above circuit is supposed to apply $$e^{-iZ\otimes Z\otimes Z \Delta t}$$ to the three qubits. Using what I've read on tensor products,

$$e^{-iZ\otimes Z\otimes Z t}|\psi\rangle = e^{Z\otimes Z\otimes (-iZ \Delta t)}(a|000\rangle + b|110\rangle)$$

$$= a(e^Z|0\rangle e^Z|0\rangle e^{-iZ \Delta t}|0\rangle)+b(e^Z|1\rangle e^Z|1\rangle e^{-iZ \Delta t}|0\rangle)$$

Using Taylor Series, I found that $$e^Z|0\rangle = e|0\rangle$$ $$e^Z|1\rangle = \frac{1}{e}|1\rangle$$ $$e^{-iZ \Delta t}|0\rangle = e^{-i\Delta t}$$

$$e^{-iZ\otimes Z\otimes Z t}|\psi\rangle = a(e|0\rangle e|0\rangle e^{-i \Delta t}|0\rangle)+b(\frac{1}{e}|1\rangle \frac{1}{e}|1\rangle e^{-i \Delta t}|0\rangle)$$ $$= ae^2e^{-i \Delta t}(|0\rangle |0\rangle |0\rangle)+b\frac{1}{e^2}e^{-i \Delta t}(|1\rangle |1\rangle |0\rangle) \tag{eq. 1}$$

Once I did this, I attempted to evaluate what the circuit above, presented in Nielsen and Chuang, does to the vector $$|\psi\rangle$$.

$$|\psi \rangle = (a|000\rangle + b|110\rangle)|0\rangle$$

Since both $$|000\rangle$$ and $$|110\rangle$$ are even, we apply $$e^{-iZ\Delta t}$$ to the aux 4th qubit, so we get:

$$|\psi \rangle = (a|000\rangle + b|110\rangle)e^{-iZ\Delta t}|0\rangle$$

And since we know that $$e^{-iZ\Delta t}|0\rangle =e^{-i\Delta t}|0\rangle$$

$$|\psi \rangle = (a|000\rangle + b|110\rangle)e^{-i\Delta t}|0\rangle$$ $$= a(e^{-i\Delta t})(|000\rangle) + b(e^{-i\Delta t})(|110\rangle) \tag{eq. 2}$$

But this equation 2 isn't equivalent to equation 1! What exactly am I missing here? The output of the circuit isn't matching up with what happens when I actually put the state $$|\psi\rangle$$ through that transformation.

I think the problem is in this assumption:

$$e^{-i Z \otimes Z \otimes Z t} |110\rangle = e^{Z}|1\rangle e^{Z}|1\rangle e^{-iZt}|0\rangle$$

It shouldn't be right, because, at least, $$e^{Z}$$ is not a unitary transformation (normalization is changed).

Now let's try to find out the actual action of the operator. Note that in all calculations I have replaced $$\Delta t$$ with $$t$$.

From 4.2 exercise from M. Nielsen and I. Chuang textbook: Let $$t$$ be a real number and $$A$$ a matrix such that $$A^2 = I$$. Then

$$e^{i A t} = \cos(t) I + i \sin(t) A$$

So, by taking into account that $$\left[Z \otimes Z\otimes Z\right]^2 = I$$, the action of the operator on $$|011\rangle$$ will be:

$$\begin{equation*} e^{-i Z \otimes Z \otimes Z t} |110\rangle = \left( \cos(t) I - i \sin( t) Z Z Z \right) |110\rangle = \\ =\cos( t) |110\rangle - i \sin(t) Z|1\rangle Z|1\rangle Z|0\rangle = \\ = \cos(t) |110\rangle - i \sin(t) (-1)|1\rangle (-1)|1\rangle (+1)|0\rangle = \\ = \left(\cos(t) - i \sin(t)\right) |110\rangle = e^{-i t}|110\rangle \end{equation*}$$

So as one can see if in the bit string we have even a number of $$1$$s (parity), then the phase will be $$e^{-it}$$, otherwise, the phase multiplied to the corresponding bit string will be $$e^{it}$$.

The circuit presented in the question does parity check with CNOTs: if in the bit string we have an even number of $$1$$s the target (ancillary) qubit will be in $$|0\rangle$$ state and:

$$e^{-i Z t} |0\rangle |\text{even parity}\rangle = e^{-i t} |0\rangle |\text{even parity}\rangle$$

The second group of CNOTs will not change that state. Otherwise, if in the bit string we have an odd number of $$1$$s the target (ancillary) qubit will be in $$|1\rangle$$ state and:

$$e^{-i Z t} |1\rangle |\text{odd parity}\rangle = e^{i t} |1\rangle |\text{odd parity}\rangle$$

After the second group of CNOTs (uncomputing the changes in the target qubit) we will have:

$$e^{i t} |0\rangle |\text{odd parity}\rangle$$

So the circuit does what we want.

• Ahh, thank you, I completely forgot about checking whether $e^Z$ is a unitary transform. Apr 26 '20 at 18:00
• @RehaanAhmad, happy to help :). Also, note that after doing Taylor expansion for $e^{-iZ \otimes Z \otimes Z \otimes t}$, one can obtain $e^{-iZ \otimes Z \otimes Z \otimes t} = \cos(t) I - i\sin(t) ZZZ$. Like the formula for $A$ operator that also can be obtained by using Taylor series. Apr 26 '20 at 18:15