Skip to main content

Welcome to a Grasp lesson

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

Lesson 15

The Moore-Penrose Pseudoinverse and Minimum-Norm Solutions

Recommended resources

Introduction

In our last lesson, we confronted a critical failure mode in linear regression: multicollinearity. We saw that when features in our dataset are linearly dependent, the matrix becomes singular, and the normal equations suddenly have infinitely many "best-fit" solutions for the model's parameters, . This destroys our ability to interpret the model, as the coefficients are no longer unique.

This naturally raises a practical question: if there are infinite solutions, which one should we choose? And how do computer packages like NumPy or R often return a single answer without crashing? This lesson provides the answer by introducing a powerful generalization of the matrix inverse. You will define the Moore-Penrose pseudoinverse, denoted , and discover its elegant role in resolving ambiguity. Specifically, you will learn how it allows us to select the single, unique solution from an infinite set that is "smallest" or "simplest"—the one with the minimum norm.


Generalizing the Inverse

The concept of a matrix inverse, , is restrictive. It only exists for square matrices that perform a non-collapsing transformation (i.e., have a non-zero determinant). However, in data science, we constantly work with non-square matrices.

  • Overdetermined systems (tall, skinny matrices, ): We have more data points than features. An exact solution to is unlikely.
  • Underdetermined systems (short, fat matrices, ): We have more features than data points, leading to infinite solutions.
  • Rank-deficient systems (our multicollinearity problem): The columns are not linearly independent, also leading to infinite least-squares solutions.

The Moore-Penrose pseudoinverse, , is designed to provide a "best" solution in all of these cases. The following video gives a superb conceptual overview of how the pseudoinverse handles both overdetermined and underdetermined systems.

Linear Systems of Equations, Least Squares Regression, Pseudoinverse

This video from Steve Brunton's series clearly explains why we need to generalize the inverse and what the pseudoinverse accomplishes in the two main scenarios.

Please watch the following segments: Introduction to generalization: Understand why the SVD is key to generalizing solutions beyond square matrices. Underdetermined systems: Focus on the case of a "short, fat" matrix where there are infinitely many solutions. This is the most direct analogy to our rank-deficient problem. Overdetermined systems: This describes the standard linear regression setup where we seek a best-fit (least-squares) solution. Optimal properties: This is the most important part. Pay close attention to the conclusion that for underdetermined systems, the pseudoinverse finds the solution \hat{\mathbf{x}} with the minimum 2-norm. For overdetermined systems, it finds the least-squares solution.

The video makes a crucial point: the pseudoinverse unifies these problems. When we have a rank-deficient least-squares problem, we have both issues at once: we can't find a perfect solution, so we settle for the least-squares projection , but then we find there are infinitely many coefficient vectors that produce this projection. The pseudoinverse resolves this by selecting the unique vector from that infinite set that has the smallest possible length, i.e., the minimum norm solution.

This is an incredibly useful principle: when faced with ambiguity, pick the simplest explanation. In this context, "simplest" means the vector of coefficients with the smallest magnitude, .


Defining the Pseudoinverse

Let's formalize this. The pseudoinverse is a matrix that allows us to find the optimal solution for the system simply by computing .

Inverses and pseudoinverses. Numerical issues, speed, symmetry.

This article introduces the pseudoinverse and connects it to the optimization problems we've been discussing.

Read the first three paragraphs of the article, from the introduction down to the statement that the solution is given by x = A^+y. This text formally states that the pseudoinverse solves both the least-squares problem and the minimum-norm problem.

Now, how is actually computed?

Case 1: A has full column rank

In the scenarios we've studied where the columns of are linearly independent, is invertible. In this case, the pseudoinverse is exactly the matrix we derived for the least-squares solution:

Here, the pseudoinverse doesn't give us anything new; it just provides a new name for the matrix that projects onto the column space of to find the coefficients .

Case 2: A is rank-deficient

This is the interesting case from our last lesson. Here, is singular, so the formula above is undefined. We need a more fundamental way to compute . This is where the Singular Value Decomposition (SVD) becomes essential.

Recall that any matrix can be decomposed as . The pseudoinverse is defined by "inverting" the components of the SVD:

The key is understanding . The matrix is a rectangular diagonal matrix containing the singular values . To get its pseudoinverse, , we do two things:

  1. Take the reciprocal of all the non-zero singular values.
  2. Transpose the shape of the resulting matrix.

For example, if for a 3x2 matrix is:

Then its pseudoinverse is:

Notice that we don't try to invert the zero singular value—that would be division by zero! This is precisely how the SVD-based pseudoinverse gracefully handles rank deficiency. It inverts the parts of the transformation that are well-defined and ignores the dimensions that were collapsed to zero.

The following resources provide the formal definition and a clear derivation.

Linear Systems of Equations, Least Squares Regression, Pseudoinverse

Let's return to the Steve Brunton video to see how the SVD formula for the pseudoinverse is derived.

Watch the segment from 06:20 to 08:51. The logic is very direct: if A\mathbf{x} = \mathbf{b}, then U\Sigma V^T \mathbf{x} = \mathbf{b}. To solve for \mathbf{x}, you "peel away" the matrices U, \Sigma, and V^T by multiplying by their (pseudo)inverses in reverse order.

[PDF] Least Squares and Data Fitting

This PDF provides a concise, formal definition of the pseudoinverse using SVD.

On page 8, find the section titled "Pseudo-Inverse". Read the two bullet points starting from this definition. This text explicitly shows the SVD-based formula A^+ = V \Sigma^+ U^T and how to construct \Sigma^+.


The Minimum-Norm Solution Explained

Let's connect this back to our problem of infinite solutions. When is rank-deficient, the set of all least-squares solutions forms a line or a plane (an affine subspace). Every vector in this set gives the exact same prediction and therefore the same minimal error.

By calculating using the SVD method, we are implicitly selecting the one vector from this solution set that is closest to the origin.

This diagram illustrates the concept. The blue line represents the infinite set of least-squares solutions. All points on this line are "optimal" in terms of minimizing prediction error. The pseudoinverse selects the specific point that has the shortest distance to the origin, making it the unique minimum-norm solution.

This is a powerful and principled way to resolve the ambiguity of multicollinearity. In a practical ML setting, this means that even if your features are perfectly correlated (e.g., you accidentally included "height in meters" and "height in centimeters"), a solver using the pseudoinverse will return a stable, unique set of coefficients. It does so by distributing the predictive power among the correlated features in a way that keeps the total magnitude of the coefficient vector as small as possible.

2.9 The Moore-Penrose Pseudoinverse

This video provides a concrete numerical example of how the pseudoinverse finds the minimum-norm solution for an underdetermined system.

Watch the segment from 34:02 to 43:12. The presenter sets up a system with infinite solutions, makes a reasonable guess for a solution, calculates its norm, and then shows that the solution found via the pseudoinverse has an even smaller norm. This demonstrates the principle in action.


Conclusion

This lesson completes our journey through linear regression, from its geometric foundations to its practical failure modes and their elegant solutions.

Key Takeaways:

  • The Moore-Penrose pseudoinverse () generalizes the concept of a matrix inverse to any matrix, whether it's full rank, rank-deficient, square, or rectangular.
  • It provides a unified way to solve linear systems: for overdetermined systems, it gives the least-squares solution; for underdetermined or rank-deficient systems with infinite solutions, it selects the unique minimum-norm solution.
  • When is rank-deficient and is singular, the pseudoinverse cannot be computed with . Instead, it is computed using the Singular Value Decomposition (SVD) via the formula .
  • The SVD approach works by only inverting the non-zero singular values, providing a stable and robust solution even when the matrix represents a collapsing transformation.

You've now seen how a deep understanding of linear algebra concepts like column space, projection, rank, and the pseudoinverse allows you to not only implement machine learning models but also to understand and troubleshoot their failure modes.

In the next module, we will explore eigenvalues and eigenvectors. These concepts will provide a new perspective on linear transformations by revealing the special directions that remain unchanged. This will be the key to understanding the geometry of data variance and will lead us directly to Principal Component Analysis (PCA), one of the most important techniques in your computational biology toolkit.