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

Initializing live version
Download to Desktop

Requires a Wolfram Notebook System

Interact on desktop, mobile and cloud with the free Wolfram Player or other Wolfram Language products.

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.


Contributed by: Noel Patson (July 2013)
Open content licensed under CC BY-NC-SA




Feedback (field required)
Email (field required) Name
Occupation Organization
Note: Your message & contact information may be shared with the author of any specific Demonstration for which you give feedback.