Okay, here is the content for the "Linear Independence of Vectors" section.
In the previous section, we saw how vectors can be combined using scalar multiplication and addition to form linear combinations, spanning a certain space or subspace. A natural question arises: given a set of vectors that span a space, are all of them truly necessary? Or could we achieve the same span with fewer vectors because some are "redundant"? This brings us to the concept of linear independence.
Imagine you have a set of vectors {v1,v2,...,vk}. We want to know if any vector in this set can be represented as a linear combination of the others. If one vector can be formed by combining the others, it doesn't add anything new to the direction or dimension spanned by the set; it's essentially redundant information within the context of the span. If no vector in the set can be expressed as a linear combination of the others, the set is called linearly independent.
Formally, a set of vectors {v1,v2,...,vk} in a vector space is said to be linearly independent if the only solution to the vector equation:
c1v1+c2v2+...+ckvk=0
is the trivial solution where all the scalar coefficients are zero: c1=0,c2=0,...,ck=0.
Conversely, the set of vectors is linearly dependent if there exists at least one non-trivial solution, meaning at least one coefficient ci is non-zero. If the vectors are linearly dependent, it implies that at least one vector vi can be isolated and written as a linear combination of the other vectors in the set. For example, if ci=0, we could rearrange the equation to:
vi=−cic1v1−...−cici−1vi−1−cici+1vi+1−...−cickvk
This confirms that vi lies within the span of the other vectors.
Let's visualize this in familiar spaces:
Consider two sets of vectors in R2: Set A = { (2, 1), (4, 2) } and Set B = { (2, 1), (1, 3) }.
Set A vectors (black and red) are linearly dependent as v2 is just 2 * v1. They lie on the same line. Set B vectors (black and blue) are linearly independent as v3 cannot be written as a scalar multiple of v1. They point in different directions.
Linear independence is not just an abstract algebraic property. It has direct consequences in machine learning, particularly when dealing with features:
Feature Redundancy: If feature vectors in a dataset are linearly dependent, it indicates that some features don't provide unique information relative to others. For instance, if one feature is simply the sum of two other features (e.g., total_sales = domestic_sales + international_sales
), including all three might be redundant. This can increase model complexity unnecessarily and sometimes obscure the importance of the underlying independent factors.
Multicollinearity in Models: In models like linear regression, we often solve systems of equations involving the feature matrix X. If the columns of X (representing different features) are linearly dependent, the matrix XTX becomes singular (non-invertible) or close to singular. This situation, known as perfect or high multicollinearity, makes it impossible to find a unique solution for the model coefficients. The estimates become highly sensitive to small changes in the data, standard errors inflate, and interpreting the contribution of individual features becomes unreliable.
Dimensionality and Basis: Linearly independent sets of vectors are essential for defining a "basis" for a vector space or subspace, which represents the fundamental directions or components of that space. Understanding linear independence helps in dimensionality reduction techniques where the goal is often to find a smaller set of linearly independent vectors (or components) that capture most of the information in the original data.
How do we determine if a set of vectors {v1,v2,...,vk} is linearly independent? We need to check if the only solution to c1v1+c2v2+...+ckvk=0 is c1=c2=...=ck=0.
This vector equation can be rewritten as a matrix equation. Let A be the matrix whose columns are the vectors v1,v2,...,vk. Let c be the column vector of the unknown coefficients [c1,c2,...,ck]T. The equation becomes:
Ac=0
This is a homogeneous system of linear equations.
From our knowledge of linear systems (Chapter 3), we know that Ac=0 has only the trivial solution if and only if the matrix A has full column rank. That is, the rank of the matrix A must be equal to the number of columns (which is the number of vectors, k).
Practical Check using Rank: The most common way to check for linear independence computationally is to form the matrix A with the vectors as columns and then compute its rank.
rank(A) == k
(number of vectors), the vectors are linearly independent.rank(A) < k
, the vectors are linearly dependent.We can use libraries like NumPy to compute the rank:
import numpy as np
# Example 1: Linearly Dependent Vectors (from plot)
v1 = np.array([2, 1])
v2 = np.array([4, 2])
A = np.array([v1, v2]).T # Vectors as columns
# A is [[2, 4],
# [1, 2]]
rank_A = np.linalg.matrix_rank(A)
num_vectors_A = A.shape[1]
print(f"Set A: Matrix rank = {rank_A}, Number of vectors = {num_vectors_A}")
# Output: Set A: Matrix rank = 1, Number of vectors = 2
# Since rank < number of vectors, they are linearly dependent.
# Example 2: Linearly Independent Vectors (from plot)
v1 = np.array([2, 1])
v3 = np.array([1, 3])
B = np.array([v1, v3]).T # Vectors as columns
# B is [[2, 1],
# [1, 3]]
rank_B = np.linalg.matrix_rank(B)
num_vectors_B = B.shape[1]
print(f"Set B: Matrix rank = {rank_B}, Number of vectors = {num_vectors_B}")
# Output: Set B: Matrix rank = 2, Number of vectors = 2
# Since rank == number of vectors, they are linearly independent.
# Example 3: Three vectors in R^2 (must be dependent)
v1 = np.array([2, 1])
v3 = np.array([1, 3])
v4 = np.array([-1, 1])
C = np.array([v1, v3, v4]).T
# C is [[ 2, 1, -1],
# [ 1, 3, 1]]
rank_C = np.linalg.matrix_rank(C)
num_vectors_C = C.shape[1]
print(f"Set C: Matrix rank = {rank_C}, Number of vectors = {num_vectors_C}")
# Output: Set C: Matrix rank = 2, Number of vectors = 3
# Since rank < number of vectors, they are linearly dependent.
# (As expected, you can't have 3 linearly independent vectors in R^2)
Understanding linear independence is fundamental. It helps us identify redundancy in data, ensures the stability of certain machine learning algorithms, and forms the bedrock for concepts like basis and dimension, which we will explore next. These concepts allow us to precisely define the "size" and structure of the vector spaces our data lives in.
© 2025 ApX Machine Learning