# How many ways are there to write $675$ as a difference of two squares?

How many ways are there to write the number $675$ as a difference of two squares?

Is there a way to generalize this?

• Note that in $a^2 - b^2 = 675$ we can factor the left-hand side and obtain $(a-b)(a+b) = 675$. Thus $a+b$ divides 675, which limits the number of possibilities.
– MJD
Sep 16, 2014 at 20:11

Suppose we have to solve $a^2-b^2 = n$.

Write $n = pq$ where $p$ and $q$ have the same parity ( $p \equiv q \mod 2$) and assume $p \geq q$.

Clearly:

$$\left(\dfrac{p+q}2\right)^2 - \left(\dfrac{p-q}2\right)^2 = pq = n$$.

Now, show that if $p$ and $q$ don't have the same parity, then $a+b=p$ and $a-b=q$ cannot be solved in integers.

More information: In the case of $675 = 25 \times 27 = pq$, we want $p$ and $q$ to be both odd. But all divisors of $675$ are odd. $675$ has $12$ divisors (why?). now only half of them will have $p \geq q$. So $675$ can be written as a difference of two squares in $6$ different ways.

Now let's explicitly list these $6$ ways using our observation. Notice: $$675= 675 \cdot 1 = 135 \cdot 5 = 27 \cdot 25 = 75 \cdot 9 = 225 \cdot 3 = 45 \cdot 15=p\cdot q.$$

The corresponding solutions using $a = \dfrac{p+q}2, b = \dfrac{p-q}2$ are:

$$675 = 338^2 - 337^2.$$ $$675 = 70^2 - 65^2.$$ $$675 = 26^2 - 1^2.$$ $$675 = 42^2 - 33^2.$$ $$675 = 114^2 - 111^2.$$ $$675 = 30^2 - 15^2.$$

• But 338^2 - 337^2 = 675
– gedr
Sep 16, 2014 at 20:23
• @gedr Note that $675 = 338^2-337^2$ is obtained by taking $p=675, q=1$. We have $pq=675$ and $p$ and $q$ have the same parity.
– MJD
Sep 16, 2014 at 20:27
• So there are 675/2 combinations?
– gedr
Sep 16, 2014 at 20:29
• @gedr no... but you should maybe consider the factorisation of 675 in prime factors :).
– Surb
Sep 16, 2014 at 20:40
• Ok. Sorry. Im not very advanced in maths but am interested in it (just did my GCSE so yeah....) So I dont really understand what you are trying to tell me :(
– gedr
Sep 16, 2014 at 20:42

675 is a small number.

So we can cheat. Let's examine $(x+1)^2-x^2 \ge 675$. This is the same as $2x+1 \ge 675$ (expand it and check), or $x \ge 337$.

This means that beyond 338, adjacent squares are more than 675 apart. Squares further apart than that will be further than 675 apart as well. So our answer lies at or below 338.

Simply check the difference of squares of every pair of numbers from 1 to 338 -- there are only 113 thousand of them. Those that equal 675 are your complete answers.

At this stage, a computer may help.

Output:

26^2 - 1^2 = 675
30^2 - 15^2 = 675
42^2 - 33^2 = 675
70^2 - 65^2 = 675
114^2 - 111^2 = 675
338^2 - 337^2 = 675

The nice thing about this approach, while inelegant (114 thousand cases to check?!), it requires only convincing yourself that the upper limit is valid and that the program does indeed do the checks of all of the cases.

(The above assumes that the domain in question is the natural numbers (positive integers). If it is a larger domain, there are more answers: negatives in the integers, and in the reals there are plenty of answers. Showing that in the rationals there are no more answers than in the integers is a fun problem.)

I agree with this logic the answer appears to be 6 ways. However there are actually 24 ways because each number to be squared can be either positive or negative, thus producing 24 ways to write the equation.

• But $(-a)^2 = a^2$: the square doesn't change, just the way it is represented, which doesn't matter as far as this question is concerned. Sep 18, 2014 at 9:12