QubitLab
IDELearnPlaygroundDocsCommunity
Log in
QubitLab
IDELearnPlaygroundDocsCommunity
Log in
QubitLab
IDELearnPlaygroundDocsCommunity
Log in
HomeLearnCatalogRanksPlaygroundDocs
03 · Superposition and the Hadamard gate0%

You are reading without signing in. Sign in or continue as guest to take quizzes and climb the ranks.

Learn/QC 101Quantum Foundations·Lesson 3 of 7

Superposition and the Hadamard gate

Where superpositions come from, what phase is, and why H twice does nothing.

Beginner12 min read7 sections · 2 questions+45
By the end you will be able to
  1. 01Apply H to |0⟩ and |1⟩ by hand.
  2. 02Distinguish |+⟩ from |−⟩ even though both give 50/50 outcomes.
  3. 03Predict the result of H·H.

Superposition is not a mystery word; it is a direction in the vector space that is neither |0⟩ nor |1⟩. The Hadamard gate rotates the basis states onto two such directions.

H=2​1​(11​1−1​),H∣0⟩=∣+⟩=2​∣0⟩+∣1⟩​,H∣1⟩=∣−⟩=2​∣0⟩−∣1⟩​
Key concept
A superposition is one definite state

|+⟩ points between |0⟩ and |1⟩; it is not a qubit that is secretly 0 or 1 while we do not know which. A coin you are merely unsure about cannot interfere with itself. A qubit in |+⟩ can, which is why a second H turns it back into |0⟩ every time.

Common mistake

“The qubit is 0 and 1 at the same time, so it computes both answers” is the most common misreading. A measurement returns one bit. The speed-ups come from arranging amplitudes so that interference makes the right answers likely and the wrong ones cancel.

01Phase: the sign you cannot see directly

|+⟩ and |−⟩ both measure 0 or 1 with probability one half. The minus sign is a relative phase. It is invisible to a measurement in the computational basis but it decides what happens next: H|+⟩ = |0⟩ while H|−⟩ = |1⟩. Interference is just phases adding or cancelling.

Hands-on

See phase on the Q-sphere

Open the State tab. Both amplitudes have probability 0.5, yet the point for |1⟩ carries phase π (shown by its colour). Remove the Z gate and the phase disappears while the bars stay identical.

OpenQASM 3
OPENQASM 3.0;
include "stdgates.inc";
qubit[1] q;
h q[0];
z q[0];
Sign in to run (nothing is saved)
Open in the IDE Open in the Playground

02H twice

HH=I⇒H(H∣0⟩)=∣0⟩
The second Hadamard makes the two paths to |1⟩ cancel (+1 and −1) and the two paths to |0⟩ add. Try it in the Debug tab, stepping gate by gate.
Worked solution
H twice, by hand

Start from |0⟩, apply H, then H again. What comes out?

  1. 1First H: |0⟩ → (|0⟩ + |1⟩)/√2.
  2. 2H is linear, so apply it to each part: (H|0⟩ + H|1⟩)/√2.
  3. 3Substitute: [(|0⟩ + |1⟩) + (|0⟩ − |1⟩)] / 2.
  4. 4The two |1⟩ terms cancel and the two |0⟩ terms add: 2|0⟩/2 = |0⟩.

Answer: |0⟩: every shot reads 0. That cancellation is interference.

Hands-on

Interference, step by step

The circuit opens with the Debug tab ready. Press the Debug button to start, then the Step over button (the arrow) to apply one gate at a time. After the first H the probabilities are 50/50; after the second they are back to 100% on |0⟩.

OpenQASM 3
OPENQASM 3.0;
include "stdgates.inc";
qubit[1] q;
h q[0];
h q[0];
Sign in to run (nothing is saved)
Open in the IDE Open in the Playground
Knowledge check

2 questions · one try each counts

Question 1

What is H|−⟩?

Sign in to answer and climb the ranks; you will come back to this lesson.

Question 2

Two states give identical measurement statistics in the computational basis. Can they still differ?

Sign in to answer and climb the ranks; you will come back to this lesson.

Key takeaway

Superposition is a direction between |0⟩ and |1⟩; phase is the sign between the two parts. Measurement hides phase, gates use it. H puts a qubit in superposition and H again takes it out by interference.

Finished reading?

Knowledge check: 2 questions waiting above. Questions are optional. Mark it complete, or press Next: moving on marks it complete too.

Up next
Lesson 4 · 10 min
Measurement
What a measurement does to a state, why shots matter and how to read a histogram.
Further reading
  • Docs: the Hadamard gate card
More in Quantum Foundations
  • Why quantum computing?
  • Bits, qubits and notation
  • Quantum Coin Game & Interference
Bits, qubits and notationMeasurement
In this lesson0%
  1. Introduction
  2. Phase: the sign you cannot see directly
  3. Try it: See phase on the Q-sphere
  4. H twice
  5. Try it: Interference, step by step
  6. Knowledge check
  7. Key takeaway
QubitLab
IDELearnPlaygroundDocsCommunity
Log in
QubitLab
IDELearnPlaygroundDocsCommunity
Log in