# How to factor Ising YY coupling gate into product of basic gates?

Let us consider Pauli YY coupling gate of the following form

$$YY_\phi= \left(\begin{matrix} \cos(\phi) & 0 & 0 & i \sin(\phi) \\ 0 & \cos(\phi) & -i \sin(\phi) & 0 \\ 0 & -i \sin(\phi) & \cos(\phi) & 0 \\ i \sin(\phi) & 0 & 0 & \cos(\phi) \end{matrix}\right)$$

I want to use this gate but I struggle rewriting it as product of unitaries representing the basic universal quantum gates ($$Rz(\phi)$$, CNOT, $$H$$ and $$\frac{\pi}{8}$$ gate).

A textbook by Nielsen & Chuang provides some gate identities allowing to write them (page 185, (4.32)-(4.39)) but YY is not listed.

I tried to match this form using by trial and error but there was always at least one sign that was wrong.

Could someone give some hints how to factor it out into usable gates or maybe provide a reference with circuit which implements this gate?

I did it like this (no promises that it's minimal!): Basically, I realised that by swapping the second and last rows and columns of your target matrix (achieved using the first and last controlled-nots in the circuit), you get something this is very nearly of the form $$I\otimes R_x(\phi)$$, except that one of the $$2\times 2$$ blocks would need to have the angle $$-\phi$$ instead of $$\phi$$. I used a controlled phase gate and the relation $$ZR_x(\phi)Z=R_x(-\phi)$$ to change the angle of that block. Then it was a case of rewriting it into the specified gate set.