Learning Quantum
  • Project Scope and Purpose
  • Getting Started
    • Need to Know
    • Resources
  • Linear Algebra
    • Linear Algebra Summary
      • Math References
    • Basics
    • Vector Relationships
    • Span, Basis and Spaces
    • Transformations
  • Physics
    • Physics Summary
      • Physics References
    • Classical Mechanics
    • Quantum Mechanics
  • Qubits
    • Qubits Summary
      • Qubit References
    • Classical Bits
    • Quantum Bits
    • Multi-Qubit Systems
  • Quantum Circuits
    • Quantum Circuit Summary
      • Quantum Circuit References
    • Classical Models of Computation
    • Quantum Information
    • Single Qubit Gates
    • Multi-Qubit Gates
  • IBMQ
    • IBMQ Summary
    • Getting Access to IBM Quantum
    • IBMQ Tools
    • Using Quantum Gates - The Circuit Composer
  • Qiskit
    • Qiskit Overview
    • Installing Qiskit
    • Parts of a Qiskit Program
    • Writing a Qiskit Program
  • Supplementary
  • Quantum Safe Algorithms
Powered by GitBook
On this page
  • The Controlled Not Gate
  • Toffoli - Double Control
  • The Controlled Z Gate
  • The SWAP Gate
  • Universal Gate Sets

Was this helpful?

  1. Quantum Circuits

Multi-Qubit Gates

Discussion some of simple gates that operate on multiple qubits

PreviousSingle Qubit GatesNextIBMQ Summary

Last updated 5 years ago

Was this helpful?

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 . 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 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}CNOT=​1000​0100​0001​0010​​

Toffoli - Double Control

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 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:

The resulting state will be:

And of course, vice versa.

Universal Gate Sets

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.

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

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∣1⟩, we flip our target bit. If either of them are ∣0⟩|0\rangle∣0⟩ 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}TOFF=​10000000​01000000​00100000​00010000​00001000​00000100​00000001​00000010​​

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

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

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∣1⟩, we preform the Z gate operation. When the control bit is ∣0⟩|0\rangle∣0⟩nothing changes. As before, the control bit is never affected by this operation.

CZ=[100001000010000−1]\text{CZ}=\begin{bmatrix}1&0&0&0\\0&1&0&0\\0&0&1&0\\0&0&0&-1\end{bmatrix}CZ=​1000​0100​0010​000−1​​
∣a⟩=∣0⟩,∣b⟩=∣1⟩|a\rangle=|0\rangle, |b\rangle=|1\rangle∣a⟩=∣0⟩,∣b⟩=∣1⟩
∣a⟩=∣1⟩,∣b⟩=∣0⟩|a\rangle=|1\rangle, |b\rangle=|0\rangle∣a⟩=∣1⟩,∣b⟩=∣0⟩
SWAP=[1000001001000001]\text{SWAP}=\begin{bmatrix}1&0&0&0\\0&0&1&0\\0&1&0&0\\0&0&0&1\end{bmatrix}SWAP=​1000​0010​0100​0001​​

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

classical models of computation
the NAND gate
same number of inputs as there are outputs
Pauli X
Symbol for the CX gate
Symbol for the TOFF gate
Symbol for the CZ gate
Symbol for the SWAP gate