Loading content...
The column space of a matrix, also known as its image or range, is one of the four fundamental subspaces in linear algebra. It represents the set of all possible output vectors that can be produced when the matrix acts as a linear transformation—in other words, all vectors that can be expressed as linear combinations of the matrix's columns.
Given a matrix A with dimensions m × n (m rows, n columns), the column space is defined as:
$$\text{Col}(A) = { A\mathbf{x} : \mathbf{x} \in \mathbb{R}^n } = \text{span}{\mathbf{a}_1, \mathbf{a}_2, \ldots, \mathbf{a}_n}$$
where a₁, a₂, ..., aₙ are the column vectors of matrix A. However, not all columns may be linearly independent—some columns might be expressible as combinations of others. The dimension of the column space equals the rank of the matrix.
To find a basis for the column space, we need to identify which columns of the original matrix are linearly independent. The most reliable method involves:
Critical Note: While we use the row-reduced form to identify pivot positions, the actual basis vectors must come from the original matrix, not the reduced form. This preserves the structure of the original column space.
Implement a function column_space_basis(A) that:
The returned matrix should contain the linearly independent columns from the original matrix that span its column space.
A = [[1, 2, 3], [4, 5, 6], [7, 8, 9]][[1, 2], [4, 5], [7, 8]]This 3×3 matrix has rank 2, meaning only 2 columns are linearly independent. When we perform row reduction:
The output matrix [[1, 2], [4, 5], [7, 8]] represents these two basis vectors as columns, spanning the 2-dimensional column space.
A = [[1, 0], [0, 1]][[1, 0], [0, 1]]This is the 2×2 identity matrix, which has full rank (rank = 2). Both columns are linearly independent—neither can be expressed as a scalar multiple of the other.
The row echelon form is already the matrix itself, with pivots in both column positions. Therefore, the entire original matrix forms the basis for its column space, which spans all of ℝ².
The output is the complete original matrix: [[1, 0], [0, 1]].
A = [[1, 2, 0], [0, 1, 1], [1, 0, 1]][[1, 2, 0], [0, 1, 1], [1, 0, 1]]This 3×3 matrix has full column rank (rank = 3), meaning all three columns are linearly independent. Row reduction confirms that each column position contains a pivot.
Since no column can be written as a linear combination of the others, all three columns are needed to form the basis. The column space equals the entire 3-dimensional space ℝ³.
The output includes all columns from the original matrix: [[1, 2, 0], [0, 1, 1], [1, 0, 1]].
Constraints