Skip to main content

Welcome to a Grasp lesson

Create a free account to keep studying and create your own study path.

Lesson 4

Understanding Vector Span

Recommended resources

Hello! In our last lesson, we introduced the concept of linear independence to understand when a set of vectors contains redundant information. To do this, we briefly touched on the idea of span—the set of all vectors you can create from a given set of "building block" vectors.

Today, we're going to put the concept of span under the microscope. We'll move beyond using it as a stepping stone and explore it in its own right. You will learn to define the span of a set of vectors and, more importantly, develop a concrete, algorithmic method to determine if any given vector lies within that span. This is not just a theoretical exercise; it directly relates to your goal of understanding mechanistic interpretability. The "spaces" that contain neural network activations or weight matrices are, fundamentally, spans of vectors. Understanding what can and cannot be represented in such a space is a cornerstone of analyzing what a model has learned.

What is Span? The Geometry of Reachable Vectors

Let's begin by solidifying the geometric intuition. The span of a set of vectors is the collection of all possible vectors you can reach by performing linear combinations. A linear combination, as we've discussed, is the result of scaling your vectors and adding them together: .

The span is the answer to the question: "What are all the possible destinations we can reach if we are only allowed to scale and add our initial vectors ?"

The 3Blue1Brown video we watched in the last lesson provides an excellent visualization of this. Let's revisit a key segment with this new focus.

Linear combinations, span, and basis vectors | Chapter 2, Essence of linear algebra

This video, "Linear combinations, span, and basis vectors," gives the best visual intuition for span.

Please watch two segments: First, re-watch the explanation of linear combinations and span in 2D from this segment. Focus on how varying the scalars sweeps out a line (for collinear vectors) or the entire plane. Then, watch the extension to 3D from this part. Notice how the span of two non-collinear vectors in \mathbb{R}^3 is a plane passing through the origin.

As the video illustrates, the geometry of the span depends on the vectors involved:

  • The span of a single non-zero vector is a line. It consists of all scalar multiples .
  • The span of two non-collinear vectors is a plane.
  • The span of three linearly independent vectors in is all of .

The image below visualizes the span of two vectors in 3D space. Any vector that can be formed by adding a scaled version of the first vector to a scaled version of the second will have its tip on that blue plane.

The span of a set of vectors in \(\mathbb{R}^3\) may form a plane. Any vector lying on this plane is said to be "in the span" of the original vectors.

The Algebraic Test: Is a Vector in the Span?

Visual intuition is powerful, but we need a systematic, computational method to determine if a vector lies in the span of a set of vectors .

The question "Is in the span?" is algebraically equivalent to asking: "Do there exist scalars such that this equation is true?"

This vector equation should look familiar. It's the definition of a system of linear equations. If we construct a matrix whose columns are our vectors, , and a column vector of the unknown scalars, , then the equation becomes:

So, the question transforms once more: A vector is in the span of the columns of a matrix if and only if the system is consistent (i.e., has at least one solution).

How do we test for consistency? We form the augmented matrix and perform row reduction. The system is inconsistent only if we find a row of the form where is a non-zero number. Any other outcome means a solution exists, and is in the span.

The following resource formalizes this exact connection.

2.3: The span of a set of vectors

This article from Mathematics LibreTexts provides a crisp, formal definition of span and its direct connection to the consistency of a linear system.

Please read the first section, "The span of a set of vectors". This section codifies the link between the geometric idea of a linear combination and the algebraic problem of solving A\mathbf{x}=\mathbf{b}.

Let's look at two examples that illustrate this procedure.

A simple case in \(\mathbb{R}^2\). The two vectors (orange and blue arrows) are collinear, so their span is a line. The point \(\mathbf{b}\) is clearly not on that line, so it is not in their span. An attempt to solve \(A\mathbf{c} = \mathbf{b}\) for this configuration would lead to an inconsistent system.

2.3: The span of a set of vectors

The same article contains two excellent examples that apply the row reduction method.

Focus on "Example 2.3.5" and "Example 2.3.7". In Example 2.3.5, the vectors \mathbf{v} and \mathbf{w} are linearly independent. Notice how the coefficient matrix row-reduces to the identity, guaranteeing a solution for any vector \mathbf{b}. This means their span is all of \mathbb{R}^2. In Example 2.3.7, the vectors are linearly dependent (collinear). The attempt to see if \mathbf{b} = [0, 2]^T is in the span leads to an inconsistent system (a row of [0 0 | 1]). This proves the vector is not in the span, which is just a line in this case.


When Does a Set of Vectors Span an Entire Space?

A crucial question in many applications is whether a set of vectors is "powerful" enough to generate every vector in the space. When does equal all of ?

The examples above give us the answer. For the span to be all of , the system must be consistent for every possible vector . This is only possible if the row-reduced echelon form of the coefficient matrix has a pivot position in every row.

Why? A pivot in every row ensures that it's impossible to create a contradiction row for any .

This leads to an important consequence. Since each pivot must be in its own column, a matrix with rows must have at least columns to have a pivot in every row.

This gives us two powerful propositions.

2.3: The span of a set of vectors

The final section of the article summarizes these key results.

Please read the two propositions at the end of the article, starting from Proposition 2.3.5. They state: A set of vectors spans \mathbb{R}^m if and only if their matrix has a pivot in every row. To span \mathbb{R}^m, you need at least m vectors.


Practice Problem

Let's put this together. Consider the vectors and .

Determine if the vector is in the span of .

Your Task:

  1. Set up the augmented matrix .
  2. Perform row reduction to find its echelon form.
  3. Based on the result, determine if the system is consistent and if is in the span.

Solution:

  1. The augmented matrix is .
  2. Row reduction proceeds as follows:
    • ;

  3. The last row corresponds to the equation , which is a contradiction. The system is inconsistent. Therefore, the vector is not in the span of . Geometrically, and define a plane in , and the vector does not lie on that plane.

Conclusion

In this lesson, we delved deep into the concept of span, moving from geometric intuition to a robust algebraic test.

Here are the key takeaways:

  • Span (Definition): The span of a set of vectors is the set of all possible linear combinations of those vectors.
  • Span (Geometry): Geometrically, the span is the line, plane, or higher-dimensional subspace that can be "reached" using the given vectors.
  • Testing for Span Membership: A vector is in the span of the columns of matrix if and only if the system is consistent. This is checked by row-reducing the augmented matrix .
  • Spanning an Entire Space: A set of vectors spans if and only if their matrix has a pivot in every row. This requires at least vectors.

We have now thoroughly investigated two pillar concepts: linear independence (a property of a set of vectors ensuring no redundancy) and span (the space generated by a set of vectors). What happens when a set of vectors has both of these properties? That is, what if it's perfectly efficient (linearly independent) and also generates the entire space we care about (it spans the space)? This ideal set of vectors is called a basis, and it will be the focus of our next lesson.