Recipe
Find the dimension of a subspace
Use when: you're given some description of a subspace — a spanning set, a null space, a set defined by constraints — and asked how many vectors a basis for it needs
Goal: the exact number of vectors in any basis of the subspace, found without necessarily writing the basis out first
Taught in Dimension
Quick recipe
-
1
If the subspace is already described as a span of explicit vectors, those vectors ARE your spanning set — nothing to build. If it's described as a null space instead, run the null-space recipe (solve A\mathbf x=\mathbf 0 and write the general solution as one vector per free variable) to build a spanning set from scratch.
Example
For \operatorname{span}\{\mathbf w_1,\mathbf w_2,\mathbf w_3\} with \mathbf w_1=(1,0,1,2), \mathbf w_2=(2,1,0,-1), \mathbf w_3=(0,1,-2,-5), the spanning set is already handed to you — nothing to build.
- the subspace is a span of given vectors — the spanning set is already in hand; continue to Step 2.
- the subspace is a null space (or otherwise built from free variables) — build the spanning set via the null-space recipe first; that construction already guarantees independence, so skip straight to Step 3 and count the free variables directly.
⚡ Shortcut
If the subspace is cut out of \mathbb{R}^n by k INDEPENDENT linear constraints (equations, not inequalities), skip the whole recipe: \dim = n-k. A plane in \mathbb{R}^3 given by one equation like x-y+2z=0 has \dim=3-1=2; a line in \mathbb{R}^3 given by two independent equations has \dim=3-2=1. This only works when the constraints are independent of each other — a redundant constraint (one implied by the others) doesn't actually cut the dimension down further, so this shortcut still needs the constraints checked for independence first.
Why: dimension is defined as the size of a basis, and a basis is an independent SPANNING set — there's nothing to count until some spanning set exists to test.
-
2
Stack the spanning vectors as the rows of a matrix and row-reduce. The number of nonzero rows left after elimination — equivalently, the number of pivots — is the number of independent vectors among them.
Example
Stack \mathbf w_1,\mathbf w_2,\mathbf w_3 as rows: \begin{bmatrix}1&0&1&2\\2&1&0&-1\\0&1&-2&-5\end{bmatrix} R_2 \to R_2-2R_1 gives (2{-}2,\ 1{-}0,\ 0{-}2,\ {-}1{-}4)=(0,1,-2,-5) — identical to R_3, so R_2^{\text{new}}-R_3=(0,0,0,0): one whole row vanishes, leaving two nonzero rows, (1,0,1,2) and (0,1,-2,-5).
Why: row operations never change the span of the rows, only which combinations of the originals get exposed as redundant — a row that reduces to all zeros is exactly a vector that was already a combination of the others (\mathbf w_2 = 2\mathbf w_1+\mathbf w_3 here).
-
3
The number of independent vectors found (nonzero rows from Step 2, or free variables directly if you took Step 1's null-space branch) IS \dim of the subspace, with no further work.
Example
Two nonzero rows survived Step 2, so \dim(\operatorname{span}\{\mathbf w_1,\mathbf w_2,\mathbf w_3\}) = \boxed{2}
Why: dimension is, by definition, the number of vectors in any basis, and the surviving independent vectors are exactly that — a basis for the subspace, discovered as a byproduct of testing for redundancy.
Common mistakes
- Counting the number of vectors originally given (“3 vectors were listed, so dimension is 3”) without checking whether they're actually independent.
- Row-reducing a null-space matrix and reporting the number of PIVOT columns as the null space's dimension — it's the FREE columns that count; the pivot columns give the dimension of a different space, the column space.
- Redoing a full rank computation on a spanning set that came from the null-space recipe's free-variable construction, which is already guaranteed independent by how it was built.
- Reporting the leftover vectors themselves as the answer instead of just their count — dimension is a single number, not a list.