SeeingML
Visual Math Toolkit Guide 2 of 6 · tap to switch
✦ Interactive Visual Guide 8 min · 4 hands-on labs · Beginner friendly

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!

Interactive Lab 1: Linear Combinations & Span (Reach Any Target Pin)
v = 1·b₁ + 1·b₂ = [1, 3]
Target Pin:
Pins hit: 0/3
xyb₁b₂Pin A [3, 4]Teal b₁ = [2, 1] (× 1)Green b₂ = [-1, 2] (× 1)Result: v = [1, 3]
a = 1
b = 1
Currently at [1, 3]. Follow the faint tilted lattice: any spot on the flat 2D map can be reached by dialing a and b (Try a = 2, b = 1 to land on Pin A [3, 4]). All reachable points together form their Span.

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!

Interactive Lab 2: Linear Independence vs. Redundant Arrows
1 Direction Only (Trapped on Rail)
xy[-3, 3] Unreachable!b₂b₁Teal b₁ = [2, 1]Green b₂ = [4, 2]Parallelogram Area = 0.0
Reading the shaded shape: Area > 0 means your two arrows span the whole flat sheet; Area = 0 means they collapsed onto one line!
a = 1
b = -1
Linearly Dependent (Redundant): Green arrow b₂ = 2·b₁ points along the exact same diagonal line as teal arrow b₁, adding zero fresh direction. No matter how you dial a and b, your cursor stays glued to the red track and can never reach [-3, 3]. This is why duplicate columns (like Distance_km and Distance_miles) confuse linear regression: infinitely many weight splits give identical answers. Your current mix lands at 1·b₁ + -1·b₂ = [-2.0, -1.0] (still stuck on the red 1D rail!).

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!

Interactive Lab 3: Change of Basis (Same Point, Smarter Rulers)
66% captured by Ruler 1
u₁u₂Fixed Point PStandard coords: [3.50, 2.50] (never moves)Rotated coords: [3.50, 2.50]Share captured by Ruler 1: 66% (Ruler 2: 34%)
Share captured by Ruler 1 (u₁): 66%Ruler 2 (u₂) leftover: 34%
0°
At 0° (standard horizontal and vertical rulers), both rulers share the job of describing Fixed Point P: [3.50, 2.50] puts 66% on Ruler 1 and 34% on Ruler 2, so neither ruler can be dropped yet. Drag the slider toward 35° (or click Tilted Cloud Rulers (35°)) while watching Point P stay frozen!

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:

  1. Duplicate units: Keeping both Size (m²) and Size (sq ft) grows your table by one column, yet Size (sq ft) is just 10.76 × Size (m²). Rank refuses to budge!
  2. The Dummy Variable Trap (All category switches + Baseline 1): To feed a category like pet type (Cat, Dog, or Bird) into a linear model, we turn each choice into a 0 or 1 yes/no switch column: Is_Cat, Is_Dog, and Is_Bird. Meanwhile, standard linear regression also includes a constant Baseline (1) column (the intercept) that holds 1 on every single row. Look at what happens when every row belongs to one of those three categories: Is_Cat + Is_Dog + Is_Bird = 1 on every single row! Because the three switches always add up to the constant 1 column, any one switch is already a hidden combination of the others (if Is_Cat = 0 and Is_Dog = 0, you already know Is_Bird must be 1). 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!

Interactive Lab 4: Matrix Rank in Spreadsheets & LoRA
Rank = 2 of 2: Clean!
House Dataset Preview (4 of 500 houses)Total Columns: 2 | True Info (Rank): 2
Row
House Size (m²)
Bedrooms
House A1002
House B1253
House C1503
House D2005
True Independent Info (Matrix Rank)Rank = 2 of 2 columns
House Size (m²): +1 Rank
Bedrooms: +1 Rank
Clean table (Rank 2 of 2)! House Size (m²) and Bedrooms bring two genuinely separate facts about each house. Click + Add Size in sq ft or + Add All 3 Pet Switches above to watch the column count grow while True Info (Rank) stalls!
See Formal Span, Linear Independence, Orthonormal Basis & Rank-NullityThesis / Reference

1. Span & Linear Independence: Given vectors {v1,…,vk}⊂Rn\{\mathbf{v}_1, \dots, \mathbf{v}_k\} \subset \mathbb{R}^n, their span is span⁡{v1,…,vk}={∑i=1kcivi:ci∈R}\operatorname{span}\{\mathbf{v}_1,\dots,\mathbf{v}_k\} = \left\{\sum_{i=1}^k c_i \mathbf{v}_i : c_i \in \mathbb{R}\right\}. They are linearly independent if and only if ∑i=1kcivi=0  ⟹  c1=⋯=ck=0\sum_{i=1}^k c_i \mathbf{v}_i = \mathbf{0} \implies c_1 = \dots = c_k = 0.

2. Orthonormal Change of Basis: If columns of Q∈Rd×d\mathbf{Q} \in \mathbb{R}^{d \times d} form an orthonormal basis (Q⊤Q=I\mathbf{Q}^\top \mathbf{Q} = \mathbf{I}), converting any point x\mathbf{x} into the new basis needs no matrix inversion, only a fast dot-product transpose:

z=Q⊤x,x=Qz\mathbf{z} = \mathbf{Q}^\top \mathbf{x}, \qquad \mathbf{x} = \mathbf{Q}\mathbf{z}

3. Rank-Nullity Theorem: For any feature matrix X∈Rn×p\mathbf{X} \in \mathbb{R}^{n \times p}, rank⁡(X)+nullity⁡(X)=p\operatorname{rank}(\mathbf{X}) + \operatorname{nullity}(\mathbf{X}) = p. Whenever rank⁡(X)<p\operatorname{rank}(\mathbf{X}) < p, X⊤X\mathbf{X}^\top \mathbf{X} has a zero eigenvalue and is singular (non-invertible).

See Matrix Rank & Orthonormal Basis (QR / Gram-Schmidt) in NumPyOptional Code
python
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.

✓ Self-Check

Quick Intuition Check

Four quick real-world scenarios. No scores, just test your intuition.

1

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?

Pick an option first, or peek anytime
2

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.

Pick an option first, or peek anytime
3

What is the geometric Span of two non-zero 2D vectors v1 = [2, 1] and v2 = [-4, -2]?

Pick an option first, or peek anytime
4

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?

Pick an option first, or peek anytime
Quick Reference

Common Questions

What is the Span of a set of vectors in plain English?
The Span of a set of vectors is every point in space you can reach by stretching, shrinking, flipping, and adding those vectors together (a*v1 + b*v2 + ...). Two non-parallel 2D vectors span the entire flat 2D plane; two parallel vectors only span a 1D line.
Why does linear dependence break Linear Regression?
When one feature column is an exact linear combination of others (such as keeping both kilometres and miles, or all one-hot categories plus an intercept), the feature matrix becomes rank-deficient and X^T X becomes singular (non-invertible), meaning infinitely many weight combinations give identical predictions.
What is a Basis of a vector space?
A Basis is a minimal set of linearly independent vectors that span the entire space. You need just enough arrows so every point can be written in one unique way, with zero redundant arrows.
How is Matrix Rank related to LoRA in modern LLMs?
Matrix Rank counts the true number of independent dimensions in a matrix. LoRA intentionally restricts huge weight updates (like 4096 x 4096) to a tiny rank-r product (e.g., r = 8 or 16), saving over 99% of trainable parameters while preserving adaptation quality.

Written & illustrated by Muhammad Aashir Irshad · Updated December 2026 · Free open-access reference

https://seeingml.com/learn/vector-spaces-basis/ Open GitHub issue Suggest an edit
Cite this guide in a paper, thesis, or course (BibTeX & APA)
BibTeX
@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}
}
APA

Irshad, M. A. (2026). Vector Spaces, Span & Basis: Interactive Visual Guide. SeeingML. https://seeingml.com/learn/vector-spaces-basis/