# Modular Arithmetic

Carl Friedrich Gauss, he is the man responsible for the modular arithmetic we see today. He authored a book in 1801 titled Disquisitiones Arithmeticae that brings such to light. It is interesting that modular arithmetic is a fairly new mathematical idea. I suppose the idea of it was present in the past but it must have never been defined in the manner that Gauss had done.

Some cases where modular arithmetic is useful.
• Simple time calculations
• Putting Items In Random Groups
• Picking A Random Item
• Running Tasks On A Cycle
• Cryptography

Modular Arithmetic Defined

“Modular arithmetic is a system of arithmetic for integers, where we only perform calculations by considering their remainder with respect to the modulus” (Brilliant).

It “...is a system of arithmetic for integers, where numbers ”wrap around“ upon reaching a certain value—the modulus” (Wiki).

One of the most organized way of doing this is by using something called a congruence relation.

Congruence relation says for a positive integer $$n$$, two integers $$a$$ and $$b$$ are said to be congruent modulo $$n$$, written: $$a \equiv b \pmod{n}$$, if $$n$$ divides the difference of $$a-b$$.

One way to think of this is that $$a \equiv b \pmod{n}$$ means when $$n$$ divides $$a$$ there is a remainder of $$b$$.

Example

One of the most common forms of modular arithmetic that is also a good example is the idea of telling time on a 12 hour clock.

Let’s say you have a flight coming in at 3pm but unfortunately it is delayed with an estimate of 14 hours. What time do you expect this plane to finally land?

Well, one way to think about this is by taking $$14$$ and dividing it by $$12$$ which gives you a remainder of $$2$$. Or in other words $$14 \equiv 2 \pmod{12}$$. From this point you add the remainder of $$2$$ as well as an am/pm switch to your original 3pm and you should have figured out that the plane will arrive at 5am. So just think, you’ll never be late again.