Basis and Dimension
A basis for a vector space V is a set of vectors that is linearly independent and spans V. Every vector in V can then be written in exactly one way as a combination of the basis vectors. The dimension of V is the number of vectors in any basis, so ℝ³ has dimension 3.
Before this lesson: Span of Vectors, Linear Independence and Null Space and Column Space
What a basis and dimension mean
A basis is a set of building blocks for a space with nothing wasted. It needs enough vectors to build everything (they span V), and no vector can be built from the others (they are linearly independent). Too few vectors can’t reach the whole space; too many means at least one is extra.
The standard basis of ℝ² is e₁ = (1, 0) and e₂ = (0, 1), but it is not the only one. The vectors b₁ = (1, 1) and b₂ = (−1, 2) also form a basis of ℝ². The vector v = (1, 4) is 1e₁ + 4e₂ in the standard basis and 2b₁ + 1b₂ in the new one. Different bases give different weights, but each basis gives exactly one set of weights.
Every basis of a space has the same number of vectors. That shared number is the dimension, and it matches the everyday idea: a line has dimension 1, a plane has dimension 2, and ℝⁿ has dimension n.
Definitions and key facts
A set B = {b₁, …, bₚ} in a vector space V is a basis for V when both conditions hold:
- B is linearly independent.
- B spans V, so V = Span{b₁, …, bₚ}.
If V has a basis with p vectors, every basis of V has p vectors, and the dimension of V is p:
\dim V = \text{number of vectors in a basis of } VThe zero space {0} has dimension 0. A space with no finite basis, such as the space of all polynomials, is called infinite-dimensional.
| Space | Standard basis | Dimension |
|---|---|---|
| ℝⁿ | e₁, …, eₙ (the columns of the identity matrix) | n |
| P_n (polynomials of degree at most n) | 1, x, x², …, xⁿ | n + 1 |
| M_{2\times 2} (2 × 2 matrices) | the four matrices with a single 1 and three 0s | 4 |
| {0} | the empty set | 0 |
Facts that save work. Suppose dim V = n.
- Any set of more than n vectors in V is linearly dependent, and any set of fewer than n vectors cannot span V.
- Basis theorem: n linearly independent vectors in V automatically span V, and n vectors that span V are automatically independent. So with exactly n vectors, you only have to check one condition.
- Spanning set theorem: if a set spans V, removing vectors that are combinations of the others leaves a basis.
- A subspace H of V has dim H ≤ dim V.
How to find a basis and the dimension
For Nul A: solve Ax = 0 and write the solution in parametric vector form. The vectors that multiply the free variables form a basis, so dim Nul A is the number of free variables.
For Col A: row reduce A to find the pivot columns. The pivot columns of the original A form a basis, so dim Col A is the number of pivot columns.
For a set of vectors in ℝᵐ: put the vectors in the columns of a matrix and row reduce. The original vectors in the pivot columns form a basis for their span.
Basis and dimension examples
Example 1: Checking a basis of ℝ³
Is B = {(1, 2, 0), (0, 1, 1), (2, 3, 2)} a basis of ℝ³?
\begin{bmatrix} 1 & 0 & 2 \\ 2 & 1 & 3 \\ 0 & 1 & 2 \end{bmatrix}Put the three vectors in the columns of a matrix.
\sim \begin{bmatrix} 1 & 0 & 2 \\ 0 & 1 & -1 \\ 0 & 1 & 2 \end{bmatrix}R₂ − 2R₁ → R₂ (see Gaussian elimination).
\sim \begin{bmatrix} 1 & 0 & 2 \\ 0 & 1 & -1 \\ 0 & 0 & 3 \end{bmatrix}R₃ − R₂ → R₃. There are 3 pivots.
A pivot in every column means the vectors are linearly independent.
Answer: yes. B is 3 independent vectors in ℝ³, which has dimension 3, so by the basis theorem B also spans ℝ³ and is a basis.
Example 2: A basis for a null space
Find a basis for Nul A and its dimension, where A = \begin{bmatrix} 1 & -2 & 0 & 3 & 1 \\ 2 & -4 & 1 & 4 & 5 \\ -1 & 2 & 2 & -7 & 5 \end{bmatrix}.
\begin{bmatrix} 1 & -2 & 0 & 3 & 1 \\ 2 & -4 & 1 & 4 & 5 \\ -1 & 2 & 2 & -7 & 5 \end{bmatrix}Start with A.
\sim \begin{bmatrix} 1 & -2 & 0 & 3 & 1 \\ 0 & 0 & 1 & -2 & 3 \\ -1 & 2 & 2 & -7 & 5 \end{bmatrix}R₂ − 2R₁ → R₂.
\sim \begin{bmatrix} 1 & -2 & 0 & 3 & 1 \\ 0 & 0 & 1 & -2 & 3 \\ 0 & 0 & 2 & -4 & 6 \end{bmatrix}R₃ + R₁ → R₃.
\sim \begin{bmatrix} 1 & -2 & 0 & 3 & 1 \\ 0 & 0 & 1 & -2 & 3 \\ 0 & 0 & 0 & 0 & 0 \end{bmatrix}R₃ − 2R₂ → R₃. This is the reduced row echelon form: pivots in columns 1 and 3, so x₂, x₄ and x₅ are free.
x_1 = 2x_2 - 3x_4 - x_5
Row 1: x₁ − 2x₂ + 3x₄ + x₅ = 0. Solve for x₁.
x_3 = 2x_4 - 3x_5
Row 2: x₃ − 2x₄ + 3x₅ = 0. Solve for x₃.
x = x_2\begin{bmatrix} 2 \\ 1 \\ 0 \\ 0 \\ 0 \end{bmatrix} + x_4\begin{bmatrix} -3 \\ 0 \\ 2 \\ 1 \\ 0 \end{bmatrix} + x_5\begin{bmatrix} -1 \\ 0 \\ -3 \\ 0 \\ 1 \end{bmatrix}Write the solution in parametric vector form.
Each vector has a 1 where its own free variable sits and 0s at the other free variables, so none is a combination of the others.
Answer: a basis for Nul A is {(2, 1, 0, 0, 0), (−3, 0, 2, 1, 0), (−1, 0, −3, 0, 1)}, and dim Nul A = 3.
Example 3: A basis for a column space
For the same matrix A, find a basis for Col A and its dimension. Then write each non-pivot column as a combination of the pivot columns.
a_1 = \begin{bmatrix} 1 \\ 2 \\ -1 \end{bmatrix},\quad a_3 = \begin{bmatrix} 0 \\ 1 \\ 2 \end{bmatrix}Example 2 found pivots in columns 1 and 3. Take those columns from the original A.
a_2 = -2a_1
Column 2 of the reduced form is (−2, 0, 0).
a_4 = 3a_1 - 2a_3
Column 4 of the reduced form is (3, −2, 0).
3\begin{bmatrix} 1 \\ 2 \\ -1 \end{bmatrix} - 2\begin{bmatrix} 0 \\ 1 \\ 2 \end{bmatrix} = \begin{bmatrix} 3 - 0 \\ 6 - 2 \\ -3 - 4 \end{bmatrix} = \begin{bmatrix} 3 \\ 4 \\ -7 \end{bmatrix}Check a₄.
a_5 = a_1 + 3a_3
Column 5 of the reduced form is (1, 3, 0).
\begin{bmatrix} 1 \\ 2 \\ -1 \end{bmatrix} + 3\begin{bmatrix} 0 \\ 1 \\ 2 \end{bmatrix} = \begin{bmatrix} 1 + 0 \\ 2 + 3 \\ -1 + 6 \end{bmatrix} = \begin{bmatrix} 1 \\ 5 \\ 5 \end{bmatrix}Check a₅.
Answer: a basis for Col A is {(1, 2, −1), (0, 1, 2)}, and dim Col A = 2. Col A is a plane in ℝ³. The columns of the reduced form, such as (1, 0, 0), are not in Col A at all, so they cannot be used.
Example 4: A basis for a space of polynomials
Find a basis and the dimension of H = {p in P_2 : p(1) = 0}.
p(x) = a + bx + cx^2
Write a general polynomial in P_2.
p(1) = a + b + c = 0
Apply the condition.
a = -b - c
Solve for a; b and c are free.
p(x) = -b - c + bx + cx^2
Substitute.
= b(x - 1) + c(x^2 - 1)
Group the b terms and the c terms.
So H = Span{x − 1, x² − 1}. Neither polynomial is a multiple of the other (they have different degrees), so the set is linearly independent.
Answer: a basis for H is {x − 1, x² − 1}, and dim H = 2. This fits: H is a proper subspace of P_2, which has dimension 3.
Example 5: Which snack bars are redundant?
A trail-mix company makes four snack bars. Each bar’s nutrients (grams of protein, carbohydrate and fat) form a vector: A = (10, 20, 5), B = (5, 30, 5), C = (15, 10, 5) and D = (0, 10, 10). Find a basis for the span of these vectors, its dimension, and a relationship that shows which bar is redundant.
\begin{bmatrix} 10 & 5 & 15 & 0 \\ 20 & 30 & 10 & 10 \\ 5 & 5 & 5 & 10 \end{bmatrix}Put A, B, C and D in the columns.
\sim \begin{bmatrix} 2 & 1 & 3 & 0 \\ 20 & 30 & 10 & 10 \\ 5 & 5 & 5 & 10 \end{bmatrix}⅕R₁ → R₁.
\sim \begin{bmatrix} 2 & 1 & 3 & 0 \\ 2 & 3 & 1 & 1 \\ 5 & 5 & 5 & 10 \end{bmatrix}⅒R₂ → R₂.
\sim \begin{bmatrix} 2 & 1 & 3 & 0 \\ 2 & 3 & 1 & 1 \\ 1 & 1 & 1 & 2 \end{bmatrix}⅕R₃ → R₃.
\sim \begin{bmatrix} 1 & 1 & 1 & 2 \\ 2 & 3 & 1 & 1 \\ 2 & 1 & 3 & 0 \end{bmatrix}R₁ ↔ R₃.
\sim \begin{bmatrix} 1 & 1 & 1 & 2 \\ 0 & 1 & -1 & -3 \\ 2 & 1 & 3 & 0 \end{bmatrix}R₂ − 2R₁ → R₂.
\sim \begin{bmatrix} 1 & 1 & 1 & 2 \\ 0 & 1 & -1 & -3 \\ 0 & -1 & 1 & -4 \end{bmatrix}R₃ − 2R₁ → R₃.
\sim \begin{bmatrix} 1 & 1 & 1 & 2 \\ 0 & 1 & -1 & -3 \\ 0 & 0 & 0 & -7 \end{bmatrix}R₃ + R₂ → R₃. Pivots are in columns 1, 2 and 4.
2\begin{bmatrix} 10 \\ 20 \\ 5 \end{bmatrix} - \begin{bmatrix} 5 \\ 30 \\ 5 \end{bmatrix} = \begin{bmatrix} 20 - 5 \\ 40 - 30 \\ 10 - 5 \end{bmatrix} = \begin{bmatrix} 15 \\ 10 \\ 5 \end{bmatrix}Column 3 is not a pivot column, so C is a combination of A and B: C = 2A − B.
Answer: a basis is {A, B, D}, and the span has dimension 3, so it is all of ℝ³. Bar C is redundant: C + B = 2A, so one C bar plus one B bar has exactly the nutrients of two A bars.
Common mistakes
| Mistake | Example of the error | Fix |
|---|---|---|
| Using columns of the reduced form as a basis for Col A | Giving {(1, 0, 0), (0, 1, 0)} as a basis for Col A in Example 3 | Find the pivot positions from the reduced form, then take those columns from the original A. |
| Calling any spanning set a basis | Saying {(1, 0), (0, 1), (1, 1)} is a basis of ℝ² | It spans ℝ², but three vectors in ℝ² are dependent. Remove (1, 1) to get a basis. |
| Counting entries instead of basis vectors | Saying a plane in ℝ³ has dimension 3 | Dimension counts basis vectors. A plane through the origin has a basis of 2 vectors, so its dimension is 2. |
| Getting dim P_n wrong | Saying dim P_2 = 2 | The basis 1, x, x² has three vectors, so dim P_2 = 3. |
| Thinking a space has only one basis | “The basis of ℝ² is {(1, 0), (0, 1)}” | Every nonzero space has infinitely many bases. All of them have the same number of vectors. |
Related ideas
Coordinates. Because the weights are unique, a basis gives every vector in V a list of coordinates. In the picture above, v has coordinates (2, 1) relative to {b₁, b₂} and (1, 4) relative to the standard basis. Change of Basis shows how to convert between the two.
Rank and nullity. For an m × n matrix, dim Col A is the number of pivot columns and dim Nul A is the number of free variables. Every column is one or the other, so the two dimensions add up to n. The next lesson, Rank of a Matrix, names these numbers and builds on this fact.
Subspaces of ℝ³ by dimension. The subspaces of ℝ³ sort neatly by dimension: {0} has dimension 0, lines through the origin 1, planes through the origin 2, and ℝ³ itself 3.
Practice problems
- Is {(1, 3), (2, 6)} a basis of ℝ²?
- Is {(2, 1), (1, −1)} a basis of ℝ²?
- Is {(1, 2, 0), (0, 1, 1), (2, 5, 1)} a basis of ℝ³?
- Can four vectors in ℝ³ ever form a basis of ℝ³? Explain.
- Give a basis and the dimension of P_3.
- Find a basis and the dimension of the plane x + 2y − z = 0 in ℝ³.
- B = {(1, 1), (−1, 2)} is a basis of ℝ². Find the weights c₁ and c₂ with v = (1, 4) = c₁(1, 1) + c₂(−1, 2).
- Find bases for Nul A and Col A, and their dimensions, for A = \begin{bmatrix} 1 & 3 & -1 \\ 2 & 6 & 1 \end{bmatrix}.
- Show that the symmetric 2 × 2 matrices have dimension 3.
- Find a basis and the dimension of Span{(1, −1, 2), (−2, 2, −4), (0, 1, 1)}.
Show answers
1.
2\begin{bmatrix} 1 \\ 3 \end{bmatrix} = \begin{bmatrix} 2 \\ 6 \end{bmatrix}The second vector is 2 times the first.
Answer: no. The vectors are linearly dependent, so they span only a line.
2.
\det\begin{bmatrix} 2 & 1 \\ 1 & -1 \end{bmatrix} = 2(-1) - 1(1) = -3Put the vectors in the columns and find the determinant.
-3 \ne 0
A nonzero determinant means the columns are independent.
Answer: yes. Two independent vectors in ℝ², which has dimension 2, form a basis.
3.
2\begin{bmatrix} 1 \\ 2 \\ 0 \end{bmatrix} + \begin{bmatrix} 0 \\ 1 \\ 1 \end{bmatrix} = \begin{bmatrix} 2 \\ 5 \\ 1 \end{bmatrix}The third vector is 2 times the first plus the second.
Answer: no. The set is linearly dependent, so it is not a basis. It spans only a plane.
4.
Answer: no. ℝ³ has dimension 3, and any set of more than 3 vectors in ℝ³ is linearly dependent.
5.
p(x) = a + bx + cx^2 + dx^3
Every polynomial in P_3 is a combination of 1, x, x² and x³, and these four are independent.
Answer: a basis is {1, x, x², x³}, and dim P_3 = 4.
6.
x = -2y + z
Solve the equation for x; y and z are free.
(x, y, z) = (-2y + z,\ y,\ z)
Write a general point of the plane.
= y(-2, 1, 0) + z(1, 0, 1)
Split by free variable.
Answer: a basis is {(−2, 1, 0), (1, 0, 1)}, and the plane has dimension 2.
7.
c_1 - c_2 = 1
First entries.
c_1 + 2c_2 = 4
Second entries.
3c_2 = 3
Subtract the first equation from the second.
c_2 = 1
Divide by 3.
c_1 = 1 + c_2 = 1 + 1 = 2
Substitute into the first equation.
Answer: c₁ = 2 and c₂ = 1, so v = 2(1, 1) + 1(−1, 2), matching the picture above.
8.
\begin{bmatrix} 1 & 3 & -1 \\ 2 & 6 & 1 \end{bmatrix} \sim \begin{bmatrix} 1 & 3 & -1 \\ 0 & 0 & 3 \end{bmatrix}R₂ − 2R₁ → R₂.
\sim \begin{bmatrix} 1 & 3 & -1 \\ 0 & 0 & 1 \end{bmatrix}⅓R₂ → R₂.
\sim \begin{bmatrix} 1 & 3 & 0 \\ 0 & 0 & 1 \end{bmatrix}R₁ + R₂ → R₁. Pivots in columns 1 and 3; x₂ is free.
x_1 = -3x_2,\quad x_3 = 0
Solve rows 1 and 2.
x = x_2\begin{bmatrix} -3 \\ 1 \\ 0 \end{bmatrix}Parametric vector form.
Answer: Nul A has basis {(−3, 1, 0)} and dimension 1. Col A has basis {(1, 2), (−1, 1)} (columns 1 and 3 of A) and dimension 2, so Col A = ℝ².
9.
\begin{bmatrix} a & b \\ b & d \end{bmatrix} = a\begin{bmatrix} 1 & 0 \\ 0 & 0 \end{bmatrix} + b\begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix} + d\begin{bmatrix} 0 & 0 \\ 0 & 1 \end{bmatrix}Every symmetric matrix is a combination of these three, so they span.
\begin{bmatrix} a & b \\ b & d \end{bmatrix} = \begin{bmatrix} 0 & 0 \\ 0 & 0 \end{bmatrix} \Rightarrow a = b = d = 0The combination is the zero matrix only when every weight is 0, so they are independent.
Answer: the three matrices form a basis, so the symmetric 2 × 2 matrices have dimension 3.
10.
\begin{bmatrix} -2 \\ 2 \\ -4 \end{bmatrix} = -2\begin{bmatrix} 1 \\ -1 \\ 2 \end{bmatrix}The second vector is −2 times the first, so drop it.
c_1(1, -1, 2) + c_2(0, 1, 1) = (0, 0, 0)
Test the two that remain.
c_1 = 0
First entries: c₁ = 0.
c_2 = 0
Second entries: −c₁ + c₂ = 0, so c₂ = 0.
Answer: a basis is {(1, −1, 2), (0, 1, 1)}, and the span has dimension 2 (a plane).
Basis and dimension FAQ
What is a basis in linear algebra?
A basis is a linearly independent set of vectors that spans the space. Every vector in the space can be written in exactly one way as a combination of the basis vectors.
How do you find the dimension of a subspace?
Find a basis and count its vectors. For a null space, count the free variables; for a column space, count the pivot columns.
Can a vector space have more than one basis?
Yes. Every nonzero vector space has infinitely many bases, but all of them have the same number of vectors. That number is the dimension.
What is the dimension of the zero subspace?
The zero subspace {0} has dimension 0. Its basis is the empty set, because any set that contains 0 is linearly dependent.
Summary
- A basis is a linearly independent set that spans the space; it gives every vector unique weights.
- The dimension is the number of vectors in a basis: dim ℝⁿ = n, dim P_n = n + 1 and dim M_{2\times 2} = 4.
- In an n-dimensional space, n independent vectors or n spanning vectors are automatically a basis.
- A basis for Nul A comes from the parametric vector form; dim Nul A is the number of free variables.
- A basis for Col A is the pivot columns of the original A; dim Col A is the number of pivots.
Previous lesson: Null Space and Column Space
Next lesson: Rank of a Matrix
Back to the Linear Algebra Index