# Theory Of Equations - Difference of Squares - Anubhav Sehgal, NMIMS Mumbai

• Any question reducible to a^2 – b^2 = N and you are asked to find ordered/unordered positive/non-negative/total integral solutions.

Case 1: N = 4k + 2 form.

There will be no integral solutions for this situation.
Any even number can be written as 2k form while any odd number can be written as 2k + 1 form
a, b: even, even => a^2 – b^2 = (2p)^2 – (2q)^2 = 4(p^2 – q^2) form = 4m form
a, b: even, odd => a^2 – b^2 = (2p)^2 – (2q + 1)^2 = 4(p^2 – q^2 - q) – 1 = 4m – 1 OR 4m’ + 3 form
a, b: odd, even => a^2 – b^2 = (2p + 1)^2 – (2q)^2 = 4(p^2 + p – q^2) + 1 = 4m + 1 form
a, b: odd, odd => a^2 – b^2 = (2p + 1)^2 – (2q + 1)^2 = 4(p^2 – q^2 + p – q) = 4m form
Hence as we can see it can never be 4k + 2 form whatever may be the value of a and b.

Case 2: N = Perfect square.

Total integral solutions = (Positive Unordered integral solutions) * 4 + 2
N is even => Positive unordered integral solutions = [f (N/4) – 1]/2
N is odd => Positive unordered integral solutions = [f (N) – 1]/2
where f (.) is the number of factors of number in the bracket.

If N is even, then it must have power of 2 in its factorization and for it to be a perfect square it must be 4k^2 form where k^2 is a perfect square to make N a perfect square as a whole.

From case 1 we can see, this is possible when both a, b are either even or odd together.
Also, writing the equation as: a^2 – b^2 = N
(a + b)(a – b) = N = 4k^2 form
X * Y = N = 4k^2 form where X = (a + b) ; Y = (a – b)
In either case, X = even and Y = even
2p * 2q = 4k^2
p * q = k^2
From our factors knowledge we know that unordered sets for this will be
[f (k^2) – 1]/2 = [f (N/4) – 1]/2

If N is odd, then we have a^2 – b^2 = N = k^2
(a + b)(a – b) = N = k^2
X * Y = k^2

Unordered sets for (X,Y) will be simply [f (k^2) – 1]/2 = [f (N) – 1]/2, each of which will give distinct unordered values for a, b because X and Y are factors of k^2. Any factor of k^2 can be taken as solution for X with Y = k^2/X and vice versa. While being a perfect square, one solution will be X = Y = k which needs to be removed for unordering.

Having got all solutions of a, b form(unordered)
We can have :
(a, -b) ; (-a, b) ; (a, b) ; (-a, -b) forms. Hence we multiply it by 4 for total integral solutions.
While we add two as we can have two solutions with a = +- sqrt (N), b = 0

Case 3: N is 4k form and not a perfect square.

Total integral solutions = (Positive unordered integral solutions) * 4 Positive unordered integral solutions
= [f (N/4)]/2

a^2 – b^2 = N = 4k form
(a + b)(a – b) = 4k
X * Y = 4k
X and Y both must be even.
2p * 2q = 4k
p * q = k
Unordered positive integral solutions for this = [f (N/4)]/2.
We do not need to subtract 1 here as there will be no p = q = sqrt (k) integral solution as k is not a perfect square [Since N is not a perfect square]

Case 4: N is odd and not a perfect square.

Total integral solutions = (Positive unordered integral solutions) * 4 Positive unordered integral solutions
= [f (N)]/2

a^2 – b^2 = N = odd
(a + b)(a – b) = N
X * Y = N
We cannot take anything common here as a and be will be either even, odd form or odd, even form.
Hence simply unordered positive integral solutions will be [f (N)/2]

1

7

1

1

1

1

1

54