Visual Tools
Calculators
Tables
Mathematical Keyboard
Converters
Other Tools

How to Find the Dimension of a Subspace

The dimension is the number of vectors in any basis. You rarely need the basis itself: for a span the dimension is the rank of the matrix of vectors, and for the solution set of Ax=0A\mathbf{x} = \mathbf{0} it is the number of unknowns minus the rank.

Recognize the task

"What is dim⁡W\dim W?" for a span, a solution set, a plane, a space of polynomials or matrices: dim⁡Span⁡{(1,2),(−2,−4)}\dim\operatorname{Span}\{(1, 2), (-2, -4)\}, the symmetric 2×22 \times 2 matrices, {p∈P3:p(0)=p(1)=0}\{p \in P_3 : p(0) = p(1) = 0\}. Test: is WW given as a span (count pivots) or by equations (count free variables)?
Dimension is defined in the dimension lesson.

Two ways to do it

Count pivots or free variablesvectors in coordinates
dim⁡Span⁡{vi}=rank⁡A,dim⁡Nul⁡(A)=n−rank⁡A\dim\operatorname{Span}\{\mathbf{v}_i\} = \operatorname{rank} A, \qquad \dim\operatorname{Nul}(A) = n - \operatorname{rank} A
Row reduce once; the second formula is the rank–nullity theorem.
Count parameterspolynomials, matrices
dim⁡W=number of free parameters in the general element\dim W = \text{number of free parameters in the general element}
Write the general element of WW, impose the conditions, and count what is still free; each parameter gives one basis vector (the definition of dimension).

Steps

StepOn W={x∈R4:x1+2x2−x4=0, 2x1+4x2+x3+x4=0}W = \{\mathbf{x} \in \mathbb{R}^4 : x_1 + 2x_2 - x_4 = 0,\ 2x_1 + 4x_2 + x_3 + x_4 = 0\}
1Decide how W is given. A list of vectors (span) or a set of equations (solution set).solution set of two equations in R4\mathbb{R}^4
2Write the matrix. Spanning vectors go in the columns; equations go in the rows.A=(120−12411)A = \begin{pmatrix} 1 & 2 & 0 & -1 \\ 2 & 4 & 1 & 1 \end{pmatrix}
3Row reduce and count the pivots. The number of pivots is the rank.R2−2R1R_2 - 2R_1: (120−10013)\begin{pmatrix} 1 & 2 & 0 & -1 \\ 0 & 0 & 1 & 3 \end{pmatrix}, rank 22
4Apply the right count. Span: dim⁡=rank⁡\dim = \operatorname{rank}. Solution set: dim⁡=n−rank⁡\dim = n - \operatorname{rank}, the number of free variables.dim⁡W=4−2=2\dim W = 4 - 2 = 2 (free x2x_2, x4x_4)
5Check against the bounds. A subspace of an nn-dimensional space has dimension between 00 and nn (the subspace dimension inequality).0≤2≤40 \le 2 \le 4 ✓; basis (−2,1,0,0)(-2, 1, 0, 0), (1,0,−3,1)(1, 0, -3, 1)

Worked examples

Example 1 · a span of parallel vectors

basic
Span⁡{(1,2),(−2,−4)}\operatorname{Span}\{(1, 2), (-2, -4)\}:  (−2,−4)=−2(1,2)\ (-2, -4) = -2(1, 2)
second is redundant
dim⁡=1\dim = 1
a line through the origin

Example 2 · symmetric 2×2 matrices

count parameters
(abbc)=a(1000)+b(0110)+c(0001)\begin{pmatrix} a & b \\ b & c \end{pmatrix} = a\begin{pmatrix} 1 & 0 \\ 0 & 0 \end{pmatrix} + b\begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix} + c\begin{pmatrix} 0 & 0 \\ 0 & 1 \end{pmatrix}
three free entries
dim⁡=3\dim = 3
three basis matrices

Example 3 · polynomials with two roots

conditions
p=a+bx+cx2+dx3p = a + bx + cx^2 + dx^3 in P3P_3, dim⁡P3=4\dim P_3 = 4
four coefficients
p(0)=0p(0) = 0: a=0a = 0;  p(1)=0\ p(1) = 0: b+c+d=0b + c + d = 0
two independent conditions
dim⁡=4−2=2\dim = 4 - 2 = 2, basis {x2−x, x3−x}\{x^2 - x,\ x^3 - x\}
free c,dc, d
Count pivots for any matrix in the matrix rank visualizer.

See it happen

Dimension counts independent directions. A line through the origin has one, a plane has two, all of R3\mathbb{R}^3 has three. Each equation that the vectors must satisfy (and that is not implied by the others) removes one direction, which is why a solution set has dimension nn minus the number of independent equations.

Common mistakes

Counting the given vectors

✗ dim⁡Span⁡{(1,2),(−2,−4)}=2\dim\operatorname{Span}\{(1, 2), (-2, -4)\} = 2
✓ count independent vectors only: the dimension is 11

Off by one for polynomials

✗ dim⁡P3=3\dim P_3 = 3
✓ dim⁡P3=4\dim P_3 = 4: the basis is 1,x,x2,x31, x, x^2, x^3

Pivots instead of free variables for a null space

✗ dim⁡Nul⁡(A)=rank⁡A=2\dim\operatorname{Nul}(A) = \operatorname{rank} A = 2 for a 3×53 \times 5 matrix of rank 22
✓ dim⁡Nul⁡(A)=5−2=3\dim\operatorname{Nul}(A) = 5 - 2 = 3, one per free variable

Confusing the subspace with the ambient space

✗ the plane x−2y+3z=0x - 2y + 3z = 0 has dimension 33 because it lives in R3\mathbb{R}^3
✓ it has dimension 3−1=23 - 1 = 2