On this page
Every lab report that fits a line through scattered points uses the method of least squares. Our post on Carl Friedrich Gauss covers his use of it to find the asteroid Ceres and the priority dispute that followed. This post is about the person who published it first, Adrien-Marie Legendre, what he actually wrote in 1805, and how the method handles equations that cannot all be true at once.
Who was Legendre?
The MacTutor biography gives his dates as 18 September 1752 to 10 January 1833, both in Paris. From a wealthy family, he studied at the Collège Mazarin and taught with Laplace at the École Militaire from 1775 to 1780. He won the 1782 Berlin Academy prize for an essay on the paths of projectiles through air.
His work ranged widely. He introduced what are now called Legendre polynomials, worked on number theory, and spent some 40 years on elliptic integrals. In 1787 he joined the survey linking the Paris and Greenwich observatories, and was elected to the Royal Society of London. His *Éléments de géométrie* (1794) replaced Euclid as the standard geometry textbook across much of Europe for about a century, and it included a simple proof that π is irrational and the first proof that π² is irrational.
What problem was he solving?
The book was *Nouvelles méthodes pour la détermination des orbites des comètes*, and the scanned 1805 edition on the Internet Archive carries the date "An XIII, 1805" on its title page. Its appendix is headed "Sur la méthode des moindres quarrés", on the method of least squares.
Legendre starts with a situation common in astronomy and surveying: many equations of the form E = a + bx + cy + ..., where the coefficients come from observations and the error E should be zero or very small. If there are as many equations as unknowns, you can make every error zero. But usually there are more equations than unknowns, and then, he writes, it is impossible to eliminate all the errors.
He then proposes his principle. In our translation: of all the principles one could propose, he thinks none is more general, more exact or easier to apply than making the sum of the squares of the errors a minimum. "By this means," he continues, "a kind of equilibrium is established among the errors", which stops the extreme ones from dominating and reveals the state of the system closest to the truth.
He also showed that taking the average of repeated measurements is a simple consequence of the method, and he gave it the name it still has. MacTutor adds that Gauss published his own version in 1809 and claimed priority, which hurt Legendre deeply. Stephen Stigler's study of the priority question (1981) is the standard account.
Worked example: three equations, two unknowns
The numbers here are a classroom example, not historical data. Suppose measurements give:
x + y = 3.2
x − y = 0.9
x + 2y = 4.0
No x and y satisfy all three. Following Legendre, minimise S = (x + y − 3.2)² + (x − y − 0.9)² + (x + 2y − 4.0)².
Setting ∂S/∂x = 0 and dividing by 2: (x + y − 3.2) + (x − y − 0.9) + (x + 2y − 4.0) = 0, so 3x + 2y = 8.1.
Setting ∂S/∂y = 0 and dividing by 2: (x + y − 3.2) − (x − y − 0.9) + 2(x + 2y − 4.0) = 0, so 2x + 6y = 10.3.
Multiply the first by 3: 9x + 6y = 24.3. Subtract the second: 7x = 14, so x = 2.0 and y = (8.1 − 6.0)/2 = 1.05.
The errors are now 3.05 − 3.2 = −0.15, 0.95 − 0.9 = 0.05 and 4.1 − 4.0 = 0.10. The sum of squares is 0.0225 + 0.0025 + 0.0100 = 0.035.
Compare with solving only the first two equations exactly: x = 2.05, y = 1.15. Then the third equation's error is 4.35 − 4.0 = 0.35, and the sum of squares is 0.1225, three and a half times larger. That is Legendre's equilibrium: least squares spreads the error instead of dumping it all on one equation.
What mistakes do students make with least squares?
Minimising the plain sum of errors. Positive and negative errors cancel, so many bad fits can make that sum zero. Squaring stops the cancelling.
Dropping the coefficient in step 2. The third equation contains 2y, so its bracket is multiplied by 2 when you differentiate with respect to y.
Trusting a fit with an outlier. Legendre himself said that if one error looks too large, the equation behind it may come from a faulty observation and can be set aside.
Our post on error propagation in measurements covers the uncertainty side of lab work. If setting up the derivatives in steps 1 and 2 is where you get lost, the Fermi Problem Library has worked problems with a step-by-step solver that explains the reasoning rather than printing an answer.
What can a student take from Legendre's way of working?
He did not hide the fact that real data disagree. He stated the problem honestly, more equations than unknowns, and proposed a clear rule for choosing among imperfect answers. Poisson wrote that Legendre wished to be spoken of only through his works, and his 1805 appendix is a good example of why: a short appendix, one principle, and a name that has lasted two centuries.
Try it now: fit the single value c to three readings, 10.2, 10.4 and 9.9, by minimising the sum of squared errors, and check that you get their average.



