CPBS 7620 - Lecture 10 - Pseudoinverse
Overview
Nicholas Dwork explains the pseudoinverse as a way to solve least-squares problems when a matrix is not invertible: project B onto the image of A, then choose the minimum-norm X that maps to that projection. He derives the full-rank formulas for tall and skinny and short and fat matrices, recommends numerically stable software such as MATLAB's lsqminnorm and NumPy's numpy.linalg.lstsq, and applies least squares to warfarin-dose prediction.
Key takeaways
- Least squares finds the point in image(A) closest to B, so its residual is orthogonal to the columns of A.
- When A has a nontrivial null space, adding any vector from null(A) preserves AX; the pseudoinverse resolves this ambiguity by choosing the solution with the smallest L2 norm.
- For full-column-rank tall matrices, A⁺ = (AᵀA)⁻¹Aᵀ; for full-row-rank wide matrices, A⁺ = Aᵀ(AAᵀ)⁻¹.
- The normal-equation formulas are useful for derivation but can be numerically unstable; MATLAB's lsqminnorm and NumPy's numpy.linalg.lstsq provide more stable computational methods.
- Warfarin-dose regression represents patient characteristics as numerical features and fits a coefficient vector, with predicting the square root of dosage working better than predicting dosage directly.
Chapters
- For invertible A, the solution is X = A⁻¹B, which makes the residual AX − B equal zero.
- For non-invertible A, least squares minimizes the L2 norm of AX − B by projecting B onto the image of A.
- If A has a nontrivial null space, adding any null-space vector to a minimizer leaves AX unchanged, so infinitely many least-squares solutions can exist.
- The pseudoinverse selects the minimum-norm solution, a useful choice when large inputs have a cost such as spacecraft thruster fuel.
- For tall, skinny, full-column-rank A, the residual B − AX* lies in the null space of Aᵀ, yielding the normal equations AᵀAX* = AᵀB.
- The tall-matrix pseudoinverse is A⁺ = (AᵀA)⁻¹Aᵀ, so X* = A⁺B.
- For short, fat, full-row-rank A, every B is reachable, but the null space of A creates multiple solutions; orthogonality between image(Aᵀ) and null(A) makes the minimum-norm solution lie in image(Aᵀ).
- The short-matrix pseudoinverse is A⁺ = Aᵀ(AAᵀ)⁻¹, giving the minimum-norm exact solution X* = A⁺B.
- Although full-rank formulas are analytic, Dwork warns that they are numerically unstable; he names MATLAB's lsqminnorm and Python's numpy.linalg.lstsq as practical alternatives.
- The lecture identifies linear regression, system identification, experiment planning, and data fusion as applications of least squares.
- A warfarin study encodes patient age, height, weight, gene variants, race, and medication use as features, then fits coefficients to predict stable dosage.
- The initial linear model predicted dose poorly; changing the target to the square root of dose improved the fit, allowing dosage estimates from a new patient's feature vector.
Transcript excerpt
0:00 Hi, I'm Nicholas Dwork, and in this lecture, we'll discuss the pseudo inverse. Recall that if we have two vectors A and B, and we want the projection of A onto B, we drop this perpendicular line, and that gives us the projection. The projection of A onto B is the point along B closest to A. Also, if we want a vector perpendicular to B, we can simply subtract this projection from A as shown. We can also project a vector onto a subspace. In this case, the subspace we're considering is the XY plane. Here, we're showing a vector in three dimensions A. And this vector here is the projection of A onto the XY plane. Again, the projection of A onto the XY plane is the point in the plane closest to A. Suppose we know that A and B such that
0:49 AX is approximately equal to B. We want to find X. If A is invertible, then we simply left multiply by A inverse. That gives us X is approximately equal to A inverse B. What if A is not invertible? Recall that AX is a vector. We could find an X such that AX is as close to B as possible. Formally written, this is an optimization problem. We're going to minimize the L2 norm of AX minus B. This is the least squares problem. This is what has led technological development for the last 200 years. We want to make sure that if A is invertible, the solution is still reasonable. So, let's consider an invertible A, and let X equal A inverse B.
1:38 AX minus B then is equal to A times A inverse B minus B, and that ends up equaling zero. Therefore, the solution to this problem X star is equal to A inverse times B,
This is the start of the transcript. Save this video free for the whole transcript, searchable and time-coded.
In this course
Related notes
Summary, takeaways, and chapters were generated by AI from the video's transcript and may contain errors. The video belongs to its creator, Nicholas Dwork.