In
quantum computing
Quantum computing is a type of computation whose operations can harness the phenomena of quantum mechanics, such as superposition, interference, and entanglement. Devices that perform quantum computations are known as quantum computers. Thou ...
and specifically the
quantum circuit
In quantum information theory, a quantum circuit is a model for quantum computation, similar to classical circuits, in which a computation is a sequence of quantum gates, measurements, initializations of qubits to known values, and possibly ...
model of computation
In computer science, and more specifically in computability theory and computational complexity theory, a model of computation is a model which describes how an output of a mathematical function is computed given an input. A model describes h ...
, a quantum logic gate (or simply quantum gate) is a basic quantum circuit operating on a small number of
qubits. They are the building blocks of quantum circuits, like classical
logic gate
A logic gate is an idealized or physical device implementing a Boolean function, a logical operation performed on one or more binary inputs that produces a single binary output. Depending on the context, the term may refer to an ideal logic ga ...
s are for conventional digital circuits.
Unlike many classical logic gates, quantum logic gates are
reversible. It is possible to perform classical computing using only reversible gates. For example, the reversible
Toffoli gate can implement all Boolean functions, often at the cost of having to use
ancilla bits. The Toffoli gate has a direct quantum equivalent, showing that quantum circuits can perform all operations performed by classical circuits.
Quantum gates are
unitary operators, and are described as
unitary matrices relative to some
basis. Usually we use the ''computational basis'', which unless we compare it with something, just means that for a ''d''-level quantum system (such as a
qubit, a
quantum register, or
qutrits and
qudits) we have labeled the orthogonal basis vectors or use
binary notation.
History
The current notation for quantum gates was developed by many of the founders of quantum information science including Adriano Barenco,
Charles Bennett,
Richard Cleve,
David P. DiVincenzo,
Norman Margolus,
Peter Shor, Tycho Sleator,
John A. Smolin
John A. Smolin (born 1967) is an American physicist and Fellow of the American Physical Society at IBM's Thomas J. Watson Research Center.
Smolin is best known for his work in quantum information theory, where, with collaborators, he introduced ...
, and Harald Weinfurter,
building on notation introduced by
Richard Feynman
Richard Phillips Feynman (; May 11, 1918 – February 15, 1988) was an American theoretical physicist, known for his work in the path integral formulation of quantum mechanics, the theory of quantum electrodynamics, the physics of the superf ...
in 1986.
Representation
Quantum logic gates are represented by
unitary matrices. A gate which acts on
qubits is represented by a
unitary matrix, and the
set of all such gates with the group operation of
matrix multiplication
In mathematics, particularly in linear algebra, matrix multiplication is a binary operation that produces a matrix from two matrices. For matrix multiplication, the number of columns in the first matrix must be equal to the number of rows in the ...
is the
symmetry group U(2''n'').
The
quantum state
In quantum physics, a quantum state is a mathematical entity that provides a probability distribution for the outcomes of each possible measurement on a system. Knowledge of the quantum state together with the rules for the system's evolution in ...
s that the gates act upon are
unit vectors in
complex dimensions, with the
complex Euclidean norm (the
2-norm
In mathematics, a norm is a function from a real or complex vector space to the non-negative real numbers that behaves in certain ways like the distance from the origin: it commutes with scaling, obeys a form of the triangle inequality, and is z ...
). The
basis vectors (sometimes called ''
eigenstates'') are the possible outcomes if
measured
Measurement is the quantification of attributes of an object or event, which can be used to compare with other objects or events.
In other words, measurement is a process of determining how large or small a physical quantity is as compared t ...
, and a quantum state is a
linear combination of these outcomes. The most common quantum gates operate on
vector space
In mathematics and physics, a vector space (also called a linear space) is a set whose elements, often called '' vectors'', may be added together and multiplied ("scaled") by numbers called '' scalars''. Scalars are often real numbers, but ...
s of one or two qubits, just like the common
classical logic gates operate on one or two
bit
The bit is the most basic unit of information in computing and digital communications. The name is a portmanteau of binary digit. The bit represents a logical state with one of two possible values. These values are most commonly represented a ...
s.
Even though the quantum logic gates belong to
continuous symmetry groups, real hardware is inexact and thus limited in precision. The application of gates typically introduces errors, and the
quantum states fidelities decreases over time. If
error correction is used, the usable gates are further restricted to a finite set. Later in this article, this is sometimes ignored as the focus is on the quantum gates' mathematical properties.
Quantum states are typically represented by "kets", from a notation known as
bra-ket.
The vector representation of a single
qubit is
:
Here,
and
are the complex
probability amplitudes of the qubit. These values determine the probability of measuring a 0 or a 1, when measuring the state of the qubit. See
measurement below for details.
The value zero is represented by the ket and the value one is represented by the ket
The
tensor product
In mathematics, the tensor product V \otimes W of two vector spaces and (over the same Field (mathematics), field) is a vector space to which is associated a bilinear map V\times W \to V\otimes W that maps a pair (v,w),\ v\in V, w\in W to an e ...
(or
Kronecker product) is used to combine quantum states. The combined state for a
qubit register is the tensor product of the constituent qubits. The tensor product is denoted by the symbol
The vector representation of two qubits is:
:
The action of the gate on a specific quantum state is found by
multiplying
Multiplication (often denoted by the cross symbol , by the mid-line dot operator , by juxtaposition, or, on computers, by an asterisk ) is one of the four elementary mathematical operations of arithmetic, with the other ones being addition ...
the vector
which represents the state by the matrix
representing the gate. The result is a new quantum state
:
Notable examples
There exists an
uncountably infinite
In mathematics, an uncountable set (or uncountably infinite set) is an infinite set that contains too many elements to be countable. The uncountability of a set is closely related to its cardinal number: a set is uncountable if its cardinal num ...
number of gates. Some of them have been named by various authors,
and below follow some of those most often used in the literature.
Identity gate
The identity gate is the
identity matrix
In linear algebra, the identity matrix of size n is the n\times n square matrix with ones on the main diagonal and zeros elsewhere.
Terminology and notation
The identity matrix is often denoted by I_n, or simply by I if the size is immaterial ...
, usually written as ''I'', and is defined for a single qubit as
:
where ''I'' is basis independent and does not modify the quantum state. The identity gate is most useful when describing mathematically the result of various gate operations or when discussing multi-qubit circuits.
Pauli gates (''X'',''Y'',''Z'')
The Pauli gates
are the three
Pauli matrices and act on a single qubit. The Pauli ''X'', ''Y'' and ''Z'' equate, respectively, to a rotation around the ''x'', ''y'' and ''z'' axes of the
Bloch sphere by
radians.
The Pauli-''X'' gate is the quantum equivalent of the
NOT gate for classical computers with respect to the standard basis which distinguishes the ''z'' axis on the
Bloch sphere. It is sometimes called a bit-flip as it maps
to
and
to
. Similarly, the Pauli-''Y'' maps
to
and
to . Pauli ''Z'' leaves the basis state
unchanged and maps
to Due to this nature, Pauli ''Z'' is sometimes called phase-flip.
These matrices are usually represented as
:
:
:
The Pauli matrices are
involutory, meaning that the square of a Pauli matrix is the
identity matrix
In linear algebra, the identity matrix of size n is the n\times n square matrix with ones on the main diagonal and zeros elsewhere.
Terminology and notation
The identity matrix is often denoted by I_n, or simply by I if the size is immaterial ...
.
:
The Pauli matrices also
anti-commute
In mathematics, anticommutativity is a specific property of some non- commutative mathematical operations. Swapping the position of two arguments of an antisymmetric operation yields a result which is the ''inverse'' of the result with unswapped ...
, for example
The
matrix exponential of a Pauli matrix
is a
rotation operator, often written as
Controlled gates
Controlled gates act on 2 or more qubits, where one or more qubits act as a control for some operation.
For example, the
controlled NOT gate (or CNOT or CX) acts on 2 qubits, and performs the NOT operation on the second qubit only when the first qubit is and otherwise leaves it unchanged. With respect to the basis it is represented by the
Hermitian unitary matrix:
:
The CNOT (or controlled Pauli-''X'') gate can be described as the gate that maps the basis states
, where
is
XOR.
The CNOT can be expressed in the
Pauli basis as:
:
Being a Hermitian unitary operator, CNOT
has the property and
, and is
involutory.
More generally if ''U'' is a gate that operates on a single qubit with matrix representation
:
then the ''controlled-U gate'' is a gate that operates on two qubits in such a way that the first qubit serves as a control. It maps the basis states as follows.
:
:
:
:
The matrix representing the controlled ''U'' is
:
When ''U'' is one of the Pauli operators, ''X'',''Y'', ''Z'', the respective terms "controlled-''X''", "controlled-''Y''", or "controlled-''Z''" are sometimes used. Sometimes this is shortened to just C''X'', C''Y'' and C''Z''.
In general, any single qubit
unitary gate can be expressed as
, where ''H'' is a
Hermitian matrix, and then the controlled ''U'' is
Control can be extended to gates with arbitrary number of qubits
and functions in programming languages.
Functions can be conditioned on superposition states.
Classical control
Gates can also be controlled by classical logic. A quantum computer is controlled by a
classical computer, and behave like a
coprocessor that receives instructions from the classical computer about what gates to execute on which qubits.
Classical control is simply the inclusion, or omission, of gates in the instruction sequence for the quantum computer.
Phase shift gates
The phase shift is a family of single-qubit gates that map the basis states
and
. The probability of measuring a
or
is unchanged after applying this gate, however it modifies the phase of the quantum state. This is equivalent to tracing a horizontal circle (a line of latitude), or a rotation along the z-axis on the
Bloch sphere by
radians. The phase shift gate is represented by the matrix:
:
where
is the ''phase shift'' with the
period . Some common examples are the ''T'' gate where
(historically known as the
gate), the phase gate (also known as the S gate, written as ''S'', though ''S'' is sometimes used for SWAP gates) where
and the
Pauli-''Z'' gate where
.
The phase shift gates are related to each other as follows:
:
:
: