Show that the last two decimal digits of a perfect square must be one of the following pairs.

Show that the last two decimal digits of a perfect square must be one of the following pairs:

$00, e1, e4, 25, o6, e9$ ($e$ stand for even digit, $o$ for odd).

Solution is given, but I don't understand it at all. First observe that it suffices to check the integers from $0$ to $99$ as $(100x+y)^2 \equiv y^2 \pmod{100}$. Now, we consider $y \ge 50$. In that case, $y = 50 +n$, where $0 \le n \le 49$. In that case, $$y^2 = (50+n)^2 = 2500 + 100n + n^2 \equiv n^2 \pmod{100}.$$ Therefore, the numbers $n$ and $50+n$ share the same last two digits (check, for example, $n=0,1,2$ etc.). As a consequence, we do not need to check the last two digits of the numbers greater than $49$. Rather, we focus on the numbers $0, 1, \cdots , 49$.

Among them, we now consider $y \ge 25$. These numbers can be written as $y = 50-n$ for $0 \le n \le 25$. But $$y^2 = (50-n)^2 = 2500 - 100n + n^2 \equiv n^2 \pmod{100}.$$ Therefore, the numbers $n$ and $50-n$ share the same last two digits (check, for example, $n=1,2$ etc.; i.e. $1^2$ and $49^2$ have the same last two digits). As a consequence, we do not need to check the last two digits of the numbers greater than $25$. Rather, we focus on the numbers $0, 1, \cdots , 25$.

For $0 \le n \le 25$, we compute their squares and observe the pattern of the last two digits. The pattern turns out to be $00, e1, e4, 25, o6, e9$.

So the last two digits of $n^2$ clearly depend on the last two digits of $n$. There are $100$ possibilities.

Now $(50+n)^2=2500+100n+n^2=100(25+n)+n^2$ and the multiple of $100$ shows that this part can't affect the last two digits, which are therefore the same as the last two digits of $n^2$. So numbers which differ by $50$ produce the same final pair of digits when squared. Since the cycle repeats after $50$ numbers there are now only $50$ possibilities to consider say the integers $0$ to $49$.

Then $(50-n)^2=2500-100n+n^2=100(25+n)+n^2$ so, for the same reason, $n$ and $50-n$ have the same final digits. In other words two numbers which sum to $50$ have the same final digits. We therefore pair $(1,49); (2,48) \dots (24,26)$ and therefore only have to consider the $26$ numbers $0$ to $25$.

Now consider $10a+5\pm b$ where $0\le a\le 2$ and $0\le b \le 5$

$$(10a+5\pm b)^2=100a^2+25+b^2+100a\pm 20ab\pm 10b$$

If we work modulo $20$ we have that the final digit and the parity of the penultimate digit are determined by that of $(b-5)^2$. Taking $b=0$ and $b=5$ as special cases giving $25$ and $00$ respectively. we need only test $|b-5|=1,2,3,4$ giving $e1, e4, e9, o6$

All the cases do in fact occur, as we find by squaring all the numbers $0 \to 25$

Lets assume we have $17^2$. We can also write this as (10 + 7)(10 + 7). If we were to multiply this out, we would get: $10^2 + 2(70) + 7^2$. Lets analyze this even further. $10^2$ is 100 so not really important in this case. $2(70)$ tells us that if we were to exclude the $7^2$, the second digit will always be even. Now we add the $7^2$. In this case it's 49. The second digit is even so the second digit of the final answer will be even because an even plus an even will always equal an even. So all we really need to prove the conjecture is to examine the perfect squares under 100. And you can scale this up to an arbitrary amount of digits and it would still work, because before adding the last digit squared, you will always have the second to last digit be even.