# How to make a circuit for the CNOT using $H$ and $CZ$ gates?

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$$.

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.
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.