Challenge: Check Linear Independence

Design a Python algorithm to test a collection of vectors for linear independence.

Statement

Write a checkLinearIndependence function that accepts a collection of vectors, S={v1,v2,,vn}S = \{v_1, v_2, \cdots , v_n\}, as input and returns either True if all vectors are linearly independent or False if there are dependent vectors. Assume that the vectors have the same vector space.

Sample inputs and outputs

The following table provides example inputs (list of vectors or rows of a matrix) and corresponding outputs:

Input Output
S:[[5,3,2],[6,7,8],[5,3,2]]S:[[5, 3, 2],[6, 7, 8],[5, 3, 2]] False
S:[[7,52,58],[90,76,36],[67,90,13]]S:[[7, 52, 58],[90, 76, 36],[67, 90, 13]] True
S:[[5,3,2],[6,7,8],[11,10,10]]S:[[5, 3, 2],[6, 7, 8],[11, 10, 10]] False

Try it yourself

The signature of the function is given below:

Get hands-on with 1400+ tech skills courses.