Lagrange's Four-Square Theorem Seen Using Polygons and Lines

Any natural number can be represented as the sum of the squares of four non-negative integers. For most numbers there are multiple representations. In this Demonstration, the four integers (not squared) may be viewed using three different options.

1. For each set of four numbers , a polygon is displayed with vertices , , , and .

2. Each set is sorted from smallest to largest. The first two numbers and the last two numbers are viewed as points so that the representation becomes a line segment. Where there are multiple representations, a polygon is formed by connecting each line segment to the next line segment in the list.

3. This is similar to option 2 except that the coordinates of the second point are reversed.

In all three options, each polygon is randomly colored to create a unique portrait for each natural number. Mouseover the polygons to see the sets of four non-negative integers.