Case Study 40.2 — The Linear Algebra of Quantum Computing: The Qubit's Final Word

Field: Physics / quantum information. Anchor tie-in: the final appearance of the quantum qubit, the anchor we have followed since Chapter 1 — through unitary gates (Chapter 21), Hermitian observables (Chapter 27), and its home in a complex inner product space (Chapter 34). This is where its arc closes.

The promise we made in Chapter 1, now kept

In the very first chapter we teased that a qubit is "a vector," and we kept returning to that promise: in Chapter 5 (vector spaces) we said the qubit's state space would turn out to be a complex vector space; in Chapter 21 we said quantum gates are orthogonal/unitary matrices; in Chapter 27 we said observables are Hermitian; in Chapter 34 we placed it all in a complex inner product space and called the infinite-dimensional version a Hilbert space. This case study delivers the payoff in full. The remarkable thesis — stated carefully, without overclaiming — is that the entire linear-algebraic skeleton of quantum computing is material you already proved. The physics is hard and the algorithms are subtle; the linear algebra is Parts IV and V, read over the complex numbers.

The state space: a qubit is a unit vector in $\mathbb{C}^2$

A classical bit is 0 or 1. A qubit is a unit vector in the complex two-dimensional space $\mathbb{C}^2$:

$$|\psi\rangle = \alpha|0\rangle + \beta|1\rangle, \qquad |\alpha|^2 + |\beta|^2 = 1,$$

where $|0\rangle=\begin{bsmallmatrix}1\\0\end{bsmallmatrix}$ and $|1\rangle=\begin{bsmallmatrix}0\\1\end{bsmallmatrix}$ are the standard basis vectors (Chapter 2), now wearing physicists' "ket" notation. The complex coefficients $\alpha,\beta$ are amplitudes, and the squared magnitudes $|\alpha|^2,|\beta|^2$ are the probabilities of measuring 0 or 1 — which is why the state must have length 1 (probabilities sum to one). That "squared length is probability" is precisely the inner-product geometry of Chapter 34: the norm comes from the complex inner product, with the conjugate that keeps lengths real and positive.

The operations: gates are unitary matrices

A quantum gate is a unitary matrix — the complex generalization of the orthogonal matrices of Chapter 21, satisfying $U^{*}U=I$ with the conjugate (Hermitian) transpose of Chapter 27. Unitarity is not an arbitrary rule; it is forced by the physics. A gate must map unit vectors to unit vectors (so probabilities keep summing to one), and the maps that preserve length are exactly the unitary ones — the theorem you proved in Chapter 21, transplanted to $\mathbb{C}^2$. Watch the most famous single-qubit gate, the Hadamard, manufacture a superposition out of a definite state:

# A qubit is a unit vector; a gate is a unitary matrix; the Hadamard creates superposition.
import numpy as np
H = (1/np.sqrt(2)) * np.array([[1, 1], [1, -1.]])   # Hadamard gate
ket0 = np.array([1., 0.])                            # the definite state |0>
psi = H @ ket0
print(np.round(psi, 4))             # [0.7071 0.7071] -- equal superposition of |0> and |1>
print(np.sum(np.abs(psi)**2))       # 1.0 -- still a unit vector (H is unitary)
print(np.round(H @ H, 6))           # [[1. 0.] [0. 1.]] -- H is its own inverse

The Hadamard sends the definite $|0\rangle$ to an equal superposition with amplitudes $1/\sqrt2$ each, so measuring it yields 0 or 1 with probability $\tfrac12$. The squared amplitudes sum to exactly 1 because $H$ is unitary; and $H^2=I$, so the gate undoes itself. Every claim in that snippet is a theorem from Parts IV–V, read in $\mathbb{C}^2$ — composition of transformations (Chapter 8), length preservation (Chapter 21), the identity as the "do nothing" map (Chapter 7).

One subtlety the snippet hides, and §40.4 flagged: because the Hadamard happens to be real, H.T @ H would also give the identity. But a general gate is complex. The phase gate $S=\mathrm{diag}(1,i)$ satisfies $S^{*}S=I$ (conjugate transpose) but not $S^{\mathsf{T}}S=I$. In real quantum code the adjoint is always the conjugate transpose U.conj().T, never the plain transpose. Forgetting the conjugate is the most common beginner bug — and it is exactly the Hermitian-transpose distinction of Chapter 27, now load-bearing.

Two qubits: the tensor product, and where §40.2 returns

A single qubit lives in $\mathbb{C}^2$. Two qubits live in the tensor product $\mathbb{C}^2\otimes\mathbb{C}^2=\mathbb{C}^4$ — the multilinear-algebra construction of §40.2, making its second appearance in this chapter. The dimensions multiply (Chapter 40's sidebar: $\dim(V\otimes W)=\dim V\cdot\dim W$), so $n$ qubits live in $\mathbb{C}^{2^n}$ — an exponentially large space, which is exactly the resource quantum computers hope to exploit. The basis states are the four combinations, built with the Kronecker product:

# Two qubits live in C^2 (x) C^2 = C^4. Build a Bell state: entanglement, via unitaries.
import numpy as np
ket0 = np.array([1., 0.])
H = (1/np.sqrt(2)) * np.array([[1, 1], [1, -1.]])
I = np.eye(2)
CNOT = np.array([[1,0,0,0],[0,1,0,0],[0,0,0,1],[0,0,1,0.]])   # flips target if control=1
state = np.kron(H, I) @ np.kron(ket0, ket0)   # apply H to qubit 1 of |00>
bell  = CNOT @ state                           # then entangle with CNOT
print(np.round(bell, 4))           # [0.7071 0.     0.     0.7071] = (|00> + |11>)/sqrt2
print(np.sum(np.abs(bell)**2))     # 1.0 -- still a unit vector

The result is the famous Bell state $(|00\rangle+|11\rangle)/\sqrt2$ — the printed vector [0.7071, 0, 0, 0.7071], with amplitude on $|00\rangle$ and $|11\rangle$ but none on $|01\rangle$ or $|10\rangle$. This is entanglement: the two qubits are now correlated so that measuring one instantly determines the other. And yet the construction is pure linear algebra — a tensor product of state spaces (§40.2), gates built by the Kronecker product (np.kron, the tensor product of matrices), and a unitary CNOT applied to a unit vector. The deep physics of entanglement rides on top of the tensor-product structure you met one section earlier.

What is not linear algebra — the honest boundary

The thesis is that the qubit, the gate, the superposition, the unitary, the tensor product of state spaces are all linear algebra you own. It would be dishonest to stop there and imply quantum computing is "just" linear algebra. Three things are genuinely beyond this book:

  1. The physics of building qubits. Keeping a real qubit coherent — protecting a fragile $\mathbb{C}^2$ state from a noisy environment — is one of the hardest engineering problems in modern science, and it is physics and materials science, not linear algebra.
  2. Algorithm design. The reason quantum computing is exciting is that for some problems (factoring via Shor's algorithm, unstructured search via Grover's, simulating quantum systems) a clever sequence of unitaries concentrates amplitude on the right answer, yielding a speedup. Designing that sequence is deep and specialized; the linear algebra only tells you that each step is a unitary applied to a vector.
  3. The full continuous theory. Position and momentum live in infinite-dimensional Hilbert spaces (the infinite-dimensional spaces in quantum mechanics), where the functional analysis of §40.3 — bounded operators, continuous spectra, completeness — is indispensable. The finite-dimensional qubit is the friendly entry point, not the whole subject.

The qubit's final word

We have followed this anchor for forty chapters, and here is where its arc lands: you already know the mathematics of quantum computing's state space. A qubit is a unit vector (Chapter 2); superposition is a linear combination (Chapter 6); a gate is a unitary, hence length-preserving, map (Chapter 21); the adjoint is the conjugate transpose (Chapter 27); the geometry is a complex inner product (Chapter 34); two qubits combine by the tensor product (§40.2); and measurement reads out squared amplitudes as probabilities. What stood between you and quantum computing was never the linear algebra — it was the physics and the algorithms, and now you can see exactly where the boundary lies. That clarity, the ability to look at a frightening-sounding field and say "the state space is just a complex vector space, and the gates are just unitaries — the hard part is over there, in the physics," is the qubit anchor's final gift, and a fitting last word for a book called The Mathematics of Everything.