This article includes a list ofgeneral references, butit lacks sufficient correspondinginline citations. Please help toimprove this article byintroducing more precise citations.(October 2015) (Learn how and when to remove this message) |

Inquantum information theory, aquantum circuit is amodel forquantum computation, similar toclassical circuits, in which a computation is a sequence ofquantum gates,measurements, initializations ofqubits to known values, and possibly other actions. The minimum set of actions that a circuit needs to be able to perform on the qubits to enable quantum computation is known asDiVincenzo's criteria.
Circuits are written such that the horizontal axis is time, starting at the left hand side and ending at the right. Horizontal lines are qubits, doubled lines represent classicalbits. The items that are connected by these lines are operations performed on the qubits, such as measurements or gates. These lines define the sequence of events, and are usually not physical cables.[2][3][4]
The graphical depiction of quantum circuit elements is described using a variant of thePenrose graphical notation.[citation needed]Richard Feynman used an early version of the quantum circuit notation in 1986.[5]
Most elementarylogic gates of a classical computer are notreversible. Thus, for instance, for anAND gate one cannot always recover the two input bits from the output bit; for example, if the output bit is 0, we cannot tell from this whether the input bits are 01 or 10 or 00.
However, reversible gates in classical computers are easily constructed for bit strings of any length; moreover, these are actually of practical interest, since irreversible gates must always increase physicalentropy. A reversible gate is a reversible function onn-bit data that returnsn-bit data, where ann-bit data is astring of bitsx1,x2, ...,xn of lengthn. The set ofn-bit data is the space {0,1}n, which consists of 2n strings of 0's and 1's.
More precisely: ann-bit reversible gate is abijective mappingf from the set {0,1}n ofn-bit data onto itself.An example of such a reversible gatef is a mapping that applies a fixed permutation to its inputs.For reasons of practical engineering, one typically studies gates only for small values ofn, e.g.n=1,n=2 orn=3. These gates can be easily described by tables.
Thequantum logic gates arereversibleunitary transformations on at least one qubit. Multiple qubits taken together are referred to asquantum registers. To define quantum gates, we first need to specify the quantum replacement of ann-bit datum. Thequantized version of classicaln-bit space {0,1}n is theHilbert space
This is by definition the space of complex-valued functions on {0,1}n and is naturally aninner product space. means the function is asquare-integrable function. This space can also be regarded as consisting oflinear combinations, orsuperpositions, of classical bit strings. Note thatHQB(n) is a vector space over thecomplex numbers ofdimension 2n. The elements of thisvector space are the possible state-vectors ofn-qubit quantum registers.
Using Diracket notation, ifx1,x2, ...,xn is a classical bit string, then
is a specialn-qubit register corresponding to the function which maps this classical bit string to 1 and maps all other bit strings to 0; these 2n specialn-qubit registers are calledcomputational basis states. Alln-qubit registers are complex linear combinations of these computational basis states.
Quantum logic gates, in contrast to classical logic gates, are always reversible. One requires a special kind of reversible function, namely aunitary mapping, that is, a linear transformation of a complexinner product space that preserves theHermitian inner product. Ann-qubit (reversible) quantum gate is aunitary mappingU from the spaceHQB(n) ofn-qubit registers onto itself.
Typically, we are only interested in gates for small values ofn.
A reversiblen-bit classical logic gate gives rise to a reversiblen-bit quantum gate as follows: to each reversiblen-bit logic gatef corresponds a quantum gateWf defined as follows:
Note thatWf permutes the computational basis states.
Of particular importance is the controlled NOT gate (also calledCNOT gate)WCNOT defined on a quantized 2 qubit. Other examples of quantum logic gates derived from classical ones are theToffoli gate and theFredkin gate.
However, the Hilbert-space structure of the qubits permits many quantum gates that are not induced by classical ones. For example, a relative phase shift is a 1 qubit gate given by multiplication by thephase shift operator:
so
Again, we consider firstreversible classical computation. Conceptually, there is no difference between a reversiblen-bit circuit and a reversiblen-bit logic gate: either one is just an invertible function on the space ofn bit data. However, as mentioned in the previous section, for engineering reasons we would like to have a small number of simple reversible gates, that can be put together to assemble any reversible circuit.
To explain this assembly process, suppose we have a reversiblen-bit gatef and a reversiblem-bit gateg. Putting them together means producing a new circuit by connecting some set ofk outputs off to some set ofk inputs ofg as in the figure below. In that figure,n=5,k=3 andm=7. The resulting circuit is also reversible and operates onn+m−k bits.

We will refer to this scheme as aclassical assemblage (This concept corresponds to a technical definition inKitaev's pioneering paper cited below). In composing these reversible machines, it is important to ensure that the intermediate machines are also reversible. This condition assures thatintermediate "garbage" is not created (the net physical effect would be to increase entropy, which is one of the motivations for going through this exercise).
Note that each horizontal line on the above picture represents either 0 or 1, not these probabilities. Since quantum computations are reversible, at each 'step' the number of lines must be the same number of input lines. Also, each input combination must be mapped to a single combination at each 'step'. This means that each intermediate combination in a quantum circuit is a bijective function of the input.[6]
Now it is possible to show that theToffoli gate is a universal gate. This means that given any reversible classicaln-bit circuith, we can construct a classical assemblage of Toffoli gates in the above manner to produce an (n+m)-bit circuitf such that
where there arem underbraced zeroed inputs and
Notice that the result always has a string ofm zeros as theancilla bits. No "rubbish" is ever produced, and so this computation is indeed one that, in a physical sense, generates no entropy. This issue is carefully discussed in Kitaev's article.
More generally, any functionf (bijective or not) can be simulated by a circuit of Toffoli gates. Obviously, if the mapping fails to beinjective, at some point in the simulation (for example as the last step) some "garbage" has to be produced.
For quantum circuits a similar composition of qubit gates can be defined. That is, associated to anyclassical assemblage as above, we can produce a reversible quantum circuit when in place off we have ann-qubit gateU and in place ofg we have anm-qubit gateW. See illustration below:

The fact that connecting gates this way gives rise to a unitary mapping onn+m−k qubit space is easy to check. In a real quantum computer the physical connection between the gates is a major engineering challenge, since it is one of the places wheredecoherence may occur.
There are alsouniversality theorems for certain sets of well-known gates; such a universality theorem exists, for instance, for the pair consisting of the single qubit phase gateUθ mentioned above (for a suitable value of θ), together with the 2-qubitCNOT gateWCNOT. However, the universality theorem for the quantum case is somewhat weaker than the one for the classical case; it asserts only that any reversiblen-qubit circuit can beapproximated arbitrarily well by circuits assembled from these two elementary gates. Note that there areuncountably many possible single qubit phase gates, one for every possible angle θ, so they cannot all be represented by a finite circuit constructed from {Uθ,WCNOT}.
So far we have not shown how quantum circuits are used to perform computations. Since many important numerical problems reduce to computing a unitary transformationU on a finite-dimensional space (the celebrateddiscrete Fourier transform being a prime example), one might expect that some quantum circuit could be designed to carry out the transformationU. In principle, one needs only to prepare ann qubit state ψ as an appropriate superposition of computational basis states for the input and measure the outputUψ. Unfortunately, there are two problems with this:
This does not prevent quantum circuits for the discrete Fourier transform from being used as intermediate steps in other quantum circuits, but the use is more subtle. In fact quantum computations areprobabilistic.
We now provide a mathematical model for how quantum circuits can simulateprobabilistic but classical computations. Consider anr-qubit circuitU withregister spaceHQB(r).U is thus a unitary map
In order to associate this circuit to a classical mapping on bitstrings, we specify
The contentsx =x1, ...,xm ofthe classical input register are used to initialize the qubitregister in some way. Ideally, this would be done with the computational basisstate
where there arer-m underbraced zeroed inputs. Nevertheless,this perfect initialization is completely unrealistic. Let us assumetherefore that the initialization is a mixed state given by some density operatorS which is near the idealized input in some appropriate metric, e.g.
Similarly, the output register space is related to the qubit register, by aYvalued observableA. Note that observables in quantum mechanics are usually defined interms ofprojection valued measures onR; if the variablehappens to be discrete, the projection valued measure reduces to afamily {Eλ} indexed on some parameter λranging over a countable set. Similarly, aY valued observable,can be associated with a family of pairwise orthogonal projections{Ey} indexed by elements ofY. such that
Given a mixed stateS, there corresponds a probability measure onYgiven by
The functionF:X →Y is computed by a circuitU:HQB(r) →HQB(r) to within ε if and only iffor all bitstringsx of lengthm
Now
so that
Theorem. If ε + δ < 1/2, then the probability distribution
onY can be used to determineF(x) with an arbitrarily small probability of error by majority sampling, for a sufficiently large sample size. Specifically, takek independent samples from the probability distribution Pr onY and choose a value on which more than half of the samples agree. The probability that the valueF(x) is sampled more thank/2 times is at least
where γ = 1/2 - ε - δ.
This follows by applying theChernoff bound.