## Reducing a Matrix to Row Reduced Echelon Form to Find a Basis for a Vector Space

Suppose we have a vector space
$V$
, a subset of
$\mathbb{R}^4$
spanned by the the vectors
$\left\{ \begin{pmatrix}1\\2\\1\\2\end{pmatrix} , \begin{pmatrix}2\\1\\2\\1\end{pmatrix} , \begin{pmatrix}3\\2\\3\\2\end{pmatrix} , \begin{pmatrix}3\\3\\3\\\end{pmatrix} , \begin{pmatrix}5\\3\\5\\3\end{pmatrix} \right\}$

We want to find a subset of this spanning set that is a basis for
$V$
.
From the set of vectors form the a matrix with rows equal to the vectors.
$\left( \begin{array}{cccc} 1 & 2 & 1 & 2 \\ 2 & 1 & 2 & 1 \\ 3 & 2 & 3 & 2 \\ 3 & 3 & 3 & 3 \\ 5 & 3 & 5 & 3 \end{array} \right)$

Now perform elementary row operations - adding or subtracting multiples of each row, interchanging rows, or scaling rows - to find the row reduced echelon form of the matrix.
Subtract two times row 1 from row 2, subtract 3 times row 1 from rows 3 and 4, and subtract 5 times row 1 from row 5. We get>/br>
$\left( \begin{array}{cccc} 1 & 2 & 1 & 2 \\ 0 & -3 & 0 & -3 \\ 0 & -4 & 0 & -4 \\ 0 & -3 & 0 & -3 \\ 0 & -7 & 0 & -7 \end{array} \right)$

Divide row 2 by -3
$\left( \begin{array}{cccc} 1 & 2 & 1 & 2 \\ 0 & 1 & 0 & 1 \\ 0 & -4 & 0 & -4 \\ 0 & -3 & 0 & -3 \\ 0 & -7 & 0 & -7 \end{array} \right)$

Subtract times row 2 from row 1, add four times row 2 to row 3, add three times row 2 to row 4 and add seven times row 2 to row 5.
$\left( \begin{array}{cccc} 1 & 0 & 1 & 0 \\ 0 & 1 & 0 & 1 \\ 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 \end{array} \right)$

This is the row reduced echelon form of the matrix.
A basis for
$V$
is then
$\left\{ \begin{pmatrix}1\\0\\1\\0\end{pmatrix} , \begin{pmatrix}0\\1\\0\\1\end{pmatrix} \right\}$