Write \(n\) as difference of squares

Revision Notes

For questions of this type, we should immediately make note of whether \(n\) is odd or even. The way forward is a little different for \(n\) being odd v/s \(n\) being even. Further, \(n\), itself being a square or not, also has a role to play.

Case 1: When \(n\) is odd, and not a square

Number of ways of writing \(n\) as a difference of two squares = \(f\)/2, where \(f\) is the number of factors of \(n\)

Variations?

i. How many solutions to \(\left(a, b\right)\) are there such that \(a^2 \;-\; b^2= n\) where \(a, b, \in \mathbb{Z}\)?

While \(a^2\) and \(b^2\) are always non-negative, but here we need values of \(a\) and \(b\) and they can be both, positive or negative, independently. e.g. if \(a^2 = 64\) and \(b^2 = 25\), the solutions will be (8, 5), (8, −5), (−8, 5), (−8, −5).

Thus, answer to this question will be \(\frac{f}{2} \times 4 = 2 \times f\)

ii. How many solutions to \(\left(a, b\right)\) are there such that \(|a^2 \;-\; b^2 | = n\) where \(a, b, \in \mathbb{Z}\)?

For this variation, each of the solution to earlier variation (i) will now result in two solutions e.g. (8, 5) will also lead to (5, 8).

Thus answer to this will be \(4 \times f\)

Case 2: When \(n\) is even, and not a square

Number of ways of writing \(n\) as a difference of two squares = \(f\)/2, where \(f\) is the number of factors of \(n\)/4 (and not of \(n\)).

What if \(n\) is not divisible by 4? In that case, \(n\) cannot be written as a difference of 2 squares.

Variations?

Exactly the same variations as done in case 1 of \(n\) being odd i.e. the answers to variations (i) will be \(2 \times f\) and that to variation (ii) will be \(4 \times f\). The only difference is that \(f\) will be number of factors of \(n\)/4 and not of \(n\).

Case 3: When \(n\) is odd and a square

In this case, \(f\) the number of factors of \(n\) will be odd and hence \(f\)/2 will lead to problems. The answer in this case will be \(\frac{f − 1}{2} + 1\) ways. The 1 way, due to the ” + 1″ in the above formula ,is \(n\) − 0, remember \(n\) is also a square and 0 is also a square. If the question specifies that squares are only of natural numbers, then this 1 way should not be counted and answer will be just \(\left(f-1\right)/2\).

Answer to variation (i) will be \(\frac{f-1}{2} \times 4 + 1 \times 2\), because the way (\(n\), 0) will branch out in only 2, \(\left(+\sqrt{n}, 0\right)\) and \(\left(-\sqrt{n}, 0\right)\), and not 4 solutions. And the above term simplifies to just \(2 \times f\), same as earlier. Keep in mind that 2 of these solutions will include 0, so if the questions prohibits 0, the answer will be \(2 \times f \;-\; 2\) or simply \(2 \times \left(f\;-\;1\right)\).

Variation (ii) … now that \(2 \times f\) is the answer to variation (i), we just need to double it, because the order can be switched in each of the solutions, and the answer will be same as \(4 \times f\). If 0 is prohibited, the answer will be \(4 \times \left(f\;-\;1\right)\)

Case 4: When \(n\) is even and a square.

We find number of factors of \(n\)/4, denote it by \(f\). And a little reasoning should help you realise that \(n\)/4 will also be a square i.e. \(f\) will still be odd. The answers will be the same as earlier case 3, just that \(f\) is number of factors of \(n\)/4 and not \(n\).

Answer to the standard question will be \(\frac{f − 1}{2} + 1\). One of these ways will be \(n − 0\) itself. Dont count this one way if question clearly specifies squares of natural numbers.

And answers to variation (i) and (ii) is same expression as in Case 3 …

Number of solutions to \(\left(a, b\right)\) are there such that \(a^2 \;-\; b^2= n\) where \(a, b, \in \mathbb{Z}\) will be \(2 \times f\) if 0 is allowed; and \(2\left(f-1\right)\) if 0 is not allowed.

Number of solutions to \(\left(a, b\right)\) are there such that \(|a^2 \;-\; b^2 | = n\) where \(a, b, \in \mathbb{Z}\) will be \(4 \times f\) if 0 is allowed; and \(4\left(f-1\right)\) if 0 is not allowed.

Leave a Reply