Least Squares Solver using Normal Equations
Find the best approximate solution to \(A \mathbf{x} \approx \mathbf{b}\) using the Normal Equations1.
Solves \(A^TA\mathbf{x} = A^T\mathbf{b}\) to minimize \(\| A \mathbf{x} - \mathbf{b} \|_2\)2.
The Normal Equations provide a direct method for solving least squares problems:
\[ A^TA\mathbf{x} = A^T\mathbf{b} \]
Derivation:
Minimizing \(\| A\mathbf{x} - \mathbf{b} \|_2^2\) requires the gradient to be zero:
\[ \nabla_{\mathbf{x}} \| A\mathbf{x} - \mathbf{b} \|^2 = 2A^T(A\mathbf{x} - \mathbf{b}) = \mathbf{0} \]
Key Points:
Enter dimensions and click Generate Matrix to create the input grid and b vector.
1 — Set Up
Loads a pre-filled 4×2 overdetermined system — ready to compute.
2 — Compute
Solves the least-squares problem via the normal equations AᵀAx = Aᵀb.
Resets all dimensions, matrix entries, and results.