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 a1โx+a2โx2.
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=[12โ24โ]>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=[12โ01โโ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)=โฉโจโงโzโ1โ21โโโญโฌโซโ>x=z, y=โ2z, z free.
>A=[12โ24โ]>. 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