Attic › Computer science › Quantum computing
Quantum algorithms use wave interference to cancel wrong answers and amplify the correct one
About Quantum algorithm
Holding millions of states at the same time is not useful if you cannot read the right one at the end. When you measure a system of qubits, the superposition stops and gives only one result based on probability. A quantum algorithm is a step-by-step procedure that increases the probability of the correct answer to nearly 100% before the measurement takes place.
If you put 50 qubits into an equal superposition of all their states and immediately measure them, you get one random combination out of about a quadrillion (2^50). To get a useful answer instead of a random one, the computer must change the numbers α and β that control the probability of each state.
In quantum mechanics, these numbers are called probability amplitudes. Unlike normal probabilities, which are always positive numbers between 0 and 1, probability amplitudes can be positive, negative, or complex numbers. Because they have both a size and a sign (or direction), amplitudes behave like waves.
When two waves meet, they combine through wave interference. If two wave peaks meet, they add together to make a larger wave (constructive interference). If a wave peak meets a wave trough, they cancel each other out (destructive interference).
A quantum computer controls this interference using quantum logic gates. While classical logic gates (such as AND, OR, and NOT) flip bits between 0 and 1, a quantum gate is a physical operation—such as a pulse of microwave light or a laser beam—that rotates the probability amplitudes of one or more qubits.
A quantum calculation works in three basic steps:
1. Preparation: The computer applies gates to put the qubits into a superposition of all possible input states.
2. Interference: The algorithm runs a sequence of quantum gates that entangle the qubits and shift their probability amplitudes. The gates are arranged so that the amplitudes for wrong answers have opposite signs and cancel each other out, while the amplitudes for the correct answer have the same sign and add together.
3. Measurement: The computer measures the qubits. Because the wrong answers have canceled out, the qubits settle into the state that represents the correct answer.
When the computer finally reads the qubits, it gets a simple string of 0s and 1s, just like a classical computer. Because this method works only when a problem has a structure that allows wrong paths to cancel out, quantum computers cannot speed up every kind of software. Each problem requires a specific algorithm designed to create the right pattern of interference.
Next: Environmental noise causes errors in qubits before they can finish a calculation.
Fact-checked against Quantum computing on Wikipedia
Part of the Computer science syllabus: Artificial Intelligence and Modern Computing
See it on the timeline of Computer science