# Row and column spaces

In linear algebra, the **column space** C(*A*) of a matrix *A* (sometimes called the **range** of a matrix) is the span (set of all possible linear combinations) of its column vectors.

Let *K* be a field (such as real or complex numbers). The column space of an *m* × *n* matrix with components from *K* is a linear subspace of the *m*-space *K*^{m}. The dimension of the column space is called the rank of the matrix.^{[3]} A definition for matrices over a ring *K* (such as integers) is also possible.

The column space of a matrix is the image or range of the corresponding matrix transformation.

The row space and column space of an *m*-by-*n* matrix are the linear subspaces generated by row vectors and column vectors, respectively, of the matrix. Its dimension is equal to the rank of the matrix and is at most min(*m*, *n*).^{[4]}

This article will consider matrices of real numbers: the row and column spaces are subspaces of **R**^{n} and **R**^{m} real spaces respectively. Row and column spaces can be constructed from matrices with components in any field or ring.

## Overview

Let A be an *m*-by-*n* matrix. Then

- rank(A) = dim(rowsp(A)) = dim(colsp(A)),
- rank(A) = number of pivots in any echelon form of A,
- rank(A) = the maximum number of linearly independent rows or columns of A.

If one considers the matrix as a linear transformation from **R**^{n} to **R**^{m}, then the column space of the matrix equals the image of this linear transformation.

The column space of a matrix A is the set of all linear combinations of the columns in A. If A = [**a**_{1}, ...., **a**_{n}], then colsp(A) = span {**a**_{1}, ...., **a**_{n}}.

The concept of **row space** generalises to matrices to **C**, the field of complex numbers, or to any field.

Intuitively, given a matrix **A**, the action of the matrix **A** on a vector **x** will return a linear combination of the columns of **A** weighted by the coordinates of **x** as coefficients. Another way to look at this is that it will (1) first project **x** into the **row space** of A, (2) perform an invertible transformation, and (3) place the resulting vector **y** in the **column space** of **A**. Thus the result ** y = Ax** must reside in the **column space** of A. See the singular value decomposition for more details on this second interpretation.

### Example

Given a matrix J:

the rows are
**r**_{1} = (2,4,1,3,2),
**r**_{2} = (−1,−2,1,0,5),
**r**_{3} = (1,6,2,2,2),
**r**_{4} = (3,6,2,5,1).
Consequently the row space of J is the subspace of **R**^{4} spanned by { **r**_{1}, **r**_{2}, **r**_{3}, **r**_{4} }.
Since these four row vectors are linearly independent, the row space is 4-dimensional. Moreover in this case it can be seen that they are all orthogonal to the vector **n** = (6,−1,4,−4,0), so it can be deduced that the row space consists of all vectors in **R**^{5} that are orthogonal to **n**.

## Column space

### Definition

Let *K* be a field of scalars. Let *A* be an *m* × *n* matrix, with column vectors **v**_{1}, **v**_{2}, ..., **v**_{n}. A linear combination of these vectors is any vector of the form

where *c*_{1}, *c*_{2}, ..., *c _{n}* are scalars. The set of all possible linear combinations of

**v**

_{1}, ... ,

**v**

_{n}is called the

**column space**of

*A*. That is, the column space of

*A*is the span of the vectors

**v**

_{1}, ... ,

**v**

_{n}.

Any linear combination of the column vectors of a matrix *A* can be written as the product of *A* with a column vector:

Therefore, the column space of *A* consists of all possible products *A***x**, for **x** ∈ **C**^{n}. This is the same as the image (or range) of the corresponding matrix transformation.

- Example
- If , then the column vectors are
**v**_{1}= (1, 0, 2)^{T}and**v**_{2}= (0, 1, 0)^{T}. - A linear combination of
**v**_{1}and**v**_{2}is any vector of the form - The set of all such vectors is the column space of
*A*. In this case, the column space is precisely the set of vectors (*x*,*y*,*z*) ∈**R**^{3}satisfying the equation*z*= 2*x*(using Cartesian coordinates, this set is a plane through the origin in three-dimensional space).

### Basis

The columns of *A* span the column space, but they may not form a basis if the column vectors are not linearly independent. Fortunately, elementary row operations do not affect the dependence relations between the column vectors. This makes it possible to use row reduction to find a basis for the column space.

For example, consider the matrix

The columns of this matrix span the column space, but they may not be linearly independent, in which case some subset of them will form a basis. To find this basis, we reduce *A* to reduced row echelon form:

^{[5]}

At this point, it is clear that the first, second, and fourth columns are linearly independent, while the third column is a linear combination of the first two. (Specifically, **v**_{3} = –2**v**_{1} + **v**_{2}.) Therefore, the first, second, and fourth columns of the original matrix are a basis for the column space:

Note that the independent columns of the reduced row echelon form are precisely the columns with pivots. This makes it possible to determine which columns are linearly independent by reducing only to echelon form.

The above algorithm can be used in general to find the dependence relations between any set of vectors, and to pick out a basis from any spanning set. A different algorithm for finding a basis from a spanning set is given in the row space article; finding a basis for the column space of *A* is equivalent to finding a basis for the row space of the transpose matrix *A*^{T}.

### Dimension

The dimension of the column space is called the **rank** of the matrix. The rank is equal to the number of pivots in the reduced row echelon form, and is the maximum number of linearly independent columns that can be chosen from the matrix. For example, the 4 × 4 matrix in the example above has rank three.

Because the column space is the image of the corresponding matrix transformation, the rank of a matrix is the same as the dimension of the image. For example, the transformation **R**^{4} → **R**^{4} described by the matrix above maps all of **R**^{4} to some three-dimensional subspace.

The **nullity** of a matrix is the dimension of the null space, and is equal to the number of columns in the reduced row echelon form that do not have pivots.^{[6]} The rank and nullity of a matrix *A* with *n* columns are related by the equation:

This is known as the rank-nullity theorem.

### Relation to the left null space

The left null space of *A* is the set of all vectors **x** such that **x**^{T}*A* = **0**^{T}. It is the same as the null space of the transpose of *A*. The product of the matrix *A*^{T} and the vector **x** can be written in terms of the dot product of vectors:

because row vectors of *A*^{T} are transposes of column vectors **v**_{k} of *A*. Thus *A*^{T}**x** = **0** if and only if **x** is orthogonal (perpendicular) to each of the column vectors of *A*.

It follows that the left null space (the null space of *A*^{T}) is the orthogonal complement to the column space of A.

For a matrix *A*, the column space, row space, null space, and left null space are sometimes referred to as the four fundamental subspaces.

### For matrices over a ring

Similarly the column space (sometimes disambiguated as *right* column space) can be defined for matrices over a ring *K* as

for any *c*_{1}, ..., *c _{n}*, with replacement of the vector

*m*-space with "right free module", which changes the order of scalar multiplication of the vector

**v**

_{k}to the scalar

*c*such that it is written in an unusual order

_{k}*vector*–

*scalar*.

^{[7]}

## Row space

### Definition

Let *K* be a field of scalars. Let *A* be an *m* × *n* matrix, with row vectors **r**_{1}, **r**_{2}, ... , **r**_{m}. A linear combination of these vectors is any vector of the form

where *c*_{1}, *c*_{2}, ... , *c _{m}* are scalars. The set of all possible linear combinations of

**r**

_{1}, ... ,

**r**

_{m}is called the

**row space**of

*A*. That is, the row space of

*A*is the span of the vectors

**r**

_{1}, ... ,

**r**

_{m}.

For example, if

then the row vectors are **r**_{1} = (1, 0, 2) and **r**_{2} = (0, 1, 0). A linear combination of **r**_{1} and **r**_{2} is any vector of the form

The set of all such vectors is the row space of *A*. In this case, the row space is precisely the set of vectors (*x*, *y*, *z*) ∈ *K*^{3} satisfying the equation *z* = 2*x* (using Cartesian coordinates, this set is a plane through the origin in three-dimensional space).

For a matrix that represents a homogeneous system of linear equations, the row space consists of all linear equations that follow from those in the system.

The column space of *A* is equal to the row space of *A*^{T}.

### Basis

The row space is not affected by elementary row operations. This makes it possible to use row reduction to find a basis for the row space.

For example, consider the matrix

The rows of this matrix span the row space, but they may not be linearly independent, in which case the rows will not be a basis. To find a basis, we reduce *A* to row echelon form:

**r _{1}**,

**r**,

_{2}**r**represents the rows.

_{3}Once the matrix is in echelon form, the nonzero rows are a basis for the row space. In this case, the basis is { (1, 3, 2), (0, 1, 0) }. Another possible basis { (1, 0, 2), (0, 1, 0) } comes from a further reduction.^{[8]}

This algorithm can be used in general to find a basis for the span of a set of vectors. If the matrix is further simplified to reduced row echelon form, then the resulting basis is uniquely determined by the row space.

It is sometimes convenient to find a basis for the row space from among the rows of the original matrix instead (for example, this result is useful in giving an elementary proof that the determinantal rank of a matrix is equal to its rank). Since row operations can affect linear dependence relations of the row vectors, such a basis is instead found indirectly using the fact that the column space of *A*^{T} is equal to the row space of *A*. Using the example matrix *A* above, find *A*^{T} and reduce it to row echelon form:

The pivots indicate that the first two columns of *A*^{T} form a basis of the column space of *A*^{T}. Therefore, the first two rows of *A* (before any row reductions) also form a basis of the row space of *A*.

### Dimension

The dimension of the row space is called the **rank** of the matrix. This is the same as the maximum number of linearly independent rows that can be chosen from the matrix, or equivalently the number of pivots. For example, the 3 × 3 matrix in the example above has rank two.^{[8]}

The rank of a matrix is also equal to the dimension of the column space. The dimension of the null space is called the **nullity** of the matrix, and is related to the rank by the following equation:

where *n* is the number of columns of the matrix *A*. The equation above is known as the rank-nullity theorem.

### Relation to the null space

The null space of matrix *A* is the set of all vectors **x** for which *A***x** = **0**. The product of the matrix *A* and the vector **x** can be written in terms of the dot product of vectors:

where **r**_{1}, ... , **r**_{m} are the row vectors of *A*. Thus *A***x** = **0** if and only if **x** is orthogonal (perpendicular) to each of the row vectors of *A*.

It follows that the null space of *A* is the orthogonal complement to the row space. For example, if the row space is a plane through the origin in three dimensions, then the null space will be the perpendicular line through the origin. This provides a proof of the rank-nullity theorem (see dimension above).

The row space and null space are two of the four fundamental subspaces associated with a matrix *A* (the other two being the column space and left null space).

### Relation to coimage

If *V* and *W* are vector spaces, then the kernel of a linear transformation *T*: *V* → *W* is the set of vectors **v** ∈ *V* for which *T*(**v**) = **0**. The kernel of a linear transformation is analogous to the null space of a matrix.

If *V* is an inner product space, then the orthogonal complement to the kernel can be thought of as a generalization of the row space. This is sometimes called the coimage of *T*. The transformation *T* is one-to-one on its coimage, and the coimage maps isomorphically onto the image of *T*.

When *V* is not an inner product space, the coimage of *T* can be defined as the quotient space *V* / ker(*T*).

## See also

- Euclidean subspace
- Kernel (matrix)
- Four fundamental subspaces
- Rank (linear algebra)
- Linear span
- Matrix (mathematics)
- null space

## Notes

- ↑ Linear algebra, as discussed in this article, is a very well established mathematical discipline for which there are many sources. Almost all of the material in this article can be found in Lay 2005, Meyer 2001, and Strang 2005.
- ↑ A definition and certain properties for rings are the same with replacement of the "vector
*n*-space"*K*^{n}with "left free module" and "linear subspace" with "submodule". For non-commutative rings this row space is sometimes disambiguated as*left*row space. - ↑ Linear algebra, as discussed in this article, is a very well established mathematical discipline for which there are many sources. Almost all of the material in this article can be found in Lay 2005, Meyer 2001, and Strang 2005.
- ↑ http://www.cliffsnotes.com/WileyCDA/CliffsReviewTopic/Row-Space-and-Column-Space-of-a-Matrix.topicArticleId-20807,articleId-20793.html
- ↑ This computation uses the Gauss–Jordan row-reduction algorithm. Each of the shown steps involves multiple elementary row operations.
- ↑ Columns without pivots represent free variables in the associated homogeneous system of linear equations.
- ↑ Important only if
*K*is not commutative. Actually, this form is merely a product*A***c**of the matrix*A*to the column vector**c**from*K*^{n}where the order of factors is*preserved*, unlike the formula above. - 1 2 The example is valid over the real numbers, the rational numbers, and other number fields. It is not necessarily correct over fields and rings with non-zero characteristic.

## References

### Textbooks

- Banerjee, Sudipto; Roy, Anindya (June 6, 2014),
*Linear Algebra and Matrix Analysis for Statistics*(1st ed.), CRC Press, ISBN 978-1-42-009538-8 - Strang, Gilbert (July 19, 2005),
*Linear Algebra and Its Applications*(4th ed.), Brooks Cole, ISBN 978-0-03-010567-8 - Axler, Sheldon Jay (1997),
*Linear Algebra Done Right*(2nd ed.), Springer-Verlag, ISBN 0-387-98259-0 - Lay, David C. (August 22, 2005),
*Linear Algebra and Its Applications*(3rd ed.), Addison Wesley, ISBN 978-0-321-28713-7 - Meyer, Carl D. (February 15, 2001),
*Matrix Analysis and Applied Linear Algebra*, Society for Industrial and Applied Mathematics (SIAM), ISBN 978-0-89871-454-8 - Poole, David (2006),
*Linear Algebra: A Modern Introduction*(2nd ed.), Brooks/Cole, ISBN 0-534-99845-3 - Anton, Howard (2005),
*Elementary Linear Algebra (Applications Version)*(9th ed.), Wiley International - Leon, Steven J. (2006),
*Linear Algebra With Applications*(7th ed.), Pearson Prentice Hall

## External links

Wikibooks has a book on the topic of: Linear Algebra/Column and Row Spaces |

- Gilbert Strang, MIT Linear Algebra Lecture on the Four Fundamental Subspaces at Google Video, from MIT OpenCourseWare
- Khan Academy video tutorial
- Lecture on column space and nullspace by Gilbert Strang of MIT
- Row Space and Column Space