Loading…

Least Squares Regression Solver

Math Linear Algebra • Applications and Advanced Linear Algebra (capstone)

View all topics

Solve the least squares problem min ||Ax − b||² using the normal equations \(A^{\mathsf T}A\,x=A^{\mathsf T}b\). For data points \((x_i,y_i)\), the calculator fits a best-fit line \(y\approx c_0+c_1x\), reports residual error, and plots the fit.

Data points
Fit \(y\approx c_0+c_1x\) from \((x_i,y_i)\).
# x y
Tip: points are converted to \(A=[\mathbf{1}\ \mathbf{x}]\) and \(b=\mathbf{y}\).
Ready
Results
Solution \(x\)
Residual norm \(\|Ax-b\|\)
SSE \(\sum r_i^2\) and RMSE
Fit equation (line mode)
Graph
Zoom with mouse wheel/trackpad, drag to pan, double-click to reset view. Click Play for animation.
Step-by-step
Enter inputs and click “Calculate”.

Rate this calculator

0.0 /5 (0 ratings)
Be the first to rate.
Your rating
You can update your rating any time.

Frequently Asked Questions

What does least squares regression compute?

It finds the vector x that minimizes the squared error ||Ax - b||^2, producing the best approximate solution when Ax = b cannot be satisfied exactly.

How are the normal equations used?

The calculator forms A^T A x = A^T b and solves this system for x. This x minimizes ||Ax - b||^2 when A^T A is invertible.

What do SSE and RMSE mean in the output?

SSE is the sum of squared residuals sum r_i^2. RMSE is sqrt(SSE/m) and gives an average-sized error per equation or data point.

Why do I see a residual bar chart instead of a fit line?

A line plot is only shown when the problem matches a 1D predictor line model (points mode or A with columns [1, x]). Otherwise the calculator plots residual magnitudes.