Module 1: Vectors
In the last lesson you learned that by choosing different coefficients you can reach different points using a linear combination. Now ask a bigger question: what's every point you can possibly reach?
The span of a set of vectors is the collection of all linear combinations you can make from them — every possible av1+bv2 as a and b range over all real numbers.
It's the answer to: "Where can these vectors take me?"
If v1 and v2 point in genuinely different directions, their span fills the entire 2D plane. You can reach any point [x, y] by picking the right a and b. The green shading in the interactive shows this.
If the two vectors point in the same direction (or exactly opposite), scaling and adding them only ever moves you along that one line. The span collapses from a whole plane down to a single line through the origin.
If v2=2v1, then av1+bv2=av1+2bv1=(a+2b)v1. The second vector adds no new direction. It can only go where v1 already goes.
Vectors that are not redundant like this are called linearly independent. That term will come up again and again through the rest of the course.
The same idea extends upward. In 3D:
The number of independent vectors you need to span a space is its dimension. 2D space has dimension 2. 3D space has dimension 3.
import numpy as np
v1 = np.array([2, 1])
v2 = np.array([-1, 2])
# Can we reach [3, 4]?
# Solve: a*v1 + b*v2 = [3, 4]
A = np.column_stack([v1, v2])
coeffs = np.linalg.solve(A, [3, 4])
print(coeffs) # [a, b] — a solution exists because v1, v2 are independentnp.linalg.solve finds the coefficients. If the vectors were parallel it would throw an error — because there's no solution for most targets.