[Math] The final digit of fourth powers

elementary-number-theorymodular arithmetic

I am working on "Elementary Number Theory" By Underwood Dudley and this is problem 13 in Section 4.

The question is "What can the last digit of a fourth power be?" I got the correct answer but I'm wondering if there is another more elegant way to do it. I'm also wondering if my argument is solid or if I just got the right answer by chance. My argument is as follows:

Any number A can be written as:

$A$ = $10^kn_k$ + $10^{k-1}$$n_{k-1}$ + $…$ + $10n_1$ + $n_0$,

where $n_k$ is the starting digit of the number and can take on any integer from 0 to 9 and so forth.

If we raise this to the fourth power and don't combine any of the terms, each term should be divisible by 10 except maybe not $n_0^4$. Now, $n_0^4$ must end must end in k where k satisfies:

$n_0^4$ $\equiv k\pmod {10}$.

And since $n_0^4$ ends in k, $A$ must end in k (since all of the other terms in the sum are divisible by 10). So, it suffices to just check what the last digit of the fourth powers of 1 through 9 are (since $0 \leq n_0 \leq 9$):

$0^4$ $\equiv 0\pmod{10}$

$1^4 \equiv 1\pmod{10}$

$2^4 \equiv 6\pmod{10}$

$3^4 \equiv 1\pmod{10}$

$4^4 \equiv 6\pmod{10}$

$5^4 \equiv 5\pmod{10}$

$6^4 \equiv 6\pmod{10}$

$7^4 \equiv 1\pmod{10}$

$8^4 \equiv 6\pmod{10}$

$9^4 \equiv 1\pmod{10}$.

So the fourth power of any integer must end in either a 0,1,5, or 6.

Did I get lucky or is this ok? Are there other more elegant ways?

Thank you!

Best Answer

That looks fine, though you could have shortened the argument by noting that the last digit of a product depends only on the last digit of each factor, and hence the same goes for powers.

You could have shortened it further by considering fourth powers modulo 2 and modulo 5. You can get either 0 or 1 modulo 2 (obviously), and the same goes modulo 5 (slightly less obviously, but you could use Fermat' little theorem if you felt super lazy).

Combining the two results gives you 0, 1, 5, 6 modulo 10 as you have found.