Consider the following problem: The square of the difference of two numbers is the same as their sum. What numbers satisfy this condition?

We might begin by expressing the problem as an equation: Then we can look for possible solutions. Let's try to simplify the expression:  Solving for a:    This last equation has an integer solution whenever 8b+1 is a perfect square and odd. So, for example, if b=1, then 8b+1=9 is a perfect square; or if b=3, then 8b+1=25 is a perfect square. But if b=5, then 8b+1=41 is not a perfect square. This is still a hit or miss way of solving the problem. We have two solutions:   This leads to the pair of solutions: and .   This leads to the pair of solutions: and . We would like to develop a more general solution, though: one that does not involve trial and error. Let's try a slightly different approach to the question of finding perfect squares that can be expressed as 8b+1. If we divide 8b+1 by 8 for any whole number b, the remainder will always be 1.

### Generalizing the Solution

So let's ask this question: What perfect squares give a remainder of 1 when divided by 8? We can start with a list of perfect squares and their remainders:

Square

Remainder

1

1

4

4

9

1

16

0

25

1

36

4

49

1

64

0

81

1

It certainly looks as though every odd square gives a remainder of 1 when divided by 8. Consider :   Clearly if n is even, then 4n(n-1) is divisible by 8. Likewise, if n is odd, then n-1 is even, and again 4n(n-1) is divisible by 8. Therefore, whether n is even or odd, p2 has a remainder of 1 when divided by 8 if p is odd. We now have a method for generating solutions. For every odd square, subtract 1 and divide by 8 to get b. Then use the value of b to obtain the value of a. Using the equation above, we can express b as . This simplifies to . This works for any whole number n. We can substitute this value to solve for a.     For every number n there exist two other numbers and such that . If these numbers look familiar, it is because they are triangle numbers. A triangle number has the form . It should be immediately obvious that and . For any two adjacent triangle numbers, and , their difference and their sum . This solution can be generalized to all real numbers, too.