A really neat problem that Gauss solved

Last night I pulled an old favorite off the shelf:

I love just flipping through this book because it has so many interesting problems and stories.  The one I ran across last night was a really neat problem that Gauss solved at age 23.  What makes it especially neat is that almost all of the ideas (right up until the end) are accessible to anyone with just a little bit of background in algebra and geometry.  I thought it would be a fun problem to talk through with my older son this morning.

The problem is pretty easy to understand:  If you pick an integer at random, what is the expected number of ways to be able to write that integer as a sum of perfect squares?

For example (and clarity) there are 8 ways to write 5 as a sum of perfect squares:

1. $5 = (1)^2 + (2)^2$
2. $5 = (-1)^2 + (2)^2$
3. $5 = (1)^2 + (-2)^2$
4. $5 = (-1)^2 + (-2)^2$
5. $5 = (2)^2 + (1)^2$
6. $5 = (-2)^2 + (1)^2$
7. $5 = (2)^2 + (-1)^2$
8. $5 = (-2)^2 + (-1)^2$

With that introduction here’s our talk through the problem:

After the introduction we moved on to talk about one bit of  basic number theory that comes into play in this problem – the sum of two perfect squares can’t have a remainder of 3 when divided by 4:

Now we get to the meat of the problem – what is the average number of ways to write an integer as a sum of perfect squares.  The next part of the discussion was just explaining this problem in a way that is (hopefully) accessible to kids.  The notation may make the problem seem difficult, but hopefully the words make the problem easier to understand:

On to Gauss’s solution.  We look at a circle in the plane with a slightly different equation than we usually see.  I spent a minute or two making sure that the notation didn’t trip up the understanding of the problem (despite tripping me up for a second!).  Then we just talk through the geometry:

Finally Gauss’s clever geometric observation – the number of points inside the circle is a decent approximation to the area of the circle.  I skipped some of the analysis details to keep the problem moving, but those details aren’t that difficult.  He essentially drew a slightly smaller circle and a slightly smaller circle and showed that the number of points always is always in between the value of the area of each of these circles.  That allows him to show that the average value we are looking for converges to $\pi$.   I just show that the average value we are looking for looks a lot like $\pi$.  Good enough for now.

I love being able to show connections between two seemingly different areas of math.  This example shows an amazing connections between arithmetic and geometry.  I also was happy to see that an amazing discovery by Gauss could be explained to kids.  Definitely a fun morning.