Determining and enforcing linear dependence Assuming we have a large set of multi-dimensional vectors (20k vectors, 100 dimensions each). My questions are the following:


*

*How can we determine the level of linear dependence of this set? Is there any appropriate technique or metric for this task?

*How can we convert this set of vectors to the closest possible set of linearly independent vectors? (by "closest possible set" I mean the set that preserves as much as possible the direction of the original vectors). Is there any method for this?


Thank you in advance for any help.
 A: At worst, you can just perform row reduction on the set, adding one new thing to test at a time.
You start with a nonzero vector, and store it in a matrix. Then, you find the next nonzero vector $v_2$ and try to get it into row-echelon form. 
Each time you succeed in getting row-echelon form, you append the next nonzero vector to the bottom of the matrix and try to make it row-echelon again. If the row turns into zeros you reject that vector you added, if it's not zero, you accept the vector and continue. At the end, the number of rows of your big matrix is the dimension of the span of those $20$k vectors.
In theory, you would need to proceed until 


*

*you collect 100 vectors in storage or

*you exhaust the supply of 20k vectors


whichever comes first! (Obviously the dimension of the span is bounded by $100$, since they all come from $F^{100}$ over whatever field you're thinking of.)
As someone mentioned, if the vectors are random, it is very likely you'll find 100 independent vectors long before you exhaust the supply.
