# Is a ccH, ccX and ccH equivalent to a cH, ccX and cH sequence?

It appears to me that a ccH, ccX and ccH sequence is exactly equivalent to a cH, ccX and cH gate sequence. Is there any quick way to see/verify this?

Start No control equals each control $$\forall U : U = C(U) \cdot \bar{C}(U)$$ Opposite controls commute $$\forall U, V : [C(U), \bar{C}(V)] = 0$$ No control equals each control $$\forall U : U = C(U) \cdot \bar{C}(U)$$ Self-inverse operations self-cancel Done

More generally, for any "V conjugated by U" operation of the form $$U_a \cdot C_b(V_a) \cdot U_a^{-1}$$, the $$U$$ operation can gain or lose any controls that $$V$$ has without changing the circuit's effect.

There is a way to simplify it down slightly - for some controlled unitary $$C\left(U\right)=I\oplus U$$ and some arbitrary unitary $$V$$ (of the same dimension as $$U$$), $$\left(I\otimes V\right).C\left(U\right).\left(I\otimes V^\dagger\right) = \begin{pmatrix}V&0\\0&V\end{pmatrix}\begin{pmatrix}I&0\\0&U\end{pmatrix}\begin{pmatrix}V^\dagger&0\\0&V^\dagger\end{pmatrix} = C\left(VUV^\dagger\right),$$ so it's now clear that $$\left[I\otimes C\left(H\right)\right].C\left(C\left(X\right)\right).\left[I\otimes C\left(H\right)\right] = C\left(C\left(H\right).C\left(X\right).C\left(H\right)\right)$$.

Funnily enough, if instead of using $$I\otimes V$$ in the above and instead used $$C\left(V\right)$$, we'd find that $$C\left(V\right).C\left(U\right).C\left(V^\dagger\right) = \begin{pmatrix}I&0\\0&V\end{pmatrix}\begin{pmatrix}I&0\\0&U\end{pmatrix}\begin{pmatrix}I&0\\0&V^\dagger\end{pmatrix} = C\left(VUV^\dagger\right)$$ and so it's not just clear that \begin{align*}C\left(C\left(H\right)\right).C\left(C\left(X\right)\right).C\left(C\left(H\right)\right) &= C\left(C\left(H\right).C\left(X\right).C\left(H\right)\right) \\ &=\left[I\otimes C\left(H\right)\right].C\left(C\left(X\right)\right).\left[I\otimes C\left(H\right)\right]\end{align*} but the more general version $$\left(I\otimes V\right).C\left(U\right).\left(I\otimes V^\dagger\right) = C\left(V\right).C\left(U\right).C\left(V^\dagger\right)$$ is also true, for any unitaries $$U$$ and $$V$$

My use of brackets in the control operation is maybe slightly more unusual, but hopefully it makes it more obvious what the operation is