Span#

Introduction#

Let’s dive into the concept of span in linear algebra, illustrated with SageMath examples.

Definition: Span

In simple terms, the span of a set of vectors is the collection of all possible linear combinations you can form using those vectors. A linear combination is just a fancy way of saying you’re adding scalar multiples of your vectors together.

Why Span Matters

The span tells you what space your vectors “fill up.” If your vectors span a line, they’re confined to that line. If they span a plane, they can reach any point on that plane. This is fundamental in understanding vector spaces and solving systems of equations.

Example 1: Span of a Single Vector#

V = VectorSpace(QQ, 2)  # 2D vector space over rational numbers
v = V([1, 2])  # Our vector is (1, 2)

span_v = V.span([v])  # Calculate the span of v
print(span_v)
Vector space of degree 2 and dimension 1 over Rational Field
Basis matrix:
[1 2]

This tells us the span of v is a one-dimensional subspace (a line) in our 2D space.

Basis matrix can be ignored for now, it is covered in the next lesson.

Example 2: Span of Two Vectors#

V = VectorSpace(QQ, 3)  # 3D vector space over rational numbers
v1 = V([1, 0, -1])
v2 = V([0, 1, 2])

span_v1_v2 = V.span([v1, v2])  # Calculate the span of v1 and v2
print(span_v1_v2)
Vector space of degree 3 and dimension 2 over Rational Field
Basis matrix:
[ 1  0 -1]
[ 0  1  2]

Here, the span of v1 and v2 is a two-dimensional subspace (a plane) in our 3D space.

Example 3: Checking if a Vector is in the Span#

V = VectorSpace(QQ, 3)
v1 = V([1, 0, -1])
v2 = V([0, 1, 2])
u = V([2, 3, 4])

span_v1_v2 = V.span([v1, v2])
print(u in span_v1_v2)  # Check if u is in the span
True

The output True indicates that the vector u is within the span of v1 and v2. To find the actual coefficients, you could solve a system of equations.

Now let’s plot the span to visualise it (don’t try to understand this code).

var('x y')

from sage.plot.plot3d.plot3d import axes

# Create a 3D plot
n = v1.cross_product(v2)  # Normal vector to the plane
d = -n.dot_product(V([0, 0, 0]))  # Constant term in plane equation
plot = plot3d(lambda x,y: (-n[0]*x - n[1]*y + d)/n[2],(x,-2,2),(y,-2,2), color='lightblue', opacity=0.25) # The plane representing the span
plot += arrow3d((0,0,0),v1, color='red')  # Vector v1
plot += arrow3d((0,0,0),v2, color='green') # Vector v2
plot += arrow3d((0,0,0),u, color='blue')  # Vector u

# Show the plot
plot.show(frame=True, axes=False)

(You can interactively rotate, zoom, and pan the above 3D plots using the mouse)

Visual Output

The resulting plot should show:

  • A light blue plane representing the span of v1 and v2.

  • A red arrow for v1.

  • A green arrow for v2.

  • A blue arrow for u, clearly lying on the plane, visually confirming that u is in the span.

Visualization key takeaways

  • This visual representation reinforces the concept of span as the set of all linear combinations.

  • Seeing u on the plane makes it clear that it can be expressed as a combination of v1 and v2.

  • SageMath provides powerful tools for combining symbolic calculations with intuitive visualizations.

Span vs Spanning Sets#

In linear algebra, “spanning set” and “span” are closely related but not exactly synonymous. Here’s the distinction:

Definition: Spanning Set

A spanning set for a vector space consists of a group of vectors that collectively have the ability to reach every point within that space through linear combinations. In other words, any vector in the space can be expressed as a combination of the vectors in the spanning set. This concept is fundamental in understanding the dimensionality and structure of vector spaces, as it provides a way to systematically explore the entire space using a finite set of vectors.

Span

The span of a set of vectors is the set of all possible linear combinations that you can form using those vectors. It’s the entire subspace that those vectors “generate” or “fill up.”

Relationship

  • A spanning set generates the span: The span of a set of vectors is precisely the vector space spanned by those vectors (i.e., the set of all linear combinations).

  • Multiple spanning sets for the same span: A vector space can have multiple different spanning sets. As long as each set can generate all the vectors in the space through linear combinations, it’s a valid spanning set.

Example

Consider the vector space ℝ².

  • Spanning set: The set of vectors {(1, 0), (0, 1)} is a spanning set for ℝ² because any vector (x, y) in ℝ² can be written as x(1, 0) + y(0, 1).

  • Span: The span of {(1, 0), (0, 1)} is the entire ℝ² space, since all possible linear combinations of (1, 0) and (0, 1) cover the whole plane.

  • Another spanning set: The set {(1, 1), (-1, 1)} is also a spanning set for ℝ². You can verify that any vector (x, y) can be expressed as a linear combination of these two vectors as well. However, it’s a different set of vectors.

In summary:

  • Spanning set refers to a specific collection of vectors that can generate the entire space.

  • Span refers to the actual vector space or subspace that is generated by a set of vectors.

Lesson Summary#

  • Geometric Interpretation: Spans have clear geometric interpretations. The span of one vector is a line, the span of two (non-parallel) vectors is a plane, and so on.

  • Linear Independence: If your vectors are linearly independent, they span the highest possible dimensional subspace. Otherwise, they span a smaller subspace.