# Last decimal digit of any perfect square must be $0,1,4,5,6$ or $9$

Last decimal digit of any perfect square must be $0,1,4,5,6$ or $9$

My Proof: Ten cases exist, yielding the following equalities:

$$(1\mod{10})^2 = 1\mod{10}$$ $$(2\mod{10})^2 = 4\mod{10}$$ $$(3\mod{10})^2 = 9\mod{10}$$ $$(4\mod{10})^2 = 6\mod{10}$$ $$(5\mod{10})^2 = 5\mod{10}$$ $$(6\mod{10})^2 = 6\mod{10}$$ $$(7\mod{10})^2 = 9\mod{10}$$ $$(8\mod{10})^2 = 4\mod{10}$$ $$(9\mod{10})^2 = 1\mod{10}$$ $$(0\mod{10})^2 = 0\mod{10}$$

Since the proposition holds for all possible cases, the proposition holds.

Is this an acceptable proof for the proposition?

What is the simplest proof for this?

Note: This is not a homework question, just a question from a weekly tutorial sheet.

• This is exhaustive, so it works. – wckronholm Mar 26 '14 at 4:07
• @wckronholm I feel as though I should try to avoid using exhaustive proofs, they seem really inefficient. – Display Name Mar 26 '14 at 4:10
• No problem if it is homework-you have shown your work as requested by the FAQ and asked a good related question. +1 – Ross Millikan Mar 26 '14 at 4:18

## 2 Answers

This is a fine proof. You could consider a few less cases in two similar ways. You could do it mod $2$ and $5$, then combine the results with the Chinese Remainder Theorem. You could do $0, \pm 1, \pm2, \pm 3, \pm 4, 5$ Both would show off more math knowledge than this approach, but I am not sure either would be less work. For moduli higher than $10$, the investment might be repaid.

• It appears a similar proof can be completed for $(x \mod 10)^3,0 \leq x \leq 9$, can a similar proof be completed for all $n \in \mathbb{Z}^+,(x \mod 10)^n, 0 \leq x \leq 9$ – Display Name Mar 27 '14 at 2:43
• Yes, you can do this for any modulus. As the modulus gets higher, the work grows. You probably want those $\ge$ signs to be $\le$ signs. For the cubes, every digit can end a cube. For any even power, there are no more than six ending digits, because $(-1)^2=1,$, so $1$ and $9$ always end in the same, as do $2$ and $8$, etc. – Ross Millikan Mar 27 '14 at 2:47

For a more "clever" solution (but yours looks perfect):

As $10=5\times 2$, let us consider $$x^2 = 10a + 5b+ r \\ 0\le 5b+r< 10 \\ 0\le r< 5$$ then reducing modulo 5: $$r = x^2 \in \{ 0,1,4 \}\mod 5\\ 5b+r \in \{ 0,1,4,0+5=5,1+5=6,4+5=9 \}\mod 5\\$$