colspace

Basis for the column space of a matrix.

Category: Mathematics > Linear Algebra

Syntax

B = colspace(A)

Returns a matrix whose columns are a basis of the column space of A.

Description

The column space is the set of all vectors A*v. Its dimension is the rank of A, which is the number of columns that colspace returns. A matrix whose columns are dependent, such as one column being twice another, gives fewer columns than A has.

Input arguments

A
Symbolic or numeric matrix.

Output arguments

B
Matrix with rank(A) columns, each lying in the span of the columns of A.

Example

Rank-2 matrix

A = sym([1 2 3; 2 4 6; 1 0 1]);
B = colspace(A)
rank(A)
Output
B = 
[1, 0]
[2, 0]
[0, 1]
ans = 2

Notes

The basis is not unique, so MATLAB and MatLivre may return different but equivalent bases.

See also

null rank rref orth