← SciSim / Mathematics

Vector Spaces, Span, Basis & Dimension

Subspaces, linear independence, basis and dimension -- with 2D span and parallelogram area visualization.
🎓 Tier: Standard Undergraduate -- Linear Algebra

📊 Section 1 — Interactive Simulation

dim(span)
--
det(V)
--
LI?
--
|v1|
--
|v2|
--
cos theta
--

Controls

Vectors

Display

💡 Section 2 -- The Idea, Step by Step

Imagine giving directions on a flat map using only two moves: "go east" and "go north." By taking some amount of each, you can reach any spot on the map. That whole collection of reachable spots is what mathematicians call a span; the moves are vectors (arrows that say "go this far, this way"); and the entire playground of arrows you are allowed to add and stretch is a vector space.

Start -- the everyday picture

A vector is just an arrow. You are allowed to do two things with arrows: add them tip-to-tail, and scale them (make them longer, shorter, or flip them around). If your two arrows point in genuinely different directions, mixing them lets you reach every point on the plane. But if they point the same way -- one arrow is just a stretched copy of the other -- then no matter how you combine them you can only ever slide back and forth along a single line.

Build -- naming the pieces

Call the arrows $\mathbf{v}_1$ and $\mathbf{v}_2$, and call the scaling numbers $c_1$ and $c_2$. A linear combination is $c_1\mathbf{v}_1+c_2\mathbf{v}_2$, and the span is the set of all of them. Try $\mathbf{v}_1=(2,0)$ and $\mathbf{v}_2=(0,3)$: the combination $1\cdot\mathbf{v}_1+1\cdot\mathbf{v}_2=(2,3)$, and because the arrows point in different directions you can land on any point in the plane, so they span $\mathbb{R}^2$. The parallelogram they make has area $|\det|=|2\cdot3-0\cdot0|=6$, and that nonzero area is the signal that the two arrows are genuinely different.

Deepen -- the precise statement

Vectors are linearly independent when $c_1\mathbf{v}_1+c_2\mathbf{v}_2=\mathbf{0}$ forces $c_1=c_2=0$: the only way to combine them and get nowhere is to not move at all. A basis is a set that is both independent and spanning -- the smallest collection of arrows that still reaches everything. The number of arrows in a basis is the dimension ($\dim\mathbb{R}^2=2$). For two arrows in the plane, $|\det[\,\mathbf{v}_1\ \mathbf{v}_2\,]|$ equals the parallelogram's area and is zero exactly when the arrows are dependent. In the sim, the angle sliders set each arrow's direction and the length sliders set $|\mathbf{v}_1|$ and $|\mathbf{v}_2|$; watch $\det$ slide toward $0$ as the two angles close in on each other.

Try this in the sim above

Set both angle sliders equal (or to 0° and 180°): $\det\to0$, the dim(span) readout drops to 1, and the blue fill collapses to a line. Then switch the preset to "Rotated 45 deg" -- the arrows are independent again, the area returns, and the dimension climbs back to 2. Finally, shrink $|\mathbf{v}_2|$ to its minimum: the area gets small but stays nonzero, proving that shortening an arrow never destroys independence -- only matching directions does.

📐 Section 3 -- Vector Spaces, Basis & Dimension

Key Theorems

Dimension Theorem: All bases of a finite-dimensional vector space have the same number of elements (the dimension).

Rank-Nullity: For $T:V\to W$: $\dim V=\text{nullity}(T)+\text{rank}(T)$.

ConceptDefinitionExample in $\mathbb{R}^2$
SubspaceClosed under $+$ and scalar mult.; contains $\mathbf{0}$Lines through origin
SpanAll linear combinations of a set$\text{span}\{(1,0),(0,1)\}=\mathbb{R}^2$
Lin. indep.$c_1\mathbf{v}_1+c_2\mathbf{v}_2=\mathbf{0}\Rightarrow c_i=0$$(1,0),(0,1)$ are LI
BasisLI spanning set$\{(1,0),(0,1)\}$
DimensionSize of any basis$\dim\mathbb{R}^2=2$
Step 1 -- Dimension is Well-Defined

Any two bases $B_1,B_2$ of $V$ have $|B_1|=|B_2|$. Proof: $B_2$ spans, so $B_1$ has no more elements than $B_2$ (by the Steinitz exchange lemma). By symmetry $|B_1|=|B_2|$.

Step 2 -- Rank-Nullity Theorem

$T:V\to W$ linear, $\dim V=n$. Then $n=\text{nullity}(T)+\text{rank}(T)$. The null space (kernel) and image (column space) together account for all dimensions of $V$.

Step 3 -- Worked Example: Null space of $A=\begin{pmatrix}1&2\\2&4\end{pmatrix}$

$\ker A$: solve $x+2y=0\Rightarrow x=-2y$. Basis: $\{(-2,1)\}$, dim 1. Rank $=2-1=1$. Column space: $\text{span}\{(1,2)\}$. Rank-nullity: $2=1+1$ ✓.

Step 4 -- Parallelogram Area = |det|

The area of the parallelogram spanned by $\mathbf{v}_1,\mathbf{v}_2\in\mathbb{R}^2$ equals $|\det[\mathbf{v}_1|\mathbf{v}_2]|$. Zero area $\iff$ dependent vectors. The simulation shows this live.

Step 5 -- Testing Linear Independence

Row reduce $[\mathbf{v}_1|\mathbf{v}_2|\cdots]$ and count pivots. Number of pivots $=$ rank $=\dim(\text{span})$. If rank $<$ number of vectors, they are dependent.

Step 6 -- Polynomial Vector Space

$\mathcal{P}_n$ = polynomials of degree $\leq n$ is a vector space of dimension $n+1$. Basis: $\{1,x,x^2,\ldots,x^n\}$. The space of continuous functions $C[a,b]$ is infinite-dimensional (no finite basis).

Reference: Strang -- Introduction to Linear Algebra, 5th ed., Ch. 3; Axler -- Linear Algebra Done Right, 3rd ed., Ch. 2; MIT OCW 18.06.

❓ Section 4 -- FAQ

🧮Conceptual  Is the set of invertible matrices a subspace?

No. The zero matrix is not invertible, so the set does not contain the zero vector (violating axiom 1). Also, $I+(-I)=0$ is not invertible -- not closed under addition. The invertible matrices form a group under multiplication, not a vector space.

Key takeaway: Invertible matrices do NOT form a subspace; zero matrix and closure under addition both fail.
🔬Simulation  What does the span visualization show?

The parallelogram with edges along $\mathbf{v}_1$ and $\mathbf{v}_2$ represents their span. When vectors are independent, it fills a 2D region. When dependent (parallel), it collapses to a line. The |det| equals the parallelogram area -- zero iff dependent.

Key takeaway: LI vectors span a 2D region; dependent vectors span only a line. |det| = area of parallelogram.
🌍Applied  Where do vector spaces appear in practice?

Signal processing: signals are in $L^2$ (infinite-dimensional); Fourier modes are a basis. ML: word embeddings are vectors in $\mathbb{R}^{300}$; PCA finds a lower-dimensional subspace. Quantum mechanics: state space is a Hilbert space. Computer graphics: homogeneous coordinates for 3D transformations.

Key takeaway: Fourier analysis, word embeddings, quantum states, PCA -- all linear algebra in abstract vector spaces.
💡Non-Obvious  Can a subspace have more than one basis?

Yes -- infinitely many. $\{(1,0),(0,1)\}$ and $\{(1,1),(1,-1)\}$ are both bases for $\mathbb{R}^2$. All have the same size (dimension). Orthonormal bases are preferred for numerical stability. Any $n$ linearly independent vectors in an $n$-dimensional space form a basis.

Key takeaway: Infinitely many bases exist for any space; all have the same cardinality (dimension).
📐Computational  Test if $\{(1,2,1),(0,1,1),(1,3,2)\}$ is a basis for $\mathbb{R}^3$.

Row reduce the matrix with these as rows. Last row becomes zero -- rank 2, not 3. The third vector $= v_1+v_2$ (dependent). These three vectors span only a 2D subspace of $\mathbb{R}^3$. NOT a basis.

Key takeaway: Row reduce to count pivots = rank = dim(span). Three vectors with rank 2 are dependent.
🎓Deep  What is a Hamel basis of $\mathbb{R}$ over $\mathbb{Q}$?

$\mathbb{R}$ viewed as a $\mathbb{Q}$-vector space has an uncountable Hamel basis -- every real number is a finite $\mathbb{Q}$-linear combination of basis elements. Its existence requires the Axiom of Choice and cannot be explicitly constructed. It enables pathological solutions to the Cauchy functional equation $f(x+y)=f(x)+f(y)$ that are not $f(x)=cx$.

Key takeaway: Hamel basis of $\mathbb{R}$ over $\mathbb{Q}$: uncountable, requires Axiom of Choice, enables pathological functions.
Best resources: 3Blue1Brown -- Essence of Linear Algebra; MIT OCW 18.06; Strang -- Introduction to Linear Algebra.

⚠️ Section 5 -- Misconceptions & Common Errors

A · Conceptual Misconceptions
❌ Misconception: Every set of n vectors in R^n forms a basis. ✅ Correction: Need linear independence AND spanning. (1,2),(2,4) in R^2 are dependent -- span only a line. 🔍 Students count vectors without checking independence. 📖 Strang §3.4.
❌ Misconception: The zero vector can be in a basis. ✅ Correction: Any set containing 0 is dependent: c*0=0 for any c != 0. Zero vector can never be in a basis. 🔍 Students forget that 0 makes every set linearly dependent. 📖 Axler §2.A.
❌ Misconception: A subspace of R^n can have dimension > n. ✅ Correction: Any subspace has dimension at most n. n+1 vectors in R^n are always dependent. 🔍 Students confuse the subspace dimension bound with infinite-dimensional spaces. 📖 Strang §3.5.
B · Common Procedural Errors
❌ Error: Testing LI of 3 vectors by pairwise comparison. ✅ Correct: Row reduce [v1|v2|v3]. Count pivots. Need ALL columns to have pivots for independence. 🔍 Pairwise comparison only works for pairs, not for 3+ vectors. 📖 Strang §3.3.
❌ Error: Claiming dim(span{v1,v2,v3})=3 because there are 3 vectors. ✅ Correct: Dimension = rank of [v1|v2|v3]. Must row-reduce to count pivots, not just count vectors. 🔍 Students equate number of vectors with dimension of their span. 📖 Strang §3.4.
❌ Error: Subspace check -- verifying closure under addition but not under scalar multiplication. ✅ Correct: Three conditions: (1) 0 in S, (2) closed under +, (3) closed under scalar mult. All three required. 🔍 Students check only one or two of the three subspace axioms. 📖 Axler §1.C.
Education research: Dorier, J.-L. -- On the Teaching of Linear Algebra, Springer (2000).