determin.ant
01-vectors / 1.5

Module 1: Vectors

Span

Where you'll see this: in robotics, span tells you which positions a robotic arm can physically reach. In ML, the span of your training features determines what patterns your model can ever learn. If two features are perfectly correlated (parallel vectors), one is redundant — it adds no new information.

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

The span of a set of vectors is the collection of all linear combinations you can make from them — every possible av1+bv2a\,\mathbf{v}_1 + b\,\mathbf{v}_2 as aa and bb range over all real numbers.

It's the answer to: "Where can these vectors take me?"

Two cases

Case 1 — independent vectors

If v1\mathbf{v}_1 and v2\mathbf{v}_2 point in genuinely different directions, their span fills the entire 2D plane. You can reach any point [x, y][x,\ y] by picking the right aa and bb. The green shading in the interactive shows this.

Case 2 — parallel vectors

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.

Try dragging v₂ until it points in the same direction as v₁. The shading disappears and you're left with just a dashed line — that's the span shrinking to one dimension.

Why parallel vectors are "redundant"

If v2=2v1\mathbf{v}_2 = 2\,\mathbf{v}_1, then av1+bv2=av1+2bv1=(a+2b)v1a\,\mathbf{v}_1 + b\,\mathbf{v}_2 = a\,\mathbf{v}_1 + 2b\,\mathbf{v}_1 = (a + 2b)\,\mathbf{v}_1. The second vector adds no new direction. It can only go where v1\mathbf{v}_1 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.

In higher dimensions

The same idea extends upward. In 3D:

  • One vector spans a line
  • Two independent vectors span a plane
  • Three independent vectors span all of ℝ³

The number of independent vectors you need to span a space is its dimension. 2D space has dimension 2. 3D space has dimension 3.

In code

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 independent

np.linalg.solve finds the coefficients. If the vectors were parallel it would throw an error — because there's no solution for most targets.

Linear CombinationsLinear Independence
drag the vectors — watch the span change
-6-6-5-5-4-4-3-3-2-2-1-1112233445566v₁v₂span = all of ℝ²
✓ Vectors are independent — span is all of 2D space
v₁ = [2, 1]  ·  v₂ = [-1, 2]