What digits can square numbers end in

algebra-precalculusproblem solvingsoft-question

Here was the solution that I stumbled upon, but I'm sure it can be improved upon:
$$
1^2=1 \\
2^2 = 4 \\
3^2 = 9 \\
\ldots \\
20^2 = 400
$$

The last digits of square numbers repeat in the following pattern: $1,4,9,6,5,6,9,4,1,0$. It seems like square numbers can end in any digit except $2,3,7, \text{and }8$. Proof that the pattern always repeats:
$$(n+10)^2=n^2+20n+100=n^2+10(2n+10)$$ A number plus a multiple of $10$ does not change its last digit, so the pattern will always repeat.

I have two questions:

  1. Can my solution be improved upon (e.g. by generalising it further)?
  2. Do you have any advice for getting to the solution more quickly when you are finding the answer to these problem solving-type questions? Even though the mathematics I used to find the solution to this problem was rather elementary, it took me half an hour of complete guess-work to find it. Is there a more structured approach one can take?

Best Answer

Consider a number $ n$ in $\mod10$. The possible representations are : $$ n \equiv 0,1,2,3,4,5,6,7,8,9\mod10$$ and $$n^2 \equiv 0,1,4,9,6,5,6,9,4,1 \mod 10$$

Hence the possible digits in the end of a square number is $\in (0,1,4,5,6,9)$

It is easier to study properties of numbers using number theory . These might be helpful: