main page, file list, single page HTML, source, report, wiki last updated on 06/07/23

Quantum Gate

{ Currently studying this, there may be errors. ~drummyfish }

Quantum (logic) gate is a quantum computing equivalent of a traditional logic gate. A quantum gate takes as an input N qubits and transforms their states to new states (this is different from classical logical gates that may potentially have a different number of input and output values).

Quantum gates are represented by complex matrices that transform the qubit states (which can be seen as points in multidimensional space, see Bloch sphere). A gate operating on N qubits is represented by a 2^Nx2^N matrix. These matrices have to be unitary. Operations performed by quantum gates may be reversed, unlike those of classical logic gates.

We normally represent a single qubit state with a column vector |a> = a0 * |0> + a1 * |1> => [a0, a1] (look up bra-ket notation). Multiple qubit states are represented as a tensor product of the individual state, e.g. |a,b> = [a0 * b0, a0 * b1, a1 * b0, a1 * b1]. Applying a quantum gate G to such a qubit vector q is performed by simple matrix multiplication: G * v.

Basic gates

Here are some of the most common quantum gates.


Acts on 1 qubit, leaves the qubit state unchanged.

1 0
0 1

Pauli Gates

Act on 1 qubit. There are three types of Pauli gates: X, Y and Z, each one rotates the qubit about the respective axis by pi radians.

The X gate is:

0 1
1 0

The Y gate is:

0 -i
i  0

The Z gate is:

1  0
0 -1


The not gate is identical to the Pauli X gate. It acts on 1 qubit and switches the probabilities of measuring 0 vs 1.


Controlled NOT, acts on 2 qubits. Performs NOT on the second qubit if the first qubit is |1>.

1 0 0 0
0 1 0 0
0 0 0 1
0 0 1 0


All content available under CC0 1.0 (public domain). Send comments and corrections to drummyfish at disroot dot org.