Chapter 05 · Gates and circuits
Programming with unitary matrices
A quantum gate is a unitary matrix and a circuit is a product of them. A few gates are enough to approximate any computation, and some very powerful-looking circuits can be simulated classically. The boundary between the two is the theory of quantum complexity.
In this chapter
In 1985 David Deutsch, at Oxford, defined the universal quantum computer: a Turing machine whose states can be in superposition. The model that won out, however, was the one he himself developed in 1989: quantum circuits, wires that carry qubits and gates that transform them. It is the language in which every quantum algorithm is written today.
Gates are unitary matrices
For a matrix the following are equivalent: (1) ; (2) preserves inner products, ; (3) preserves norms, ; (4) the columns of form an orthonormal basis.
Proof
(1)⇒(2): . (2)⇒(3) is the case . (3)⇒(2) uses the polarization identity, which recovers the inner product from norms: . (2)⇔(4): the entries of are the inner products of the columns. (4)⇒(1) for the same reason.
The most common single-qubit gates are the Pauli matrices, the Hadamard gate and the phase gates:
On the Bloch sphere, every single-qubit gate is a rotation. , and are half-turns about each axis; is a half-turn about the axis between and ; and are quarter and eighth turns about .
Every unitary can be written as
for some real numbers : any rotation of the sphere is a composition of rotations about , and .
Two qubits: CNOT
The controlled-NOT gate flips the second qubit (the target) only if the first one (the control) is 1. In the basis :
A Hadamard followed by a CNOT creates entanglement from scratch. Try it in the simulator.
Universality
Classically, NAND is enough to build everything. Is there a finite quantum set that is enough too? The answer comes in two steps.
Every unitary on qubits can be written exactly as a product of CNOT gates and single-qubit gates.
But there are infinitely many single-qubit gates, and a real device can only implement a few with high precision. Fortunately, approximating is enough, and it is cheap:
Let be a finite set of single-qubit gates, closed under inverses, that generates a dense subgroup of (for example ). Then every single-qubit gate can be approximated to precision by a product of gates from , with (improved versions reach ).
Together, is a universal set: any quantum computation can be approximated with polylogarithmic overhead.
Not every quantum circuit is powerful
Superposition and entanglement are necessary for a quantum advantage, but not sufficient. The circuits built from , and CNOT (the Clifford group) can generate highly entangled states and yet:
A circuit that starts in , uses only Clifford gates and measures in the computational basis can be simulated by a classical computer in time polynomial in the number of qubits and gates.
The trick is to describe the state not by its amplitudes, but by the Pauli operators that leave it invariant (its stabilizers), which Clifford gates transform into one another. The power of a quantum computer comes from adding non-Clifford gates like , which are also the most expensive to protect from errors.
Deutsch–Jozsa: the first exponential separation
Suppose a function is promised to be either constant or balanced (0 on exactly half the inputs). A deterministic classical algorithm may need queries to be sure. The algorithm of Deutsch and Jozsa (1992) needs a single one:
The amplitude of at the end is : it is if is constant and exactly 0 if it is balanced. Measuring all zeros or not answers the question with certainty. A randomized classical algorithm can answer with high probability using only a few queries, so the separation is against deterministic algorithms; but the idea (put the information in the phases and make it interfere) is the template for everything that follows.
Quantum complexity
In 1993 Ethan Bernstein and Umesh Vazirani defined BQP, the class of problems that a quantum computer solves in polynomial time with error probability at most . They also proved that
The first inclusion says that quantum computers can do everything randomized classical ones can (thanks to Toffoli); the second, that they can be simulated with polynomial memory, by summing over paths. Whether either inclusion is strict is not known: proving would imply , a major open problem. The evidence of quantum power is, for now, algorithms like Shor's for problems that we believe are classically hard.
References
- D. Deutsch (1985). “Quantum theory, the Church–Turing principle and the universal quantum computer”. Proceedings of the Royal Society A, 400.
- D. Deutsch and R. Jozsa (1992). “Rapid solution of problems by quantum computation”. Proceedings of the Royal Society A, 439.
- E. Bernstein and U. Vazirani (1993). “Quantum complexity theory”. STOC (journal version: SIAM J. Computing, 1997).
- A. Barenco et al. (1995). “Elementary gates for quantum computation”. Physical Review A, 52(5).
- D. Gottesman (1998). “The Heisenberg Representation of Quantum Computers”. arXiv:quant-ph/9807006.
- C. M. Dawson and M. A. Nielsen (2006). “The Solovay-Kitaev algorithm”. Quantum Information and Computation, 6(1).