Professional Documents
Culture Documents
Math
Math
"
In modular arithmetic, numbers "wrap around" upon reaching a given fixed quantity, which is known as
the modulus (which would be 12 in the case of hours on a clock, or 60 in the case of minutes or seconds
on a clock).
Residue
We say that $a$ is the modulo-$m$ residue of $n$ when $n\equiv a\pmod m$, and $0\le a<m$.
Congruence
There is a mathematical way of saying that all of the integers are the same as one of the modulo 5
residues. For instance, we say that 7 and 2 are congruent modulo 5. We write this using the symbol
$\equiv$: In other words, this means in base 5, these integers have the same residue modulo 5:
The (mod 5) part just tells us that we are working with the integers modulo 5. In modulo 5, two integers
are congruent when their difference is a multiple of 5. In general, two integers $a$ and $b$ are
congruent modulo $n$ when $a - b$ is a multiple of $n$. In other words, $a \equiv b \pmod{n}$ when
$\frac{a-b}{n}$ is an integer. Otherwise, $a \not\equiv b \pmod{n}$, which means that $a$ and $b$ are
not congruent modulo $n$.
Addition
Problem
We could find their sum, which is $8221$, and note that the units digit is $1$. However, we could find
the units digit with far less calculation.
Solution
The units digit of this sum is $1$, which must be the same as the units digit of the four-digit sum we
computed earlier.
We can rewrite each of the integers in terms of multiples of $10$ and remainders:
$791 = 79 \cdot 10 + 1$
$688 = 68 \cdot 10 + 8$
At this point, we already see the units digits grouped apart and added to a multiple of $10$ (which will
not affect the units digit of the sum):
Now let's look back at this solution, using modular arithmetic from the start. Note that
Addition rule
In general, when $a, b, c$, and $d$ are integers and $m$ is a positive integer such that
$a \equiv c \pmod{m}$
$b \equiv d \pmod{m}$
$a + b \equiv c + d \pmod{m}$.
And as we did in the problem above, we can apply more pairs of equivalent integers to both sides, just
repeating this simple principle.
Let $a-c=m\cdot k$, and $b-d=m\cdot l$ where $l$ and $k$ are integers. Adding the two equations we
get: \begin{eqnarray*} mk+ml&=&(a-c)+(b-d)\\ m(k+l)&=&(a+b)-(c+d) \end{eqnarray*}
Subtraction
The same shortcut that works with addition of remainders works also with subtraction.
Problem
Find the remainder when the difference between $60002$ and $601$ is divided by $6$.
Solution
Note that $60002 = 10000 \cdot 6 + 2$ and $601 = 100 \cdot 6 + 1$. So,
Thus,
so 1 is the remainder when the difference is divided by $6$. (Perform the subtraction yourself, divide by
$6$, and see!)
Subtraction rule
When $a, b, c$, and $d$ are integers and $m$ is a positive integer such that
$a \equiv c \pmod{m}$
$b \equiv d \pmod{m}$
$a - b \equiv c - d \pmod{m}$
Multiplication
Modular arithmetic provides an even larger advantage when multiplying than when adding or
subtracting. Let's take a look at a problem that demonstrates the point.
Problem
Jerry has $44$ boxes of soda in his truck. The cans of soda in each box are packed oddly so that there
are $113$ cans of soda in each box. Jerry plans to pack the sodas into cases of $12$ cans to sell. After
making as many complete cases as possible, how many sodas will Jerry have leftover?
meaning there are $4$ sodas leftover. Yeah, that was much easier.
Multiplication rule
When $a, b, c$, and $d$ are integers and $m$ is a positive integer such that
$a \equiv c \pmod{m}$
$b \equiv d \pmod{m}$
https://artofproblemsolving.com/wiki/index.php/Modular_arithmetic/Introduction#Addition
http://mathworld.wolfram.com/ModularArithmetic.html