Modular Arithmetic
What is the remainder when this expression is divided by 3?
It seems like it will take some time to calculate the result of the operation. Maybe, we choose another way to solve this. But first, we must examine modular artihmetic deeply.
Definition : We say that two numbers and are congruent modulo if they have the same remainder when divided by . This donete by
In other words, a number is congruent modulo to all numbers for integer . In particular, if is remainder of when divided by then .
Key Lemmas and Properties
Addition
- If , then for any .
- If and , then .
Multiplication
- If , then for any .
- If and , then .
These lemmas essentially state that we can perform addition and multiplication on congruent numbers without changing their congruence modulo .
Example
To find the remainder of when divided by , we can replace each number with its equivalent modulo :
Then, the sum becomes:
Therefore, the remainder is 1.
Now we are ready to solve the problem that asked us to calculate the remainder of when divided by .
To compute the remainder, we can substitute each number by their remainder when divided by 3. As we have seen, this change does not affect the remainders of the results of arithmetic operations. This gives us
This simplifies computation a lot. This way, the computer does not consume much computing power.