Row and column spaces





In linear algebra, the column space (also called the range or image) of a matrix A is the span (set of all possible linear combinations) of its column vectors. The column space of a matrix is the image or range of the corresponding matrix transformation.

Let $$F$$ be a field. The column space of an $m × n$ matrix with components from $$F$$ is a linear subspace of the m-space $$F^m$$. The dimension of the column space is called the rank of the matrix and is at most $min(m, n)$. A definition for matrices over a ring $$R$$ is also possible.

The row space is defined similarly.

The row space and the column space of a matrix $A$ are sometimes denoted as $C(A^{T})$ and $C(A)$ respectively.

This article considers matrices of real numbers. The row and column spaces are subspaces of the real spaces $$\R^n$$ and $$\R^m$$ respectively.

Overview
Let $A$ be an $m$-by-$n$ matrix. Then
 * 1) $rank(A) = dim(rowsp(A)) = dim(colsp(A))$ = number of pivots in any echelon form of $A$,
 * 2) $rank(A)$ = the maximum number of linearly independent rows or columns of $A$.
 * 1) $rank(A)$ = the maximum number of linearly independent rows or columns of $A$.

If one considers the matrix as a linear transformation from $$\mathbb{R}^n$$ to $$\mathbb{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 generalizes to matrices over $\C$, the field of complex numbers, or over 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 $J$. See singular value decomposition for more details on this second interpretation.

Example
Given a matrix $J$:

J = \begin{bmatrix} 2 & 4 & 1 & 3 & 2\\   -1 & -2 & 1 & 0 & 5\\    1 & 6 & 2 & 2 & 2\\    3 & 6 & 2 & 5 & 1  \end{bmatrix} $$ the rows are $$\mathbf{r}_1 = \begin{bmatrix} 2 & 4 & 1 & 3 & 2 \end{bmatrix}$$, $$\mathbf{r}_2 = \begin{bmatrix} -1 & -2 & 1 & 0 & 5 \end{bmatrix}$$, $$\mathbf{r}_3 = \begin{bmatrix} 1 & 6 & 2 & 2 & 2 \end{bmatrix}$$, $$\mathbf{r}_4 = \begin{bmatrix} 3 & 6 & 2 & 5 & 1 \end{bmatrix}$$. Consequently, the row space of $J$ is the subspace of $$\R^5$$ 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]$ ($n$ is an element of the kernel of $K$ ), so it can be deduced that the row space consists of all vectors in $$\R^5$$ that are orthogonal to $n$.

Definition
Let $A$ 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
 * $$c_1 \mathbf{v}_1 + c_2 \mathbf{v}_2 + \cdots + c_n \mathbf{v}_n,$$

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:
 * $$\begin{array} {rcl}

A \begin{bmatrix} c_1 \\ \vdots \\ c_n \end{bmatrix} & = & \begin{bmatrix} a_{11} & \cdots & a_{1n} \\ \vdots & \ddots & \vdots \\ a_{m1} & \cdots & a_{mn} \end{bmatrix} \begin{bmatrix} c_1 \\ \vdots \\ c_n \end{bmatrix} = \begin{bmatrix} c_1 a_{11} + \cdots + c_{n} a_{1n} \\ \vdots \\ c_{1} a_{m1} + \cdots + c_{n} a_{mn} \end{bmatrix} = c_1 \begin{bmatrix} a_{11} \\ \vdots \\ a_{m1} \end{bmatrix} + \cdots + c_n \begin{bmatrix} a_{1n} \\ \vdots \\ a_{mn} \end{bmatrix} \\ & = & c_1 \mathbf{v}_1 + \cdots + c_n \mathbf{v}_n \end{array}$$

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

Example
If $$A = \begin{bmatrix} 1 & 0 \\ 0 & 1 \\ 2 & 0 \end{bmatrix}$$, then the column vectors are $v_{1} = [1, 0, 2]^{T}$ and $v_{2} = [0, 1, 0]^{T}$. A linear combination of v1 and v2 is any vector of the form $$c_1 \begin{bmatrix} 1 \\ 0 \\ 2 \end{bmatrix} + c_2 \begin{bmatrix} 0 \\ 1 \\ 0 \end{bmatrix} = \begin{bmatrix} c_1 \\ c_2 \\ 2c_1 \end{bmatrix}$$ 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 = 2x$ (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
 * $$A = \begin{bmatrix} 1 & 3 & 1 & 4 \\ 2 & 7 & 3 & 9 \\ 1 & 5 & 3 & 1 \\ 1 & 2 & 0 & 8 \end{bmatrix}.$$

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:
 * $$\begin{bmatrix} 1 & 3 & 1 & 4 \\ 2 & 7 & 3 & 9 \\ 1 & 5 & 3 & 1 \\ 1 & 2 & 0 & 8 \end{bmatrix}

\sim \begin{bmatrix} 1 & 3 & 1 & 4 \\ 0 & 1 & 1 & 1 \\ 0 & 2 & 2 & -3 \\ 0 & -1 & -1 & 4 \end{bmatrix} \sim \begin{bmatrix} 1 & 0 & -2 & 1 \\ 0 & 1 & 1 & 1 \\ 0 & 0 & 0 & -5 \\ 0 & 0 & 0 & 5 \end{bmatrix} \sim \begin{bmatrix} 1 & 0 & -2 & 0 \\ 0 & 1 & 1 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 0 & 0 \end{bmatrix}.$$ 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} = −2v_{1} + v_{2}$.) Therefore, the first, second, and fourth columns of the original matrix are a basis for the column space:
 * $$\begin{bmatrix} 1 \\ 2 \\ 1 \\ 1\end{bmatrix},\;\;

\begin{bmatrix} 3 \\ 7 \\ 5 \\ 2\end{bmatrix},\;\; \begin{bmatrix} 4 \\ 9 \\ 1 \\ 8\end{bmatrix}.$$ 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. Also 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}$.

To find the basis in a practical setting (e.g., for large matrices), the singular-value decomposition is typically used.

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 \to \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. The rank and nullity of a matrix $n$ with $A$ columns are related by the equation:
 * $$\operatorname{rank}(A) + \operatorname{nullity}(A) = n.\,$$

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:
 * $$A^\mathsf{T}\mathbf{x} = \begin{bmatrix} \mathbf{v}_1 \cdot \mathbf{x} \\ \mathbf{v}_2 \cdot \mathbf{x} \\ \vdots \\ \mathbf{v}_n \cdot \mathbf{x} \end{bmatrix},$$

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 $K$, 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 $m$ as
 * $$\sum\limits_{k=1}^n \mathbf{v}_k c_k$$

for any $c_{1}, ..., c_{n}$, with replacement of the vector $K$-space with "right free module", which changes the order of scalar multiplication of the vector $v_{k}$ to the scalar $c_{k}$ such that it is written in an unusual order vector–scalar.

Definition
Let $A$ be a field of scalars. Let $K$ be an $Ac$ matrix, with row vectors $c$. A linear combination of these vectors is any vector of the form
 * $$c_1 \mathbf{r}_1 + c_2 \mathbf{r}_2 + \cdots + c_m \mathbf{r}_m,$$

where $K^{n}$ are scalars. The set of all possible linear combinations of $m × n$ is called the row space of $A$. That is, the row space of $A$ is the span of the vectors $r_{1}, r_{2}, ..., r_{m}$.

For example, if
 * $$A = \begin{bmatrix} 1 & 0 & 2 \\ 0 & 1 & 0 \end{bmatrix},$$

then the row vectors are $c_{1}, c_{2}, ..., c_{m}$ and $r_{1}, ..., r_{m}$. A linear combination of $r_{1}, ..., r_{m}$ and $r_{1} = [1, 0, 2]$ is any vector of the form
 * $$c_1 \begin{bmatrix}1 & 0 & 2\end{bmatrix} + c_2 \begin{bmatrix}0 & 1 & 0\end{bmatrix} = \begin{bmatrix}c_1 & c_2 & 2c_1\end{bmatrix}.$$

The set of all such vectors is the row space of $A$. In this case, the row space is precisely the set of vectors $r_{2} = [0, 1, 0]$ satisfying the equation $r_{1}$ (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 $r_{2}$.

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
 * $$A = \begin{bmatrix} 1 & 3 & 2 \\ 2 & 7 & 4 \\ 1 & 5 & 2\end{bmatrix}.$$

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:

$(x, y, z) ∈ K^{3}$, $z = 2x$, $A^{T}$ represents the rows.

\begin{align} \begin{bmatrix} 1 & 3 & 2 \\ 2 & 7 & 4 \\ 1 & 5 & 2\end{bmatrix} &\xrightarrow{\mathbf{r}_2-2\mathbf{r}_1 \to \mathbf{r}_2} \begin{bmatrix} 1 & 3 & 2 \\ 0 & 1 & 0 \\ 1 & 5 & 2\end{bmatrix} \xrightarrow{\mathbf{r}_3-\,\,\mathbf{r}_1 \to \mathbf{r}_3} \begin{bmatrix} 1 & 3 & 2 \\ 0 & 1 & 0 \\ 0 & 2 & 0\end{bmatrix} \\ &\xrightarrow{\mathbf{r}_3-2\mathbf{r}_2 \to \mathbf{r}_3} \begin{bmatrix} 1 & 3 & 2 \\ 0 & 1 & 0 \\ 0 & 0 & 0\end{bmatrix} \xrightarrow{\mathbf{r}_1-3\mathbf{r}_2 \to \mathbf{r}_1} \begin{bmatrix} 1 & 0 & 2 \\ 0 & 1 & 0 \\ 0 & 0 & 0\end{bmatrix}. \end{align} $$ Once the matrix is in echelon form, the nonzero rows are a basis for the row space. In this case, the basis is $r_{1}$. Another possible basis $r_{2}$ comes from a further reduction.

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 $r_{3}$ is equal to the row space of $A$. Using the example matrix $A$ above, find $\{ [1, 3, 2], [2, 7, 4] \}$ and reduce it to row echelon form:



A^{\mathrm{T}} = \begin{bmatrix} 1 & 2 & 1 \\ 3 & 7 & 5 \\ 2 & 4 & 2\end{bmatrix} \sim \begin{bmatrix} 1 & 2 & 1 \\ 0 & 1 & 2 \\ 0 & 0 & 0\end{bmatrix}. $$

The pivots indicate that the first two columns of $\{ [1, 0, 2], [0, 1, 0] \}$ 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.

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:
 * $$\operatorname{rank}(A) + \operatorname{nullity}(A) = n,$$

where $A$ is the number of columns of the matrix $n$. 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 $A^{T}$ for which $A^{T}$. The product of the matrix $A$ and the vector $A^{T}$ can be written in terms of the dot product of vectors:
 * $$A\mathbf{x} = \begin{bmatrix} \mathbf{r}_1 \cdot \mathbf{x} \\ \mathbf{r}_2 \cdot \mathbf{x} \\ \vdots \\ \mathbf{r}_m \cdot \mathbf{x} \end{bmatrix},$$

where $x$ are the row vectors of $A$. Thus $Ax = 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 $A$ and $V$ are vector spaces, then the kernel of a linear transformation $r_{1}, ..., r_{m}$ is the set of vectors $Ax = 0$ for which $x$. The kernel of a linear transformation is analogous to the null space of a matrix.

If $W$ 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 $V$. The transformation $T$ is one-to-one on its coimage, and the coimage maps isomorphically onto the image of $T$.

When $T$ is not an inner product space, the coimage of $V$ can be defined as the quotient space $T: V → W$.