determin.ant
05-vector-spaces / 5.1

Module 5: Vector Spaces

Basis and Dimension

Where you'll see this: every coordinate system you've ever used is secretly a basis. GPS uses latitude/longitude (one basis). A 3D game engine uses x/y/z world coordinates (another). Computer graphics constantly switches between bases — model space, world space, camera space, screen space.

You've been working with vectors in terms of the standard axes: right and up. But those axes aren't special — they're just a convenient choice. Any two non-parallel vectors can serve as a basis.

What is a basis?

A basis for ℝ² is a set of two vectors where:

  • They are linearly independent — neither is a scalar multiple of the other
  • They span ℝ² — you can reach any point using linear combinations of them

The standard basis is e1=[1,0]\mathbf{e}_1 = [1, 0] and e2=[0,1]\mathbf{e}_2 = [0, 1]. But [2,1][2, 1] and [0,3][0, 3] also form a valid basis — just a tilted, stretched one.

Coordinates are relative

When we say a vector is [3,2][3, 2], we mean: 3 steps in the e₁ direction, 2 steps in the e₂ direction. Change the basis, and the same physical arrow gets different coordinates.

The vector hasn't changed — only our ruler has. The coordinates are always relative to a basis.

Dimension

The dimension of a space is the number of vectors in any basis for it. ℝ² has dimension 2. ℝ³ has dimension 3. A line through the origin has dimension 1 — one vector spans it.

A key fact: every basis for ℝ² has exactly 2 vectors. You can't span the plane with 1 vector, and 3 vectors are always redundant (one is a combination of the others).

Try it

Drag the blue and pink vectors to change the basis. The purple vector v is always expressed as a combination of the two basis vectors — watch the coefficients update.

Now try dragging e₁ and e₂ on top of each other. The basis becomes degenerate: they no longer span the plane.

In NumPy: a change of basis is just a matrix multiply. If P contains your basis vectors as columns, then P_inv @ v gives v's coordinates in the new basis.
import numpy as np
P = np.array([[2, 0], [1, 3]])  # columns = basis vectors
v = np.array([4, 3])
coords = np.linalg.solve(P, v)  # coordinates in new basis
print(coords)  # [2, 0.33...]
InvertibilityColumn, Null, and Row Space
-6-6-5-5-4-4-3-3-2-2-1-1112233445566e₁e₂v

e₁ = [1, 0] e₂ = [0, 1]

v = [2, 1]

v = 2 · e₁ + 1 · e₂

Drag any vector. When e₁ ∥ e₂, they no longer span ℝ².