3
$\begingroup$

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.

$\endgroup$
1

1 Answer 1

5
$\begingroup$

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}}}

$\endgroup$
1
  • $\begingroup$ Why would you want to use Pick[S, MatrixRank[#] == 2& /@ S] over Select[S, MatrixRank[#] == 2&]? $\endgroup$ Commented Jul 5, 2022 at 18:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.