Challenge: Subspace Dimension Finder

Design a Python algorithm to find a subspace dimension.

Statement

Write a smallestSubspaceDimensionFinder function that accepts a collection of four vectors in the R5\R^{5}, say, S={v1,v2,v3,v4}S = \{v_1, v_2, v_3 , v_{4}\}. The function should find and return the dimensions of the smallest subspace that contains these four vectors.

Sample inputs and outputs

The following table provides sample inputs and corresponding outputs.

Input Output
[[5,3,2,3,7],[6,7,2,1,8],[5,3,2,3,7],[[5,3,2,3,7],[6,7,2,1,8],[5,3,2,3,7],[11,10,4,4,15]][11,10,4,4,15]] 2
[[7,50,5,4,1],[9,7,3,1,5],[6,9,1,50,7],[[7,50,5,4,1],[9,7,3,1,5],[6,9,1,50,7],[34,52,13,83,12]][34,52,13,83,12]] 4

Try it yourself

The signature of the function is given below:

Get hands-on with 1200+ tech skills courses.