Skip to main content
© 2026 ePowerAI. All rights reserved.
CoursesContact
eAI
CoursesContact
Week 5: Vector Spaces, Independence, and Basis
Linear Algebra
01Week 1: Vectors and Linear Combinations
02Week 2: Linear Transformations and Matrices
03Week 3: Elimination and LU Factorization
04Week 4: Determinants
05Week 5: Vector Spaces, Independence, and Basis
06Week 6: The Four Fundamental Subspaces
07Week 7: Orthogonality and Projections
08Week 8: Least Squares and QR
09Week 9: Eigenvalues and Eigenvectors
10Week 10: Diagonalization and Markov Matrices
11Week 11: Differential Equations
12Week 12: Symmetric and Positive Definite Matrices
13Week 13: The SVD and Complex Matrices
14Week 14: The Fourier Matrix, FFT, and PCA
Week 05· Linear Algebra18 min read

Week 5: Vector Spaces, Independence, and Basis

✦Learning Outcomes
  • Verify whether a set is a vector space or subspace
  • Test vectors for linear independence
  • Find a basis and compute the dimension of a vector space
  • Explain the relationship between a basis and coordinate representation
◆Prerequisites

Background knowledge assumed:

  • Linear combinations
  • Gaussian elimination and rank

Recommended: Review Week 1: Vectors and Linear Combinations and Week 3: Elimination and LU Factorization before starting.

Vector Spaces and Subspaces#

A vector space is a set VVV of objects (called vectors) together with two operations — addition and scalar multiplication — that stay inside VVV 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 Rn\mathbb{R}^nRn, but the same language applies to matrices, polynomials, or functions once the operations are defined.

The practical test is closure: if u,v∈Vu, v \in Vu,v∈V and c∈Rc \in \mathbb{R}c∈R, then both u+vu + vu+v and cucucu must still lie in VVV. 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 W⊆VW \subseteq VW⊆V is a subspace of VVV when:

  1. 0∈W0 \in W0∈W,
  2. u,v∈Wu, v \in Wu,v∈W implies u+v∈Wu + v \in Wu+v∈W,
  3. u∈Wu \in Wu∈W and c∈Rc \in \mathbb{R}c∈R implies cu∈Wcu \in Wcu∈W.

(The full list of vector-space axioms then holds automatically because they already hold in VVV.)

Examples in R2\mathbb{R}^2R2 and R3\mathbb{R}^3R3.

  • Any line through the origin in R2\mathbb{R}^2R2 is a subspace: if vvv and www both lie on that line, so do v+wv + wv+w and cvcvcv. Algebraically it is span⁡{v}\operatorname{span}\{v\}span{v} for some nonzero vvv.
  • Any plane through the origin in R3\mathbb{R}^3R3 is a subspace: it is span⁡{v1,v2}\operatorname{span}\{v_1, v_2\}span{v1​,v2​} for two non-parallel vectors in the plane.
  • The set {0}\{0\}{0} (only the zero vector) is a subspace — the trivial subspace.
  • The whole space Rn\mathbb{R}^nRn is a subspace of itself.

Non-examples.

  • A line that does not pass through the origin fails: it does not contain 000, 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 x2+y2=1x^2 + y^2 = 1x2+y2=1 in R2\mathbb{R}^2R2 is not a subspace: the sum of two unit vectors is generally not a unit vector, and 000 is not on the circle.
  • The set of vectors with integer components is closed under addition but not under arbitrary real scalar multiplication (scale (1,0)(1,0)(1,0) by 12\frac{1}{2}21​).

Span is always a subspace. For any vectors v1,…,vkv_1, \ldots, v_kv1​,…,vk​ in a vector space VVV,

span⁡{v1,…,vk}={c1v1+⋯+ckvk:ci∈R}\operatorname{span}\{v_1, \ldots, v_k\} = \{ c_1 v_1 + \cdots + c_k v_k : c_i \in \mathbb{R} \}span{v1​,…,vk​}={c1​v1​+⋯+ck​vk​:ci​∈R}

is a subspace of VVV. It is the smallest subspace containing every viv_ivi​: any subspace that contains the viv_ivi​ 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 v1,…,vkv_1, \ldots, v_kv1​,…,vk​ is linearly independent if the only linear combination that produces the zero vector is the trivial one:

c1v1+c2v2+⋯+ckvk=0⟹c1=c2=⋯=ck=0.c_1 v_1 + c_2 v_2 + \cdots + c_k v_k = 0 \quad\Longrightarrow\quad c_1 = c_2 = \cdots = c_k = 0.c1​v1​+c2​v2​+⋯+ck​vk​=0⟹c1​=c2​=⋯=ck​=0.

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 MMM whose columns are v1,…,vkv_1, \ldots, v_kv1​,…,vk​:

M=[v1v2⋯vk].M = \begin{bmatrix} v_1 & v_2 & \cdots & v_k \end{bmatrix}.M=[v1​​v2​​⋯​vk​​].

The equation c1v1+⋯+ckvk=0c_1 v_1 + \cdots + c_k v_k = 0c1​v1​+⋯+ck​vk​=0 is exactly Mc=0M c = 0Mc=0, where c=(c1,…,ck)⊤c = (c_1, \ldots, c_k)^\topc=(c1​,…,ck​)⊤. By Week 3, the nullspace of MMM is nontrivial precisely when elimination produces fewer than kkk pivots — that is, when

rank⁡(M)<k.\operatorname{rank}(M) < k.rank(M)<k.

So:

  • rank⁡(M)=k\operatorname{rank}(M) = krank(M)=k (full column rank)   ⟺  \iff⟺ the columns are independent,
  • rank⁡(M)<k\operatorname{rank}(M) < krank(M)<k   ⟺  \iff⟺ the columns are dependent.

If k>nk > nk>n (more vectors than the ambient dimension of Rn\mathbb{R}^nRn), rank is at most nnn, so the vectors are automatically dependent. You cannot fit more than nnn independent directions in Rn\mathbb{R}^nRn.

Worked example. Take

v1=(121),v2=(210),v3=(032)v_1 = \begin{pmatrix} 1 \\ 2 \\ 1 \end{pmatrix}, \quad v_2 = \begin{pmatrix} 2 \\ 1 \\ 0 \end{pmatrix}, \quad v_3 = \begin{pmatrix} 0 \\ 3 \\ 2 \end{pmatrix}v1​=​121​​,v2​=​210​​,v3​=​032​​

in R3\mathbb{R}^3R3. Form

M=(120213102).M = \begin{pmatrix} 1 & 2 & 0 \\ 2 & 1 & 3 \\ 1 & 0 & 2 \end{pmatrix}.M=​121​210​032​​.

Elimination: subtract 222 times row 1 from row 2, and 111 times row 1 from row 3:

(1200−330−22).\begin{pmatrix} 1 & 2 & 0 \\ 0 & -3 & 3 \\ 0 & -2 & 2 \end{pmatrix}.​100​2−3−2​032​​.

Replace row 3 by row3−23 row2\text{row}_3 - \frac{2}{3}\,\text{row}_2row3​−32​row2​:

(1200−33000).\begin{pmatrix} 1 & 2 & 0 \\ 0 & -3 & 3 \\ 0 & 0 & 0 \end{pmatrix}.​100​2−30​030​​.

There is a zero row and only two pivots, so rank⁡(M)=2<3\operatorname{rank}(M) = 2 < 3rank(M)=2<3. The three vectors are dependent. Explicitly, the free variable c3c_3c3​ gives a nontrivial null vector; you can check that

v3=2v1−v2,v_3 = 2 v_1 - v_2,v3​=2v1​−v2​,

so 2v1−v2−v3=02v_1 - v_2 - v_3 = 02v1​−v2​−v3​=0 with coefficients not all zero. Any two of {v1,v2}\{v_1, v_2\}{v1​,v2​} (or {v1,v3}\{v_1, v_3\}{v1​,v3​}, or {v2,v3}\{v_2, v_3\}{v2​,v3​}) are independent and span the same plane.

Exercise · Fill in the blank

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 VVV is a set of vectors that is both:

  1. Linearly independent, and
  2. Spanning — every vector in VVV 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 Rn\mathbb{R}^nRn is

e1=(10⋮0),e2=(01⋮0),…,en=(00⋮1).e_1 = \begin{pmatrix} 1 \\ 0 \\ \vdots \\ 0 \end{pmatrix}, \quad e_2 = \begin{pmatrix} 0 \\ 1 \\ \vdots \\ 0 \end{pmatrix}, \quad \ldots, \quad e_n = \begin{pmatrix} 0 \\ 0 \\ \vdots \\ 1 \end{pmatrix}.e1​=​10⋮0​​,e2​=​01⋮0​​,…,en​=​00⋮1​​.

These nnn vectors are independent (the matrix they form is III, rank nnn) and span Rn\mathbb{R}^nRn (any x=(x1,…,xn)⊤x = (x_1, \ldots, x_n)^\topx=(x1​,…,xn​)⊤ equals x1e1+⋯+xnenx_1 e_1 + \cdots + x_n e_nx1​e1​+⋯+xn​en​). So {e1,…,en}\{e_1, \ldots, e_n\}{e1​,…,en​} is a basis of Rn\mathbb{R}^nRn.

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 dim⁡(V)\dim(V)dim(V). In particular:

dim⁡(Rn)=n,\dim(\mathbb{R}^n) = n,dim(Rn)=n,

and if W=span⁡{v1,…,vk}W = \operatorname{span}\{v_1, \ldots, v_k\}W=span{v1​,…,vk​} with the viv_ivi​ independent, then dim⁡(W)=k\dim(W) = kdim(W)=k. 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 VVV (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 R3\mathbb{R}^3R3 has dimension 111: any single nonzero vector on the line is a basis.
  • A plane through the origin has dimension 222: two independent vectors in the plane form a basis.
  • The three dependent vectors v1,v2,v3v_1, v_2, v_3v1​,v2​,v3​ from the previous section span a 222-dimensional subspace of R3\mathbb{R}^3R3; a basis is {v1,v2}\{v_1, v_2\}{v1​,v2​}.

If a set has more vectors than dim⁡(V)\dim(V)dim(V), it cannot be independent. If it has fewer than dim⁡(V)\dim(V)dim(V), it cannot span VVV. A basis hits the count exactly and satisfies both properties.


Coordinates Relative to a Basis#

Once a basis B={b1,…,bn}B = \{b_1, \ldots, b_n\}B={b1​,…,bn​} of VVV is fixed, every vector v∈Vv \in Vv∈V can be written uniquely as

v=c1b1+c2b2+⋯+cnbn.v = c_1 b_1 + c_2 b_2 + \cdots + c_n b_n.v=c1​b1​+c2​b2​+⋯+cn​bn​.

The scalars (c1,…,cn)(c_1, \ldots, c_n)(c1​,…,cn​) are the coordinates of vvv relative to BBB, often written [v]B[v]_B[v]B​. Uniqueness is exactly linear independence: if two coefficient lists produced the same vvv, their difference would be a nontrivial combination equal to zero. Existence is exactly spanning.

In the standard basis of Rn\mathbb{R}^nRn, 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

b1=(11),b2=(1−1)b_1 = \begin{pmatrix} 1 \\ 1 \end{pmatrix}, \quad b_2 = \begin{pmatrix} 1 \\ -1 \end{pmatrix}b1​=(11​),b2​=(1−1​)

in R2\mathbb{R}^2R2. These are independent (neither is a scalar multiple of the other) and there are two of them in a 222-dimensional space, so B={b1,b2}B = \{b_1, b_2\}B={b1​,b2​} is a basis of R2\mathbb{R}^2R2. For v=(42)v = \begin{pmatrix} 4 \\ 2 \end{pmatrix}v=(42​), solve c1b1+c2b2=vc_1 b_1 + c_2 b_2 = vc1​b1​+c2​b2​=v:

(111−1)(c1c2)=(42).\begin{pmatrix} 1 & 1 \\ 1 & -1 \end{pmatrix} \begin{pmatrix} c_1 \\ c_2 \end{pmatrix} = \begin{pmatrix} 4 \\ 2 \end{pmatrix}.(11​1−1​)(c1​c2​​)=(42​).

Adding the two equations: 2c1=62c_1 = 62c1​=6, so c1=3c_1 = 3c1​=3. Subtracting: 2c2=22c_2 = 22c2​=2, so c2=1c_2 = 1c2​=1. Thus

[v]B=(31),[v]_B = \begin{pmatrix} 3 \\ 1 \end{pmatrix},[v]B​=(31​),

meaning v=3b1+1⋅b2v = 3b_1 + 1\cdot b_2v=3b1​+1⋅b2​ (as in the Week 1 span example). In the standard basis the same vector is simply (4,2)⊤(4, 2)^\top(4,2)⊤. 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#

Question 1 of 3

A basis for a vector space must be:

Linearly independent and span the space
Just linearly independent
Just spanning
Orthogonal

Browser lab#

Test three vectors for independence using numpy.linalg.matrix_rank.

python · runs in browser
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])
← Previous
Week 4: Determinants
Next →
Week 6: The Four Fundamental Subspaces
On this page
  • Vector Spaces and Subspaces
  • Linear Independence
  • Basis and Dimension
  • Coordinates Relative to a Basis
  • Knowledge check
  • Browser lab