Single-Qubit Gates
Quantum gates are unitary transformations that rotate qubit states on the Bloch sphere. A gate is unitary if:
This ensures that quantum evolution preserves the normalization of probability amplitudes.
Pauli Gates
The Pauli matrices are fundamental single-qubit gates:
Pauli-X (NOT gate):
It flips , analogous to the classical NOT gate. On the Bloch sphere, is a rotation about the X-axis.
Pauli-Y:
Pauli-Z (phase flip):
It leaves unchanged and maps .
Hadamard Gate
The Hadamard gate creates superpositions:
Key properties:
- (self-inverse)
On the Bloch sphere, is a rotation that maps the Z-axis to the X-axis.
Phase Gates
S gate (phase gate):
T gate ( gate):
The T gate is particularly important in fault-tolerant quantum computing. The relation holds, and both gates add a relative phase to the component.
Two-Qubit Gates
CNOT (Controlled-NOT):
The CNOT gate flips the target qubit if and only if the control qubit is . It is the primary entangling gate and can create Bell states:
Toffoli Gate (CCNOT)
The Toffoli gate is a three-qubit gate that flips the target if both controls are :
The Toffoli gate is universal for classical computation β any Boolean function can be implemented using only Toffoli gates. Combined with the Hadamard gate, the Toffoli gate is universal for quantum computation.
SWAP Gate
The SWAP gate exchanges two qubits:
It can be decomposed into three CNOT gates:
Python: Gate Simulator
import numpy as np
# Pauli gates
X = np.array([[0, 1], [1, 0]], dtype=complex)
Y = np.array([[0, -1j], [1j, 0]], dtype=complex)
Z = np.array([[1, 0], [0, -1]], dtype=complex)
# Hadamard
H = (1 / np.sqrt(2)) * np.array([[1, 1], [1, -1]], dtype=complex)
# CNOT
CNOT = np.array([[1,0,0,0],[0,1,0,0],[0,0,0,1],[0,0,1,0]], dtype=complex)
# Create Bell state
KET_00 = np.kron(np.array([1,0]), np.array([1,0]))
bell = CNOT @ np.kron(H, np.eye(2)) @ KET_00
print(f"Bell state: {bell}")
print(f"Probabilities: {np.abs(bell)**2}")
This code constructs the Bell state by applying to the first qubit followed by CNOT.
Gate Decomposition Theorems
Solovay-Kitaev theorem: any single-qubit gate can be approximated to precision using gates from a finite universal set, where .
Solovay-Kitaev corollary: the overhead of approximating arbitrary gates is polylogarithmic in precision, making fault-tolerant quantum computing practical.
This theorem guarantees that even with a limited gate set, we can implement any quantum algorithm to arbitrary precision.