This is a problem from BdMO $2012$ Dhaka region Question Paper:

The product of a number with itself is called its square. For example, $2$ multiplied by $2$ is $4$, so $4$ is the square of $2$. If you take a square number and multiply it with itself, what will be the largest possible remainder if the product is divided by $10$?

I came up with this: $$x^4 \mod {10}$$

I know that the modulus (%) operator calculates the remainder of a division. And that it can be used to see, suppose, whether $N$ is a multiple of $M$ or not. Nothing more than that. I am much familiar with mod because of my programming experience with mid-level languages like C and C++. It was not until later that I came to know that modulus is used in mathematics as well.

Now, how to use the 'modulus' operator? How can I use this to go further into solving this problem?


$1$. The remainder will be the unit digit of the number you are dividing. For example, Remainder when $16$ is divided by $10$ is $6$.

Proof: If you have got a $n$ digit number then you can write it as $10^{n-1}a_0+10^{n-2}a_1+........+10a_{n-2}+a_{n-1}$ where $a_{n-1}$ is the unit digit. Notice that all the terms in the sum are divisible by $10$, the only suspect is $a_{n-1}$.

$2$. Notice that unit digit of a square number can be $0,1,4,5,6,9$ and corresponding unit digits of $4th$ powers can be $0,1,6,5,6,1,$.

So, largest remainder is $6$.


By Fermat's Little Theorem, $x^4$ has remainder $1$ when divided by $5$; so, when divided by $10$, it could only have as remainder $1$ or $6$. The latter is achievable, e.g., by $2^4$ mod $10 \equiv 6$ as the max. QED.


We know that the unit digits of the squares always belong in the set of these numbers : $A = \{ 1,4,9,6,5,0\}$.

The unit digits of the squares of the numbers $\in A$ gives us the possible unit digits of the fourth powers of all numbers. Thus, we create a a set $B = \{1,6,5,0\}$ where the elements in $B$ denotes the possible modulo of the fourth powers of a number $10$.

Out of these, we can see that the maximum possible remainder is $6$. On a side note, this is achieved for all even numbers except multiples of $10$. Hope it helps.


So you can simply try out all $10$ possible options:

  • $x\equiv0\pmod{10} \implies x^4\equiv0^4\equiv 0\equiv0\pmod{10}$
  • $x\equiv1\pmod{10} \implies x^4\equiv1^4\equiv 1\equiv1\pmod{10}$
  • $x\equiv2\pmod{10} \implies x^4\equiv2^4\equiv 16\equiv6\pmod{10}$
  • $x\equiv3\pmod{10} \implies x^4\equiv3^4\equiv 81\equiv1\pmod{10}$
  • $x\equiv4\pmod{10} \implies x^4\equiv4^4\equiv 256\equiv6\pmod{10}$
  • $x\equiv5\pmod{10} \implies x^4\equiv5^4\equiv 625\equiv5\pmod{10}$
  • $x\equiv6\pmod{10} \implies x^4\equiv6^4\equiv1296\equiv6\pmod{10}$
  • $x\equiv7\pmod{10} \implies x^4\equiv7^4\equiv2401\equiv1\pmod{10}$
  • $x\equiv8\pmod{10} \implies x^4\equiv8^4\equiv4096\equiv6\pmod{10}$
  • $x\equiv9\pmod{10} \implies x^4\equiv9^4\equiv6561\equiv1\pmod{10}$