# Simulating a 3-local Hamiltonian Term

This may be a fairly basic question, but in Nielsen & Chuang, the following circuit is given for simulating $$\exp\left(-i\Delta t Z_1 \otimes Z_2 \otimes Z_3\right)$$: which uses an ancilla qubit initialized to $$|0\rangle$$. But from messing around with different gate sequences, it seems like this can be done with

\begin{align} CNOT_{1,2}CNOT_{1,3}e^{-i\Delta t Z_3}CNOT_{1,3}CNOT_{1,2} \end{align} or even \begin{align} CNOT_{1,2}CNOT_{2,3}e^{-i\Delta t Z_3}CNOT_{2,3}CNOT_{1,2} \end{align}

which doesn't require the ancilla and has two fewer CNOTs. Is there any advantage to using an ancilla qubit in this circuit?

Yes, in this special case the circuit will simplify as you suggest. The advantage of the circuit that was given is that it generalises more easily, and works for any $$H$$ which has $$\pm 1$$ eigenvalues. Here's a general form of the circuit for your reference: This essentially comes down to an issue of how you can reversibly compute a one-bit function $$f:\{0,1\}^n\mapsto\{0,1\}$$ (the 0/1 answer conveys whether it's in the +1 or -1 eigenspace). You can guarantee to do this with $$n+1$$ bits. Sometimes you can do it with $$n$$ (basically if the function $$f$$ is balanced so that half the inputs give 0 answer and half give the 1 answer).