# Understanding Why Certain Numbers Cannot Be the Sum of Three Squares

Written on

## Chapter 1: Introduction to the Concept

In the realm of mathematics, it’s interesting to observe how certain numbers can or cannot be represented as the sum of three squares. For instance, consider the following numbers that can be expressed in this way:

- 3 = 1² + 1² + 1²
- 6 = 2² + 1² + 1²
- 4 = 2² + 0² + 0²
- 82 = 9² + 1² + 0²
- 125 = 10² + 3² + 4²

However, the numbers from this specific list—7, 15, 23, 31, 39, 47, and so on—cannot be expressed as the sum of three squares. Why is that? This is a question that can be explored easily with some simple calculations on a piece of scrap paper.

A hint to consider is that all the numbers in this list can be represented in the form of 8k + 7, where k is a non-negative integer.

### Section 1.1: The Concept of Modular Arithmetic

When you divide a non-negative number N by 8, the possible remainders are 0, 1, 2, 3, 4, 5, 6, or 7. This means N can take one of eight forms based on the integer k, as shown below:

- N = 0 + 8k (representing numbers like 0, 8, 16, 24, …)
- N = 1 + 8k (representing numbers like 1, 9, 17, 25, …)
- N = 2 + 8k (representing numbers like 2, 10, 18, 26, …)
- N = 3 + 8k (representing numbers like 3, 11, 19, 27, …)
- N = 4 + 8k (representing numbers like 4, 12, 20, 28, …)
- N = 5 + 8k (representing numbers like 5, 13, 21, 29, …)
- N = 6 + 8k (representing numbers like 6, 14, 22, 30, …)
- N = 7 + 8k (representing numbers like 7, 15, 23, 31, …)

Next, if we square each case, we find:

- N² = (0 + 8k)(0 + 8k) = 0 + 8(8k²)
- N² = (1 + 8k)(1 + 8k) = 1 + 8(2k + 8k²)
- N² = (2 + 8k)(2 + 8k) = 4 + 8(4k + 8k²)
- N² = (3 + 8k)(3 + 8k) = 1 + 8(1 + 6k + 8k²)
- N² = (4 + 8k)(4 + 8k) = 0 + 8(2 + 8k + 8k²)
- N² = (5 + 8k)(5 + 8k) = 1 + 8(3 + 10k + 8k²)
- N² = (6 + 8k)(6 + 8k) = 4 + 8(4 + 12k + 8k²)
- N² = (7 + 8k)(7 + 8k) = 1 + 8(6 + 14k + 8k²)

This leads us to the conclusion that every square number N² can be categorized in one of three forms:

- N² = 0 + 8j
- N² = 1 + 8j
- N² = 4 + 8j

When we sum three squares, X² + Y² + Z², each of these can fall into one of the three categories above. Therefore, X² + Y² + Z² can be represented as 0 + 8k, 1 + 8k, 2 + 8k, 3 + 8k, 4 + 8k, 5 + 8k, or 6 + 8k, but never 7 + 8k (where k is a non-negative integer).

This forms the crux of the argument.

The first video discusses various tricks and shortcuts for reasoning with number series, offering deeper insights into this mathematical concept.

### Section 1.2: Legendre’s Three Square Theorem

It's essential to note that just because a number isn't listed above doesn’t necessarily imply it can be expressed as the sum of three squares. A more intricate theorem proposed by the French mathematician Adrien-Marie Legendre states that:

**Theorem**: A natural number N can be expressed as the sum of three squares X² + Y² + Z² if and only if N is NOT of the form (4^a)(7 + 8b), where a and b are non-negative integers (with 4^a indicating 4 raised to the power of a).

In our previous example, we only considered the case where a = 0. According to Legendre, there are other numbers, such as 28, which cannot be expressed as the sum of three squares even though they aren't on our initial list.

## Chapter 2: Conclusion on Square Sums

A natural follow-up question is how many square numbers are needed to express any given natural number. The mathematician Lagrange demonstrated that every natural number can be expressed as the sum of four integer squares. This principle is known as Lagrange’s Four-Square Theorem.

The second video focuses on problem-solving techniques for young learners, showcasing different methods to represent numbers.