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 — Compute
Solves the least-squares problem via the normal equations AᵀAx = Aᵀb.
Resets all dimensions, matrix entries, and results.
Cite this tool
Kapita, S. (2026). Least Squares Solver using Normal Equations. Math Tools. https://doi.org/10.5281/zenodo.20981259
Kapita, Shelvean. "Least Squares Solver using Normal Equations." Math Tools, 2026, doi.org/10.5281/zenodo.20981259.
@online{kapita2026leastsquaresnormaleqns,
author = {Shelvean Kapita},
title = {{Least Squares Solver using Normal Equations}},
year = {2026},
organization = {Math Tools},
doi = {10.5281/zenodo.20981259},
url = {https://doi.org/10.5281/zenodo.20981259}
}