MAT1041 · Week 8 · - Basis and Dimension

Basis, dimension and the coordinate vector

You learn to test whether a set is a basis, to find a basis and the dimension of a subspace given by equations, to extract a basis from a set, and to compute the coordinates of a vector relative to a basis.

basisstandard basisdimensionfinite-dimensionalcoordinate vectorcoordinates relative to a basispivot columnssolution spaceunique representation

Last week we asked two questions: “Do these vectors span the space?” and “Is there an unnecessary vector?”. A set for which the answer is “yes, it spans, no, nothing is unnecessary” is called a basis. A basis is a coordinate system for a space: every vector is written in exactly one way with the elements of the basis. The number of elements in a basis is the dimension of the space. These two concepts are the groundwork for rank (week 9) and the matrices of linear transformations (week 12).

Golden rules:

  1. Basis = independent + spans.
  2. If you know the dimension, half the work is done: in an nn-dimensional space, nn independent vectors automatically span.
  3. The basis of a subspace given by an equation: solve the equations, separate by the free variables.
  4. When choosing a basis from a set, take the original vectors corresponding to the pivot columns.

Basis

Let VV be a vector space and B={v1,…,vn}⊆VB = \{\mathbf{v}_1, \dots, \mathbf{v}_n\} \subseteq V. If BB is both

  1. linearly independent, and
  2. spans VV,

then it is a basis of VV.

Why it matters: unique representation. If BB is a basis, then for every v∈V\mathbf{v} \in V the expression v=c1v1+⋯+cnvn\mathbf{v} = c_1\mathbf{v}_1 + \dots + c_n\mathbf{v}_n is unique. If there were two different expressions, their difference would be a nontrivial combination of zero and independence would fail.

Standard bases

SpaceStandard basisDimension
Rn\mathbb{R}^ne1=(1,0,…,0),…,en\mathbf{e}_1 = (1, 0, \dots, 0), \dots, \mathbf{e}_nnn
PnP_n{1,x,x2,…,xn}\{1, x, x^2, \dots, x^n\}n+1n + 1
M2,2M_{2,2}[1000],[0100],[0010],[0001]\begin{bmatrix} 1 & 0 \\ 0 & 0 \end{bmatrix}, \begin{bmatrix} 0 & 1 \\ 0 & 0 \end{bmatrix}, \begin{bmatrix} 0 & 0 \\ 1 & 0 \end{bmatrix}, \begin{bmatrix} 0 & 0 \\ 0 & 1 \end{bmatrix}44
Mm,nM_{m,n}matrices with a single 1 and 0 elsewheremnmn
{0}\{\mathbf{0}\}the empty set00

A space has infinitely many bases. The standard basis is just the easiest one.

Dimension

Theorem. If one basis of VV has nn elements, every basis of VV has nn elements. This common number is called the dimension of VV: dim⁡V=n\dim V = n.

The idea behind it: in a space spanned by nn vectors, more than nn vectors are always dependent. The consequences (dim⁡V=n\dim V = n):

The set you haveResult
more than nn vectorsdependent, not a basis
fewer than nn vectorsdoes not span VV, not a basis
exactly nn vectors, independentbasis (no need to check spanning)
exactly nn vectors, spanning VVbasis (no need to check independence)

For nn vectors in Rn\mathbb{R}^n the only test is the determinant of the column matrix.

Example 1. Is B={(1,2,0),(0,1,1),(1,0,2)}B = \{(1, 2, 0), (0, 1, 1), (1, 0, 2)\} a basis for R3\mathbb{R}^3?

det⁡[101210012]=1(2−0)−0+1(2−0)=4≠0.\det\begin{bmatrix} 1 & 0 & 1 \\ 2 & 1 & 0 \\ 0 & 1 & 2 \end{bmatrix} = 1(2 - 0) - 0 + 1(2 - 0) = 4 \neq 0.

Yes, it is a basis.

Coordinate vector

If B={v1,…,vn}B = \{\mathbf{v}_1, \dots, \mathbf{v}_n\} is a basis and v=c1v1+⋯+cnvn\mathbf{v} = c_1\mathbf{v}_1 + \dots + c_n\mathbf{v}_n, the coordinate vector of v\mathbf{v} relative to BB is

[v]B=(c1,…,cn).[\mathbf{v}]_B = (c_1, \dots, c_n).

The order matters: a basis is an ordered set. To find it, solve the system. For BB from Example 1 and v=(3,5,3)\mathbf{v} = (3, 5, 3):

[101321050123]→R2←R2−2R1[101301−2−10123]→R3←R3−R2[101301−2−10044]\left[\begin{array}{ccc|c} 1 & 0 & 1 & 3 \\ 2 & 1 & 0 & 5 \\ 0 & 1 & 2 & 3 \end{array}\right] \xrightarrow{R_2 \leftarrow R_2 - 2R_1} \left[\begin{array}{ccc|c} 1 & 0 & 1 & 3 \\ 0 & 1 & -2 & -1 \\ 0 & 1 & 2 & 3 \end{array}\right] \xrightarrow{R_3 \leftarrow R_3 - R_2} \left[\begin{array}{ccc|c} 1 & 0 & 1 & 3 \\ 0 & 1 & -2 & -1 \\ 0 & 0 & 4 & 4 \end{array}\right]

c3=1c_3 = 1, c2=−1+2=1c_2 = -1 + 2 = 1, c1=3−1=2c_1 = 3 - 1 = 2. [v]B=(2,1,1)[\mathbf{v}]_B = (2, 1, 1). Check: 2(1,2,0)+(0,1,1)+(1,0,2)=(3,5,3)2(1, 2, 0) + (0, 1, 1) + (1, 0, 2) = (3, 5, 3).

In the standard basis, the coordinates are the components themselves: in P2P_2 the coordinate of 4−x+3x24 - x + 3x^2 relative to {1,x,x2}\{1, x, x^2\} is (4,−1,3)(4, -1, 3). In week 12 we will see the change of coordinates between two bases (transition matrix).

Finding a basis of a subspace

A subspace given by equations. W={(x,y,z,w):x+y−2z+w=0}W = \{(x, y, z, w) : x + y - 2z + w = 0\}, in R4\mathbb{R}^4.

x = -y + 2z - w;   y = r, z = s, w = t free
(x,y,z,w) = r(-1,1,0,0) + s(2,0,1,0) + t(-1,0,0,1)

A basis is {(−1,1,0,0),(2,0,1,0),(−1,0,0,1)}\{(-1, 1, 0, 0), (2, 0, 1, 0), (-1, 0, 0, 1)\}, dim⁡W=3\dim W = 3. The vectors obtained this way are automatically independent: each has a 1 in a free position where the others have 0.

General rule: if W={x:Ax=0}W = \{\mathbf{x} : A\mathbf{x} = \mathbf{0}\} then dim⁡W\dim W = number of free variables = number of variables − number of pivots.

For matrices and polynomials the same route: write the condition in terms of the coefficients, solve, separate by the free coefficients (Q6, Q7).

PITFALL · confusing the dimension with the number of equations. dim⁡W=n−(number of equations)\dim W = n - (\text{number of equations}) is true only if the equations are independent. In Q12 there are 3 equations but one is the sum of the other two; the dimension is 4−2=24 - 2 = 2, not 4−3=14 - 3 = 1. Always reduce to REF and count the pivots.

Extracting a basis from a set

A set S={v1,…,vk}S = \{\mathbf{v}_1, \dots, \mathbf{v}_k\} is given; a basis for span⁡S\operatorname{span}S made of elements of SS is asked.

  1. Make the vectors columns.
  2. Reduce to REF and identify the pivot columns.
  3. The original vectors corresponding to the pivot columns form the basis; their number is dim⁡span⁡S\dim\operatorname{span}S.

Example 2. S={(1,2,−1),(2,4,−2),(0,1,3),(1,3,2)}S = \{(1, 2, -1), (2, 4, -2), (0, 1, 3), (1, 3, 2)\}.

[12012413−1−232]→R3←R3+R1R2←R2−2R1[120100110033]→R3←R3−3R2[120100110000]\begin{bmatrix} 1 & 2 & 0 & 1 \\ 2 & 4 & 1 & 3 \\ -1 & -2 & 3 & 2 \end{bmatrix} \xrightarrow[R_3 \leftarrow R_3 + R_1]{R_2 \leftarrow R_2 - 2R_1} \begin{bmatrix} 1 & 2 & 0 & 1 \\ 0 & 0 & 1 & 1 \\ 0 & 0 & 3 & 3 \end{bmatrix} \xrightarrow{R_3 \leftarrow R_3 - 3R_2} \begin{bmatrix} 1 & 2 & 0 & 1 \\ 0 & 0 & 1 & 1 \\ 0 & 0 & 0 & 0 \end{bmatrix}

The pivots are in columns 1 and 3: the basis is {(1,2,−1),(0,1,3)}\{(1, 2, -1), (0, 1, 3)\}, dimension 2. The non-pivot columns also tell you the combination: column 2 = 2 × column 1, column 4 = column 1 + column 3. Indeed (1,3,2)=(1,2,−1)+(0,1,3)(1, 3, 2) = (1, 2, -1) + (0, 1, 3).

PITFALL · writing the columns of the REF as the basis. Row operations change the column space. The columns of the REF only tell you which vectors to choose; write the original vectors in the answer.

Completing a basis and the dimension of a subspace

  • An independent set can always be extended to a basis: add a vector not in the span, independence is preserved, continue.
  • A spanning set can always be reduced to a basis: discard one that is a combination of the others.
  • If W⊆VW \subseteq V is a subspace then dim⁡W≤dim⁡V\dim W \le \dim V; if they are equal, W=VW = V.

Dimensions of the subspaces of R3\mathbb{R}^3: {0}\{\mathbf{0}\} is 0, a line is 1, a plane is 2, R3\mathbb{R}^3 is 3.

Common mistakes

WrongRight
dim⁡Pn=n\dim P_n = nn+1n + 1
Checking only spanning for a basisIndependence is also required (if the dimension is not known)
Writing a proof of both spanning and independence for nn vectors in an nn-dimensional spaceOne is enough
Writing the columns of the REF as the basisThe original vectors
Getting the dimension by subtracting the number of equationsCount pivots: there may be dependent equations
Mixing up the order of the basis in the coordinate vector[v]B[\mathbf{v}]_B in the order the basis is given
Writing the basis of {0}\{\mathbf{0}\} as {0}\{\mathbf{0}\}The empty set; a set containing 0\mathbf{0} is dependent

Test yourself

Exam-style questions. Solve them on paper first, then reveal the answer.

Question 1easy

What are dim⁡M2,3\dim M_{2,3} and dim⁡P3\dim P_3?

Show answer
66 and 44

M2,3M_{2,3}: the 6 matrices with a 1 in one position and 0 elsewhere form the standard basis. dim⁡=2⋅3=6\dim = 2 \cdot 3 = 6.P3P_3: the standard basis {1,x,x2,x3}\{1, x, x^2, x^3\} has 4 elements. Trap: the degree is 3 but the dimension is 3+1=43 + 1 = 4.

Question 2easy

Is {(1,2),(2,4)}\{(1, 2), (2, 4)\} a basis for R2\mathbb{R}^2?

Show answer
No

(2,4)=2(1,2)(2, 4) = 2(1, 2): dependent. det⁡[1224]=0\det\begin{bmatrix} 1 & 2 \\ 2 & 4 \end{bmatrix} = 0.
Both vectors lie on a single line, they do not span R2\mathbb{R}^2.

Question 3medium

Is {(1,0,1),(2,1,0),(1,1,2)}\{(1, 0, 1), (2, 1, 0), (1, 1, 2)\} a basis for R3\mathbb{R}^3?

Show answer
Yes

3 vectors, dim⁡R3=3\dim\mathbb{R}^3 = 3: independence (or spanning) alone is enough.
The column matrix is [121011102]\begin{bmatrix} 1 & 2 & 1 \\ 0 & 1 & 1 \\ 1 & 0 & 2 \end{bmatrix}, along column 1: 1(2−0)−0+1(2−1)=3≠01(2 - 0) - 0 + 1(2 - 1) = 3 \neq 0.

Question 4medium

Find a basis and the dimension of W={(x,y,z):x−3y+2z=0}W = \{(x, y, z) : x - 3y + 2z = 0\}.

Show answer
Basis {(3,1,0),(−2,0,1)}\{(3, 1, 0), (-2, 0, 1)\}, dim⁡W=2\dim W = 2

x=3y−2zx = 3y - 2z, with y=sy = s, z=tz = t free: (3s−2t,s,t)=s(3,1,0)+t(−2,0,1)(3s - 2t, s, t) = s(3, 1, 0) + t(-2, 0, 1).
The two vectors span and are independent (look at the 2nd and 3rd components). One equation, 3 variables: dim⁡=3−1=2\dim = 3 - 1 = 2.

Question 5medium

Find a basis and the dimension of W={(a,b,c,d):a+b=0, c−2d=0}W = \{(a, b, c, d) : a + b = 0,\ c - 2d = 0\} in R4\mathbb{R}^4.

Show answer
Basis {(−1,1,0,0),(0,0,2,1)}\{(-1, 1, 0, 0), (0, 0, 2, 1)\}, dim⁡W=2\dim W = 2

a=−ba = -b, c=2dc = 2d. With b=sb = s, d=td = t: (−s,s,2t,t)=s(−1,1,0,0)+t(0,0,2,1)(-s, s, 2t, t) = s(-1, 1, 0, 0) + t(0, 0, 2, 1).
Two independent equations, 4 variables: dim⁡=4−2=2\dim = 4 - 2 = 2.

Question 6medium

What is the dimension of the subspace of 3×33 \times 3 symmetric matrices?

Show answer
6

A symmetric matrix is completely determined by the diagonal (3 entries) and the above-diagonal part (3 entries); the lower part is a mirror.
One basis matrix for each free position: 3+3=63 + 3 = 6. In general: n(n+1)2\frac{n(n+1)}{2}.

Question 7medium

Find a basis and the dimension of W={p∈P2:p(1)=0}W = \{p \in P_2 : p(1) = 0\}.

Show answer
Basis {x−1,x2−1}\{x - 1, x^2 - 1\}, dim⁡W=2\dim W = 2

p=a+bx+cx2p = a + bx + cx^2, p(1)=a+b+c=0⇒a=−b−cp(1) = a + b + c = 0 \Rightarrow a = -b - c.p=−b−c+bx+cx2=b(x−1)+c(x2−1)p = -b - c + bx + cx^2 = b(x - 1) + c(x^2 - 1). The two polynomials are independent (different degrees).dim⁡P2=3\dim P_2 = 3, one condition: 3−1=23 - 1 = 2.

Question 8medium

Find the coordinate vector of v=(5,3)\mathbf{v} = (5, 3) relative to the basis B={(1,1),(1,−1)}B = \{(1, 1), (1, -1)\}.

Show answer
[v]B=(4,1)[\mathbf{v}]_B = (4, 1)

a(1,1)+b(1,−1)=(5,3)a(1, 1) + b(1, -1) = (5, 3): a+b=5a + b = 5, a−b=3a - b = 3. Add: 2a=82a = 8, a=4a = 4, b=1b = 1.
Check: 4(1,1)+1(1,−1)=(5,3)4(1, 1) + 1(1, -1) = (5, 3).

Question 9hard

Find a basis for span⁡S\operatorname{span}S consisting of vectors from S={(1,2,1),(2,4,2),(1,0,1),(0,1,0)}S = \{(1, 2, 1), (2, 4, 2), (1, 0, 1), (0, 1, 0)\}, and give its dimension.

Show answer
Basis {(1,2,1),(1,0,1)}\{(1, 2, 1), (1, 0, 1)\}, dimension 22

Make the vectors columns and reduce: [121024011210]\begin{bmatrix} 1 & 2 & 1 & 0 \\ 2 & 4 & 0 & 1 \\ 1 & 2 & 1 & 0 \end{bmatrix}. R2←R2−2R1R_2 \leftarrow R_2 - 2R_1: (0,0,−2,1)(0, 0, -2, 1); R3←R3−R1R_3 \leftarrow R_3 - R_1: a zero row.
The pivots are in columns 1 and 3. The original 1st and 3rd vectors form the basis.
Check: (2,4,2)=2(1,2,1)(2, 4, 2) = 2(1, 2, 1), (0,1,0)=12[(1,2,1)−(1,0,1)](0, 1, 0) = \frac12[(1, 2, 1) - (1, 0, 1)].

Question 10hard

For which values of kk is {(1,k,2),(0,1,k),(1,0,1)}\{(1, k, 2), (0, 1, k), (1, 0, 1)\} a basis for R3\mathbb{R}^3?

Show answer
k≠1k \neq 1 and k≠−1k \neq -1

The determinant of the matrix with these as rows, along row 1: 1(1−0)−k(0−k)+2(0−1)=1+k2−2=k2−11(1 - 0) - k(0 - k) + 2(0 - 1) = 1 + k^2 - 2 = k^2 - 1.
Basis   ⟺  det⁡≠0  ⟺  k≠±1\iff \det \neq 0 \iff k \neq \pm1.

Question 11easy

True or false: A set of three polynomials can span P3P_3.

Show answer
False

dim⁡P3=4\dim P_3 = 4. To span a space of dimension nn you need at least nn vectors. The span of three polynomials is at most 3-dimensional.

Question 12hard

Find a basis for and the dimension of the solution space of x1+2x2−x3+x4=0x_1 + 2x_2 - x_3 + x_4 = 0, 2x1+4x2−x3+3x4=02x_1 + 4x_2 - x_3 + 3x_4 = 0, 3x1+6x2−2x3+4x4=03x_1 + 6x_2 - 2x_3 + 4x_4 = 0.

Show answer
Basis {(−2,1,0,0),(−2,0,−1,1)}\{(-2, 1, 0, 0), (-2, 0, -1, 1)\}, dimension 22

R2←R2−2R1R_2 \leftarrow R_2 - 2R_1: (0,0,1,1)(0, 0, 1, 1). R3←R3−3R1R_3 \leftarrow R_3 - 3R_1: (0,0,1,1)(0, 0, 1, 1). R3←R3−R2R_3 \leftarrow R_3 - R_2: zero. R1←R1+R2R_1 \leftarrow R_1 + R_2: (1,2,0,2)(1, 2, 0, 2).
RREF: x1=−2x2−2x4x_1 = -2x_2 - 2x_4, x3=−x4x_3 = -x_4. With x2=sx_2 = s, x4=tx_4 = t: s(−2,1,0,0)+t(−2,0,−1,1)s(-2, 1, 0, 0) + t(-2, 0, -1, 1).
Dimension = number of free variables = 4−2=24 - 2 = 2.

Verification: The basis tests were done in node with BigInt fractions using determinants and rank, the subspace bases as null spaces from the exact RREF, and the coordinate vectors by exact solution; the pivot columns were read from the RREF, and in the parametric basis question det = k² − 1 was checked at many values of k (verify/MAT1041/08.mjs).

Review card

BASIS: both linearly independent and spans V. Every v is a UNIQUE combination of the basis vectors → coordinates. All bases have the same number of elements → dim V. dim Rⁿ = n, dim P_n = n+1, dim M_mn = mn, dim {0} = 0. dim symmetric n×n = n(n+1)/2. When dim V = n: n independent vectors → basis; n vectors that span → basis (one is enough). more than n → dependent; fewer than n → do not span. n vectors in Rⁿ are a basis ⇔ det ≠ 0. Basis of a subspace (given by equations): solve, give the free variables s,t, separate the vectors. dim = number of variables - number of independent equations = number of free variables. Extract a basis from a set: make columns, REF, the ORIGINAL vectors of the PIVOT columns. [v]_B: solve the system c1b1 + ... + cnbn = v. W ⊆ V → dim W ≤ dim V; if equal, W = V.