Nepedia
Back to Discover
Fluent Reader
🔢

Least squares

math Maturity 11-13 Next article →

Imagine you are looking at a scatter of dots on a graph. These dots represent real things we have measured, like the height of plants or the speed of a car.

Linear least squares2
Linear least squares2

Usually, these dots do not fall in a perfect, straight line. There are small gaps between the dots and the path we try to draw through them. We call these tiny gaps residuals. The least squares method is a way to find the very best path through these dots. It works by making the sum of the squared gaps as small as possible. This helps us create a model that truly fits the data we see.

Linear regression residuals
Linear regression residuals

To make this work, we look at how much each dot misses our line. We take each gap, or residual, and square it. Squaring means multiplying the number by itself. We do this so that negative gaps and positive gaps do not cancel each other out. Then, we add all those squared numbers together. The goal is to find the specific path where this total sum is the smallest it can be.

Linear regression residuals parabolic
Linear regression residuals parabolic

If the gaps look like they have a pattern, like a curve, we might use a different kind of model. This allows us to fit a shape that matches the data more closely.

Many famous thinkers helped develop this idea over hundreds of years. In 1700, Isaac Newton used a method of averages to study the equinoxes. Later, in 1750, Tobias Mayer used similar ideas to study the Moon. In 1757, Roger Joseph Boscovich used it to study the shape of the Earth. Pierre-Simon Laplace also worked on this problem in 1788 and 1789. He tried to find a way to minimize errors using a specific mathematical form. These early steps paved the way for the formal math we use today.

In 1805, Adrien-Marie Legendre published the first clear guide for this method. He showed how to use algebra to fit lines to data. Shortly after, Carl Friedrich Gauss published his own work in 1809. Gauss claimed he had used the method since 1795. He went even further by connecting least squares to the normal distribution.

Bendixen - Carl Friedrich Gauß, 1828
Bendixen - Carl Friedrich Gauß, 1828

This helped explain how errors usually behave in the real world. He even showed that the arithmetic mean is the best estimate for certain types of data.

This math is incredibly useful for predicting the future. A great example happened in 1801 with a new space rock called Ceres.

X33-ellips-1
X33-ellips-1

An astronomer named Giuseppe Piazzi found it, but it was soon lost behind the Sun. A young Gauss, who was only 24, used least squares to find its path. His math allowed Franz Xaver von Zach to find Ceres again. This proved that the method was a powerful tool for astronomy. Today, we still use these ideas to understand patterns in almost everything we measure.

471 words

Where will your curiosity go next?

Keep exploring at your chosen reading level.

🖼️ Images & Media (6)
File:Linear least squares2.svg
Linear least squares2.svg
File:X33-ellips-1.svg
X33-ellips-1.svg
File:Bendixen - Carl Friedrich Gauß, 1828.jpg
Bendixen - Carl Friedrich Gauß, 1828.jpg
File:Linear regression residuals.svg
Linear regression residuals.svg
File:Linear regression residuals parabolic.svg
Linear regression residuals parabolic.svg
File:Linear regression residuals heteroscedastic.svg
Linear regression residuals heteroscedastic.svg
More to explore

What is Nepedia?

A free, ad-free encyclopedia for children. Every article is written at five reading levels, so the same page works for a five-year-old and a fifteen-year-old — use the level switcher above to see this one change. No account needed to read.