Qubits, Bloch Sphere, and Quantum Gates
The fundamental building blocks of quantum computation
1.1 The Qubit
The fundamental unit of quantum information is the qubit (quantum bit). Unlike a classical bit that is definitively 0 or 1, a qubit can exist in a superposition of both computational basis states:
$$|\psi\rangle = \alpha|0\rangle + \beta|1\rangle$$
where $\alpha, \beta \in \mathbb{C}$ are probability amplitudes satisfying the normalization condition:
$$|\alpha|^2 + |\beta|^2 = 1$$
In the computational basis, we identify:
- $|0\rangle = \begin{pmatrix} 1 \\ 0 \end{pmatrix}$ -- the ground state (analogous to classical 0)
- $|1\rangle = \begin{pmatrix} 0 \\ 1 \end{pmatrix}$ -- the excited state (analogous to classical 1)
Upon measurement in the computational basis, the qubit collapses to $|0\rangle$ with probability $|\alpha|^2$ or to $|1\rangle$ with probability $|\beta|^2$. This probabilistic nature is fundamentally different from classical randomness -- the qubit genuinely exists in both states simultaneously until measured.
Global Phase Invariance
Two states that differ only by a global phase factor $e^{i\gamma}$ are physically indistinguishable:
$$|\psi\rangle \sim e^{i\gamma}|\psi\rangle \quad \text{(same physical state)}$$
This means we can always choose $\alpha$ to be real and non-negative, leaving three real parameters, reduced to two by normalization.
1.2 The Bloch Sphere
Exploiting global phase freedom, any single-qubit pure state can be written as:
$$|\psi\rangle = \cos\frac{\theta}{2}|0\rangle + e^{i\phi}\sin\frac{\theta}{2}|1\rangle$$
where $\theta \in [0, \pi]$ and $\phi \in [0, 2\pi)$. This parametrization maps each qubit state to a point on the unit sphere -- the Bloch sphere:
- North pole ($\theta = 0$): $|0\rangle$
- South pole ($\theta = \pi$): $|1\rangle$
- Equator ($\theta = \pi/2$): equal superpositions, e.g. $|+\rangle = \frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)$
The Bloch vector is:
$$\vec{r} = (\sin\theta\cos\phi,\; \sin\theta\sin\phi,\; \cos\theta)$$
For pure states $|\vec{r}| = 1$. Mixed states (described by density matrices) correspond to points inside the sphere with $|\vec{r}| < 1$. The maximally mixed state $\rho = I/2$ sits at the center.
1.3 Single-Qubit Gates
Quantum gates are unitary operators: $UU^\dagger = U^\dagger U = I$. Unitarity ensures that quantum evolution is reversible and preserves the norm of the state vector. Single-qubit gates are represented by $2 \times 2$ unitary matrices.
Pauli Gates
The three Pauli matrices, together with the identity, form a basis for all $2 \times 2$ Hermitian matrices:
Pauli-X (NOT gate)
$$X = \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}$$
Rotation by $\pi$ about x-axis
Pauli-Y
$$Y = \begin{pmatrix} 0 & -i \\ i & 0 \end{pmatrix}$$
Rotation by $\pi$ about y-axis
Pauli-Z
$$Z = \begin{pmatrix} 1 & 0 \\ 0 & -1 \end{pmatrix}$$
Rotation by $\pi$ about z-axis
Identity
$$I = \begin{pmatrix} 1 & 0 \\ 0 & 1 \end{pmatrix}$$
No operation
Key algebraic properties of the Pauli matrices:
- $X^2 = Y^2 = Z^2 = I$ (each is its own inverse)
- $XY = iZ$, $YZ = iX$, $ZX = iY$ (cyclic commutation)
- $\{X, Y\} = \{Y, Z\} = \{Z, X\} = 0$ (anticommutation)
- $\text{tr}(\sigma_i) = 0$, $\text{tr}(\sigma_i \sigma_j) = 2\delta_{ij}$
Hadamard Gate
The Hadamard gate creates equal superpositions and is one of the most frequently used gates:
$$H = \frac{1}{\sqrt{2}}\begin{pmatrix} 1 & 1 \\ 1 & -1 \end{pmatrix}$$
- $H|0\rangle = |+\rangle = \frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)$
- $H|1\rangle = |-\rangle = \frac{1}{\sqrt{2}}(|0\rangle - |1\rangle)$
- $H^2 = I$ (self-inverse)
- $H = \frac{X + Z}{\sqrt{2}}$ (in terms of Paulis)
Phase and T Gates
S Gate (Phase)
$$S = \begin{pmatrix} 1 & 0 \\ 0 & i \end{pmatrix} = \sqrt{Z}$$
T Gate ($\pi/8$)
$$T = \begin{pmatrix} 1 & 0 \\ 0 & e^{i\pi/4} \end{pmatrix} = \sqrt{S}$$
General Single-Qubit Rotation
Any single-qubit unitary can be decomposed as a rotation about an arbitrary axis $\hat{n}$:
$$R_{\hat{n}}(\theta) = e^{-i\theta\hat{n}\cdot\vec{\sigma}/2} = \cos\frac{\theta}{2}\,I - i\sin\frac{\theta}{2}\,(n_x X + n_y Y + n_z Z)$$
The Z-Y decomposition theorem states that any $U \in \text{SU}(2)$ can be written as:
$$U = e^{i\alpha} R_z(\beta) R_y(\gamma) R_z(\delta)$$
1.4 Multi-Qubit Systems and Gates
A system of $n$ qubits lives in the tensor product Hilbert space $\mathcal{H} = (\mathbb{C}^2)^{\otimes n}$, which has dimension $2^n$. A general $n$-qubit state is:
$$|\psi\rangle = \sum_{x \in \{0,1\}^n} c_x |x\rangle, \quad \sum_x |c_x|^2 = 1$$
CNOT Gate (Controlled-NOT)
The CNOT gate is the quintessential two-qubit gate. It flips the target qubit if and only if the control qubit is $|1\rangle$:
$$\text{CNOT} = |0\rangle\langle 0| \otimes I + |1\rangle\langle 1| \otimes X = \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0 \end{pmatrix}$$
Truth table:
- $|00\rangle \to |00\rangle$
- $|01\rangle \to |01\rangle$
- $|10\rangle \to |11\rangle$
- $|11\rangle \to |10\rangle$
Creating Entanglement: Bell States
Applying a Hadamard to the first qubit followed by a CNOT creates the four Bell states -- maximally entangled two-qubit states:
- $$|\Phi^+\rangle = \frac{1}{\sqrt{2}}(|00\rangle + |11\rangle)$$
- $$|\Phi^-\rangle = \frac{1}{\sqrt{2}}(|00\rangle - |11\rangle)$$
- $$|\Psi^+\rangle = \frac{1}{\sqrt{2}}(|01\rangle + |10\rangle)$$
- $$|\Psi^-\rangle = \frac{1}{\sqrt{2}}(|01\rangle - |10\rangle)$$
Toffoli Gate (CCNOT)
The Toffoli gate is a three-qubit gate that flips the target only when both controls are $|1\rangle$:
$$\text{Toffoli}: |a, b, c\rangle \to |a, b, c \oplus (a \cdot b)\rangle$$
The Toffoli gate is classically universal (it can implement any classical Boolean function reversibly) and, combined with the Hadamard gate, becomes quantum-universal.
SWAP Gate
$$\text{SWAP} = \begin{pmatrix} 1&0&0&0 \\ 0&0&1&0 \\ 0&1&0&0 \\ 0&0&0&1 \end{pmatrix}, \quad \text{SWAP}|a,b\rangle = |b,a\rangle$$
The SWAP gate can be decomposed into three CNOT gates: SWAP = CNOT(1,2) CNOT(2,1) CNOT(1,2).
1.5 Universal Gate Sets
A set of gates is universal if any unitary operation on $n$ qubits can be approximated to arbitrary precision using a finite sequence of gates from this set. The Solovay-Kitaev theorem guarantees that the approximation overhead is only polylogarithmic.
Common Universal Gate Sets
- Clifford + T: $\{H, S, \text{CNOT}, T\}$ -- the standard fault-tolerant gate set
- CNOT + single-qubit rotations: $\{\text{CNOT}, R_y(\theta), R_z(\phi)\}$
- Toffoli + Hadamard: $\{\text{Toffoli}, H\}$
The Clifford group alone (generated by $\{H, S, \text{CNOT}\}$) is not universal -- by the Gottesman-Knill theorem, Clifford circuits can be efficiently simulated classically. Adding the T gate breaks this simulability and achieves universality.
1.6 Qiskit Example: Creating a Bell State
Let us build and simulate a quantum circuit that creates the Bell state $|\Phi^+\rangle = \frac{1}{\sqrt{2}}(|00\rangle + |11\rangle)$ using Qiskit:
Click Run to execute the Python code
Code will be executed with Python 3 on the server
1.7 The Quantum Circuit Model
In the circuit model of quantum computation, a quantum algorithm consists of:
- Initialization: Prepare $n$ qubits in $|0\rangle^{\otimes n}$
- Unitary evolution: Apply a sequence of quantum gates $U = U_T U_{T-1} \cdots U_2 U_1$
- Measurement: Measure some or all qubits in the computational basis
- Classical post-processing: Interpret the measurement outcomes
The circuit depth is the number of time steps (layers of parallel gates). The circuit width is the number of qubits. A key goal in quantum algorithm design is to minimize both depth and width while achieving the desired computation.
No-Cloning Theorem
A fundamental constraint on quantum circuits: it is impossible to create an identical copy of an arbitrary unknown quantum state. Formally, there exists no unitary $U$ such that:
$$U|\psi\rangle|0\rangle = |\psi\rangle|\psi\rangle \quad \text{for all } |\psi\rangle$$
This has profound implications: quantum error correction cannot simply copy qubits, and quantum information must be protected through more subtle encoding schemes (see Part III).
1.8 Density Matrix Formalism
For mixed states (statistical mixtures of pure states), we use the density matrix:
$$\rho = \sum_i p_i |\psi_i\rangle\langle\psi_i|$$
For a single qubit, the density matrix can be expressed in terms of the Bloch vector:
$$\rho = \frac{1}{2}(I + \vec{r} \cdot \vec{\sigma}) = \frac{1}{2}\begin{pmatrix} 1 + r_z & r_x - ir_y \\ r_x + ir_y & 1 - r_z \end{pmatrix}$$
Properties of density matrices:
- $\rho \geq 0$ (positive semidefinite)
- $\text{tr}(\rho) = 1$ (normalization)
- $\text{tr}(\rho^2) = 1$ for pure states, $\text{tr}(\rho^2) < 1$ for mixed states
- Gate application: $\rho \to U\rho U^\dagger$
- Measurement probability: $p_m = \text{tr}(P_m \rho)$