# How to remove linearly dependent rows/cols

How would one remove linearly dependent rows/columns from a rank-deficient matrix.

For example, (from wikipedia):

$$A = \begin{bmatrix} 2 & 4 & 1 & 3 \\ -1 & -2 & 1 & 0 \\ 0 & 0 & 2 & 2 \\ 3 & 6 & 2 & 5 \end{bmatrix}.$$

If you convert it to row-echelon-form, you get:

$$A = \begin{bmatrix} 1 & 2 & 0 & 1 \\ 0 & 0 & 1 & 1 \\ 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 \end{bmatrix}$$

This demonstrates that there are two linearly independent columns. As noted in the wikipedia article, "We see that the second column is twice the first column, and that the fourth column equals the sum of the first and the third". How can one extract the linearly independent columns (or rows) and get a result like:

$$A = \begin{bmatrix} 2 & 1 \\ -1 & 1 \\ 0 & 2 \\ 3 & 2 \end{bmatrix}.$$

-