Targeted Prerequisite Refresher: Linear Algebra and Quantum Mechanics for Quantum Computing
For readers approaching quantum computing from diverse academic backgrounds—whether computer science, mathematics, or traditional physics—the gap between standard introductory coursework and the precise mathematical and physical tools required for research-grade quantum information work is often wider than it appears. This chapter is not a general review of linear algebra or quantum mechanics; it is a targeted, curated refresher of exactly the concepts, notations, and operational rules that underpin every quantum algorithm, error correction scheme, and hardware implementation discussed in later chapters. We will avoid redundant coverage of tangential topics (e.g., general solutions to the Schrödinger equation for arbitrary potentials, or full spectral theory for infinite-dimensional operators) and focus exclusively on the finite-dimensional, discrete-variable framework that defines modern gate-model quantum computing. Each section pairs formal definitions with worked examples grounded in quantum computing operations, and sidebars highlight notation conventions and common pitfalls encountered in peer-reviewed research literature and production quantum software frameworks.
Dirac Notation and Inner Product Spaces
Quantum computing relies almost exclusively on Dirac (bra-ket) notation to represent quantum states and linear operators, a compact abstract framework that eliminates the need to explicitly write out coordinate representations of vectors and matrices except when implementing or simulating systems. A ket $|\psi\rangle$ is a vector in a complex Hilbert space $\mathcal{H}$, the state space of a quantum system. The corresponding bra $\langle\psi|$ is the Hermitian conjugate (conjugate transpose) of $|\psi\rangle$, an element of the dual space $\mathcal{H}^*$ of linear functionals on $\mathcal{H}$. The inner product between two kets $|\phi\rangle$ and $|\psi\rangle$ is written $\langle\phi|\psi\rangle$, a complex scalar satisfying three core properties: 1. Conjugate symmetry: $\langle\phi|\psi\rangle = \langle\psi|\phi\rangle^*$ 2. Linearity in the second argument: $\langle\phi|(a|\psi_1\rangle + b|\psi_2\rangle) = a\langle\phi|\psi_1\rangle + b\langle\phi|\psi_2\rangle$ for $a,b \in \mathbb{C}$ 3. Positive definiteness: $\langle\psi|\psi\rangle \geq 0$, with equality if and only if $|\psi\rangle = 0$
For a valid quantum state (a pure state), the norm of the ket is normalized to 1: $\langle\psi|\psi\rangle = 1$. The outer product of a ket and a bra $|\psi\rangle\langle\phi|$ is a linear operator on $\mathcal{H}$, mapping any input ket $|x\rangle$ to $\langle\phi|x\rangle |\psi\rangle$. Outer products are the building blocks of all quantum operators: any linear operator $A$ on $\mathcal{H}$ can be written in outer product form via its spectral decomposition $A = \sum_i \lambda_i |i\rangle\langle i|$, where $\lambda_i$ are the eigenvalues of $A$ and $|i\rangle$ the corresponding orthonormal eigenvectors.
For the single-qubit systems that form the foundation of quantum computing, the standard computational basis (also called the Z-basis) is the orthonormal set $\{|0\rangle, |1\rangle\}$, where: $$|0\rangle = \begin{bmatrix} 1 \\ 0 \end{bmatrix}, \quad |1\rangle = \begin{bmatrix} 0 \\ 1 \end{bmatrix}$$ Any single-qubit pure state can be written as a linear combination of these basis kets: $$|\psi\rangle = \alpha|0\rangle + \beta|1\rangle$$ where $\alpha, \beta \in \mathbb{C}$ satisfy the normalization constraint $|\alpha|^2 + |\beta|^2 = 1$. The coefficients $\alpha$ and $\beta$ are called probability amplitudes: $|\alpha|^2$ is the probability of measuring the qubit in the $|0\rangle$ state, and $|\beta|^2$ the probability of measuring it in $|1\rangle$, when measured in the computational basis.
> Worked Example 1.1: Inner Product and Orthogonality > Let $|\psi\rangle = \frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)$ (the $|+\rangle$ state) and $|\phi\rangle = \frac{1}{\sqrt{2}}(|0\rangle - |1\rangle)$ (the $|-\rangle$ state). Compute $\langle\phi|\psi\rangle$ and interpret the result. > > First, write the bra corresponding to $|\phi\rangle$: $\langle\phi| = \frac{1}{\sqrt{2}}(\langle 0| - \langle 1|)$. The inner product is then: > $$\langle\phi|\psi\rangle = \frac{1}{\sqrt{2}}(\langle 0| - \langle 1|) \cdot \frac{1}{\sqrt{2}}(|0\rangle + |1\rangle) = \frac{1}{2}\left(\langle 0|0\rangle + \langle 0|1\rangle - \langle 1|0\rangle - \langle 1|1\rangle\right)$$ > Using the orthonormality of the computational basis ($\langle i|j\rangle = \delta_{ij}$), this simplifies to $\frac{1}{2}(1 + 0 - 0 - 1) = 0$. A zero inner product means $|\psi\rangle$ and $|\phi\rangle$ are orthogonal, so measuring $|\psi\rangle$ in the $\{|+\rangle, |-\rangle\}$ basis will always return the $|+\rangle$ outcome with probability 1.
> Sidebar: Notation Convention for Outer Products > In quantum computing literature, outer products of computational basis kets are often used to define projection operators. For example, $|0\rangle\langle 0|$ is the projector onto the $|0\rangle$ state: applying it to any qubit state returns $\alpha|0\rangle$ if the input is $\alpha|0\rangle + \beta|1\rangle$, and $0$ otherwise. The identity operator on a single qubit is written $I = |0\rangle\langle 0| + |1\rangle\langle 1|$, a sum of projectors onto the full orthonormal basis. This notation extends directly to multi-qubit systems, as we will see in the tensor product section.
> Pitfall: Forgetting Conjugation in Bra-Ket Inner Products > A common error when computing inner products is to omit the complex conjugate of the bra's coefficients. For $|\psi\rangle = \alpha|0\rangle + \beta|1\rangle$, the corresponding bra is $\langle\psi| = \alpha^*\langle 0| + \beta^*\langle 1|$, not $\alpha\langle 0| + \beta\langle 1|$. Failing to take the conjugate leads to incorrect probability calculations and non-conservation of the norm, which will break all downstream quantum algorithm logic. This error is especially common when working with states that include complex phases, such as the $|i\rangle = \frac{1}{\sqrt{2}}(|0\rangle + i|1\rangle)$ state.
Hilbert Spaces for Finite-Dimensional Quantum Systems
Formally, a Hilbert space $\mathcal{H}$ is a complete inner product space: a vector space equipped with an inner product, where every Cauchy sequence of vectors converges to a limit that is also in the space. For quantum computing, we work exclusively with *finite-dimensional* complex Hilbert spaces, so completeness is automatically satisfied. The state space of an $n$-qubit quantum register is the $n$-fold tensor product of the single-qubit Hilbert space $\mathbb{C}^2$, denoted $(\mathbb{C}^2)^{\otimes n}$, with dimension $2^n$. This exponential scaling of state space dimension with qubit count is the root of quantum advantage for many algorithms: a 50-qubit system has a state space of dimension $2^{50} \approx 10^{15}$, which is at the limit of classical supercomputer simulation capacity, while a 300-qubit system has more dimensions than there are estimated atoms in the observable universe.
Every finite-dimensional Hilbert space has an orthonormal basis (ONB): a set of mutually orthogonal, unit-norm vectors $\{|e_1\rangle, |e_2\rangle, ..., |e_d\rangle\}$ that span the space, where $d = \dim(\mathcal{H})$. Any state $|\psi\rangle \in \mathcal{H}$ can be written uniquely as a linear combination of the basis vectors: $$|\psi\rangle = \sum_{i=1}^d c_i |e_i\rangle, \quad \text{where } c_i = \langle e_i|\psi\rangle$$ The computational basis $\{|0\rangle, |1\rangle, ..., |2^n-1\rangle\}$ for an $n$-qubit system is the standard ONB used for most quantum computing operations, but alternative bases are often used for specific tasks. Two common examples are the X-basis (Fourier basis for a single qubit) $\{|+\rangle, |-\rangle\}$ defined earlier, and the Y-basis $\{|+i\rangle, |-i\rangle\}$ where $|+i\rangle = \frac{1}{\sqrt{2}}(|0\rangle + i|1\rangle)$ and $|-i\rangle = \frac{1}{\sqrt