Basis#
Let’s dive into the concept of linear algebra basis using SageMath to illustrate.
Review of key concepts
Vector Space: A collection of vectors that can be added together and multiplied by scalars (usually real or complex numbers), while still obeying specific rules.
Linear Combination: Adding multiples of vectors together (e.g., 3vector1 + 2vector2).
Span: The set of all possible linear combinations you can create from a given set of vectors.
Linear Independence: A set of vectors is linearly independent if none of them can be expressed as a linear combination of the others.
Definition: Basis:
A linearly independent set of vectors that spans the entire vector space. It’s essentially a minimal set of vectors that can “build” any other vector in the space through linear combinations.
A basis is a special type of spanning set that is also linearly independent, making it the minimal and most efficient set of vectors needed to span the space.
SageMath Examples
Let’s use SageMath, a powerful open-source mathematics software system, to make these concepts more tangible.
1. Creating Vectors and Vector Spaces
v1 = vector([1, 2, 3])
v2 = vector([4, 5, 6])
v3 = vector([7, 8, 9])
V = VectorSpace(QQ, 3) # Create a 3-dimensional vector space over rational numbers
print(V)
Vector space of dimension 3 over Rational Field
2. Checking Linear Independence
V.linear_dependence([v1, v2, v3])
# A non-empty list indicates linear dependence
[(1, -2, 1)]
3. Finding a Basis
A = matrix(QQ, [[1, 2, 3], [4, 5, 6], [7, 8, 9]])
row_space_basis = A.row_space()
basis_vectors = row_space_basis.basis()
print(basis_vectors)
[
(1, 0, -1),
(0, 1, 2)
]
SageMath finds a basis for the row space of matrix A.
This means these two vectors can be combined to create any row of A.
4. Expressing rows as a combination of the basis vectors
Each row of matrix \( A \) can be expressed as a combination of the basis vectors found by SageMath. Let’s start with your matrix \( A \):
\( A = \begin{pmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9 \end{pmatrix} \)
The basis vectors for the row space of \( A \) are given by:
\( \mathbf{v}_1 = (1, 0, -1) \) \( \mathbf{v}_2 = (0, 1, 2) \)
These basis vectors mean that any row of \( A \) can be written as a linear combination of \(\mathbf{v}_1\) and \(\mathbf{v}_2\).
Let’s express each row of \( A \) as such a combination.
Row 1: \( (1, 2, 3) \)
We want to find scalars \( c_1 \) and \( c_2 \) such that:
\( (1, 2, 3) = c_1 (1, 0, -1) + c_2 (0, 1, 2) \)
This leads to the system of equations:
$ \begin{cases} c_1 = 1 \ c_2 = 2 \
c_1 + 2c_2 = 3 \end{cases} $
Let’s solve it step-by-step:
From the first equation: \( c_1 = 1 \).
From the second equation: \( c_2 = 2 \).
Check the third equation: \( -1 + 2 \cdot 2 = -1 + 4 = 3 \).
So, the combination for the first row is:
\( (1, 2, 3) = 1 \cdot (1, 0, -1) + 2 \cdot (0, 1, 2) \)
Let’s verify this:
vector([1, 2, 3]) == 1 * vector([1,0,-1]) + 2* vector([0,1,2])
True
The combinations for the second and third row have been calculated for you and are shown below:
\( (4, 5, 6) = 4 \cdot (1, 0, -1) + 5 \cdot (0, 1, 2) \)
\( (7, 8, 9) = 7 \cdot (1, 0, -1) + 8 \cdot (0, 1, 2) \)
In summary, the basis vectors \((1, 0, -1)\) and \((0, 1, 2)\) can indeed be combined using appropriate scalars to reconstruct each row of matrix \( A \).
Why Basis Matters#
Compact Representation: A basis gives you the most concise way to describe a vector space.
Coordinates: Every vector in the space gets a unique “address” (coordinates) with respect to a chosen basis.
Transformations: Basis vectors help understand how linear transformations (like rotations or reflections) work.