On this page
Two ideas from Carl Friedrich Gauss show up in almost every science stream: a quick way to add an arithmetic series, and a way to fit a line through messy data. One is a school trick; the other runs through every lab report and data science course. This post tells the story behind each, works through both with numbers, and ends with what a student can learn from how Gauss worked.
Who was Gauss?
The MacTutor biography from the University of St Andrews gives his dates as 30 April 1777, Brunswick, to 23 February 1855, Göttingen. He studied at Göttingen from 1795 to 1798, and by then had found how to construct a regular 17-sided polygon with ruler and compasses, which MacTutor calls the biggest advance in that field since Greek mathematics. His book on number theory, Disquisitiones Arithmeticae, appeared in 1801. In 1807 he became director of the Göttingen observatory. From 1832 he worked with Wilhelm Weber on terrestrial magnetism.
How did Gauss add 1 to 100?
MacTutor tells the story this way: at elementary school, his teacher and assistant "were amazed when Gauss summed the integers from 1 to 100 instantly by spotting that the sum was 50 pairs of numbers each pair summing to 101". Treat the details as a story handed down by biographers; the method is what matters.
Worked example.
Pair the first and last: 1 + 100 = 101. Then 2 + 99 = 101, 3 + 98 = 101, and so on.
There are 100 numbers, so 50 pairs.
Sum = 50 x 101 = 5,050.
In general, 1 + 2 + ... + n = n(n + 1)/2. For n = 100 that gives 100 x 101 / 2 = 5,050. The same pairing gives the sum of any arithmetic progression: number of terms x (first + last) / 2. For 7 + 11 + 15 + ... + 47, there are (47 - 7)/4 + 1 = 11 terms, so the sum is 11 x (7 + 47)/2 = 11 x 27 = 297.
Common mistake: with an odd number of terms, students worry the pairing breaks. It does not, because the formula n x (first + last)/2 already handles the middle term. Check: 1 + 2 + 3 + 4 + 5 = 5 x 6 / 2 = 15.
How did Gauss find a lost asteroid?
MacTutor explains that the Italian astronomer Piazzi discovered Ceres on 1 January 1801, but could follow it through only 9 degrees of its orbit before it vanished behind the Sun. Several astronomers published predictions of where it would reappear. Gauss's differed greatly from the others. When Ceres was found again on 7 December 1801, it was almost exactly where he had said. MacTutor adds that, without disclosing it at the time, he had used his least squares method.
The priority question is examined in Stephen Stigler's paper Gauss and the Invention of Least Squares in the Annals of Statistics (1981). The account of Legendre's side is in his MacTutor biography.
What does least squares actually do?
When measurements scatter, you cannot draw a line through all of them. Least squares picks the line that makes the sum of the squared vertical gaps (residuals) as small as possible.
Worked example 1: one value from repeated readings. You measure a length three times: 10.1, 10.3 and 9.9 cm. Which value c makes (10.1 - c)^2 + (10.3 - c)^2 + (9.9 - c)^2 smallest? Setting the derivative to zero gives c = the mean, (10.1 + 10.3 + 9.9)/3 = 10.1 cm. Averaging is least squares in its simplest form.
Worked example 2: a straight line. Fit y = mx + b to the points (0, 1), (1, 3), (2, 4).
Means: x-bar = 1, y-bar = 8/3.
Slope m = sum of (x - x-bar)(y - y-bar) / sum of (x - x-bar)^2 = [(-1)(1 - 8/3) + 0 + (1)(4 - 8/3)] / [1 + 0 + 1] = (5/3 + 4/3)/2 = 3/2.
Intercept b = y-bar - m x x-bar = 8/3 - 3/2 = 7/6.
Check: predictions 7/6, 8/3, 25/6; residuals -1/6, 1/3, -1/6, which sum to zero, as they must for a least squares line.
Common mistakes: minimising the plain sum of residuals (it is always zero for any line through the mean point, so it cannot choose between lines), and mixing up which variable is x. Our guide to mean, variance and standard deviation covers the statistics behind these formulas, and Gauss's law problems shows his name in electrostatics.
What can a student learn from how Gauss worked?
Look for structure before you compute. The pairing trick replaces 99 additions with one multiplication.
Let the data vote. Least squares combines many imperfect measurements into one estimate instead of trusting any single reading.
Publish and explain. He kept his method private, and someone else published first. Writing up your working clearly is part of doing the work.
When a series or a fitting problem goes wrong, the Fermi Problem Library has a step-by-step solver that explains the reasoning rather than printing an answer.
Practice routine: sum 3 + 8 + 13 + ... + 98, fit a least squares line to (1, 2), (2, 2), (3, 5), and check that your residuals add to zero.
Next step: take any three readings from your last physics practical and find their least squares mean and line by hand.



