I'm new to quantum computing, so I hope you don't find this question tedious. However, after watching many hours of lectures and reading online, I still don't 100% understand why we need to initialize a qubit with an H gate (put it in superposition).

I understand that it's required in many circuits, especially when we are entangling qubits, but I don't understand why.

Is it because we need some randomness to confirm that two qubits are in fact entangled and a random state of the control qubit changes the random state of the target qubit?

I would appreciate a practical example of why it's needed.

  • $\begingroup$ If you don't ever create a state that's in superposition, you just have classical states and classical computation. Superposition is what makes quantum different from classical, and the Hadamard is a particularly convenient operation for creating superposition. $\endgroup$
    – DaftWullie
    Commented Jun 3 at 14:05

2 Answers 2


The reason relates to the task of entanglement generation. For the generation of a Bell state, we want to make the state of the second qubit is maximally correlated with that of the first, such that inference of the second qubit's state is deterministic if the first qubit is measured. If $|\psi\rangle \neq | \phi \rangle$ denote two possible states, we want something of the form

$$a | \psi\rangle \otimes |\text{some state for qubit 2}\rangle + b |\phi\rangle \otimes |\text{some other state for qubit 2}\rangle $$

where $a, b$ are some normalization coefficients, which in the case of the Bell states, $a = b = 1/\sqrt{2}$. If you want to deterministically know the state of qubit 2 by measuring only qubit 1, two properties should be satisfied: 1) $|\psi\rangle$ is orthogonal to $|\phi\rangle$, and 2) you need to measure in the $\{|\psi\rangle, |\phi \rangle\}$ basis. In this way, you can measure and perfectly distinguish which of the above terms your state has collapsed into. This is all pretty standard thus far.

To finally address your question, one can choose any orthogonal choices of $|\psi\rangle$ and $|\phi\rangle$ and produce an entangled state of the form above satisfying the "deterministic inference" requirement. But, to implement this concretely in a circuit, you need to essentially perform something akin to a CNOT where the control is not on the $|1\rangle$ state but now on $|\phi\rangle$, which is generally not so straightforward. Rather, we assume controlled operations are performed in a "computational basis" which generally corresponds to some physical states that are easier to work with (e.g. discrete energy levels of an atom). It is also presumed measurement in this basis is easier. We call this computational basis $\{|0\rangle, |1\rangle\}$, so to create a Bell state, in the equation above, $|\psi\rangle = |0\rangle, |\phi\rangle = |1\rangle$ wlog.

$$|\Phi^{+}\rangle = \frac{1}{\sqrt{2}}(|0\rangle \otimes |0\rangle + |1\rangle \otimes |1\rangle)$$

If your first qubit starts in $|+\rangle$ and your second in $|0\rangle$, you obviously don't need a Hadamard and can just directly perform a CNOT to produce a Bell state. But, once again, we sort of assume that we can initialize our qubits in either $|0\rangle$ or $|1\rangle$ due to measurement, whereas reliable initialization in the $|+\rangle$ state by direct measurement is harder. Thus, we measure in the $Z$ basis, herald the result to start with $|0\rangle$, and go from there. It is convention to assume all qubits in the start of your algorithm are in the $|0\rangle$ state. Therefore, to get the $|+\rangle$ state from there, it is just the matter of performing a Hadamard gate.

  • $\begingroup$ Appreciate the detailed response. Would it be correct to say that putting q1 in superposition using the H gate is just simply required to create branching path for q2 to be entangled? $\endgroup$
    – M.C
    Commented Jun 2 at 19:28
  • $\begingroup$ Yes, that's one way you can think about it. $\endgroup$ Commented Jun 3 at 19:19

The Hadamard gate is in general not necessary to create entanglement, but the standard beginner example of creating an entangled state out of $|00\rangle$ is with H and CNOT (as in rmehta's answer).

I think a simple (but good enough for the beginning) perspective of why H shows up at the start of oracle-type beginners algorithms like Deutsch-Jozsa, Bernstein-Vazirani, Grover (...) is the following:

  • H transforms $|0\rangle$ into $|+\rangle$
  • starting with $|0...0\rangle$ and applying H on all qubits gives $|+...+\rangle$
  • the $|+...+\rangle$ state is a so-called equal superposition in the computational basis

$$|+...++\rangle = \frac{1}{\sqrt N}(|0...00\rangle + |0...01\rangle + |0...10\rangle + ... + |1...11\rangle)$$

  • applying an oracle to that state applies the oracle applies the oracle to each component that is each possible combination at once (it is probably this concept where the common misconception of a quantum computer simply doing all calculations at once comes from)

  • the above listed algorithms all have a clever way of extracting some kind of information out of the superposition that has been altered by the oracle call(s)


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.