Hello! Welcome back to our study of linear algebra through the lens of deep learning.
In our last lesson, we began dissecting the geometry of a linear layer by introducing its column space and null space. We saw the column space as the set of all possible outputs—the layer's activation space—and the null space as the set of inputs that are completely discarded. Today, we will complete this picture by introducing the two remaining fundamental subspaces and exploring the elegant, symmetric relationships that bind all four together. This structure, often called the Fundamental Theorem of Linear Algebra, provides a complete blueprint for understanding information flow and bottlenecks in any linear transformation.
The Four Fundamental Subspaces
For any matrix , there are four associated subspaces that define its behavior as a linear map from to . We've met two; let's now meet all four.
- Column Space, : The span of the columns of . A subspace of the output space, .
- Null Space, : The set of all vectors such that . A subspace of the input space, .
- Row Space, : The span of the rows of . Since rows are conventionally vectors, we can think of this as the column space of the transposed matrix, . It is a subspace of the input space, .
- Left Null Space, : The null space of the transposed matrix . It contains all vectors such that , which is equivalent to . It's a subspace of the output space, .
Professor Gilbert Strang's lectures provide a classic, step-by-step introduction to these four spaces using a concrete example. His intuitive approach is perfect for establishing the definitions.
The Four Fundamental Subspaces and Least Squares
This video walks through the definition and construction of each of the four fundamental subspaces for a sample matrix. Professor Strang's clear, example-driven style makes the concepts very tangible.
Please watch the following segments to see how each subspace is defined and visualized: Introduction: Prof. Strang introduces the four subspaces and frames them in the context of data science where matrices are often rectangular. He shows the "big picture" diagram we're aiming to understand. Column Space: A quick review of the column space, which you'll recall is the set of all linear combinations of the columns. Row Space: Here, he introduces the row space by transposing the matrix and examining its column space. Notice how it's a subspace of the input space \mathbb{R}^n (in his example, a plane in 3D). Null Space: A review of the null space A\mathbf{x}=\mathbf{0}. Pay attention to how he finds a specific vector that lies in this space for his example matrix. Left Null Space: The final subspace, N(A^T), is introduced. In his example, this space is trivial (containing only the zero vector), but he explains the general idea. Review and Rank: Prof. Strang recaps the dimensions of the four subspaces for his example and states the crucial fact that the dimension of the row space and column space are identical. This dimension is the rank of the matrix, denoted r.
The Big Picture: Orthogonality and Decomposition
The true power of this framework comes from the relationships between the subspaces. The four spaces form two pairs of orthogonal complements.
- The row space is orthogonal to the null space . Together, they span the entire input space .
- The column space is orthogonal to the left null space . Together, they span the entire output space .
This structure has a profound implication. Any vector in the input space can be uniquely decomposed into two orthogonal components: one in the row space () and one in the null space ().
When we apply the transformation , look what happens:
By definition, , so the equation simplifies to:
This is a critical insight: the matrix transformation only acts on the component of the input that lies in its row space. The null space component is completely annihilated. The row space can be seen as the domain of "effective inputs."
The following short video provides an excellent visualization of this decomposition and mapping.
04.2.1 Visualizing the Four Fundamental Spaces
This animation cleanly illustrates the 'big picture' diagram that Professor Strang introduced, showing how an input vector is decomposed and mapped between the subspaces.
Watch the full clip (Visualizing the Four Spaces), paying close attention to how the input vector x is split into x_r (in the row space) and x_n (in the null space), and how only x_r contributes to the final output vector b.
Finding the Subspaces: The Role of SVD
This theoretical framework is beautiful, but how do we find orthonormal bases for these subspaces in practice? The answer lies in the Singular Value Decomposition (SVD).
As a brief refresher, the SVD of any matrix is a factorization of the form:
Where:
- is an orthogonal matrix whose columns are the left singular vectors.
- is an diagonal matrix containing the non-negative singular values.
- is an orthogonal matrix whose columns are the right singular vectors.
Geometrically, this factorization decomposes any linear transformation into a sequence of three fundamental operations: a rotation (), a scaling along axes (), and another rotation ().

The true magic is that the matrices and directly provide orthonormal bases for the four fundamental subspaces. The following resource explains this connection with remarkable clarity.
5. Singular Value Decomposition (SVD)
This text provides a concise but comprehensive explanation of how the SVD provides a complete, orthonormal basis for each of the four fundamental subspaces.
Please read the section 5.4. Four Fundamental Subspaces. Start by reviewing the definitions of the four subspaces. Then, focus on the core argument that follows. The text shows how partitioning the SVD matrices U and V based on the rank p of the matrix reveals the bases. The key conclusion is summarized in the equations labeled (5.7), which I've re-stated below for clarity. Pay close attention to how this section explicitly links the columns of U and V to each subspace.
Let's consolidate the key result from the reading. If the rank of is , we can partition the columns of and accordingly:
- The first columns of , denoted , form an orthonormal basis for the row space of .
- The remaining columns of , denoted , form an orthonormal basis for the null space of .
- The first columns of , denoted , form an orthonormal basis for the column space of .
- The remaining columns of , denoted , form an orthonormal basis for the left null space of .
The SVD doesn't just tell us these subspaces exist; it hands us a perfectly structured, orthogonal basis for each one. This makes it an exceptionally powerful tool for analysis.
Information Flow in a Neural Network Layer
Let's apply this complete picture to a linear layer with weight matrix , mapping from an -dimensional input space to an -dimensional output space.
-
Row Space : This is the subspace of inputs that the layer is "sensitive" to. Any component of an input vector that is orthogonal to this space (i.e., in the null space) will be annihilated. Thus, is the effective input space. A low-rank weight matrix implies that the layer is only paying attention to a small subspace of its possible inputs.
-
Null Space : This is the subspace of "invisible" inputs. Any patterns or features described by vectors in are completely discarded. This is the source of information loss or compression. In a layer like
nn.Linear(1024, 128), the null space has a dimension of at least . The layer is explicitly designed to ignore most of the input space. -
Column Space : As we knew, this is the activation space—the range of possible outputs. Any output from this layer must lie in this subspace. If the rank , the layer cannot produce any vector with a component outside of this -dimensional subspace, creating an information bottleneck.
-
Left Null Space : This is the "unreachable" subspace in the output domain. It consists of all directions in the output space that the layer can never produce, no matter the input. If , then for any , the output will be orthogonal to . This describes the built-in constraints on the layer's output geometry. For an autoencoder's decoder, this would represent shapes or patterns that the network is fundamentally incapable of generating.
By analyzing the four fundamental subspaces of a weight matrix, you gain a complete geometric understanding of how it transforms information—what it preserves, what it discards, what it can produce, and what it cannot.
Conclusion
Today, we've assembled the complete picture of how a matrix transforms a vector space.
Key Takeaways:
- Any matrix has four fundamental subspaces: the row space, null space, column space, and left null space.
- These subspaces form two pairs of orthogonal complements, which decompose the input and output spaces entirely: and .
- The transformation annihilates the null space component of and maps the row space component of to the column space.
- The Singular Value Decomposition (SVD), , provides orthonormal bases for all four subspaces through the columns of and .
- In a neural network, these subspaces define the information flow: the row space is the effective input, the null space is information loss, the column space is the achievable output, and the left null space represents unreachable outputs.
This understanding of the complete structure of a linear map is not just theoretical. In our next lesson, we will see how we can exploit this structure by using the SVD to create low-rank approximations of matrices, a technique with direct connections to modern model compression methods like LoRA.