[Math] How to use the ‘modulus’ operator

contest-mathelementary-number-theorynumber theory

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?

Best Answer

$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$.