Introduction
In our last lesson, we established that the rank of a matrix tells us the "true" dimensionality of the data it represents by counting its linearly independent columns. We saw this as the dimension of the column space—the set of all possible outputs of the transformation. Today, we put these concepts to work to answer one of the most fundamental questions in all of applied mathematics: when can we solve the equation ?
This simple equation is the mathematical heart of many machine learning models. Think of as a matrix of your data (e.g., gene expression values for different patients), as the unknown model parameters (e.g., weights indicating each gene's importance), and as the target outcomes you want to predict (e.g., a measure of disease severity). Solving for is equivalent to training your model.
In this lesson, you will learn to determine whether such a solution exists, whether it's unique, or if there are infinitely many possibilities. Understanding these three scenarios is crucial for diagnosing your models. It helps you recognize when a model can't possibly fit the data, or when it fits the data too well in a non-unique way, a classic sign of potential overfitting.
The Geometry of Solving Equations
Before diving into the conditions, let's build a strong geometric intuition for what is actually asking. The 3Blue1Brown video you've seen before provides a perfect visual explanation.
Inverse matrices, column space and null space | Chapter 7, Essence of linear algebra
This video, "Inverse matrices, column space and null space," interprets solving a system of equations as a geometric transformation problem.
Watch the segment from 02:08 to 07:43. Focus on these key ideas: The Core Question: Solving A\mathbf{x} = \mathbf{b} means finding a vector \mathbf{x} that, after being transformed by the matrix A, lands on the vector \mathbf{b}. The Invertible Case: When A has a non-zero determinant (it's full-rank), the transformation can be perfectly reversed by its inverse, A^{-1}. There is one and only one \mathbf{x} that lands on \mathbf{b}. The Singular Case: When A has a zero determinant (it's rank-deficient), it squishes space into a lower dimension (a plane or a line). A solution only exists if you're "lucky" and \mathbf{b} happens to be on that plane or line.
This geometric view leads to two interpretations of the problem, both of which are useful.
- The Row Picture (Intersection of Hyperplanes): Each row of the equation defines a line (in 2D), a plane (in 3D), or more generally, a hyperplane. The solution is the single point where all these hyperplanes intersect. This is likely how you first learned to solve systems of equations in school.

- The Column Picture (Linear Combinations): The equation can be rewritten as a linear combination of the columns of , where the weights are the components of . A solution exists if and only if we can find some combination of the columns of that adds up to the vector . This directly connects to our previous lesson: a solution to exists if and only if is in the column space of .
This second perspective is far more powerful for understanding machine learning models.
Three Regimes: The Model Fitting Perspective
Let's analyze the three possible outcomes for a system in the context of model fitting. Here, is an matrix representing data points and features. The vector contains the model weights, and is the vector of target values.

1. Overdetermined Systems: Usually No Solution ()
This is the standard setup in supervised learning. You have more data points () than features ().
- What it means: You are asking your model to perfectly explain a large number of data points using a smaller number of parameters. Unless the data is perfectly clean and perfectly follows your model's assumptions (e.g., is perfectly linear), it's highly unlikely that will lie exactly in the column space of .
- Result: There is no exact solution.
- ML Implication: This is not a failure! It's the normal state of affairs. Our goal is not to find an that solves perfectly, but to find an that makes as close to as possible. This is called finding a least-squares solution, and it is the foundation of linear regression.
We can find an approximate solution by projecting onto the column space of .
Introduction to Linear Algebra for Applied Machine Learning ...
This section from "Introduction to Linear Algebra for Applied Machine Learning" explains the core idea behind handling unsolvable systems.
Read the short section titled "Projections as approximate solutions". The key takeaway is that when an exact solution doesn't exist, we find the best approximation \hat{\mathbf{y}} (or \hat{\mathbf{b}} in our notation) by projecting the target vector onto the column space of the data matrix.
2. Underdetermined Systems: Infinitely Many Solutions ( or )
This occurs when you have more features than data points, a common scenario in your field of computational biology (e.g., thousands of genes for a few dozen patients), or when your features are redundant (linearly dependent).
- What it means: The matrix has a non-trivial null space. If a solution exists, you can add any vector from the null space, , to it, and is also a solution.
- Result: If a solution exists, there are infinitely many solutions.
- ML Implication: This is a red flag for model instability and overfitting. Your model has too much flexibility. It can perfectly explain the training data in countless ways. These different solutions will likely give wildly different predictions on new, unseen data. This is precisely why techniques like L1 and L2 regularization are essential in high-dimensional settings; they add constraints to pick one "good" solution out of the infinite set.
3. Exactly Determined Systems: A Unique Solution ()
This is the textbook case where the matrix is square and full-rank (invertible).
- What it means: The number of independent features equals the number of data points. The transformation does not collapse space, and its column space is all of . The vector will always be in the column space.
- Result: There is always one unique solution, given by .
- ML Implication: This is rare in practice. It represents a perfectly balanced problem where the model has just enough complexity to perfectly explain the data.
A Systematic Framework: Rank, , and
Professor Gilbert Strang of MIT provides a comprehensive framework for analyzing the number of solutions by comparing the rank () to the matrix dimensions ( and ).
8. Solving Ax = b: Row Reduced Form R
This clip from Prof. Strang's lecture "Solving Ax = b: Row Reduced Form R" summarizes how rank determines the number of solutions.
Watch the segment from 24:56 to 46:40. This is a rich and dense summary. Focus on the four cases he outlines, which depend on the relationship between rank r, rows m, and columns n. Don't worry about the row-echelon form details; absorb the high-level conclusions for each case.
Here is a summary of that logic, which is the core of this lesson:
| Case | Description | Solvability & Uniqueness | ML Interpretation |
|---|---|---|---|
| Full Column Rank |
Tall Matrix. No redundant features. | 0 or 1 solution. A unique solution exists if is in C(A). | Standard regression setup. Usually no exact solution, so we find the best approximate one (least squares). |
| Full Row Rank |
Wide Matrix. Columns are dependent. | Infinitely many solutions. A solution exists for every . | Underdetermined problem. Prone to overfitting. Requires regularization to select a meaningful solution. |
| Full Rank (Square) |
Invertible Matrix. | Exactly 1 solution for every . | A perfectly posed problem. Theoretically ideal but rare in practice. |
| Rank Deficient |
Neither Tall nor Wide. Redundant features and constraints on data. | 0 or infinitely many solutions. Never unique. | A combination of the above. An ill-posed problem that also might not have a solution for a given . |
This table is your guide to diagnosing a linear model. By understanding the shape of your data matrix and its rank, you can immediately anticipate the nature of the solutions your model can find.
The Structure of the Complete Solution
When there are infinitely many solutions, they all share a beautiful and elegant structure. The MIT video you just watched provides the intuition.
8. Solving Ax = b: Row Reduced Form R
This part of the lecture explains the structure of the complete solution set.
Watch the segment from 10:00 to 24:26. The main formula to understand is: \mathbf{x}_{\text{complete}} = \mathbf{x}_{\text{particular}} + \mathbf{x}_{\text{null}} Particular Solution (\mathbf{x}_p): This is any single vector that solves A\mathbf{x} = \mathbf{b}. Null Space Solution (\mathbf{x}_n): This is the set of all vectors that solve A\mathbf{x} = \mathbf{0}. Geometric Picture: The set of all solutions is a shifted subspace. It's the null space (which always passes through the origin) shifted by the particular solution vector.
This structure is incredibly powerful. It tells us that to find all infinite solutions, we only need to find one particular solution and then find the null space of the matrix. Adding any vector from the null space to our particular solution gives us another valid solution, because .
Conclusion
You have now connected the abstract properties of a matrix—its rank, column space, and null space—to the concrete problem of solving and fitting a model to data.
Key Takeaways:
- Solving means finding a linear combination of the columns of that equals . A solution exists if and only if is in the column space of .
- The nature of the solution set is determined by the relationship between the rank (), the number of data points (), and the number of features ().
- Overdetermined (): Typically no exact solution. This is the standard case for regression, where we seek an approximate solution.
- Underdetermined (): Typically infinitely many solutions. This suggests an ill-posed problem common in high-dimensional fields like genomics, necessitating regularization.
- Full Square Rank (): Always a unique solution. This is the invertible, well-behaved case.
- When infinite solutions exist, the complete solution set is a shifted subspace: .
In your own cancer classification project, you are almost certainly in an underdetermined regime (n > m), as the number of genes or other biomarkers typically far exceeds the number of patient samples. This lesson should make it clear why standard linear models might be unstable or non-unique, and it provides the conceptual groundwork for understanding why techniques like Lasso or Ridge regression (which we'll touch on later) are not just optional but essential for finding meaningful biological insights.
In the next lesson, we will dive deep into the most common scenario: the overdetermined system. We will formalize the idea of an "approximate solution" by exploring geometric projection and deriving the normal equations, which provide the exact solution to the least-squares problem at the heart of linear regression.