Exercise 4.17#
Suppose that we have control-\(X\) operation as
(1)#\[
{\rm CNOT}: |0\rangle\langle 0| \otimes I + |1\rangle\langle 1| \otimes X
\]
control-\(Z\) operation can be expressed as follow,
(2)#\[
{\rm control-}Z: |0\rangle\langle 0| \otimes I + |1\rangle\langle 1| \otimes Z
\]
Then we could simply add one Hadamard gate before the target operation, and one Hadamard gate after the target operation. That is,
(3)#\[\begin{split}
\begin{align}
(I\otimes H){\rm control-}Z(I\otimes H) &= (I\otimes H)(|0\rangle\langle 0| \otimes I + |1\rangle\langle 1| \otimes Z )(I\otimes H) \\
&= (|0\rangle\langle 0| \otimes H + |1\rangle\langle 1| \otimes HZ )(I\otimes H)\\
&= |0\rangle\langle 0| \otimes HH + |1\rangle\langle 1| \otimes HZH
\end{align}
\end{split}\]
Note that \(H = H^{\dagger}\) and \(H^{\dagger}H = I\), and \(HZH = X\), we could conclude that
(4)#\[
{\rm CNOT} = (I\otimes H){\rm control-}Z(I\otimes H)
\]
Similarly, if the control-\(Z\) gate is in the following form,
(5)#\[
{\rm control-}Z_2: I\otimes |0\rangle\langle 0| + Z\otimes |1\rangle\langle 1|
\]
we could also write a \(\rm CNOT\) gate as
(6)#\[
(H\otimes I){\rm control-}Z_2(H\otimes I) = I\otimes |0\rangle\langle 0| + X\otimes |1\rangle\langle 1|
\]