Math Fun Facts!
hosted by the Harvey Mudd College Math Department created, authored and ©1999-2010 by Francis Su
Subscribe to our RSS feed   or follow us on Twitter.
Get a random Fun Fact!
No subject limitations
Search only in selected subjects
    Calculus or Analysis
    Number Theory
    Other subjects
  Select Difficulty  
Enter keywords 

  The Math Fun Facts App!
  List All : List Recent : List Popular
  About Math Fun Facts / How to Use
  Contributors / Fun Facts Home
© 1999-2010 by Francis Edward Su
All rights reserved.

From the Fun Fact files, here is a Fun Fact at the Medium level:

Sums of Two Squares Ways

In the Fun Fact Sums of Two Squares, we've seen which numbers can be written as the sum of two squares. For instance, 11 cannot, but 13 can (as 32+22). A related question, with a surprising answer, is: on average, how many ways can a number can be written as the sum of two squares?

We should clarify what we mean by average. Let W(N) is the number of ways to write N as the sum of two squares. Thus W(11)=0, and W(13)=8 (as sums of squares of all possible combinations of +/-3 and +/-2 , in either order).

So if A(N) is the average of the numbers W(1), W(2), ..., W(N), then A(N) is the average number of ways the first N numbers can be written as the sum of two squares. Then it makes sense to take the limit of A(N) as N goes to infinity to get the "average" number of ways to write a number as the sum of two squares, over all positive whole numbers.

A surprising fact is that this limit exists, and it is Pi!

Presentation Suggestions:
This might be presented after a discussion of lattice points in Pick's Theorem.

The Math Behind the Fact:
The proof is as neat as the result! Every solution (x,y) to x2+y2=N can be thought of as a lattice point in the plane, i.e., a point with integer coordinates. Such a lattice point lies on a circle of radius Sqrt(N).

Therefore, the sum of W(1) through W(N) counts the number of lattice points in the plane inside or on a circle of radius Sqrt(N) (except for the origin), and the average A(N) is this number of lattice points divided by N. But as N goes to infinity, the number of lattice points inside this circle is approximately the area of the circle, hence Pi times the radius squared: Pi*Sqrt(N)2 or Pi*N. Therefore A(N) is approximately Pi, and this approximation gets better and better as N goes to infinity!

Counting the the number of lattice points inside a circle is known as Gauss' circle problem. Also, see several other Fun Facts about sums of two squares or formulas for pi.

How to Cite this Page:
Su, Francis E., et al. "Sums of Two Squares Ways." Math Fun Facts. <>.

Keywords:    Pick's Theorem, number theory, geometry, pi formulas
Subjects:    geometry, number theory
Level:    Medium
Fun Fact suggested by:   Darryl Yong
Suggestions? Use this form.
Click to rate this Fun Fact...
    *   Awesome! I totally dig it!
    *   Fun enough to tell a friend!
    *   Mildly interesting
    *   Not really noteworthy
and see the most popular Facts!
New: get the MathFeed iPhone App!

Brings you news and views on math:
showcasing its power, beauty, and humanity

Want another Math Fun Fact?

For more fun, tour the Mathematics Department at Harvey Mudd College!