In this series I show some mathematical results that can be found with only elementary math – math you learned in elementary or middle school, or maybe high school.

Today I answer another question posed by James Tanton (@JamesTanton on Twitter). He asked:

**Which integers are the difference of two square numbers?**

Square numbers are those that are a number multiplied by itself. 1 = 1*1, 4 = 2*2, 9 = 3*3 etc.

Before proceeding, I strongly urge you to play. Try to solve the problem. Struggle a bit, if you have to. That’s how you learn math. Not by memorizing or reading or watching, but by doing. The same way you would learn to play tennis or cook: By doing it.

First Intermission

Did you find anything? Maybe you solved the whole problem! Maybe just some of it. Maybe you got the solution by a different method than I did.

Here’s what I did: I played. I started by taking the integers and trying to find squares that would give those numbers: I didn’t find one for 1 or 2, but 3 = 22 – 12; then I didn’t find one for 4, unless you include 42 – 02. Then I tried to get more organized. I made a “subtraction table” (similar to multiplication tables) of the squares. The rows were 4, 9, 16, 25…. and the columns were 1, 4, 9, 16… Then each cell was the row minus the column. I only did the lower half of the triangle. The start of the table looked like this:

1 4 9 16

4 3

9 8 5

16 15 12 7

25 24 21 16 9

Now, I urge you to play some more. See what you can find in the table.

Second Intermission

What I noticed here is that the diagonals show a pattern. The first diagonal is all the odd numbers. Next, we have 4, 8, 12 … which are all divisible by 4. The next diagonal is 9, 15, 21…. again, odd numbers. Then multiples of 8. Then I noticed that the numbers that didn’t show up were all of the form 4n + 2. That is, numbers that left a remainder of 2 when divided by 4. How could I prove this?

Well, there is a proof that every odd number is the difference of two consecutive squares: Let two consecutive numbers be x and x+1. Then square each to get x2 and x2 + 2x + 1, then subtract to get 2x + 1, which are all the odd numbers; when x = 1, this equals 3; when x = 2 this equals 5 and so on. That takes care of numbers of the form 4n+1 and 4n+3. What about those of form 4n? Well, if you find the difference between numbers that skip one between them (x and x+2) then square them to get x2 and x2 + 4x + 4, then take the difference to get 4x + 4 and this is all the numbers divisible by 4: When x = 1, this is 0, when x = 2, it is 4, when x = 3 it is 8 and so on.

How to show that numbers of the form 4n+2 do *not* appear? The differences of the squares of numbers that are separated by an odd number will always be odd, so they can’t be of the form 4x + 2. What about differences that are even?

When the difference is 2 we saw above that the difference of the squares is divisible by 4.

When the difference is 4 we have x2 and x2 + 8x + 16 and the difference is 8x + 16, which is divisible by 4.

When the difference is 6 we have x2 and x2 + 12x + 36, which is also divisible by 4.

How can we generalize? A even number can be represented by 2a. So, we are finding the difference between x2 and (x+2a)2; which is the difference between x2 and x2 + 4ax + 4a2; that difference is 4ax + 4a2 which is divisible by 4.