Foundations to Frontier
Tests
A. Mathematical Foundations › A2 Linear Algebra › Vectors and spaces

Vector Spaces, Subspaces, Span and Linear Independence

Which places can a set of moves reach, and are any of those moves redundant? These two questions explain model capacity, low-rank fine-tuning, multicollinearity, and the self-motion of redundant robot arms.

Level 0: Foundation

★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.

What can you reach?

A toy robot knows only two moves: “one step east” and “one step north”. By repeating them (and going backwards), it can reach every square on the floor. Its moves span the whole floor.

Now imagine a robot whose two moves are “one step east” and “two steps east”. Both point the same way, so no matter how it combines them, it can never leave its row. The second move adds nothing new. It’s redundant.

Mixing paints

With red and blue paint you can mix many purples. If someone gives you a third pot that is already “half red, half blue”, it doesn’t let you make any new colour. In maths, that third pot is linearly dependent on the other two.

Try it below. Make u and v point the same way and watch the reachable area shrink from the whole plane to a single line:

Span: what can a·u + b·v reach?
uvau+bv
u and v are independent: combinations a·u + b·v reach the whole plane. a·u + b·v = (4, 3).
📝 Quick check (Level 0)
0/3 answered
  1. 1. A robot's moves are 'east' and 'west'. Can it reach a square to the north?
  2. 2. Red, blue, and a pot of 'red + blue'. How many truly different base colours?
  3. 3. Moves 'east' and 'north'. Which squares can the robot reach?

Level 1: Beginner

★★☆☆☆ Basic⏱ 15 minSecondary-school mathematics: arithmetic and elementary algebra.

Linear combinations and span

A linear combination of v1,…,vk\mathbf v_1, \dots, \mathbf v_k is c1v1+⋯+ckvkc_1\mathbf v_1 + \dots + c_k\mathbf v_k for any numbers cic_i. The span is the set of all such combinations:

span⁡(v1,…,vk)={c1v1+⋯+ckvk:ci∈R}\operatorname{span}(\mathbf v_1,\dots,\mathbf v_k) = \{c_1\mathbf v_1 + \dots + c_k\mathbf v_k : c_i \in \mathbb{R}\}
  • The span of one non-zero vector in R2\mathbb{R}^2 is a line through the origin.
  • The span of two non-parallel vectors in R2\mathbb{R}^2 is the whole plane.
  • The span of two non-parallel vectors in R3\mathbb{R}^3 is a plane through the origin.

Worked example. Is (5,1)(5,1) in the span of (1,1)(1,1) and (1,−1)(1,-1)? Solve a(1,1)+b(1,−1)=(5,1)a(1,1) + b(1,-1) = (5,1). That gives a+b=5a + b = 5 and a−b=1a - b = 1, so a=3,b=2a = 3, b = 2. Yes.

Linear independence

Vectors are linearly dependent if one of them is a combination of the others, like (2,4)=2(1,2)(2,4) = 2(1,2). Otherwise they’re independent: each one adds a genuinely new direction.

📝 Quick check (Level 1)
0/3 answered
  1. 1. Is (2, 4) in the span of (1, 2)?
  2. 2. Are (1, 0, 0), (0, 1, 0), (1, 1, 0) independent?
  3. 3. The span of (1, 2) and (2, 4) is…

Level 2: Intermediate

★★★☆☆ Intermediate⏱ 35 minUndergraduate students and practising engineers.

Vector spaces

A vector space is any set VV with addition and scalar multiplication satisfying eight rules: addition is commutative and associative, there’s a zero vector 0\mathbf 0, every vector has a negative, and scalar multiplication distributes and is compatible (a(bv)=(ab)va(b\mathbf v) = (ab)\mathbf v, 1v=v1\mathbf v = \mathbf v).

The power of the idea is that many things that aren’t lists of numbers are vector spaces:

Vector space “Vectors” Dimension
Rn\mathbb{R}^n lists of numbers nn
Rm×n\mathbb{R}^{m\times n} matrices (e.g. a weight matrix) mnmn
Pd\mathcal{P}_d polynomials of degree ≤d\le d d+1d+1
C[a,b]C[a,b] continuous functions infinite
Solutions of y′′+y=0y'' + y = 0 functions acos⁡t+bsin⁡ta\cos t + b\sin t 2

Subspaces

A subset W⊆VW \subseteq V is a subspace if it’s a vector space in its own right. You only need to check three things:

  1. 0∈W\mathbf 0 \in W;
  2. closed under addition: u,w∈W⇒u+w∈W\mathbf u, \mathbf w \in W \Rightarrow \mathbf u + \mathbf w \in W;
  3. closed under scaling: w∈W⇒cw∈W\mathbf w \in W \Rightarrow c\mathbf w \in W.

✅ Lines and planes through the origin, the span of any set, and the solutions of Ax=0A\mathbf x = \mathbf 0. ❌ The line x+y=1x + y = 1 (misses 0), the first quadrant (not closed under −1-1), the two axes together (not closed under +).

Linear independence, precisely

v1,…,vk\mathbf v_1, \dots, \mathbf v_k are linearly independent if

c1v1+⋯+ckvk=0⟹c1=⋯=ck=0.c_1\mathbf v_1 + \dots + c_k\mathbf v_k = \mathbf 0 \quad\Longrightarrow\quad c_1 = \dots = c_k = 0.

In practice, put the vectors into a matrix and compute its rank, the number of independent rows (A2.1-6). The vectors are independent exactly when the rank equals the number of vectors.

🐍 Exercise 1: rank, independence and span by elimination
Implement rank() with Gaussian elimination using exact fractions, then is_independent and in_span.

Why this matters

Where Span / independence question
Data science: multicollinearity If one feature is a combination of others (like total = a + b), the columns of the data matrix are dependent. Regression weights are then not unique, and they become unstable when features are nearly dependent.
One-hot encoding Including all kk dummy columns plus an intercept makes them dependent (the “dummy variable trap”). That’s why one category is dropped.
ML capacity A linear model w⋅x\mathbf w\cdot\mathbf x can only output functions in the span of its features. Feature engineering enlarges that span.
Robotics The hand velocities a robot arm can produce form the span of the Jacobian’s columns. At a singular pose that span loses a dimension, and the arm can’t move in some direction.
📝 Quick check (Level 2)
0/3 answered
  1. 1. Is {(x, y, z) : x + 2y − z = 0} a subspace of ℝ³?
  2. 2. What is the dimension of the space of 3 × 4 matrices?
  3. 3. Any set of vectors containing 0 is…

Level 3: Advanced

★★★★☆ Advanced⏱ 45 minGraduate level, with full derivations and proofs.

Span is the smallest subspace

Theorem

span⁡(S)\operatorname{span}(S) is a subspace, and it’s contained in every subspace that contains SS.

Proof. 0=∑0⋅vi\mathbf 0 = \sum 0\cdot\mathbf v_i. The sum of two combinations is a combination, and so is a scaled combination. So the span is a subspace. Any subspace containing SS is closed under + and scaling, so it contains every combination of SS. ∎

Too many vectors are always dependent

Theorem

Any k>nk > n vectors in Rn\mathbb{R}^n are linearly dependent.

Proof. c1v1+⋯+ckvk=0c_1\mathbf v_1 + \dots + c_k\mathbf v_k = \mathbf 0 is a homogeneous system of nn equations in kk unknowns. Gaussian elimination leaves at most nn pivot columns, so at least k−n≥1k - n \ge 1 unknowns are free. Setting a free unknown to 1 gives a non-trivial solution. ∎

Intersections and unions

Theorem

The intersection of two subspaces is a subspace. Their union is a subspace only if one contains the other.

Proof. If u,w\mathbf u, \mathbf w are in both UU and WW, so are u+w\mathbf u + \mathbf w and cuc\mathbf u. For the union: suppose neither contains the other. Pick u∈U∖W\mathbf u \in U\setminus W and w∈W∖U\mathbf w \in W \setminus U. If u+w∈U\mathbf u + \mathbf w \in U, then w=(u+w)−u∈U\mathbf w = (\mathbf u+\mathbf w) - \mathbf u \in U, a contradiction. The same argument rules out WW. So u+w\mathbf u + \mathbf w isn’t in the union. ∎

The right way to “combine” subspaces is the sum U+W={u+w}U + W = \{\mathbf u + \mathbf w\}, which is the smallest subspace containing both.

The exchange lemma

Steinitz exchange lemma

If u1,…,um\mathbf u_1, \dots, \mathbf u_m are independent and lie in span⁡(w1,…,wn)\operatorname{span}(\mathbf w_1, \dots, \mathbf w_n), then m≤nm \le n.

This is the key fact behind dimension (A2.1-4): every basis of a space has the same size.

Independence of functions

Functions are vectors too. 1,x,x2,…,xd1, x, x^2, \dots, x^d are independent: a polynomial that is zero for every xx must have all coefficients zero, since a non-zero polynomial has finitely many roots. For differentiable functions, a non-zero Wronskian W(f,g)=fg′−f′gW(f,g) = fg' - f'g at some point proves independence. For example, W(ex,e2x)=e3x≠0W(e^x, e^{2x}) = e^{3x} \ne 0.

Exercise 3.1: For which k are (1,2,3), (0,1,4), (2,k,6) dependent?

Subtract 2× the first vector from the third: (2,k,6)−2(1,2,3)=(0,k−4,0)(2,k,6) - 2(1,2,3) = (0, k-4, 0). Together with (0,1,4)(0,1,4), this gives a dependence only when k−4=0k - 4 = 0, so k=4k = 4. Equivalently, the determinant of the matrix with these rows is 16−4k16 - 4k, which is zero exactly at k=4k = 4.

📝 Quick check (Level 3)
0/3 answered
  1. 1. Five vectors in ℝ⁴ are…
  2. 2. Two distinct planes through the origin in ℝ³ intersect in…
  3. 3. W(eˣ, e²ˣ) at x = 0 equals…

Level 4: Expert

★★★★★ Expert⏱ 30 minResearchers: original papers and open problems.

Learning often happens in a small subspace

Li et al. (2018) trained networks while restricting the parameters to a random dd-dimensional subspace of the full DD-dimensional space: θ=θ0+Pz\theta = \theta_0 + P\mathbf z. Many tasks reached 90% of full performance with dd in the hundreds or thousands, though DD was in the millions. They called the smallest such dd the intrinsic dimension. Aghajanyan et al. (2021) found that fine-tuning large language models has a remarkably low intrinsic dimension. That observation helped motivate LoRA (Hu et al., 2022), which confines the weight update to a low-rank subspace: ΔW=BA\Delta W = BA with rank r≪dr \ll d (F6).

🐍 Exercise 2 (research): intrinsic dimension in a toy problem
Only k = 10 of D = 1000 coordinates matter. Restrict θ to a random d-dimensional subspace and find the best achievable loss. It drops to 0 once d ≥ k.

Neural networks are not subspaces

The set of functions computed by networks of a fixed width is not closed under addition. The sum of two width-ww networks generally needs width 2w2w. So it isn’t a vector space, which is one reason its geometry is so much harder to analyse than that of linear models or kernel methods. Kernel methods do live in a vector space of functions, a reproducing kernel Hilbert space (B3), which is why their theory is so clean.

Redundant robots: the null space is freedom

A 7-joint arm (like most cobots and space arms) controlling a 6-D hand pose has one extra degree of freedom. The joint velocities that leave the hand still form the null space of the Jacobian: {q˙:Jq˙=0}\{\dot{\mathbf q} : J\dot{\mathbf q} = \mathbf 0\}, a 1-dimensional subspace. Controllers use this self-motion to avoid obstacles, joint limits and singularities while the hand keeps doing its task (Khatib, 1987; S5). Practice Code 5 computes it for a 3-link planar arm.

References

  1. G. Peano (1888). Calcolo geometrico secondo l’Ausdehnungslehre di H. Grassmann. (The first axiomatic definition of a vector space.)
  2. E. Steinitz (1913). “Bedingt konvergente Reihen und konvexe Systeme.” Journal für die reine und angewandte Mathematik, 143. (Exchange lemma.)
  3. O. Khatib (1987). “A unified approach for motion and force control of robot manipulators: The operational space formulation.” IEEE Journal on Robotics and Automation, 3(1).
  4. C. Li, H. Farkhoor, R. Liu, J. Yosinski (2018). “Measuring the intrinsic dimension of objective landscapes.” ICLR.
  5. A. Aghajanyan, S. Gupta, L. Zettlemoyer (2021). “Intrinsic dimensionality explains the effectiveness of language model fine-tuning.” ACL.
  6. E. Hu et al. (2022). “LoRA: Low-rank adaptation of large language models.” ICLR.
  7. S. Axler (2024). Linear Algebra Done Right, 4th ed. Chapters 1–2.