Quadratic Residues and Solving Diophantine Equations

All squared numbers end in the same six digits: 0, 1, 4, 5, 6, or 9

e.g. 7^2 = 49 ends in 9, 8^2 = 64 ends in 4, 9^2 = 81 ends in 1 ... etc. Any number you choose will invariably have its last digit be one of these 6.

What they do is form a closed group of special integers called quadratic residues. Named aptly because they are the residues of the modulus of the square base 10.

But what's interesting is that all bases, not just numbers in base 10, will form similar closed groups.

i.e. All residues of squared numbers base 12 must end in the group 0, 1, 4 or 9.

The proof as to why a closed group exists is straight forward:

We can let some integer X in base y be written as a*y + b, where b is the mod(y) residue.

Therefore, taking the square:

X^2 = (a*y + b)^2 = (a*y)^2 + 2*a*y + b^2

Now clearly the first two terms are divisible by the base y, hence the residue of X^2 mod y must be solely the last term, b^2, which is a square. Hence the quadratic residues form a closed group.

Why only certain numbers exist in this group though is a little less trivial. And proving which numbers DO exist in the group is even less trivial. However if we do know the numbers strictly in the group, we can use them sometimes to prove if solutions exist to certain diophantine equations.

E.g. Does the following equation have any integer solutions:

17*x^5 + 360 = y^2

Now obviously with these kinds of "do any solutions exist" type questions, we cannot exhaustively search the subspace of all integers. We must turn to some other type of analysis.

And utilising what we know about quadratic residues, and noticing that the right hand side is simply a square integer, we can deduce that the residue of the right hand side, taken with a certain modulus, must be congruent to a quadratic residue, if a solution were to exist.

What mod to choose becomes obvious. For simplicity we can reduce the residue down to just the integer term (360) if we take the mod of the coefficient (17), allowing us to ignore all of the trouble with dealing with the quintic term.

Hence the LHS is congruent to 360 mod 17, which is equal to 3 mod 17. And if we know what quadratic residues exist for 17 (which we can find just by checking 17 times through exhaustion), we will invariably notice 3 is not a quadratic residue. Hence no integer solutions to the equation.