# How can I test if a set is linearly independent?

Is there a function that takes a list like

{{1,0,3},{0,-3,1}}

and decide if the vectors (1,0,3) and (0,-3,1) are linearly independent or not?

It would be great if the output is 1 for yes (they are linearly independent) and 0 for no (they are linearly dependent). I aim to select from a list of lists those whose vectors are linearly independent. Maybe I can use Select to do it because if the output is 0 or 1 I can put the result as a criteria in the argument of Select. For example, Let

S={{{1,0,13},{2,12,1}},{{1,13,0},{2,26,0}},{{1,-4,2},{-2,8,-4}},{{1,0,0},{0,1,0}}}

I want to obtain from S the subset

B={{{1,0,13},{2,12,1}},{{1,0,0},{0,1,0}}}

of its linearly independent lists.

Another way to do that could be by calculating the minors, but I think this would complicate things.

• You've seen NullSpace[], no? Sep 27 '17 at 17:21

I think the simplest approach is to find the MatrixRank of the list:

S = {
{{1,0,13},{2,12,1}},
{{1,13,0},{2,26,0}},
{{1,-4,2},{-2,8,-4}},
{{1,0,0},{0,1,0}}
};

MatrixRank[#] == 2& /@ S


{True, False, False, True}

Then, you can use Pick to obtain what you want:

Pick[S, MatrixRank[#] == 2& /@ S]


{{{1, 0, 13}, {2, 12, 1}}, {{1, 0, 0}, {0, 1, 0}}}