Linear Dependence#
Introduction#
Let’s dive into linear algebra and linear dependence, using SageMath to illustrate the concepts.
Definition: Linear Dependence
A set of vectors is linearly dependent if you can express one of the vectors as a linear combination of the others. In other words, one vector is redundant because it doesn’t add any new information to the set.
SageMath Examples
Let’s use SageMath to explore linear dependence.
Example 1: Two Vectors in 2D Space#
v1 = vector([1, 2])
v2 = vector([3, 6])
# Check if v2 is a scalar multiple of v1
v2 == 3*v1
True
In this case, v2 is simply 3 times v1, so these vectors are linearly dependent.
A = matrix([v1, v2]).transpose()
show(A)
rank_of_A = A.rank()
print(rank_of_A)
1
is_dependent = rank_of_A < 2 # 2 is the number of vectors (or number of columns)
print(is_dependent)
True
Definition: Rank
Rank is a Measure of Information: The rank of a matrix indicates the amount of independent information contained in the equations. A lower rank signifies that some information is redundant.
Connection to Linear Dependence: The rows (or columns) of a matrix are linearly dependent if and only if the rank of the matrix is less than the number of rows (or columns). This directly connects the concept of rank to linear dependence of equations.
Example 2: Three Vectors in 3D Space#
v1 = vector([1, 0, -1])
v2 = vector([2, 1, 3])
v3 = vector([0, -1, -5])
A = matrix([v1, v2, v3])
print(A.rank())
2
Linear Dependence: Since the rank of the matrix (2) is less than the number of vectors (3), we know that the vectors are linearly dependent. This means that we can express one of the vectors as a linear combination of the other two.
show(A.echelon_form())
Finding the Relationship: By examining the row echelon form, we can see that:
Row 1 represents: \(\:\: v1 + 0v2 - v3 = 0\)
Row 2 represents: \(\:\:0v1 + v2 + 5v3 = 0\)
We can rearrange the second equation to express v3 in terms of v1 and v2:
\(v3 = -\frac{1}{5}v2\)
Example 3: Three Vectors in 3D Space#
This example is the same as 2, but with one of the vector element values changed
v1 = vector([1, 0, -1])
v2 = vector([2, 1, 3])
v3 = vector([0, -1, -6]) # -6 was -5 in Example 2.
A = matrix([v1, v2, v3])
show(A)
print(A.rank())
3
The rank is equal to the number of columns (vectors) so this system is linearly independent.
show(A.echelon_form())
Notice that we have a pivot in each column, so this means the solution is unique.
In augmented form: \( \:\: \left(\begin{array}{rrr|r} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \end{array}\right) \)
Therefore:
\(v1 = 0\)
\(v2 = 0\)
\(v3 = 0\)
VectorSpace.linear_dependence() method#
v1 = vector([1, 2, 3]) # Create a vector
v2 = vector([4, 5, 6]) # Create a vector
V = VectorSpace(QQ, 3) # Create a 3-dimensional vector space over rational numbers
V.linear_dependence([v1, v2])
# An empty list indicates linear independence
[]
v1 = vector([1, 0, -1])
v2 = vector([2, 1, 3])
v3 = vector([0, -1, -5])
V = VectorSpace(QQ, 3)
V.linear_dependence([v1, v2, v3])
# A non-empty list indicates linear dependence
[(2, -1, -1)]
Key Points#
The rank of a matrix tells us the maximum number of linearly independent rows (or columns) in that matrix.
Row echelon form helps us identify relationships between the rows (or columns) of a matrix, making it easier to spot linear dependence.
When the rank of a matrix is less than the number of vectors it contains, those vectors are linearly dependent. We can then use row echelon form or other methods to find the specific linear combination that expresses one vector in terms of the others.