What Are Quantum Gates?
Quantum gates form the fundamental building blocks of quantum circuits, acting as the essential logic elements that facilitate the running of quantum algorithms. These algorithms are used in chemistry, optimization, AI, and other areas.
These specialized quantum gates manipulate the state of qubits, which enables quantum algorithms to perform complex operations and take advantage of quantum computing capabilities such as parallelism, interference, entanglement, and superposition.
The Difference Between Classical and Quantum Gates
Quantum gates differ from classical gates in that they operate on qubits, not classical bits, which are limited to being either 0s or 1s at any given moment. A qubit can exist in the 0 and 1 states simultaneously, known as superposition, enabling quantum gates to perform multiple calculations at once in this superposition state. Quantum gates can also entangle qubits, creating a unique connection in which altering one qubit can instantaneously affect another. Quantum algorithms use these features of quantum gates to execute computations that, for certain tasks, can be more efficient than those performed by classical algorithms.
Common Types of Quantum Gates
Common types of quantum gates include Pauli, Clifford, non-Clifford, rotation, control, and multiqubit gates.
Pauli Gates
Pauli gates are a set of one-qubit quantum gates that are represented by the Pauli matrices. The three Pauli gates are the Pauli X, Y, and Z gates, and they correspond to rotations around the respective axes of the Bloch sphere by π radians (180 degrees). They have the following properties:
- They are Hermitian: (\( U^{†} = U\)), where \( U^{†} \) is the conjugate transpose of \( U\).
- They are unitary: (\( U^{†} U = U U^{†} = I \)), where \( I\) is the identity matrix.
- They have eigenvalues of ±1.
Clifford Gates
Applying a Clifford gate before and after a Pauli operator results in another Pauli operator. The set of Clifford gates forms a group known as the Clifford group, which is an important concept in quantum error correction and quantum computing. Examples of Clifford gates include Pauli X, Y, and Z gates; Hadamard gates (H); phase gates; and controlled X, Y, and Z gates, among others.
Clifford gates have the following properties:
- They map the Pauli group to itself under conjugation. For example, \( HXH^{†} = Z \). Here, \( H^{†} \) is the Hermitian conjugate (or the adjoint) of the Hadamard gate \( H\), and \( H\) acts as the Clifford gate. \( X\) and \( Z\) are Pauli X gate and Pauli Z gate, respectively.
- They can be efficiently simulated using classical gates, which is known as the Gottesman-Knill theorem.
- They play an important role in quantum error correction.
Non-Clifford Gates
T and Toffoli gates are examples of non-Clifford gates.
Rotation Gates
Rotation gates in quantum computing are operations that rotate the state of a qubit around a particular axis on the Bloch sphere. Each rotation gate is parameterized by an angle θ and corresponds to a rotation by that angle. The most common rotation gates are the:
- x-axis rotation gate, which rotates a qubit around the x-axis of the Bloch sphere by an angle \( θ \)
- y-axis rotation gate, which rotates a qubit around the y-axis by an angle \( θ \)
- z-axis rotation gate, which rotates a qubit around the z-axis by an angle \( θ \)
- z-axis rotation gate with global phase, which is equivalent to the z-axis rotation gate with a global phase difference
These gates are required for creating arbitrary single-qubit states. Performing these precise rotations is necessary for quantum state manipulation and quantum computation.
Control Gates
Control gates in quantum computing are multiqubit gates in which one or more qubits act as the control for the operation to be executed on the other qubit, known as the target. The operation is performed on the target qubits only when the control qubits are in a specific state, typically the \( |1⟩ \) state. The most common examples are the CNOT, or controlled X gate, which flips the target qubit if the control qubit is \( |1⟩ \), and the controlled x-axis rotation gate, which rotates the target qubit by an angle \( θ \) around the x-axis if the control qubit is \( |1⟩ \). Control gates are used for creating entanglement and implementing conditional logic in quantum circuits. Other variants include the controlled Z gate, controlled Hadamard gate, and controlled controlled X gate, also known as a Toffoli gate, among others.
Multiqubit Gates
Quantum gates that operate on two or more qubits are known as multiqubit gates. They facilitate the creation of highly entangled quantum states and enabling the execution of complex quantum algorithms.
Properties of Quantum Gates
Quantum gates have several special properties:
- Unitarity: Quantum gates are unitary matrixes, which means they preserve the total probability of the qubits’ states. After a gate operation, the sum of probabilities of all possible states of the qubits is equal to 1.
- Reversibility: Quantum gates are reversible, meaning that the operation can be undone.
- Combinability:
Parallel operation (tensor product): Quantum gates, for example the Pauli Z gate and Pauli X gate, can act on qubits in parallel. The combined operation is:
\( X \vert q_1⟩ \otimes Z \vert q_0⟩ = (X \otimes Z)\vert q_1 q_0⟩ \)
\( X \otimes Z = \begin{bmatrix} 0\begin{bmatrix} 1 & 0 \\ 0 & -1 \end{bmatrix} & 1\begin{bmatrix} 1 & 0 \\ 0 & -1 \end{bmatrix} \\ 1\begin{bmatrix} 1 & 0 \\ 0 & -1 \end{bmatrix} & 0\begin{bmatrix} 1 & 0 \\ 0 & -1 \end{bmatrix} \end{bmatrix} = \begin{bmatrix} \begin{matrix} 0 & 0 \\ 0 & 0 \end{matrix} & \begin{matrix} 1 & 0 \\ 0 & -1 \end{matrix} \\ \begin{matrix} 1 & 0 \\ 0 & -1 \end{matrix} & \begin{matrix} 0 & 0 \\ 0 & 0 \end{matrix} \end{bmatrix}\)
This operation tensor product allows you to describe the effect of the gates on the combined state of the qubits.
Series operation (matrix multiplication): Quantum gates can also act on the qubit one after the other. The combined operation is:
\( (Z \bullet X) \vert q⟩ \)
Here, \( X\) operates first on qubit \( q\) and then \( Z\).
\( (Z \bullet X) = \begin{bmatrix} 1 & 0 \\ 0 & -1 \end{bmatrix} \begin{bmatrix} 0 & 1 \\ -1 & 0 \end{bmatrix} = \begin{bmatrix} 0 & 1 \\ -1 & 0 \end{bmatrix} \)
This matrix multiplication enables us to describe the effect of the gates in series on the combined state of the qubit.
The resulting matrices describe the overall effect of the quantum gates on the state of the qubits, whether they are in parallel or in series.
Universal Set of Quantum Gates
A universal set of quantum gates is a collection that, through their combined action, can approximate any quantum gate to any desired precision. There are many universal sets of quantum gates; a few common ones are:
- Hadamard, CNOT, and T gate.
- The Pauli X, Y, and Z gates and Hadamard gate can represent any single qubit rotation. Together with the CNOT gate, this set of gates can create any quantum circuit.
- The Clifford group (consisting of Clifford gates) is Hadamard, S gate, and CNOT gate. The Clifford group, together with a non-Clifford gate, such as T gate or the Toffoli gate, is another set of universal quantum gates.
The concept of a universal gate set is important for designing quantum algorithms and practically building quantum computers with a finite set of basic gates. It ensures that with just a finite number of quantum gates, a quantum computer can execute any computable quantum operation and realize any quantum algorithm.
Creating Quantum Gates with MATLAB
MATLAB® and the MATLAB Support Package for Quantum Computing provide built-in quantum gates and customizable composite gates that enable you to build, simulate, and run quantum circuits.
Multiqubit gates in MATLAB include qftGate
and mcxGate
, among others. Additionally, the compositeGates
function enables the integration of multiple quantum gates into a single operation. This approach significantly simplifies the construction of complex quantum gates and enhances efficiency.
See examples of using quantum gates in machine learning, finance, optimization, and chemistry.
Examples and How To
Software Reference
See also: quantum computing , quantum finance
Free Cheat Sheets