Module 5: Vector Spaces
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.
A basis for ℝ² is a set of two vectors where:
The standard basis is e1=[1,0] and e2=[0,1]. But [2,1] and [0,3] also form a valid basis — just a tilted, stretched one.
When we say a vector is [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 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).
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.
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...]e₁ = [1, 0] e₂ = [0, 1]
v = [2, 1]
v = 2 · e₁ + 1 · e₂
Drag any vector. When e₁ ∥ e₂, they no longer span ℝ².