Multi-Qubit Gates

Discussion some of simple gates that operate on multiple qubits

Unlike single qubit gates, multi-qubit gates are to complex to be described using the relatively simple Bloch sphere diagram. For these we'll just have their matrix to describe their behaviour.

Something important to note is that all gates must have the same number of inputs as there are outputs. This is because no information can be lost in quantum systems - whatever goes in must come out again.

The Controlled Not Gate

This gate is also called the "CX" or the "controlled X" gate. You can guess what this means - it preforms the same operation as the Pauli X gate but controlled by another qubit.

CNOT=[1000010000010010]\text{CNOT}=\begin{bmatrix}1&0&0&0\\0&1&0&0\\0&0&0&1\\0&0&1&0\end{bmatrix}

We pass in two bits - a control bit and a target bit. If the control bit is 1|1\rangle, the target bit will flip states. If the control bit is 0|0\rangle, nothing happens. The control bit is never affected by this gate.

Toffoli - Double Control

The Toffoli gate ("double control", "CCNOT", "CCX" or "TOFF") does basically the same thing, except this time we have two control bits. If both control bits are 1|1\rangle, we flip our target bit. If either of them are 0|0\rangle nothing happens. The control bits are still never effected.

TOFF=[1000000001000000001000000001000000001000000001000000000100000010]\text{TOFF}=\begin{bmatrix}1&0&0&0&0&0&0&0\\0&1&0&0&0&0&0&0\\0&0&1&0&0&0&0&0\\0&0&0&1&0&0&0&0\\0&0&0&0&1&0&0&0\\0&0&0&0&0&1&0&0\\0&0&0&0&0&0&0&1\\0&0&0&0&0&0&1&0\end{bmatrix}

As we operate on more quits, and end up with more distinguishable states, are matrices get larger. The same as a system with nn qubits have 2n2^n distinguishable states, or matrices will likewise have 2n2^n numbers of rows and columns.

So our TOFF gate, which works on 3 qubits, has 23=82^3=8 distinguishable states, and there for 8 rows and 8 columns in it's matrix.

Notice that this works the same way it would when constructing classical truth tables to describe operations on classical bits.

The Controlled Z Gate

The controlled Z gate ("CZ") works essentially just like the controlled X gate. It's the Pauli Z gate with an extra control bit. When the control bit is 1|1\rangle, we preform the Z gate operation. When the control bit is 0|0\ranglenothing changes. As before, the control bit is never affected by this operation.

CZ=[1000010000100001]\text{CZ}=\begin{bmatrix}1&0&0&0\\0&1&0&0\\0&0&1&0\\0&0&0&-1\end{bmatrix}

The SWAP Gate

This gate does what is says - it swaps the state of the two bits included in the operation. So if the starting state is:

a=0,b=1|a\rangle=|0\rangle, |b\rangle=|1\rangle

The resulting state will be:

a=1,b=0|a\rangle=|1\rangle, |b\rangle=|0\rangle

And of course, vice versa.

SWAP=[1000001001000001]\text{SWAP}=\begin{bmatrix}1&0&0&0\\0&0&1&0\\0&1&0&0\\0&0&0&1\end{bmatrix}

Universal Gate Sets

In the section about classical models of computation, we talked a bit about constructing all possible classical logic gates with just one - the NAND gate. The NAND gate is a universal gate because of this special property.

In quantum computing we have the same concept. All possible quantum gates can be a constructed with a selection of one and two qubit gates. Exactly which gates depends - there are multiple possible universal sets of quantum gates. You'll see different resources will rely on different universal sets. For this tutorial what most important is that you understand the concept.

Last updated