Orthonormal Basis for 2D Vectors

Vectors & Geometry DS practice problem on Onlearn.

Difficulty: medium.

Topics: Understanding Compute Orthonormal Basis for 2D Vectors, Vector normalization, Dot product, Numerical tolerance, Orthogonal subtraction, Unit vector scaling, Linear Algebra, Numerical Computation, Machine Learning, Geometry, Data Preprocessing, Gram-Schmidt process, Orthonormal basis, Vector projection, Linear independence, Orthogonal transformations.

Implement a function that computes an orthonormal basis for the subspace spanned by a list of 2D vectors using the Gram Schmidt process. The function should take a list of 2D vectors and a tolerance value (tol) to determine linear independence, returning a list of orthonormal vectors (unit length and orthogonal to each other) that span the same subspace. This is a fundamental concept in linear algebra with applications in machine learning, such as feature orthogonalization.