Visual Math Toolkit Guide 2 of 6 · tap to switch
Vector Spaces, Span & Basis
See how two basis arrows tile an entire 2D plane, watch dependent columns collapse into a 1D rail, and rotate rulers like PCA.
Imagine building a delivery-time predictor from a spreadsheet. You already have a Distance_km column, and a teammate helpfully adds Distance_miles right next to it. Your table just got wider, yet did you add a single drop of brand-new information? Not at all! Every mile number is simply 0.621 times the kilometer number. In machine learning, two columns that say the exact same thing do not help a model; they actually trip it up.
To see why, picture steering a cursor across a flat 2D map with two levers, like an Etch-a-Sketch or a game controller. Instead of moving strictly left-right and up-down, your two levers push along two tilted arrows: a teal arrow b₁ = [2, 1] and a green arrow b₂ = [-1, 2]. Turning dial a stretches, shrinks, or flips the teal arrow; turning dial b does the same to the green arrow; and your cursor lands where both moves add together (a · b₁ + b · b₂).
Mixing scaled arrows together like a · b₁ + b · b₂ is called a Linear Combination. The entire collection of every spot your two levers can reach is called their Span, and this flat playground where arrows can be stretched and added freely is a Vector Space. Dial a and b below to hit all three target pins on the map!
Notice the faint tilted grid behind the arrows. Because the teal arrow b₁ and green arrow b₂ point in genuinely different directions, those two levers tile every single spot on the flat 2D sheet, with one unique dial recipe for every destination. A clean, non-redundant starter set of arrows that can reach the entire space with zero wasted levers is called a Basis.
Linear Independence vs. Redundant Arrows
Now imagine someone breaks your controller so the green arrow points along the exact same line as the teal arrow, just twice as long (b₂ = 2 · b₁ = [4, 2]). Even though you still hold two levers in your hands, both levers push your cursor back and forth along the exact same diagonal track. You have lost an entire dimension!
Arrows that each unlock a brand-new direction are Linearly Independent. When one arrow is just a stretched, flipped, or combined copy of the others, the group is Linearly Dependent (redundant).
Lab 2 starts in that broken, trapped state. Try sliding a and b to escape the red track and reach [-3, 3], then switch to Almost Parallel and 2 Fresh Directions to watch the shaded parallelogram pop open!
That exact collapse is why multicollinearity (having duplicate or nearly duplicate feature columns) hurts Linear Regression. When a spreadsheet contains both Distance_km and Distance_miles, those two columns point along the same line. Your model cannot uniquely decide how much weight belongs to kilometers versus miles, because infinitely many weight splits give identical predictions (so standard fitting either crashes or swings wildly on tiny noise).
Change of Basis: same point, smarter rulers
By default, every spreadsheet measures points along a standard horizontal ruler ([1, 0]) and a vertical ruler ([0, 1]). Notice two tidy properties of those standard rulers: they meet at a 90° right angle (perpendicular), and each has length 1. Any pair of perpendicular length-1 rulers like this is called an orthonormal basis.
Here is the geometric superpower: nothing forces you to keep your rulers horizontal and vertical! You can spin that perpendicular pair to any angle you want while the data points stay frozen on the floor. Measuring the exact same fixed point with rotated rulers is called a Change of Basis.
Drag the rotation slider below (or click Tilted Cloud Rulers (35°)) while keeping your eyes glued to the purple Fixed Point P. Watch what happens to P’s coordinates!
Point P never moved a single pixel. Rotating our orthonormal rulers (u₁ and u₂) to line up with the diagonal data cloud packed nearly 100% of P’s location onto Ruler 1 (4.30) and shrank Ruler 2 to almost zero (0.04). When an entire cloud hugs Ruler 1 like that, you can drop Ruler 2 and compress two features down to one with almost zero information loss. That single rotation trick is the geometric heart of Principal Component Analysis (PCA)!
Matrix Rank in real ML tables (and LoRA!)
In machine learning, a dataset is stored as a matrix: simply a spreadsheet grid of numbers where each row is one example (like a house) and each column is a feature vector. Counting total columns is easy, yet column count alone can fool you when redundant columns sneak in. The Rank of a matrix is the true number of independent dimensions inside that grid, ignoring duplicate or redundant columns.
Two classic bugs drop a table’s rank below its column count:
- Duplicate units: Keeping both
Size (m²)andSize (sq ft)grows your table by one column, yetSize (sq ft)is just10.76 × Size (m²). Rank refuses to budge! - The Dummy Variable Trap (All category switches + Baseline
1): To feed a category like pet type (Cat,Dog, orBird) into a linear model, we turn each choice into a0or1yes/no switch column:Is_Cat,Is_Dog, andIs_Bird. Meanwhile, standard linear regression also includes a constant Baseline (1) column (the intercept) that holds1on every single row. Look at what happens when every row belongs to one of those three categories:Is_Cat + Is_Dog + Is_Bird = 1on every single row! Because the three switches always add up to the constant1column, any one switch is already a hidden combination of the others (ifIs_Cat = 0andIs_Dog = 0, you already knowIs_Birdmust be1). Dropping one switch removes the redundant copy and keeps every remaining column linearly independent.
Wait: is low rank always a bug? Not at all! Large Language Models (LLMs) contain massive weight grids, such as 4,096 × 4,096 (over 16.7 million numbers in a single layer). Instead of updating every single one of those numbers during fine-tuning, LoRA (Low-Rank Adaptation) intentionally routes the update through a tiny bottleneck of just a few independent directions (4,096 -> 2 -> 4,096), cutting trainable numbers by 99.9%!
Explore both sides of Rank in Lab 4 below: toggle redundant columns ON and OFF in the live spreadsheet to watch Rank stall, then switch to the LoRA Bottleneck tab to see intentional low rank in action!
| Row | House Size (m²) | Bedrooms |
|---|---|---|
| House A | 100 | 2 |
| House B | 125 | 3 |
| House C | 150 | 3 |
| House D | 200 | 5 |
See Formal Span, Linear Independence, Orthonormal Basis & Rank-NullityThesis / Reference
1. Span & Linear Independence: Given vectors , their span is . They are linearly independent if and only if .
2. Orthonormal Change of Basis: If columns of form an orthonormal basis (), converting any point into the new basis needs no matrix inversion, only a fast dot-product transpose:
3. Rank-Nullity Theorem: For any feature matrix , . Whenever , has a zero eigenvalue and is singular (non-invertible).
See Matrix Rank & Orthonormal Basis (QR / Gram-Schmidt) in NumPyOptional Code
import numpy as np
# Collinear columns: col 2 = 2 * col 1
X_bad = np.array([[2.0, 4.0], [1.0, 2.0], [3.0, 6.0]])
print("Rank of duplicate columns:", np.linalg.matrix_rank(X_bad)) # 1 (deficient!)
# Orthonormal rotation matrix Q at 35 degrees
theta = np.deg2rad(35)
Q = np.array([[np.cos(theta), -np.sin(theta)],
[np.sin(theta), np.cos(theta)]])
p = np.array([3.5, 2.5])
print("Rotated coordinates z = Q.T @ p:", np.round(Q.T @ p, 2)) # [4.30, 0.04]Next: how matrices bend entire spaces at once
Now that you know how two basis arrows define an entire grid, what happens when a matrix picks up both basis arrows and moves them to brand-new locations? The entire grid warps cleanly along with them!
Next up: Matrices & Matrix Multiplication.
Quick Intuition Check
Four quick real-world scenarios. No scores, just test your intuition.
You add a new column Distance_miles = 0.621 * Distance_km to an existing 3-column dataset that already contains Distance_km. What happens to the Matrix Rank?
When you perform an orthonormal Change of Basis (rotating perpendicular length-1 rulers, as in PCA), the underlying data points physically shift to brand-new locations in space.
What is the geometric Span of two non-zero 2D vectors v1 = [2, 1] and v2 = [-4, -2]?
A linear model already includes a constant Baseline (1) column. You turn a pet's type into three yes/no switch columns (Is_Cat, Is_Dog, Is_Bird) where every row has exactly one 1. Why should you drop one of those three switch columns?
Common Questions
What is the Span of a set of vectors in plain English?
Why does linear dependence break Linear Regression?
What is a Basis of a vector space?
How is Matrix Rank related to LoRA in modern LLMs?
Related Visual Guides
Matrices & Matrix Multiplication
See a matrix as a live space-warping machine, watch the Determinant scale or squash area, and master PyTorch layer shapes.
Principal Component Analysis (PCA)
How to rotate and compress dozens of correlated features into a few clean axes without throwing away the real story.
LoRA Fine-Tuning, RLHF & DPO (Post-Training)
How raw internet autocomplete becomes a helpful, aligned assistant via SFT, RLHF/DPO, and verifiable reasoning RL, plus low-cost LoRA adaptation.
Written & illustrated by Muhammad Aashir Irshad · Updated December 2026 · Free open-access reference
Cite this guide in a paper, thesis, or course (BibTeX & APA)
@misc{irshad2026vectorspacesbasis,
author = {Irshad, Muhammad Aashir},
title = {Vector Spaces, Span & Basis: Interactive Visual Guide},
howpublished = {SeeingML},
year = {2026},
month = {dec},
url = {https://seeingml.com/learn/vector-spaces-basis/},
note = {Interactive visual guide}
} Irshad, M. A. (2026). Vector Spaces, Span & Basis: Interactive Visual Guide. SeeingML. https://seeingml.com/learn/vector-spaces-basis/