[Math] I need explanation for this solution for the proof. (Perfect square ends with 0,1,4,5,6,9)

discrete mathematicsintuition

Give a proof to the sentence: "The final decimal digit of a perfect square is 0, 1, 4, 5, 6 or 9."

Solution:
A integer $n$ can be expressed as $10a+b$, where $a$ and $b$ are positive integers and $b$ is 0, 1, 2, 3, 4, 5, 6, 7, 8, or 9.
Here $a$ is the integer obtained by subtracting the final decimal digit of $n$ and dividing by 10. (so $a=(n-b)/10$)
Next note that $(10a + b)^2 = 100a^2+20ab+b^2=10(10a^2+2b)+b^2$ so the final decimal digit of $n^2$ is same as the final decimal digit of $b^2$.

I understand until this point but not below:
Furthermore, note that the final decimal digit of $b^2$ is the same as final decimal digit of $(10-b)^2 = 100 – 20ab + b^2$. (how did you get this equation?) consequently we cab reduce our proof to the consideration of fix cases.

final digit of:

1) $n$ is 1 or 9 is 1

2) $n$ is 2 o 8 is 4

3) $n$ is 3 or 7 is 9

4) $n$ is 4 or 6 is 6

5) $n$ is 5 is 5

6) $n$ is 0 is 0

THANKS!

Best Answer

The point of the final step is to prove that, upon squaring, $\rm\:b\:$ and $\rm\: 10-b\:$ leave the same remainder modulo $10\:,\:$ i.e. $\rm\:(\pm b)^2 = b^2\pmod{10}\:.\:$ Indeed $\rm\:(10-b)^2 =\: b^2 + 10\ (10-2\:b)\:.\:$ Therefore to find all of the squares modulo $10\:,\:$ it suffices to square only the integers between $0$ and $5\:,\:$ i.e.

$$\:\{0,1,2,3,4,5,6,7,8,9\}^2\equiv\{0,\pm1,\pm2,\pm3,\pm4,5\}^2 \equiv \{0,1,4,9,6,5\}\pmod{10}$$

since $\rm\:\ 9\equiv -1,\:\ 8\equiv -2,\:\ 7\equiv -3,\:\ 6\equiv -4\pmod{10}\:.$

Related Question