Skip to main content
The new Teacher Workspace is here. Your first 3 assignments are free. Try it →

Least squares method

The least squares method is a way to find the best fitting line or vector by minimizing the sum of squared errors. In Linear Algebra and Differential Equations, it shows up when a system has no exact solution and you need the closest approximation.

Last updated July 2026

What is the least squares method?

The least squares method is the standard way to find the best approximating vector when a system has no exact solution. In Linear Algebra and Differential Equations, that usually means you have more equations than unknowns, so you cannot satisfy every equation at once and instead choose the solution that makes the total squared error as small as possible.

The idea is to measure how far your candidate solution is from the target using squared distances. Squaring the errors does two things: it keeps positive and negative mistakes from canceling out, and it makes larger errors count more than smaller ones. That is why the least squares answer is not just any close answer, it is the one that gives the smallest overall mismatch.

Geometrically, least squares is tied to orthogonal projection. You can think of the target vector as sitting outside a subspace, and the method finds the point in that subspace closest to it. That closest point is the best approximating vector, and the leftover difference is the residual, which is orthogonal to the subspace spanned by the columns of the design matrix.

The algebraic setup usually starts with a matrix equation Ax = b. If no exact x exists, you solve the normal equations A^T A x = A^T b instead. This comes from projecting b onto the column space of A, and the solution gives the coefficient vector that produces the closest fit.

A small example makes the idea clearer. Suppose two equations disagree because of noisy data or an overconstrained model. Least squares does not force a fake exact answer, it finds the x value that makes the total squared residual as small as possible. That is why the method shows up in regression, curve fitting, and any place where the data is approximate rather than perfectly consistent.

A common mistake is to think least squares means minimizing the absolute error or making every residual tiny one by one. It does not. It minimizes the sum of squared residuals, which is a very specific objective and leads directly to projection and matrix methods.

Why the least squares method matters in Linear Algebra and Differential Equations

Least squares shows up whenever the course moves from exact solutions to approximation. That shift matters because many real systems are inconsistent, overdetermined, or built from measured data, so there is no exact vector that satisfies every equation.

This concept connects the algebra of matrices to the geometry of subspaces. Instead of treating a system as a list of unrelated equations, you start reading it as a projection problem: which vector in the column space is closest to the target vector? That viewpoint is one of the big ideas in Linear Algebra and carries into differential equations when approximate models or fitted parameters appear.

It also gives meaning to residuals. A residual is not just leftover error, it tells you how far the chosen solution misses the data and whether the model is a decent fit. If the residuals are large or patterned, the model may be a poor choice, or the data may not match the linear assumptions behind the method.

You also need least squares to work with design matrices, coefficient vectors, and normal equations without treating them like separate formulas. They are part of one process: build the matrix, project onto its column space, and solve for the coefficients that create the best fit. That process comes up again and again in homework problems that ask you to approximate data or solve an inconsistent system using matrix algebra.

Keep studying Linear Algebra and Differential Equations Unit 6

Official unit cheatsheet

open one-pager

How the least squares method connects across the course

Residuals

Residuals are the differences between the actual vector or data value and the value predicted by your model. Least squares chooses the solution that makes the sum of squared residuals as small as possible. When you check a problem, the residual tells you how far off the approximation is after projection.

Orthogonal Projection

Least squares is really a projection idea in disguise. You project the target vector onto the column space of the matrix, and that projection is the closest vector you can get inside the subspace. If you understand projection, the least squares solution stops feeling mysterious and starts looking geometric.

Normal Equations

The normal equations are the matrix equations you solve to get the least squares coefficients. They come from setting the residual orthogonal to the column space, which turns the approximation problem into A^T A x = A^T b. Many class problems ask you to move from the data matrix to this system.

Design Matrix

The design matrix is the matrix built from the basis vectors or model terms you want to use. In least squares, its columns define the subspace you are projecting onto, so the design matrix determines what counts as the best fit. Changing the matrix changes the approximation space.

Is the least squares method on the Linear Algebra and Differential Equations exam?

A problem set question usually gives you a matrix A and a vector b, then asks for the least squares solution or the best fitting line. You set up the normal equations, solve A^T A x = A^T b, and interpret x as the coefficient vector for the closest approximation. If the problem is geometric, you may be asked to identify the projection of b onto the column space of A.

You also need to explain the residual if the question asks for interpretation. The residual is the gap between the actual vector and the projected vector, and it should be orthogonal to the column space in a correct least squares solution. If a quiz includes data fitting, you may be asked why least squares is better than trying to force an exact solution, especially when the system is inconsistent or noisy.

The least squares method vs normal equations

The least squares method is the whole approach for finding the best approximation, while the normal equations are the specific linear system you solve to get that answer. The method explains what you are doing, and the normal equations are one algebraic tool for doing it. Students often use the terms interchangeably, but they are not the same thing.

Key things to remember about the least squares method

  • The least squares method finds the closest solution when a system has no exact answer.

  • It minimizes the sum of squared residuals, not the sum of absolute errors.

  • Geometrically, least squares is an orthogonal projection onto a column space.

  • The normal equations turn the approximation problem into a solvable matrix equation.

  • Residuals tell you how far your approximation misses the target vector or data.

Frequently asked questions about the least squares method

What is the least squares method in Linear Algebra and Differential Equations?

It is the method for finding the best approximating solution to an inconsistent system or fitting model. Instead of forcing an exact answer, you minimize the squared distance between the predicted values and the actual vector or data. In this course, that usually means solving a matrix problem through projection.

How do least squares and orthogonal projection connect?

The least squares solution is the projection of the target vector onto the column space of the matrix. That projected vector is the closest one in the subspace, so the error vector is orthogonal to the subspace. This geometric view is one of the cleanest ways to understand why the method works.

Are least squares and normal equations the same thing?

No. Least squares is the method, and the normal equations are the equation system you often use to find the least squares solution. The normal equations come from the projection condition, but they are just one way to compute the best fit.

What does a residual mean in a least squares problem?

A residual is the difference between the observed vector or data value and the value predicted by your approximation. In a correct least squares solution, the residual is orthogonal to the column space of the design matrix. Big or patterned residuals can show that the model is not a good fit.

Least Squares Method | Linear Algebra | Fiveable