ContentsChapter 1 · Linear algebra2 of 7

1.2

Span, basis and dimension

In this chapter
  1. 1.1Vectors and linear combinations
  2. 1.2Span, basis and dimension
  3. 1.3Matrices as transformations
  4. 1.4Determinant, inverse and Ax = b
  5. 1.5Dot products, angles and projections
  6. 1.6Eigenvectors and eigenvalues
  7. 1.7Symmetric matrices and the SVD
Before you readYou can move only along u=(1,2)u = (1, 2) and v=(2,4)v = (2, 4) as far as you like either way. Which points can you reach?
Watch: Linear combinations, span, and basis vectors · 3Blue1Brown · Essence of Linear Algebra, ch. 2

The span of a set of vectors is every linear combination of them: every point you can reach by scaling and adding.

There, vv was linearly dependent: a combination of the others, adding no new direction. A set where no vector is a combination of the rest is linearly independent.

A basis is an independent set that spans the space, and its size is the dimension. The standard basis of R2\mathbb{R}^2 is ı^=(1,0)\hat\imath = (1,0) ȷ^=(0,1)\hat\jmath = (0,1) but any two independent vectors work.

Finding a basis. Write the vectors as the rows of a matrix and eliminate: subtract multiples of one row from the others to create zeros. Rows that become all zero were dependent; the nonzero rows that remain are a basis, and their count is the dimension. For (1,2,0)(1, 2, 0) (2,4,1)(2, 4, 1) (3,6,1)(3, 6, 1) row 2 minus 2 × row 1 gives (0,0,1)(0, 0, 1) row 3 minus 3 × row 1 gives (0,0,1)(0, 0, 1) and subtracting those leaves (0,0,0)(0, 0, 0) So {(1,2,0),(0,0,1)}\{(1, 2, 0), (0, 0, 1)\} is a basis and the dimension is 2.

Why ML cares: if one feature is a combination of others (height in cm and in inches), the data live in fewer dimensions than there are features. Regression then has no unique answer, and PCA (see Dimensionality reduction) is about finding the dimensions that matter.

u = (2, 1)v = (1, 2)dimension of span = 2 (the whole plane)
Dots are combinations iu + jv with whole numbers i, j. Drag v onto the line through u and the span collapses to that line.
Recall
What is the span of a set of vectors?
Recall
When is a set of vectors linearly dependent?
Recall
What is the dimension of a space?
Exercise
Row reduce to find the dimension of span⁡{(1,1,0)T,(0,1,1)T,(1,3,2)T}\operatorname{span}\{(1, 1, 0)^T, (0, 1, 1)^T, (1, 3, 2)^T\}