Subspaces: Definition, Testing & Examples
2156 words
11 min read
Visual companion
Python
Type and operator map
Python Week 1: the first filter for runtime behavior
View
Revision summary
What this note is really saying
Short form
# Subspaces: Definition, Testing & Examples ## 🎯 Learning Objectives After this topic you will be able to: - State the subspace test (closed under $+$, closed under $\cdot$, contains $\mathbf{0}$) - Determine whether a given subset of a vector space is a subspace - Visualise subspaces of $\mathbb{R}^2$ and $\mathbb...

Subspaces: Definition, Testing & Examples
🎯 Learning Objectives
After this topic you will be able to:
- State the subspace test (closed under +, closed under ⋅, contains 0)
- Determine whether a given subset of a vector space is a subspace
- Visualise subspaces of R2 and R3 as lines, planes, and points through the origin
- Describe the column space, null space, and row space of a matrix
- Prove that the intersection of two subspaces is a subspace
📋 Prerequisites
- Vector Spaces Definition (this week) — you need to know the axioms
- Subspaces are vector spaces that live inside bigger vector spaces
1. Intuition: A Smaller Room Inside the House
A vector space is like a house. A subspace is a room inside that house — a subset that is itself a complete vector space.
For a subset W of a vector space V to be a subspace, it must:
- Contain the zero vector — the room must have a floor
- Be closed under addition — adding two things in the room keeps you in the room
- Be closed under scalar multiplication — stretching/shrinking something in the room keeps you in the room (Diagram) In R3, subspaces are:
- The origin {0} (dimension 0)
- Lines through the origin (dimension 1)
- Planes through the origin (dimension 2)
- The whole space R3 (dimension 3) Crucially: Subspaces must contain the origin. If it doesn't pass through the origin, it's not a subspace.
2. The Subspace Test
Theorem (Subspace Test). A non-empty subset W of a vector space V is a subspace of V if and only if:
- Zero vector: 0∈W
- Closure under addition: For all u,v∈W, u+v∈W
- Closure under scalar multiplication: For all v∈W and c∈R, cv∈W If these three hold, the other seven axioms are automatically inherited from V. Why only three checks? Because W inherits commutativity, associativity, etc. from V. The only things that could go wrong are: (a) W lacks a zero vector, (b) adding two elements of W leaves W, or (c) scaling an element of W leaves W.
2.1 Streamlined Test
Often we combine conditions 2 and 3 into one check:
One-step test: W is a subspace iff 0∈W and for all u,v∈W, c∈R, we have u+cv∈W.
3. Examples of Subspaces
3.1 Lines Through the Origin in R2
Example 1: W={(x,y)∈R2∣y=2x} Check:
- 0=(0,0): 0=2(0) ✓
- Closure under addition: Let (x1,2x1), (x2,2x2)∈W. Sum = (x1+x2,2x1+2x2)=(x1+x2,2(x1+x2)) — still satisfies y=2x ✓
- Closure under scalar multiplication: c(x,2x)=(cx,2cx) — still satisfies y=2x ✓ So W is a 1-dimensional subspace of R2.
3.2 Planes Through the Origin in R3
Example 2: W={(x,y,z)∈R3∣x+y−z=0} Check:
- 0=(0,0,0): 0+0−0=0 ✓
- Closure under addition: Let (x1,y1,z1), (x2,y2,z2)∈W. Then x1+y1−z1=0, x2+y2−z2=0. Sum = (x1+x2,y1+y2,z1+z2). Check: (x1+x2)+(y1+y2)−(z1+z2)=(x1+y1−z1)+(x2+y2−z2)=0+0=0 ✓
- Closure under scalar multiplication: c(x,y,z)=(cx,cy,cz). Check: cx+cy−cz=c(x+y−z)=c⋅0=0 ✓ So W is a 2-dimensional subspace of R3.
3.3 Polynomial Subspaces
Example 3: W={p(x)∈P2∣p(0)=0} (polynomials of degree ≤2 with zero constant term) Check:
- Zero polynomial: p(x)=0 satisfies p(0)=0 ✓
- Closure under addition: If p(0)=0 and q(0)=0, then (p+q)(0)=p(0)+q(0)=0+0=0 ✓
- Closure under scalar multiplication: (cp)(0)=c⋅p(0)=c⋅0=0 ✓ So W is a subspace of P2. It consists of polynomials like a1x+a2x2.
4. Non-Examples
4.1 Line Not Through the Origin
W={(x,y)∈R2∣y=2x+1} Fails zero vector: (0,0) gives 0=1, so 0∈/W. Not a subspace. Also fails closure under addition: (x1,2x1+1)+(x2,2x2+1)=(x1+x2,2(x1+x2)+2). The sum has y=2x+2, not 2x+1.
4.2 First Quadrant
W={(x,y)∈R2∣x≥0,y≥0} Contains 0 ✓, closed under addition ✓, but fails scalar multiplication: (−1)(1,1)=(−1,−1)∈/W. Not a subspace.
5. Important Subspaces Associated with a Matrix
5.1 Null Space (Kernel)
>N(A)={x∈Rn∣Ax=0}>Definition (Null Space). For an m×n matrix A, the null space is:
N(A) is a subspace of Rn.
Proof of subspace:
- 0∈N(A) because A0=0 ✓
- If Ax=0 and Ay=0, then A(x+y)=Ax+Ay=0+0=0 ✓
- If Ax=0, then A(cx)=cAx=c⋅0=0 ✓
5.2 Column Space (Range)
>C(A)={y∈Rm∣y=Ax for some x∈Rn}>Definition (Column Space). For an m×n matrix A, the column space is:
C(A) is a subspace of Rm. It is the span of the columns of A.
5.3 Row Space
>A=[1224]>Definition (Row Space). The row space of A is the span of its rows (as vectors in Rn). It equals C(AT). Example 4: Null space and column space
>N(A)={y[−21]y∈R}>Null space: Solve Ax=0: x+2y=0, 2x+4y=0. Solutions: x=−2y, y free.
— a line through origin.Column space: Columns are (1,2) and (2,4). The second is a scalar multiple of the first, so C(A)=span{(1,2)} — also a line through origin.
6. Subspace Operations
6.1 Intersection of Subspaces
Theorem. If W1 and W2 are subspaces of V, then W1∩W2 is also a subspace of V. Proof: 0∈W1 and 0∈W2, so 0∈W1∩W2. If u,v∈W1∩W2, then u+v∈W1 and u+v∈W2, so u+v∈W1∩W2. Similarly for scalar multiplication.
6.2 Sum of Subspaces
Definition (Sum). W1+W2={w1+w2∣w1∈W1,w2∈W2}. The sum of two subspaces is also a subspace. Example 5: Intersection and sumIn R3, let W1={(x,y,0)} (the xy-plane) and W2={(0,y,z)} (the yz-plane).W1∩W2={(0,y,0)} — the y-axis (a line). W1+W2=R3 (every vector can be written as sum of something in xy-plane and something in yz-plane).
7. Edge Cases & Gotchas
| Situation | What Happens |
|---|---|
| ** W={0} ** | The trivial subspace — always a subspace |
| ** W=V ** | The whole space is a subspace (of itself) |
| Union of subspaces | W1∪W2 is generally not a subspace (except if one contains the other) |
| Affine subspaces (lines/planes not through origin) | Not subspaces — they are "translates" of subspaces (Week 7) |
8. Common Pitfalls
❌ Pitfall 1: Checking only closure
Students forget to check 0∈W. Without it, W could be non-empty but still not a subspace (e.g., a line not through the origin).
❌ Pitfall 2: Assuming any subset of Rn is a subspace
Only subsets satisfying all three conditions are subspaces. Most subsets fail at least one.
❌ Pitfall 3: Confusing null space and column space
N(A) is in Rn (domain), C(A) is in Rm (codomain). They live in different spaces.
9. Formula Summary Table
| Concept | Description | Check |
|---|---|---|
| Subspace | Subset that is itself a vector space | 0∈W , closed under + and ⋅ |
| Null space | N(A)={x∣Ax=0} | Subspace of Rn |
| Column space | C(A)={Ax∣x∈Rn} | Subspace of Rm |
| Intersection | W1∩W2 | Always a subspace |
| Sum | W1+W2 | Always a subspace |
| Union | W1∪W2 | Usually not a subspace |
10. 📝 Practice Questions
>A=[1201−10]>Q1: Subspace test — line through originIs W={(x,y)∈R2∣x=−2y} a subspace?Solution: Yes.
- 0=(0,0): 0=−2(0) ✓
- Addition: (x1,−2x1)+(x2,−2x2)=(x1+x2,−2x1+x2) ✓
- Scalar: c(x,−2x)=(cx,−2cx) ✓ Q2: Subspace test — plane in ℝ³
Is W={(x,y,z)∈R3∣2x−y+3z=0} a subspace?Solution: Yes (plane through origin).
- 0: 2(0)−0+3(0)=0 ✓
- Addition: (x1+x2,y1+y2,z1+z2). Check: 2(x1+x2)−(y1+y2)+3(z1+z2)=(2x1−y1+3z1)+(2x2−y2+3z2)=0+0=0 ✓
- Scalar: c(x,y,z). Check: 2(cx)−cy+3(cz)=c(2x−y+3z)=c⋅0=0 ✓ Q3: Not a subspace — line not through origin
Is W={(x,y)∈R2∣y=3x−1} a subspace?Solution: No. (0,0)∈/W because 0=−1. Fails the zero vector condition. Q4: Not a subspace — discrete setIs W={(x,y)∈R2∣x2=y2} a subspace?Solution: No. (1,1)∈W and (1,−1)∈W, but (1,1)+(1,−1)=(2,0). Check: 22=02, so (2,0)∈/W. Fails closure under addition. Q5: Polynomial subspaceIs W={p(x)∈P2∣p′(0)=0} a subspace of P2?Solution: Yes.
- Zero polynomial p(x)=0 has p′(0)=0 ✓
- If p′(0)=0 and q′(0)=0, then (p+q)′(0)=p′(0)+q′(0)=0+0=0 ✓
- (cp)′(0)=cp′(0)=c⋅0=0 ✓ Q6: Null space
Find a basis for N(A) where
>{x−z=02x+y=0⇒x=z,y=−2x=−2z>.Solution: Solve Ax=0:
>N(A)=⎩⎨⎧z1−21⎭⎬⎫>x=z, y=−2z, z free.
>A=[1224]>. Basis: {(1,−2,1)}. Q7: Column spaceFind a basis for C(A) where
.Solution: Columns are (1,2) and (2,4). Since column 2 = 2(column 1), they are linearly dependent. A basis for C(A) is {(1,2)}. Q8: Intersection of subspacesIn R3, W1={(x,y,z)∣x+y=0}, W2={(x,y,z)∣y−z=0}. Find W1∩W2.Solution: x+y=0 and y−z=0 ⇒ x=−y, z=y. W1∩W2={(−y,y,y)∣y∈R}=span{(−1,1,1)}, a line. Q9: Union is not a subspaceShow that W1∪W2 is not a subspace where W1={(x,0)} and W2={(0,y)} in R2.Solution: (1,0)∈W1∪W2, (0,1)∈W1∪W2, but (1,0)+(0,1)=(1,1)∈/W1 and (1,1)∈/W2, so (1,1)∈/W1∪W2. Fails closure under addition. Q10: Sum of subspacesIf W1={(x,y,0)} and W2={(0,0,z)} in R3, show that W1+W2=R3.Solution: Any (a,b,c)∈R3 can be written as (a,b,0)+(0,0,c) where (a,b,0)∈W1 and (0,0,c)∈W2. So W1+W2=R3.
🔗 Cross-References
- Next topic: Linear Independence
- Week 5 (Rank-Nullity): Relates dimensions of N(A) and C(A)
- Week 6 (Kernel & Image): Generalises null space and column space to linear transformations
- Week 7 (Affine Subspaces): Subspaces translated away from origin
- BSCS2004 (ML Foundations): Feature spaces, solution spaces in regression Join Discord Previous3.1 Vector Spaces DefinitionNext3.3 Linear Independence