How to Find a Basis for a Subspace
Finding a basis for a subspace is a fundamental skill in linear algebra that lets you describe the subspace with the smallest possible set of vectors. A basis provides both a spanning set and a guarantee of linear independence, which together reveal the dimension of the subspace and simplify many calculations such as solving linear systems, performing transformations, or computing eigenvalues. Below is a step‑by‑step guide that explains the theory, outlines practical procedures, and includes worked examples to help you master the process.
Introduction
A subspace (W) of a vector space (V) (usually (\mathbb{R}^n) or (\mathbb{C}^n)) is a subset that is closed under vector addition and scalar multiplication. To work efficiently with (W), we need a basis: a set of vectors ({ \mathbf{v}_1, \mathbf{v}_2, \dots, \mathbf{v}_k }) that
- Span (W) – every vector in (W) can be written as a linear combination of the basis vectors, and
- Are linearly independent – no basis vector can be expressed as a combination of the others.
The number of vectors in any basis equals the dimension of the subspace, denoted (\dim(W)). The following sections show how to extract such a set from a given description of (W) Which is the point..
General Procedure for Finding a Basis
The method you use depends on how the subspace is presented. Common descriptions include:
- Span of a set of vectors – (W = \operatorname{span}{ \mathbf{s}_1, \dots, \mathbf{s}_m }).
- Solution set of a homogeneous linear system – (W = { \mathbf{x} \in \mathbb{R}^n \mid A\mathbf{x} = \mathbf{0} }).
- Column space or null space of a matrix – directly related to the two cases above.
Regardless of the form, the core idea is to reduce the generating set to a linearly independent subset that still spans the same space. The most reliable tool for this is row reduction (Gaussian elimination) applied to a matrix whose rows or columns encode the generators Small thing, real impact..
The official docs gloss over this. That's a mistake It's one of those things that adds up..
Below is a unified algorithm that works for the span and null‑space cases:
- Form a matrix whose columns (or rows) are the given vectors.
- Row‑reduce the matrix to its reduced row echelon form (RREF).
- Identify pivot columns (if you used columns as generators) or pivot rows (if you used rows).
- Select the corresponding original vectors – these form a basis.
- Count the pivots to obtain the dimension.
If the subspace is given as a solution set of (A\mathbf{x}=\mathbf{0}), you instead solve for the free variables and express each solution as a linear combination of vectors attached to the free variables; those vectors automatically form a basis for the null space.
Detailed Steps with Rationale
Step 1: Write the Generating Set as a Matrix
If the subspace is (W = \operatorname{span}{ \mathbf{s}_1, \dots, \mathbf{s}_m }):
Create an (n \times m) matrix (S = [\mathbf{s}_1 ; \mathbf{s}_2 ; \dots ; \mathbf{s}_m]), where each (\mathbf{s}_i) is a column vector in (\mathbb{R}^n) Turns out it matters..
If the subspace is the null space of (A):
Work directly with the coefficient matrix (A) (size (p \times n)) It's one of those things that adds up..
Step 2: Perform Gaussian Elimination to Obtain RREF
Apply elementary row operations (swap rows, multiply a row by a non‑zero scalar, add a multiple of one row to another) until the matrix satisfies:
- The leading entry in each non‑zero row is 1 (a pivot).
- Each pivot is the only non‑zero entry in its column.
- Rows with all zeros lie at the bottom.
The resulting matrix is the reduced row echelon form, denoted (\operatorname{rref}(S)) or (\operatorname{rref}(A)) Not complicated — just consistent..
Step 3: Locate Pivot Positions
For a span: Look at the columns of the original matrix (S). The columns that contain pivots in (\operatorname{rref}(S)) correspond to linearly independent generators.
For a null space: After obtaining (\operatorname{rref}(A)), identify the free variables (columns without pivots). Express each free variable as a parameter and solve for the pivot variables; each parameter yields a basis vector Small thing, real impact. Still holds up..
Step 4: Extract Basis Vectors
Span case: Take the original vectors (\mathbf{s}i) whose column indices are pivot columns. The set ({ \mathbf{s}{i_1}, \dots, \mathbf{s}_{i_k} }) is a basis for (W) Still holds up..
Null‑space case: For each free variable (t_j), set (t_j = 1) and all other free variables to 0, then compute the resulting solution vector (\mathbf{x}). Collect all such vectors; they form a basis for (\operatorname{Nul}(A)).
Step 5: Verify (Optional but Recommended)
Check that the chosen vectors are indeed linearly independent (e.g., by forming a matrix with them as columns and confirming its rank equals the number of vectors) and that they span the original subspace (by showing any generator can be reproduced as a combination).
Scientific Explanation: Why the Procedure Works
The correctness of the algorithm rests on two fundamental theorems:
-
Row operations preserve the row space and null space of a matrix It's one of those things that adds up..
- Swapping rows, scaling a row, or adding a multiple of one row to another does not change the set of all linear combinations of the rows (the row space).
- Likewise, the solution set to (A\mathbf{x}= \mathbf{0}) remains unchanged because each operation corresponds to multiplying both sides of the equation by an invertible matrix.
-
Pivot columns of the original matrix form a basis for the column space.
- In (\operatorname{rref}(S)), pivot columns are clearly linearly independent (each contains a lone 1 in a distinct row).
- Since row operations do not alter linear relations among columns, the same independence holds for the corresponding columns of (S).
- Worth adding, every non‑pivot column can be expressed as a combination of pivot columns, guaranteeing that the pivot columns span the column space.
For null spaces, the free‑variable method exploits the fact that each free variable corresponds to a direction in which you can move while still satisfying (A\mathbf{x}= \mathbf{0}). Setting one free variable to 1 and the others to 0 isolates a basic direction; varying all free variables produces the whole null space as a linear combination of those directions.
Thus, the algorithm yields a minimal spanning set—exactly the definition of a basis.
Worked Examples
Example 1: Basis from a Span
Find a basis for (W = \operatorname{span}{ \mathbf{s}_1, \mathbf{s}_2, \