LearnViz Math
Expert ▦ Linear Algebra Topic 58 of 104

Least Squares

Best approximate solution minimising error.

Key idea

Best approximate solution minimising error.

In depth

When Ax = b has no solution, minimise |Ax − b|². The solution satisfies the normal equations AᵀA x̂ = Aᵀb. Geometrically Ax̂ is the projection of b onto the column space.

Worked example

Fit y = c + dx to (0, 1), (1, 2), (2, 2): solve AᵀA x̂ = Aᵀb to get c = 7/6, d = 1/2.

Formula

AᵀA x̂ = Aᵀb

Real-world uses

Common mistake

Using least squares when the data have outliers without checking.

How to learn this

  1. Read the key idea and say it in your own words.
  2. Work through the worked example, then try a similar problem.
  3. Use the interactive lesson’s visual and mini-quiz to check the pattern.

Frequently asked questions

What is Least Squares?

Best approximate solution minimising error. It is a topic at the expert level in Linear Algebra.

What is the formula for Least Squares?

The key formula is AᵀA x̂ = Aᵀb.

Where is Least Squares used in real life?

Real-world examples: Fitting a best line to noisy sensor readings; Estimating prices from house features.

What should I learn before Least Squares?

Make sure you are comfortable with QR Decomposition, the previous topic in Linear Algebra.

What is a common mistake with Least Squares?

Using least squares when the data have outliers without checking.

How can I practise Least Squares?

Open the interactive lesson, play with the visual, then answer the three-question mini-quiz. Getting two right marks the topic complete.

What comes after Least Squares?

Move on to Linear Regression via Matrices next.

Related expert topics in Linear Algebra