## 12.3   Sums of Two Squares

The idea here is just like the previous section, but for the sum of two squares. In other words, we want to find integer solutions to the equation

n = x2 + y2.

This time we will state the research questions and then give some useful applets. We will only ask the question: how many ways can an integer n be written as the sum of two squares for prime values of n?

#### Research Question 2

Which primes p can be written as the sum of two squares, and in how many ways can it be done?

Note: This is a case where you will only be able to prove part of your conjecture. The complete proof of an optimal conjecture is beyond the scope of the chapter summary.

#### Research Question 3

Which positive integers n can be written as the sum of two squares?

Hint: It is probably a good idea to use the standard progression for investigating problems which we have used earlier in the course. Research Question 2 takes care of the case when n is prime. Try products of distinct primes and prime powers before trying to jump to the complete conjecture. Also keep in mind that your answer here needs to be consistent with your conjecture for Research Question 2.

We start with an applet analogous to the one in the previous section. It will compute all values of x2 + y2 with x and y nonnegative and ranging up to some bound. This time, switching the values of x and y leaves x2 + y2 unchanged, so we take x y. Here is a sample.

Your browser does not support java.

For the problem of sums of squares, if we have a fixed value of n and we want to determine if n = x2 + y2 for some x and y, there are clearly only finitely many x and y we have to try. In fact, if we take x y, then we can be sure that x (n/2)1/2. The next applet takes a single value of n as input and uses this observation to find all ways of writing n as a sum of two squares x and y with x y. For example, the output from the first applet indicated that 29 could be written as the sum of two squares. Here are the values of x and y with x y that do it:

Your browser does not support java.

Thus we see that 29 = 22 + 52, and that x = 2 and y = 5 provide the only solution (with x y) to the equation x2 + y2 = 29.

On the other hand, 50 can be written as a sum of two squares in two different ways:

Your browser does not support java.

So, 50 = 12 + 72 = 52 + 52. From the output of the first applet, it appeared that 15 was not the sum of two squares. We can verify this below:

Your browser does not support java.

Section 12.1 | Section 12.2 | Section 12.3 | Section 12.4 | Section 12.5