# Making a Controlled-Z from a CNOT

How can we draw a circuit that is based on the gates $$H, CZ$$ that implements $$CNOT$$.
I know that the $$H$$ gate is like that: And also the $$CZ$$ gate is: But I'm not sure how to draw this with the implementation of $$CNOT$$.

## 2 Answers

You can check that the following is equal to a CNOT gate (the mid-part being the controlled $$Z$$-gate) The first Hadamard gate rotates $$q_1$$ to the $$X$$-basis. In that basis, the $$Z$$-gate acts like a bit flip (the same way the $$X$$-gate acts in the $$Z$$-basis). The second Hadamard rotates $$q_1$$ back to $$Z$$-basis.

@Durd3nT answered the question nicely. But here is another way to see it, and hopefully it will be useful for future purposes...

All you need to know is the identity $$X = HZH$$. Then now you can see that $$CNOT (CX)$$ can be rewritten as $$CX = \big( I \otimes H \big) CZ \big( I \otimes H \big)$$ This is because when the controlled-qubit is in the state $$|0\rangle$$, you are not doing anything, so the two Hadamard ($$H$$) gates cancel each other out. And when the controlled-qubit is in the state $$|1\rangle$$, the combination $$HZH$$ will acts as an $$X$$ gate.