# Gate sequence for exponential of product of Pauli Z operators

I want to compile $$\exp(-i \theta \sigma_i^z \sigma_j^z)$$ down to a gate sequence of single qubit rotations and CNOTs. How do I do this? What is the general procedure for compiling a unitary $$U$$ to an elementary gate sequence? (As I understand it, this is a very hard problem, but I am curious how I could begin going about it.)

• Please clarify what you mean by arbitrary unitaries. The operator you give is an arbitrary unitary, no? – psitae Jan 9 '19 at 21:58

On the computational basis. This acts as $$e^{-i \theta}$$ when both are the same and $$e^{i \theta}$$ when they are different.

So first do a circuit that computes whether or not they are the same or not. That is do the following:

$$\begin{eqnarray*} | 0 0 \rangle &\to& | 0 0 \rangle\\ | 0 1 \rangle &\to& | 0 1 \rangle\\ | 1 0 \rangle &\to& | 1 1 \rangle\\ | 1 1 \rangle &\to& | 1 0 \rangle\\ \end{eqnarray*}$$

That is the first qubit is left alone and the second is 0 when they are the same and 1 when different. This is a $$CNOT_{12}$$

Now do a single qubit unitary that does

$$\begin{eqnarray*} | 0 \rangle &\to& e^{-i \theta} | 0 \rangle\\ | 1 \rangle &\to& e^{i \theta} | 1 \rangle\\ \end{eqnarray*}$$

on the second qubit.

Now put the second qubit back to what it was with another $$CNOT_{12}$$.

In total:

$$\begin{eqnarray*} | 0 0 \rangle &\to& e^{-i \theta} | 0 0 \rangle\\ | 0 1 \rangle &\to& e^{i \theta} | 0 1 \rangle\\ | 1 0 \rangle &\to& e^{i \theta} | 1 0 \rangle\\ | 1 1 \rangle &\to& e^{-i \theta} | 1 1 \rangle\\ \end{eqnarray*}$$

It does the right thing on the computational basis and so we are done.