Article · Physics

What a Quantum Computer Actually Does

A quantum computer does not try every answer at once; it arranges interference so that a final measurement is likely to return the right one.

A popular description

A common description says that a quantum computer tries every possible answer at the same time. It is catchy, and it leaves out the two things that make the machine work: interference, and the fact that a measurement returns only one outcome. The article on "or" contrasts events as sets, with probabilities from a probability measure, and events as subspaces, with probabilities from projections. A classical computer works in the first picture and a quantum computer in the second. This article uses the arrow picture to say what a quantum computer does and where a speed advantage could come from.

The map

Every quantum computation has the same three steps, shown in Figure 1. We prepare a known state, apply a sequence of gates, and measure. This is the simple circuit model used here; real computations can also include intermediate measurements and repeated runs.

Figure 1. The three steps of a quantum computation. The middle step is where interference happens.

The rest of the article goes through the steps in order, using the smallest example that shows interference.

From a bit to a qubit

A classical bit has one of two values, 0 or 1. Classical computing combines bits with the logic of sets: AND, OR and NOT, and its probabilities are weights on sets. A qubit is the quantum counterpart. Its state is an arrow of length 1 in an abstract space of states, which is not the space we live in. We draw the arrow in a flat plane, and the answers 0 and 1 are two perpendicular directions in it.

A qubit can point along 0, along 1, or anywhere in between. Relative to the 0 and 1 directions, an arrow in between is a superposition. Its two components, called amplitudes, say how much of each it contains. Measuring in this basis asks which outcome occurs, 0 or 1; the two outcomes are perpendicular alternatives, so one of them always occurs, and the probability of each is the squared length of the arrow's shadow on that direction, the square of its amplitude (in general, its squared magnitude). An arrow halfway between 0 and 1 has amplitude 1/√2 on each, so a measurement gives 0 or 1 with probability ½ each. Amplitudes can be negative, and a sign between the two amplitudes will matter, though a sign on the whole arrow never does. In general amplitudes are complex numbers, but real ones are enough for the example here.

Gates and interference

The earlier "or" combines questions. A gate performs a different task: it transforms a state. It changes the arrow while keeping its length, which is what keeps the probabilities adding to 1. The Hadamard gate takes the 0 arrow to the arrow with amplitudes +1/√2 on 0 and +1/√2 on 1. It takes the 1 arrow to the arrow with amplitudes +1/√2 on 0 and −1/√2 on 1. In the polarization picture, it maps horizontal and vertical to the +45° and −45° states.

Apply it twice, starting from 0, as in Figure 2. After the first gate, a measurement would give 0 or 1 with probability ½ each. Apply the second gate instead of measuring. The amplitude of ending at 0 has two contributions, one through each middle state, and they add: ½ + ½ = 1. The amplitude of ending at 1 also has two contributions, and they cancel: ½ − ½ = 0. A measurement now gives 0 with certainty.

Figure 2. Routes through two gates. The two routes to 0 add; the two routes to 1 cancel.

Compare a coin. A classical random bit that starts at 0, is scrambled to 50/50 and is scrambled again is still 50/50, because probabilities of different routes only add. Amplitudes of different routes can cancel. This is the difference between a superposition and a random mixture seen earlier, now at work as the engine of computation.

Many qubits

Two qubits have four possible outcomes, 00, 01, 10 and 11, and their state has four amplitudes. In general n qubits have 2ⁿ amplitudes. With about 300 qubits that is more than the number of atoms in the observable universe, which is estimated at around 10⁸⁰. This size is the source of the popular description, and it is also why simulating a quantum computer on a classical one is hard in general.

But the amplitudes are not 2ⁿ answers that you can read. A measurement returns one outcome, which is n bits, chosen with probabilities given by the squared magnitudes of the amplitudes. The state with 2ⁿ components is a resource for interference, not a table of answers.

What an algorithm does

A quantum algorithm is a sequence of gates designed so that the amplitudes of wrong answers cancel, as the routes to 1 did above, and the amplitude of the right answer grows. A final measurement then returns a useful answer with high probability. If the answer is wrong, we repeat the computation, and checking an answer is often easy. Finding a sequence of gates that achieves this for a real problem is hard, and it is what the known algorithms accomplish.

How can gates favor right answers without knowing them? Grover's algorithm shows how. Suppose there is one right candidate among N. Start with equal amplitudes on all N candidates. A supplied test, which can recognize the right answer when shown it, flips the sign of its amplitude. Flipping this sign leaves the probabilities of measuring the candidates unchanged at this stage. The next operation, which reflects the amplitudes about their average, converts the relative sign into a larger amplitude for the right candidate and a smaller one for the rest. Repeating the pair of steps about √N times makes a measurement likely to return the right candidate.

Two examples show the range:

  • Grover's search (1996). To find the one marked item among N using only a test that recognizes it, a classical computer needs about N tests in the worst case; Grover's algorithm needs about √N uses of the test. No quantum algorithm can do better: Bennett, Bernstein, Brassard and Vazirani proved in 1997 that unstructured search needs about √N queries. The bound counts queries, not the full cost of an implementation, and it does not settle how quantum and randomized classical computers compare in general.
  • Shor's factoring algorithm (1994). It factors integers in time that grows polynomially with their number of digits, while the best known classical methods take far longer. It does not prove that no efficient classical method exists.

What this does not say

  • It does not change what is computable. A quantum computer computes the same functions as a classical one. The question is speed, not possibility.
  • It does not promise a speedup for every problem. It is not proved that quantum computers can efficiently solve any problem that classical computers using randomness cannot. Whether and how much they help is decided problem by problem.
  • It does not cover building the machine. Making large, accurate devices is a separate engineering question.
  • It leaves out entanglement. Our one-qubit example did not need it. Larger computations use states of several qubits that cannot be described one qubit at a time. The Bell article explores the correlations such joint states can produce.

Back to the description

A quantum computer does not try every answer and pick the best. It holds a state with many amplitudes, transforms it with gates so that contributions cancel or add, and measures once. Where a speed advantage exists, it comes from that steering. Keeping only the probabilities of the intermediate alternatives loses the information needed for interference. A classical computer can retain that information by tracking amplitudes, but the calculation can become costly. Interference rests on the same linear structure that makes the span of two alternatives contain their superpositions, as shown in the article on "or". Here that structure becomes a resource for computation.

References

  • M. A. Nielsen and I. L. Chuang, Quantum Computation and Quantum Information (Cambridge University Press, 2000).
  • L. K. Grover, "A fast quantum mechanical algorithm for database search", in Proceedings of the 28th Annual ACM Symposium on Theory of Computing (1996) 212–219.
  • C. H. Bennett, E. Bernstein, G. Brassard and U. Vazirani, "Strengths and weaknesses of quantum computing", SIAM Journal on Computing 26(5) (1997) 1510–1523.
  • P. W. Shor, "Polynomial-time algorithms for prime factorization and discrete logarithms on a quantum computer", SIAM Journal on Computing 26(5) (1997) 1484–1509.