# How to decompose a controlled unitary $C(U)$ operation where $U$ is a 2-qubit gate?

In the vein of this question, say I have a 2-qubit unitary gate $$U$$ which can be represented as a finite sequence of (say) single qubit gates, CNOTs, SWAPs, cXs, cYs and cZs. Now I need to implement a controlled-$$U$$ gate and hence need its decomposition in terms of simple one- and two-qubit gates. Is there a standard method to get this decomposed circuit?

In Nielsen and Chuang they deal with the general recipe for decomposing $$C^n(U)$$ gates where $$U$$ is a single qubit unitary, but not where $$U$$ is a $$k$$-qubit unitary cf. glS's answer.

You can reduce further to controlled SWAPs and cXs by putting in the appropriate $$U$$ such that $$UXU^\dagger=Y$$ or $$Z$$. That gets rid of dealing with the controlled cYs and cZs separately.
• Thanks. Any idea how to compute the $U$'s corresponding to $Y$ and $Z$? Jun 4, 2019 at 2:06
• @SanchayanDutta up to some phase factors, you basically want $\sqrt{Z}$ and $\sqrt{Y}$ respectively. This is because any rotation abou a axis that does not contain any $X$ satisfies (up to a phase) $XU^\dagger=UX$, so $UXU^\dagger$ becomes $U^2X$, and we know things like $YX=Z$ (again, up to a phase) Jun 4, 2019 at 7:43