Finding an Answer with Waves
UF Herbert Wertheim College of Engineering, University of Florida UF Herbert Wertheim College of Engineering, University of Florida Quantum Theory
Project
Finding an Answer with Waves  /  high school
Quantum for high school · page 2 of 3
How a quantum computer finds an answer

Finding an answer with waves

A normal computer checks possibilities one at a time. A quantum computer gives every possibility a score, lets the scores add and cancel like waves, and reads out whatever is left standing. This page builds that idea from ripples in a pond to a search that finds one box out of four in a single try.

What you need to know already

  1. The arrow. From page 1. A qubit is an arrow on a sphere. Its height sets the chance of reading 0, and it has a hidden direction that looking cannot see but turning can.
  2. Waves. Two waves that rise together make a bigger wave. Two waves where one rises as the other falls cancel out. You have seen this with ripples or with sound.
  3. Squaring. A score of −0.5 and a score of +0.5 both square to 0.25. That one fact is what makes negative scores useful.
two waves, adding and cancelling
01

Waves add, and waves cancel

Noise-cancelling headphones work by making a second sound wave that is the first one flipped upside down. Added together, they make silence.

Two waves in step make a bigger wave. Two waves out of step make nothing.

The slider shifts the second wave along. At zero shift the two waves sit on top of each other and their sum is twice as tall. At a half-wave shift, which is 180 degrees, one rises exactly where the other falls, and the sum is a flat line. Everything on this page is a way of using that flat line.

Try it  Two waves and their sum
1.73height of the sum, where 2 is the most
The number to remember. The shift is an angle, from 0 to 360 degrees. In step is 0. Fully out of step is 180. Waves are the reason the hidden direction from page 1 was also an angle.
For teachers
Superposition of two sinusoids of equal amplitude: sin(x) + sin(x + φ) = 2 cos(φ/2) sin(x + φ/2). The envelope 2 cos(φ/2) is what the readout reports. The important idea for what follows is that a phase is an angle and that 180° means cancellation. Students who know the identity can verify the readout; those who do not can read it off the picture.
02

The hidden direction is where a wave is in its cycle

On page 1 the arrow could point toward you or away from you without changing the odds. That compass direction is the same thing as the shift of a wave.

Spin the arrow around the vertical axis and a wave slides along with it. The height stays put, so the odds stay put.

Physicists call the compass direction of the arrow its phase, and they call the shift of a wave its phase too. That is not a coincidence. A qubit whose arrow points sideways is a wave, and its hidden direction says where in the cycle that wave is. When two such waves meet, they add or cancel depending on the difference between their directions.

Try it  The arrow and its wave
drag to look around
50%chance of reading 0, unchanged
Two names, one thing. Hidden direction of the arrow, or phase of the wave. From here on the page uses the word phase.
For teachers
The state (|0⟩ + eiφ|1⟩)/√2 with φ the azimuth of the Bloch vector. The wave drawn is cos(x + φ), a visual stand-in for the complex amplitude eiφ. It is a metaphor with a precise core: relative phases between amplitudes combine exactly as phases of interfering waves, which is the content of section 03.
03

Two roads to the same place

Send a qubit down two roads at once, delay one road, and let the roads rejoin. Which detector lights up depends only on the delay.

Tip sideways to split the arrow onto two roads. Add a phase on one road. Tip sideways again to rejoin. The waves from the two roads add or cancel at the detectors.

chance of detector 0 = (1 + cos(delay)) / 2

Slide the delay. At zero delay the roads rejoin in step and detector 0 fires every time. At 180 degrees they rejoin out of step and detector 1 fires every time. The delay never changed the odds while the qubit was on the road. It only changed what happened at the rejoin. This is the whole trick, and every quantum algorithm uses it.

Try it  The fork in the road
Where is the qubit while it is on the road? On both roads, with a score for each. That is not a trick of language. If you block one road, the cancellation stops and both detectors fire half the time. The blank line at 180 degrees only happens when both roads are open.
For teachers
The Mach–Zehnder interferometer, or equivalently the circuit H · Rz(φ) · H. Output probability P(0) = cos²(φ/2) = (1 + cos φ)/2. The which-path point in the footer is the standard argument that the superposition is physical: removing one arm destroys the interference. The word "score" is introduced here and made precise in section 04 as the amplitude.
04

A score for every pattern

Two switches make four patterns. Two qubits give each of those four patterns a score. The chance of reading a pattern is its score squared, and scores can be negative.

Chance = score × score. A negative score is just as likely as a positive one, but negative and positive scores can cancel.

Below are four scores, one per pattern. Drag them. The chances update, and they always add to 100 percent, so the page keeps the scores in balance for you. Notice that a score of −0.5 gives the same chance as +0.5. Now read the next section, where a negative score is made to cancel a positive one on purpose.

Try it  Four patterns, four scores
The rule that makes quantum computing possible. Ordinary chances can only add. Scores can subtract. A quantum computer is a machine for arranging the scores so that the wrong answers subtract to zero before anyone looks.
For teachers
Real amplitudes for a two-qubit state, with the Born rule P = |a|². The bench renormalizes after each drag so that Σ a² = 1 is always visible. Complex phases are suppressed; every example on this page, including Grover on four items, needs only real amplitudes with signs, which is a deliberate simplification that loses nothing for these cases.
05

Find the prize in one try

Four boxes, one prize. Opening boxes one at a time takes 2.25 tries on average. With scores that cancel, it takes one.

Give every box the same score. Flip the sign of the prize box. Flip every score about the average. The prize box ends up with all of the chance.

You are not allowed to see which box has the prize. You are only allowed to ask a machine one question, and the machine answers by flipping the sign of the prize box's score. That sounds useless, since a sign flip does not change any chance. Then the "flip about the average" move turns the one negative score into the only score left. Step through it and watch the bars.

Try it  The four-box search

Where is the prize?

Step

What "flip about the average" means. Work out the average of the four scores. Every score is moved to the other side of that average by the same distance it was from it. Three scores that were slightly above the average land on zero. The one that was far below lands far above. Try it with the numbers: average of 0.5, 0.5, −0.5, 0.5 is 0.25.
For teachers
Grover's algorithm for N = 4, M = 1, which is exact after one iteration because ⌊(π/4)√4⌋ = 1. The oracle is a phase flip on the marked state and the diffusion operator 2|s⟩⟨s| − I is the "inversion about the mean". For larger N the speedup is √N, not exponential, and students should hear that. The 2.25 figure is the expected number of sequential openings with four boxes: (1 + 2 + 3 + 3)/4.
06

What it is good for, and what it is not

A quantum computer is not a faster computer. It is a different one, and it wins only on problems where the wrong answers can be made to cancel.

Chemistry and materialsSimulating moleculesElectrons in a molecule are themselves quantum. A quantum computer can keep their scores directly, where a normal computer runs out of memory at a few dozen atoms.
CodesBreaking and making themThe locks that protect online banking rely on a math problem that a large quantum computer could solve. New locks that resist it are already being rolled out.
Searching and optimizingModest speedupsThe four-box trick scales: finding one item among a million takes about a thousand tries instead of half a million. Useful, but not magic.
Not everythingEmail, games, videoNo help at all. Most everyday computing has no wrong answers to cancel, and a normal computer is far cheaper and far more reliable.
Why this matters

The hard part is keeping the scores. Every score on this page lives in the hidden direction of an arrow, and hidden directions get scrambled by every stray field that reaches the qubit. Real quantum computers today keep their scores for a fraction of a second, which is why they hold only a few hundred to a few thousand qubits and make mistakes. Page 3 shows that the same fragility, turned around, makes a qubit a superb sensor.

Try this at home  hear two waves cancel
You need
  • Two phones, or a phone and a laptop
  • A tone generator app or website playing a steady note, about 400 Hz
  • A quiet room
Steps
  1. Play the same steady tone on both devices at the same volume. Put them about a metre apart on a table.
  2. Walk slowly along a line between them, keeping one ear at table height.
  3. You will hear the tone get loud, then quiet, then loud again every 40 centimetres or so. The quiet spots are where the two waves arrive out of step and cancel.
  4. Turn off one device. The quiet spots vanish. That is the "block one road" experiment from section 03.
Why this one. It is the fork in the road, done with sound. Two sources, one listener, and a delay set by the difference in distance. The quiet spots are the detector-1 outcomes.

Next: A Qubit as a Sensor, where the fragile phase becomes the point. Let the world turn the arrow, and reading it tells you the field the qubit sits in.