Least Squares Solver using SVD and the Pseudoinverse
Compute the least squares solution \(\mathbf{x} = A^{\dagger}\mathbf{b}\) using the Moore-Penrose pseudoinverse1.
Most robust method for rank-deficient and ill-conditioned matrices2.
The SVD-based method uses the pseudoinverse to solve least squares problems:
\[\mathbf{x} = A^{\dagger}\mathbf{b}\]
How it works:
Compute SVD: \(A = U\Sigma V^T\), then form the pseudoinverse:
\[A^{\dagger} = V\Sigma^{\dagger}U^T\]
where \(\Sigma^{\dagger}\) inverts nonzero singular values and transposes.
Advantages:
- Handles rank-deficient matrices automatically
- Most numerically stable method3
- Provides minimum-norm solution for underdetermined systems
- Reveals condition number and numerical rank
Enter dimensions and click Generate Matrix to create the input grid and b vector.
1 — Set Up
Loads a pre-filled 3×2 overdetermined system — ready to compute.
2 — Compute
Solves the least-squares problem via SVD and the pseudoinverse A⁺ = VΣ⁺Uᵀ.
Resets all dimensions, matrix entries, and results.