Single-Qubit States and Gates#
Pauli matrices, Hadamard, phase gates, rotations on the Bloch sphere. The universal single-qubit gate set.
Single-qubit gates are the building blocks of quantum circuits. Each gate is a \(2 \times 2\) unitary matrix that maps one qubit state to another. On the Bloch sphere, every single-qubit gate corresponds to a rotation. This section catalogs the essential gates and shows how to combine them.
The Pauli Matrices#
The three Pauli matrices, together with the identity, form a basis for all \(2 \times 2\) Hermitian matrices. They are the most important operators in quantum computing.
Properties#
\(X^2 = Y^2 = Z^2 = I\) (each is its own inverse)
\(XY = iZ\), \(YZ = iX\), \(ZX = iY\) (cyclic commutation)
Eigenvalues: \(\pm 1\) for all three
Trace: \(\text{Tr}(X) = \text{Tr}(Y) = \text{Tr}(Z) = 0\)
Actions#
Gate |
Action |
Bloch sphere |
|---|---|---|
\(X\) |
\(|0\rangle \leftrightarrow |1\rangle\) (bit flip) |
\(180°\) rotation about \(x\)-axis |
\(Y\) |
\(|0\rangle \mapsto i|1\rangle\), \(|1\rangle \mapsto -i|0\rangle\) |
\(180°\) rotation about \(y\)-axis |
\(Z\) |
\(|0\rangle \mapsto |0\rangle\), \(|1\rangle \mapsto -|1\rangle\) (phase flip) |
\(180°\) rotation about \(z\)-axis |
The Hadamard Gate#
The Hadamard gate creates and destroys superpositions:
Properties:
\(H^2 = I\) (self-inverse)
\(H = \frac{X + Z}{\sqrt{2}}\) (midway between \(X\) and \(Z\))
On the Bloch sphere: \(180°\) rotation about the axis \((\hat{x} + \hat{z})/\sqrt{2}\)
The Hadamard gate changes the measurement basis: measuring \(H|\psi\rangle\) in the \(Z\)-basis is equivalent to measuring \(|\psi\rangle\) in the \(X\)-basis.
Phase Gates#
Phase gates modify the relative phase between \(|0\rangle\) and \(|1\rangle\):
Important special cases:
Gate |
\(\phi\) |
Matrix |
Effect |
|---|---|---|---|
\(S\) |
\(\pi/2\) |
\(\begin{pmatrix}1&0\\0&i\end{pmatrix}\) |
Quarter turn (\(Z\)-axis) |
\(T\) |
\(\pi/4\) |
\(\begin{pmatrix}1&0\\0&e^{i\pi/4}\end{pmatrix}\) |
Eighth turn (\(Z\)-axis) |
\(Z\) |
\(\pi\) |
\(\begin{pmatrix}1&0\\0&-1\end{pmatrix}\) |
Half turn (\(Z\)-axis) |
The \(T\) gate is especially important: it cannot be efficiently simulated classically when combined with Clifford gates, making it the resource for universal quantum computation.
The Clifford + T Gate Set
The Clifford group (generated by \(H\), \(S\), and CNOT) can be efficiently simulated classically by the Gottesman-Knill theorem. Adding the \(T\) gate makes the set universal: any unitary can be approximated to arbitrary precision. The Solovay-Kitaev theorem guarantees that \(O(\log^c(1/\epsilon))\) gates suffice for precision \(\epsilon\).
Rotation Gates#
General rotations about the Bloch sphere axes:
Any single-qubit unitary \(U\) can be decomposed as:
for suitable angles \(\gamma, \alpha, \beta, \delta\). This is the \(ZYZ\) decomposition.
Universal Single-Qubit Gate Sets#
A set of gates is universal for single-qubit operations if any single-qubit unitary can be expressed (or approximated) as a finite product of gates from the set.
Gate set |
Universal? |
Notes |
|---|---|---|
\(\{R_y(\theta), R_z(\phi)\}\) for all \(\theta, \phi\) |
Exact |
Continuous parameters |
\(\{H, T\}\) |
Approximate |
Dense in SU(2), Solovay-Kitaev applies |
\(\{H, S\}\) |
No |
Generates finite Clifford group only |
\(\{X, H\}\) |
No |
Cannot generate arbitrary phases |
Code Examples#
from qiskit import QuantumCircuit
from qiskit.quantum_info import Statevector
import numpy as np
qc = QuantumCircuit(1)
# Apply gates
qc.h(0) # Hadamard: |0> -> |+>
qc.t(0) # T gate: adds pi/4 phase to |1>
qc.rx(np.pi/3, 0) # Rx rotation by pi/3
qc.rz(np.pi/6, 0) # Rz rotation by pi/6
# Get the statevector
sv = Statevector.from_instruction(qc)
print("State:", sv)
print("Probabilities:", sv.probabilities())
import cirq
import numpy as np
qubit = cirq.LineQubit(0)
circuit = cirq.Circuit([
cirq.H(qubit), # Hadamard
cirq.T(qubit), # T gate
cirq.rx(rads=np.pi/3)(qubit), # Rx rotation
cirq.rz(rads=np.pi/6)(qubit), # Rz rotation
])
print(circuit)
# Simulate
sim = cirq.Simulator()
result = sim.simulate(circuit)
print("State vector:", result.final_state_vector)
import pennylane as qml
import numpy as np
dev = qml.device("default.qubit", wires=1)
@qml.qnode(dev)
def circuit():
qml.Hadamard(wires=0)
qml.T(wires=0)
qml.RX(np.pi/3, wires=0)
qml.RZ(np.pi/6, wires=0)
return qml.state()
state = circuit()
print("State:", state)
print("Probabilities:", np.abs(state)**2)
from pyquil import Program
from pyquil.gates import H, T, RX, RZ
from pyquil.quilbase import DefGate
import numpy as np
p = Program()
p += H(0) # Hadamard
p += T(0) # T gate
p += RX(np.pi/3, 0) # Rx rotation
p += RZ(np.pi/6, 0) # Rz rotation
print(p)
Gate Summary Table#
Gate |
Matrix |
Inverse |
Bloch Rotation |
|---|---|---|---|
\(X\) |
\(\begin{pmatrix}0&1\\1&0\end{pmatrix}\) |
\(X\) |
\(\pi\) about \(\hat{x}\) |
\(Y\) |
\(\begin{pmatrix}0&-i\\i&0\end{pmatrix}\) |
\(Y\) |
\(\pi\) about \(\hat{y}\) |
\(Z\) |
\(\begin{pmatrix}1&0\\0&-1\end{pmatrix}\) |
\(Z\) |
\(\pi\) about \(\hat{z}\) |
\(H\) |
\(\frac{1}{\sqrt{2}}\begin{pmatrix}1&1\\1&-1\end{pmatrix}\) |
\(H\) |
\(\pi\) about \((\hat{x}+\hat{z})/\sqrt{2}\) |
\(S\) |
\(\begin{pmatrix}1&0\\0&i\end{pmatrix}\) |
\(S^\dagger\) |
\(\pi/2\) about \(\hat{z}\) |
\(T\) |
\(\begin{pmatrix}1&0\\0&e^{i\pi/4}\end{pmatrix}\) |
\(T^\dagger\) |
\(\pi/4\) about \(\hat{z}\) |
Further Reading#
Nielsen, M. A. & Chuang, I. L. (2010). Quantum Computation and Quantum Information, Section 4.2.
Dawson, C. M. & Nielsen, M. A. (2006). “The Solovay-Kitaev Algorithm.” Quantum Information & Computation, 6(1), 81-95.
Gottesman, D. (1998). “The Heisenberg Representation of Quantum Computers.” arXiv:quant-ph/9807006.