A linear combination of vectors v1,…,vk is c1v1+⋯+ckvk, for any numbers c1,…,ck (lesson 3.1.1). The span of the vectors is the set of all their linear combinations. Lesson 3.1.1 asked which points combinations of two vectors can reach: the span is the answer.
Rule: Span
span{v1,…,vk}={c1v1+⋯+ckvk}
Every combination, with any numbers c1 to ck. Setting every ci=0 gives 0, so a span always contains the origin.
What the span looks like depends on how the vectors point:
One non-zero vector: its multiples, a line through the origin. The span of (1,2) holds (−1,−2), (0.5,1) and (2,4).
Two vectors in the plane pointing different ways: the whole plane, R2. With u=(3,1) and v=(1,2), lesson 3.1.1 reached (5,5)=u+2v and (1,−3)=u−2v.
Two vectors along one line, such as (1,2) and (2,4): only that line. Lesson 3.3.2 drew this case: (3,6) is reached and (3,5) is not.
The zero vector alone: only the origin.
A plane in space
In R3, take a1=(1,0,1) and a2=(0,1,1). A combination is
sa1+ta2=sts+t
So the span is the set of points whose third component is the sum of the first two: a plane through the origin. (1,2,3)=a1+2a2 lies in it, and (1,2,0) does not, since 1+2=0.
The span of a1 and a2 is a plane through the origin. Their sum stays in the plane and adds nothing new. c=(1,1,0) lies 2 below it, so adding c reaches all of space.
Lesson 3.3.2 gives a test that needs no picture. A vector b is in the span exactly when Ax=b has a solution, where A has the vectors as its columns. So adding b as an extra column must not raise the rank.
Try it
The loop builds three combinations sa1+ta2: each third component is the sum of the first two.
Then the rank test. With (1,2,3) added the rank stays 2, so it is in the span; with (1,2,0) it rises to 3.
⌘/Ctrl + Enter runs the cell
Linear independence
Vectors are linearly independent when none of them is a combination of the others. Otherwise they are dependent: at least one of them adds nothing to the span.
(3,1) and (1,2) are independent: neither is a multiple of the other.
(1,2) and (2,4) are dependent, since (2,4)=2(1,2). Lesson 3.3.2 met them as the columns of a singular matrix.
u, v and (5,5) are dependent, since (5,5)=u+2v. Any three vectors in R2 are.
a1, a2 and a1+a2 are dependent; a1, a2 and c=(1,1,0) are independent. The figure shows why.
Any set that contains 0 is dependent: 0=0⋅u is a combination of the others.
Dependence also shows as a combination that gives 0 without every coefficient being 0: 2(1,2)−(2,4)=0. For independent vectors, the only combination that gives 0 is 0v1+⋯+0vk.
Two tests
Put the k vectors in the columns of a matrix A. Elimination (lesson 3.3.2) finds a pivot in every column exactly when no column is a combination of the others.
Rule: Testing independence
independent⟺rankA=kfor k=n: detA=0
A has the k vectors as columns, each with n components. The determinant test (lesson 3.4.1) needs a square matrix: n vectors in Rn. With more vectors than components, k>n, the rank is at most n, so they are always dependent.
vectors
rank
count
independent?
(3,1), (1,2)
2
2
yes, det=5
(1,2), (2,4)
1
2
no
(3,1), (1,2), (5,5)
2
3
no
a1, a2, a1+a2
2
3
no, det=0
a1, a2, (1,1,0)
3
3
yes, det=−2
(3,1), 0
1
2
no
Try it
Each set becomes the columns of a matrix. The loop prints its rank beside the number of vectors: independent exactly when they match.
The last loop prints the determinants of the three square cases. Adding 0.0 turns a -0.0 into 0.0, as in lesson 3.4.1.
⌘/Ctrl + Enter runs the cell
Basis and dimension
A basis of a span is a set of independent vectors that spans it. It has no spare vectors: drop one and the span shrinks.
e1=(1,0) and e2=(0,1) are the standard basis of R2; e1,e2,e3 are that of R3.
u=(3,1) and v=(1,2) are another basis of R2. Any two independent vectors in the plane are.
a1 and a2 are a basis of the plane in the figure. Adding c gives a basis of all of R3.
From a dependent set, drop each vector that is a combination of the others until the rest are independent. a1, a2 and a1+a2 span the same plane as a1 and a2 alone.
Every basis of the same span has the same number of vectors, its dimension. Rn has dimension n, a line through the origin dimension 1 and a plane dimension 2.
Rule: Dimension of a span
dimspan{v1,…,vk}=rankA
A has the vectors as columns. The rank counts the independent columns, so it counts the vectors a basis needs. It is at most k, and at most n.
For example, (1,2,3), (2,4,6) and (0,1,1) have rank 2: the second is twice the first. So they span a plane, with (1,2,3) and (0,1,1) as a basis.
Try it
The first line is the rank of the example: its span has dimension 2.
Dropping a1+a2 leaves the rank at 2, so the span is still the same plane. Adding c instead raises it to 3, the dimension of R3, as for the standard basis.
⌘/Ctrl + Enter runs the cell
Coordinates in a basis
A basis spans its space and has no spare vectors. So every vector in the space is exactly one combination of the basis vectors. The numbers in that combination are the vector's coordinates in that basis.
The components used so far are coordinates in the standard basis: (4,−2)=4e1−2e2. In the basis u=(3,1), v=(1,2), the same point is 2u−2v, so its coordinates are (2,−2).
One point, two grids. In the standard basis x=4e1−2e2; in the basis u,v it is 2u−2v.
To find coordinates c1,c2, solve c1u+c2v=x. That is a linear system Bc=x, where B has the basis vectors as its columns (lesson 3.3.1):
3c1+c2c1+2c2=4=−2
Twice the first minus the second gives 5c1=10, so c1=2 and then c2=−2. Check: 2(3,1)−2(1,2)=(4,−2).
x in the standard basis
(5,5)
(7,4)
(1,−3)
(4,−2)
(1,0)
coordinates in u,v
(1,2)
(2,1)
(1,−2)
(2,−2)
(0.4,−0.2)
Whole-number points can have fractional coordinates: e1=0.4u−0.2v. The order of the basis matters too: in the basis v,u, the point (4,−2) has coordinates (−2,2).
Rule: Coordinates in a basis
x=c1b1+⋯+cnbnc=B−1x
B has the basis vectors b1,…,bn as columns. Its columns are independent, so it has an inverse (lesson 3.4.1). Compute c with np.linalg.solve(B, x), as lesson 3.2.3 advises.
Only a basis gives coordinates that exist and are unique. With dependent vectors a point is reached in many ways, as (3,6) was in lesson 3.3.2. With too few vectors, some points are not reached at all.
An orthogonal basis
When the basis vectors are orthogonal (lesson 3.1.2), no system is needed. Take b1=(1,1) and b2=(−1,1), whose dot product is 0. Each coordinate of (4,−2) is a dot product divided by a squared length:
c1=2(4,−2)⋅(1,1)=1c2=2(4,−2)⋅(−1,1)=−3
Check: 1(1,1)−3(−1,1)=(4,−2). Lesson 3.5.2 shows why this works: each coordinate measures a projection.
Try it
B holds u and v as columns. The loop solves for the coordinates of each point of the table, and checks the combination with np.allclose.
The last line is the shortcut for the orthogonal basis (1,1), (−1,1).
⌘/Ctrl + Enter runs the cell
The column space and the null space
Two spans come with every matrix A. The first is the column space: the span of the columns of A. A product Ax is a combination of the columns (lesson 3.2.1), so the column space holds every Ax.
So Ax=b has a solution exactly when b is in the column space. That is the picture of lesson 3.3.2, where columns along one line reached only that line. The dimension of the column space is rankA.
Take the tall system of lesson 3.3.2:
T=1111−12
Its two columns are independent, so its column space is a plane in R3. b=(3,1,4) lies in it, since T(2,1)=b. b=(3,1,5) does not, so that system has no solution.
Elimination with letters says which b the plane holds. The steps of lesson 3.3.2 leave b3−1.5b1+0.5b2 in the last row, so b is reached exactly when 3b1−b2−2b3=0.
For (3,1,5) that number is −2, not 0. Lesson 3.5.3 finds the point of the plane closest to it.
The null space
The null space of A is the set of all x with Ax=0. It always contains x=0, and it is a span too: a point, a line, a plane or more, through the origin.
Independent columns: only x=0, since no other combination of the columns gives 0. The null space of T is just 0.
(1224): x1+2x2=0, so the null space is the line of multiples of (−2,1). Lesson 3.2.3's singular Z=(10.521) has the same one: it sends (2,−1) to 0.
123246134 from lesson 3.3.2: the line of multiples of (−2,1,0).
That last direction is familiar. Lesson 3.3.2 found the solutions of this system with b=(4,9,13) as (3,0,1)+t(−2,1,0). Adding any vector of the null space to one solution gives another.
Rule: Column space and null space
column space: every Axdimension rankAnull space: every x with Ax=0dimension n−rankA
A has n columns. Ax=b has a solution exactly when b is in the column space. The dimension of the null space is the number of free variables of lesson 3.3.2.
Lesson 3.6.1 finds eigenvectors as the null space of a matrix.
Try it
The first loop tests both right-hand sides for T by rank, and prints 3b1−b2−2b3.
Then a vector from each of two null spaces, and three solutions (3,0,1)+t(−2,1,0) that all give (4,9,13). SciPy's null_space returns basis vectors of length 1, whose sign can vary, so the cell divides by the second entry.
⌘/Ctrl + Enter runs the cell
Common mistakes
A span always passes through the origin. The points (x,3) form a line, but not a span: 0 is not on it.
Independence belongs to the whole set.(1,0,1), (0,1,1) and (1,1,2) are dependent, though no two of them are multiples of each other.
The dimension is the rank, not the count. Three vectors can span a plane, a line or only the origin.
Too many or too few. More than n vectors in Rn are always dependent; fewer than n never span Rn.
Coordinates depend on the basis and its order.(4,−2) is (2,−2) in the basis u,v and (−2,2) in v,u.
The determinant test needs a square matrix. For k vectors in Rn with k=n, compare the rank with k.
A null space is never empty. It always holds 0; "only 0" means the columns are independent.
Span, independence and basis
0 of 12 correct
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
How to type answers
Powers with ^: x^7, 2^(1/3), a^-2.
Multiply with * or by writing side by side: 3x^2, 2(x+1).
ln(x) is the natural log, log(x, 2) is log base 2, e is Euler's number, sqrt(x) is a square root.
sin(x), cos(x) and tan(x) take radians; write pi for π and sin(x)^2 for sin²x.
Your first answer to each question is saved: it counts towards your score and brings the question back for review.
Exact answers like ln(20)/ln(3) are best. Decimals need about 4 significant figures.
Summary card
The span of v1,…,vk is every combination c1v1+⋯+ckvk: the origin, a line, a plane or more, always through 0.
Vectors are independent when none is a combination of the others. With them as the columns of A: independent exactly when rankA=k, and for n vectors in Rn, when detA=0.
A basis is an independent set that spans; its size is the dimension, equal to the rank. Rn has dimension n.
Every vector has unique coordinates c=B−1x in a basis B; for orthogonal basis vectors, each is a dot product over a squared length.
The column space of A holds every Ax, with dimension rankA; Ax=b is solvable exactly when b is in it.
The null space holds every x with Ax=0, with dimension n−rankA.