Vector Spaces and Subspaces#
A vector space is a set of objects (called vectors) together with two operations — addition and scalar multiplication — that stay inside and obey the usual algebraic rules from Week 1: addition is commutative and associative, there is a zero vector, every vector has an additive inverse, and scalars distribute and associate as expected. In this course the default space is , but the same language applies to matrices, polynomials, or functions once the operations are defined.
The practical test is closure: if and , then both and must still lie in . Combined with the presence of the zero vector, closure under addition and scalar multiplication is what makes a subset of a larger space into a vector space of its own.
A subspace is a vector space living inside a larger one. Formally, a nonempty subset is a subspace of when:
- ,
- implies ,
- and implies .
(The full list of vector-space axioms then holds automatically because they already hold in .)
Examples in and .
- Any line through the origin in is a subspace: if and both lie on that line, so do and . Algebraically it is for some nonzero .
- Any plane through the origin in is a subspace: it is for two non-parallel vectors in the plane.
- The set (only the zero vector) is a subspace — the trivial subspace.
- The whole space is a subspace of itself.
Non-examples.
- A line that does not pass through the origin fails: it does not contain , and the sum of two points on the line need not stay on the line when you treat them as vectors from the origin. (Affine lines are important in geometry, but they are not subspaces.)
- The unit circle in is not a subspace: the sum of two unit vectors is generally not a unit vector, and is not on the circle.
- The set of vectors with integer components is closed under addition but not under arbitrary real scalar multiplication (scale by ).
Span is always a subspace. For any vectors in a vector space ,
is a subspace of . It is the smallest subspace containing every : any subspace that contains the must contain all their linear combinations. Week 1 introduced span as “what these vectors generate”; here we recognize that the generated set is itself a vector space.
Linear Independence#
A set of vectors is linearly independent if the only linear combination that produces the zero vector is the trivial one:
If there exist coefficients, not all zero, that still sum to zero, the set is linearly dependent. Dependence means redundancy: at least one vector is a linear combination of the others. Independence means no vector in the set is wasted — each adds a genuinely new direction.
Matrix test. Form the matrix whose columns are :
The equation is exactly , where . By Week 3, the nullspace of is nontrivial precisely when elimination produces fewer than pivots — that is, when
So:
- (full column rank) the columns are independent,
- the columns are dependent.
If (more vectors than the ambient dimension of ), rank is at most , so the vectors are automatically dependent. You cannot fit more than independent directions in .
Worked example. Take
in . Form
Elimination: subtract times row 1 from row 2, and times row 1 from row 3:
Replace row 3 by :
There is a zero row and only two pivots, so . The three vectors are dependent. Explicitly, the free variable gives a nontrivial null vector; you can check that
so with coefficients not all zero. Any two of (or , or ) are independent and span the same plane.
Are v1=(1,2,1), v2=(2,1,0), v3=(0,3,2) linearly independent? Form the matrix with these as columns and compute its rank.
Basis and Dimension#
A basis of a vector space is a set of vectors that is both:
- Linearly independent, and
- Spanning — every vector in is a linear combination of the basis vectors.
Independence removes redundancy; spanning ensures coverage. Together they give a minimal generating set with no leftover directions.
Standard basis. The standard basis of is
These vectors are independent (the matrix they form is , rank ) and span (any equals ). So is a basis of .
Same number of vectors. A fundamental theorem of linear algebra says that every basis of a given space has the same number of vectors. That common number is the dimension of the space, written . In particular:
and if with the independent, then . More generally, the dimension of a span equals the rank of the matrix whose columns are the spanning vectors: drop dependent columns until you have a basis, and count what remains.
Finding a basis from a spanning set. Start with vectors that span (for example, the columns of a matrix). Run elimination and keep only the columns that produce pivots; those pivot columns form a basis of the column space. The number of pivots is both the rank and the dimension of that subspace.
Examples.
- A line through the origin in has dimension : any single nonzero vector on the line is a basis.
- A plane through the origin has dimension : two independent vectors in the plane form a basis.
- The three dependent vectors from the previous section span a -dimensional subspace of ; a basis is .
If a set has more vectors than , it cannot be independent. If it has fewer than , it cannot span . A basis hits the count exactly and satisfies both properties.
Coordinates Relative to a Basis#
Once a basis of is fixed, every vector can be written uniquely as
The scalars are the coordinates of relative to , often written . Uniqueness is exactly linear independence: if two coefficient lists produced the same , their difference would be a nontrivial combination equal to zero. Existence is exactly spanning.
In the standard basis of , the coordinates of a vector are just its usual components. In a different basis, the same geometric vector has different numbers attached to it — the change-of-basis story that returns when you study similarity and diagonalization later in the course.
Worked example. Let
in . These are independent (neither is a scalar multiple of the other) and there are two of them in a -dimensional space, so is a basis of . For , solve :
Adding the two equations: , so . Subtracting: , so . Thus
meaning (as in the Week 1 span example). In the standard basis the same vector is simply . The vector did not change — only the labels relative to the chosen basis did.
Why bases matter. Coordinates turn abstract linear algebra into numerical linear algebra: matrices store the action of a linear map on a basis, and changing basis changes the matrix without changing the map. Week 6 will use independence and dimension to classify the four fundamental subspaces of a matrix (column space, nullspace, row space, left nullspace) and relate their dimensions by the rank–nullity theorem.
Knowledge check#
A basis for a vector space must be:
Browser lab#
Test three vectors for independence using numpy.linalg.matrix_rank.
import numpy as np
v1 = np.array([1, 2, 1])
v2 = np.array([2, 1, 0])
v3 = np.array([0, 3, 2])
M = np.column_stack([v1, v2, v3])
rank = np.linalg.matrix_rank(M)
print("M =\n", M)
print("rank(M) =", rank)
print("Independent:", rank == M.shape[1])