Join Our 5-Week ML/AI Engineer Interview Bootcamp 🚀 led by ML Tech Leads at FAANGs
Linear independence is a core linear algebra concept used to tell whether a set of vectors contains any redundancy. In this task, you’ll implement a simple checker that decides if a list of vectors is linearly independent. Formally, a set of vectors is linearly independent if the equation:
has only the trivial solution .
Implement the function
Rules:
True/False).np.linalg.matrix_rank).Output:
| Argument | Type |
|---|---|
| vectors | np.ndarray |
| Return Name | Type |
|---|---|
| value | bool |
Use NumPy for calculation
Input is a NumPy array
Return a single boolean True/False
Use the property that a set of k vectors is linearly independent if and only if the matrix formed by them has rank equal to k.
np.linalg.matrix_rank(A) computes the rank (number of linearly independent rows or columns).
Check if np.linalg.matrix_rank(vectors) == len(vectors).