how to find maximal linearly independent subsets
Given a set of vectors, we can compute the number of independent vectors by calculating the rank of the set, but my question is how to find a maximal linearly independent subset. Thanks!
Solution 1:
One method is:
- Place the vectors as columns of a matrix. Call this matrix $A$.
- Use Gaussian elimination to reduce the matrix to row-echelon form, $B$.
- Identify the columns of $B$ that contain the leading $1$s (the pivots).
- The columns of $A$ that correspond to the columns identified in step 3 form a maximal linearly independent set of our original set of vectors.
Another method is:
- Let $A$ be your multiset of vectors, and let $B=\varnothing$, the empty set.
- Remove from $A$ any repetitions and all zero vectors.
- If $A$ is empty, stop. This set is a maximal linearly independent subset of $A$. Otherwise, go to step 4.
- Pick a vector $\mathbf{v}$ from $A$ and test to see if it lies in the span of $B$.
- If $\mathbf{v}$ is in the span of $B$, replace $A$ with $A-\{\mathbf{v}\}$, and do not modify $B$; then go back to step 3.
- If $\mathbf{v}$ is not in the span of $B$, replace $A$ with $A-\{\mathbf{v}\}$ and replace $B$ with $B\cup\{\mathbf{v}\}$. Then go back to step 3.
When step 3 instructs you to stop, $B$ contains a maximal linearly independent subset of $A$.
Solution 2:
Form a matrix whose columns are the given vectors. Do row reduction to bring it to reduced form. In each non-zero row of the reduced form, circle the leftmost non-zero entry. The columns in the original matrix that correspond to columns in the reduced matrix with a circled entry - they form a maximal linearly independent set.