# constructing a CNOT gate using a CZ and H gates [duplicate]

How can I construct a CNOT gate using a CZ and H gates?

And I also need to prove it using these identities:

$$$$H = (1/\sqrt{2})(X+Z)\\ XZ = -ZX\\ X^2 = Z^2 = H^2 = 1\\ HXH = Z\\ HZH = X\\$$$$

Thank you!

• Does this answer your question? Making a Controlled-Z from a CNOT May 8, 2021 at 21:05
• No sir, its the other way around... May 8, 2021 at 21:08
• The title of that question is a bit deceptive but if you read what the question, you will see it is the same as yours... The person was asking to help with constructing a circuit that representing the CNOT gate using H and CZ. There are two answers to that question. May 8, 2021 at 21:58
• You're correct, but I still couldn't understand the algebric proof that was given there. Can you please try to explain? because if X=HZH then CX should be equal to CHZH so I didn't understand the jump to the other flank... May 8, 2021 at 23:13
• I wanted to add the explanation to the comment but it didn't fit... hence I wrote it as an answer. May 9, 2021 at 4:22

Remember that when you apply a CNOT (CX) gate to two qubits, $$q_0$$ (controlled) and $$q_1$$ (target), then when $$q_0$$ is in the $$|1\rangle$$ state, you apply the $$X$$ gate to the target quit $$q_1$$. And when $$q_0$$ is in the $$|0\rangle$$ state, you simply do nothing. CZ is the same. when $$q_0$$ is $$|1\rangle$$ you apply $$Z$$ to $$q_1$$, and when $$q_0$$ is $$|0\rangle$$ you do nothing.
Now, if you consider the circuit $$\big( I \otimes H \big) CZ \big(I \otimes H \big)$$ which can be drawn as:
With the above circuit, note that when the controlled qubit, $$q_0$$, is in the state $$|0\rangle$$, $$CZ$$ do nothing to $$q_1$$ and so you will end up with just $$H \cdot H = I$$. Thus, when $$q_0$$ is $$|0\rangle$$, nothing happens, just as the case when we have $$CX$$.
Now. ote that when the controlled qubit, $$q_0$$, is in the state $$|1\rangle$$,$$CZ$$ will apply the gate $$Z$$ to $$q_1$$. Thus, you have $$H \cdot Z \cdot H = X$$. Thus, when $$q_0$$ is $$|1\rangle$$, we apply the gate $$X$$ to $$q_1$$. This is exactly the case in $$CX$$.
Therefore, in both cases, when $$q_0$$ is $$|0\rangle$$ and $$q_1$$ is $$|1\rangle$$, we have the same result as $$CX$$. This implies that the above circuit is indeed exactly the same as the circuit