QubitLab
IDELearnPlaygroundDocsCommunity
Log in
QubitLab
IDELearnPlaygroundDocsCommunity
Log in
QubitLab
IDELearnPlaygroundDocsCommunity
Log in
HomeLearnCatalogRanksPlaygroundDocs
05 · Quantum Coin Game & Interference0%

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

Learn/QC 101Quantum Foundations·Lesson 5 of 7

Quantum Coin Game & Interference

Why two Hadamards are not two coin flips: amplitudes add and cancel like waves.

Beginner10 min read7 sections · 2 questions+45
By the end you will be able to
  1. 01Explain why flipping a fair coin twice is still 50/50.
  2. 02Predict the result of H then H, and of H, Z, H, by following amplitudes along every path.
  3. 03Tell constructive interference from destructive interference.

Start with an ordinary coin. Flip it and you get heads or tails with even odds. Flip it again without looking and the odds are still even: the second flip forgets the first. Probabilities are never negative, so adding up all the ways to reach heads can only raise its chance, never remove it.

01The quantum coin

Now let H play the flip. One H on |0⟩ gives |+⟩, and reading it is 50/50, just like the coin. By coin logic a second H should leave it at 50/50. Instead the qubit comes back to |0⟩ in every shot. The difference: a qubit carries amplitudes, and amplitudes can be negative.

Path through H, HAmplitude along the pathEnds at
0 → 0 → 0(1/√2)·(1/√2) = +1/2|0⟩
0 → 1 → 0(1/√2)·(1/√2) = +1/2|0⟩
0 → 0 → 1(1/√2)·(1/√2) = +1/2|1⟩
0 → 1 → 1(1/√2)·(−1/√2) = −1/2|1⟩
a(0)=21​+21​=1,a(1)=21​−21​=0
The minus sign comes from H itself: the step from 1 to 1 has amplitude −1/√2. The two paths to |0⟩ arrive in step and reinforce; the two paths to |1⟩ arrive with opposite signs and cancel. The probabilities are 1 and 0.

02Constructive and destructive

Picture two water waves meeting. Crest on crest makes a higher crest; crest on trough leaves flat water. Amplitudes behave the same way. A classical coin can only pile probabilities up; a qubit can make a wrong answer vanish. A quantum algorithm is a plan that sends the paths to wrong answers out of step and the paths to the right answer in step.

Hands-on

Two flips that undo each other

Simulate: every shot reads 0, never 1. Two classical coin flips would give 50/50 here.

OpenQASM 3
OPENQASM 3.0;
include "stdgates.inc";
qubit[1] q;
bit[1] c;
h q[0];
h q[0];
c[0] = measure q[0];
Sign in to run (nothing is saved)
Open in the IDE Open in the Playground
Hands-on

Flip the sign in the middle

The Z between the Hadamards only changes the sign of the |1⟩ path. Simulate: now every shot reads 1, because the paths to 0 cancel and the paths to 1 add. Replace z with s (a quarter turn of phase) and the result is 50/50: the paths neither fully add nor fully cancel.

OpenQASM 3
OPENQASM 3.0;
include "stdgates.inc";
qubit[1] q;
bit[1] c;
h q[0];
z q[0];
h q[0];
c[0] = measure 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

A qubit starts in |0⟩ and goes through H, Z, H. What do 1000 shots show?

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

Question 2

What makes destructive interference possible for qubits but not for coins?

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

Key takeaway

Probabilities only pile up; amplitudes can cancel. H then H returns |0⟩ because the two paths to |1⟩ cancel and the two paths to |0⟩ reinforce. Quantum algorithms are built so that wrong answers interfere destructively.

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 6 · 12 min
The Bloch sphere
One qubit as a point on a sphere: angles, rotations and what entanglement does to the picture.
Further reading
  • Docs: states, amplitudes and phase
More in Quantum Foundations
  • Why quantum computing?
  • Bits, qubits and notation
  • Superposition and the Hadamard gate
MeasurementThe Bloch sphere
In this lesson0%
  1. Introduction
  2. The quantum coin
  3. Constructive and destructive
  4. Try it: Two flips that undo each other
  5. Try it: Flip the sign in the middle
  6. Knowledge check
  7. Key takeaway
QubitLab
IDELearnPlaygroundDocsCommunity
Log in
QubitLab
IDELearnPlaygroundDocsCommunity
Log in