Here is a further challenge for you after you have seen this solution: is it true that no number can be written as the difference of 2 squares in exactly three ways, and if so why?
Counting the dots which are joined by lines in the diagram we get the odd numbers 1, 3, 5 , 7 and 9. To make larger squares add 11 dots (i.e. twice five plus one), then 13 (twice six plus one) and so on, each time adding an odd number of dots. In this way any odd number (2n+1) can be represented by dots along two sides of an (n+1) by (n+1) square, showing that:
2n+1 = (n+1)² - n² .
The rest of the question can be done algebraically or by using a program or a spreadsheet.
Expressing a number as the difference of two squares is equivalent to factorising the number.
N = a² - b² = (a - b)(a + b).
If we know pairs of factors we can find (a -b) and (a + b) and then a and b.
To find every possible way of writing 105 as the difference of two squares first find all the pairs of factors:
105 = 1 x 105 = 3 x 35 = 5 x 21 = 7 x 15.
The results are given in the following table.
| PAIRS OF FACTOR OF 105 | DIFFERENCE OF 2 SQUARES | |||
| a - b | a + b | a | b | a² - b² |
| 1 | 105 | 53 | 52 | 53² - 52² |
| 3 | 35 | 19 | 16 | 19² - 16² |
| 5 | 21 | 13 | 8 | 13² - 8² |
| 7 | 15 | 11 | 4 | 11² - 4² |
The same method gives the eight ways of representing 1155 as the difference of two squares.
| PAIRS OF FACTOR OF 1155 | DIFFERENCE OF 2 SQUARES | |||
| a - b | a + b | a | b | a² - b² |
| 1 | 1155 | 578 | 577 | 578² - 577² |
| 3 | 385 | 194 | 191 | 194² - 191² |
| 5 | 231 | 118 | 113 | 118² - 113² |
| 7 | 165 | 86 | 79 | 86² - 79² |
| 11 | 105 | 58 | 47 | 58² - 47² |
| 15 | 77 | 46 | 31 | 46² - 31² |
| 21 | 55 | 38 | 17 | 38² - 17² |
| 33 | 35 | 34 | 1 | 34² - 1² |
The best solution sent in came from Michael Pryor, Kunal Patel and Matthew Loffman of the Simon Langton Boys School Canterbury . They set up a spreadsheet with two columns for values of a and b using the formula
b = sqrt (a² - 1155)
for the entries in the second column (giving a² - b² =1155 in every row). They were then able to pick out the required whole number solutions.
They also recognised (from the first part of the question) that the largest squares would be 578 and 577 squared, and that the lowest had to be over the square root of 1155, so they ran their spreadsheet from a = 34 to a = 578 in the first column knowing that this would give them all the required solutions.