12.2   Differences of Two Squares

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 = x2y2

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, since x and y are squared, we will only use nonnegative values for them. Next, we observe that whenever x = y, we will get 0, so we omit those combinations. We notice that switching the roles of x and y will negate n. So, it suffices to take x > y. The parameter B specifies a bound for the values of x and y, with 0 <= x <= B and 0 <= y <= B. Finally, the output is sorted. The result will then be that we will only see the positive values of n which are the difference of two squares. Here's what we get for B = 10:

Your browser does not support java.

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 B is too low. Similarly, increasing the value for B may uncover more ways of writing a given integer as the difference of two squares.

Research Question 1

Which positive integers n can 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

Chapter 12 | DNT Table of Contents

Copyright © 2001 by W. H. Freeman and Company