Question
Why QDU solves the projected least squares system
Original question: If you have a coefficient matrix A = QDU and you're trying to solve an inconsistent system AX = B, why is it that solving (QDU)X = B gives you the solution to AX = Proj (B) [onto col(A)]? And why isn't that a true solution to AX = B?
Expert Verified Solution
Key takeaway: For an inconsistent linear system, the factorization A = QDU helps separate the column-space geometry from the algebra. The equation (QDU)X = B is not really being solved against the original B in the full space; it is solved after projecting B onto col(A), which is the part A can actually produce.
The key idea: only vectors in col(A) are attainable
If the system is inconsistent, that means is not in the column space of . So there is no vector such that equals the original exactly. What the factorization gives you is a clean way to separate the part of that lies inside from the part that lies outside it.
Because the columns of span , any exact output of must live in that subspace. If has a component orthogonal to , that component cannot be matched by any choice of .
Why solving really means solving against the projection
In practice, the factor is orthogonal, so it preserves lengths and angles. The decomposition is arranged so that the action of maps coordinates in the domain into the subspace where the data live. When is not in , the best you can do is replace by its orthogonal projection onto :
That projected vector is the unique vector in closest to . Since every vector of the form must lie in , this is the meaningful target. The factorization lets you solve the reduced, compatible system inside the subspace where a solution actually exists.
Why this is not a true solution to the original system
A true solution to would require exact equality with , not just the closest vector in the column space. If , then the residual
cannot be zero. Instead, for the least-squares or projected solution, that residual is orthogonal to , which is the geometric condition characterizing the best approximation.
So is only a formal way of writing the computation after you reinterpret the right-hand side as its projection. It does not contradict inconsistency, because the actual solved equation is
not .
The geometry behind the factorization
The factorization is useful because it isolates three roles: changes coordinates, scales along independent directions, and rotates or reflects into the subspace geometry. This makes it easier to see that the system is solvable exactly only for right-hand sides inside the image of .
When is outside that image, the orthogonal projection is the best possible replacement. That is why the factorization naturally leads to the projected system and to least-squares behavior.
Pitfalls the pros know 👇 A common mistake is to think that writing automatically means you have solved the original inconsistent system. That is not correct unless already lies in . Another pitfall is to confuse the algebraic manipulation with the geometric meaning: the factorization does not create a true solution out of nothing. It only makes the closest attainable right-hand side explicit. The residual does not disappear; it becomes the part of orthogonal to the column space.
What if the problem changes? If the system were consistent, meaning , then the projection would satisfy , and solving the factored system would give a true exact solution to . A different variant is when you solve the normal equations instead. That formulation also produces the least-squares solution, but it uses the orthogonality condition directly rather than the geometry. In both cases, the computed minimizes the error when exact equality is impossible.
Tags: column space projection, least squares solution, orthogonal residual
FAQ
Why does solving the factored system give the projection onto the column space?
Because every vector of the form AX must lie in col(A), the closest attainable right-hand side to an inconsistent B is its orthogonal projection onto col(A). The QDU factorization organizes that projection algebraically and geometrically.
Why is the projected solution not an exact solution to the original linear system?
It is not exact unless B already lies in col(A). When B has a component outside the column space, no choice of X can make AX equal B, so the residual remains nonzero even though it is orthogonal to col(A).