The basic question here is: which integers can be written as the difference of two squares? In other words, we want to know the integer solutions to the equation

n=x^{2}–y^{2}Since the equation is already solved for

n, a natural way to run experiments is to substitute lots of pairs (x,y) into the right-hand side and see what comes out. The applet below does just that, with some simplifications to improve efficiency. First, sincexandyare squared, we will only use nonnegative values for them. Next, we observe that wheneverx=y, we will get 0, so we omit those combinations. We notice that switching the roles ofxandywill negaten. So, it suffices to takex>y. The parameterBspecifies a bound for the values ofxandy, with 0xBand 0yB. Finally, the output is sorted. The result will then be that we will only see the positive values ofnwhich are the difference of two squares. Here's what we get forB= 10:Notice that we have not removed duplicates; some numbers appear more than once. This will give you an indication of how many ways certain integers can be written as the sum of two squares. Keep in mind that some numbers may not appear on this list because the bound

Bis too low. Similarly, increasing the value forBmay uncover more ways of writing a given integer as the difference of two squares.

## Research Question 1

Which positive integers

ncan be written as the difference of two squares, and in how many ways can it be done?

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

Copyright © 2001 by W. H. Freeman and Company