# Finding a basis for the columnspace of a matrix

Find a linearly independent set of vectors that spans the same subspace of $R^4$ as that spanned by the vectors - $$\begin{bmatrix} 2 \\ -4 \\ -1 \\ -2 \\ \end{bmatrix} , \begin{bmatrix} 7 \\ -2 \\ 7 \\ 2 \\ \end{bmatrix} , \begin{bmatrix} 1 \\ 2 \\ 3 \\ 2 \\ \end{bmatrix} , \begin{bmatrix} 3 \\ -2 \\ 2 \\ 0 \\ \end{bmatrix}$$

So I start by reducing the matrix of these vectors to echelon form -

$$\begin{bmatrix} 1 & -7 & -3 & -2 \\ 0 & 21 & 7 & 7 \\ 0 & -30 & -10 & -10 \\ 0 & -12 & -4 & -4 \\ \end{bmatrix}$$

$$\begin{bmatrix} 1 & -7 & -3 & -2 \\ 0 & 3 & 1 & 1 \\ 0 & -3 & -1 & -1 \\ 0 & -3 & -1 & -1 \\ \end{bmatrix}$$

$$\begin{bmatrix} 1 & -7 & -3 & -2 \\ 0 & 3 & 1 & 1 \\ 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 \\ \end{bmatrix}$$

Then I get $x_2 = -\frac{1}{3}x_3 - \frac{1}{3}x_4$ and $x_1 = \frac{2}{3}x_3 - \frac{1}{3}x_4$

So this gives me the linearly independent vectors below that span the same subspaces as the original vectors -

$$\begin{bmatrix} 1 \\ 0 \\ \frac {2}{3} \\ -\frac {1}{3}\\ \end{bmatrix} , \begin{bmatrix} 0 \\ 1 \\ -\frac {1}{3} \\ -\frac {1}{3} \\ \end{bmatrix}$$

But when I enter this answer I am told it is incorrect...anyone able to see where Im going wrong?

-
Try writing the first of your four vectors as a linear combination of the two you derived. It is impossible. – Alex Becker Mar 19 '12 at 3:16
@Samuel Reid: isn't it obvious that row 3 and 4 and linear combinations of row 2? just thought Id save myself writing in another matrix. – Jim_CS Mar 19 '12 at 3:24
@AlexBecker: can you see where I am going wrong though, I can't pinpoint where I am making a mistake. – Jim_CS Mar 19 '12 at 3:25
I am certified as blind as a bat. – Samuel Reid Mar 19 '12 at 3:37
@Brian_CS: (Edit, too late; deleted old comment and fixed it) What you are doing is finding a basis for the nullspace. What you are supposed to be doing is finding a basis for the columnspace. The columnspace does not equal the nullspace, and elementary row operations do not respect the columnspace. – Arturo Magidin Mar 19 '12 at 3:54

## 1 Answer

Start with a matrix whose columns are the vectors you have.

Then reduce this matrix to row-echelon form.

A basis for the columnspace of the original matrix is given by the columns in the original matrix that correspond to the pivots in the row-echelon form.

What you are doing does not really make sense because elementary row operations do not preserve the column space, but you are looking for a basis of the column space. In the end, what you are finding is a basis for the nullspace of the matrix, but what you are looking for is a basis for the columnspace.

Now, the nullspace and the rowspace are orthogonal to each other (in fact, orthogonal complements), so you could use your two vectors to find a basis for the column space, but it's too much extra work.

So: starting with the matrix of vectors you have,

\begin{align*} \left(\begin{array}{rrrr} 2 & 7 & 1 & 3\\ -4 & -2 & 2 & -2\\ -1 & 7 & 3 & 2\\ -2 & 2 & 2 & 0 \end{array}\right) &\to \left(\begin{array}{rrrr} -1 & 7 & 3 & 2\\ -4 & -2 & 2 & -2\\ 2 & 7 & 1 & 3\\ -2 & 2 & 2 & 0 \end{array}\right) \to \left(\begin{array}{rrrr} -1 & 7 & 3 & 2\\ 0 & -30 & -10 & -10\\ 0 & 21 & 7 & 7\\ 0 & -12 & -4 & -4 \end{array}\right)\\ &\to \left(\begin{array}{rrrr} -1 & 7 & 3 & 2\\ 0 & 3 & 1 & 1\\ 0 & 3 & 1 & 1\\ 0 & 3 & 1 & 1 \end{array}\right) \to \left(\begin{array}{rrrr} \color{red}{-1} & 7 & 3 & 2\\ 0 & \color{red}3 & 1 & 1\\ 0 & 0 & 0 & 0\\ 0 & 0 & 0 & 0 \end{array}\right) \end{align*} (Same thing you had)

Now, since the pivots of the row echelon form are in columns 1 and 2 (marked in red), that means that columns 1 and 2 of the original matrix are independent and span the column space. That is, you can take $$\left(\begin{array}{r} 2 \\-4\\-1\\-2\end{array}\right)\quad\text{and}\quad \left(\begin{array}{r} 7\\-2 \\ 7 \\ 2 \end{array}\right).$$ It should be easy to see that the two vectors are linearly independent. Also, $$\left(\begin{array}{r} 1\\2\\3\\2\end{array}\right) = -\frac{2}{3}\left(\begin{array}{r} 2\\-4\\-1\\-2\end{array}\right) + \frac{1}{3}\left(\begin{array}{r}7\\-2\\7\\2\end{array}\right)$$ and $$\left(\begin{array}{r} 3\\-2\\2\\0\end{array}\right) = \frac{1}{3}\left(\begin{array}{r} 2\\-4\\-1\\-2\end{array}\right) + \frac{1}{3}\left(\begin{array}{r}7\\-2\\7\\2\end{array}\right)$$ so the first two columns span the same space as all four.

The reason this works is that any linear combination between the columns is respected by elementary row operations (equivalently: elementary row operations do not change the nullspace). Since the columns that contain the pivots are necessarily a basis for the columnspace of the row-echelon form, the corresponding columns in the original form a basis. In fact, you can find the expressions I found above to show the other two columns are linear combinations by looking in the reduced-row echelon form instead of the original matrix; this is often easier.

This method extracts a subset of your original set that is a basis for the span of the set; that is, it gives you a way to pare your set down to a basis. If all you need is to find a basis, you can also begin by putting the vectors as the rows of a matrix and then performing elementary row operations until you get a matrix in row-echelon form. The (transpose of the) rows that contain the pivots in the row-echelon form give you a basis for the span of the original vectors. The reason this works is that elementary row operations don't change the row space, and the rows that contain the pivots are clearly a basis for the row space of the row-echelon form of the matrix. But you would not look for the nullspace in any case.

-
Excellent answer, cheers mate. – Jim_CS Mar 19 '12 at 4:06