# Modular arithmetic

https://arbital.com/p/modular_arithmetic

by Malcolm McCrimmon Jul 30 2016 updated Aug 2 2016

[summary: Modular arithmetic is the type of [-addition] we use when calculating dates and times. In ordinary [-arithmetic], $9 + 6 = 15$, but when working with the hours of the day, 6 hours after 9 o'clock is 3 o'clock, not 15 o'clock. This type of "wrap-around" addition generalizes to many other domains. ]
In ordinary [-arithmetic], you can think of [-addition] and [-subtraction] as traveling in different directions along an [infinity infinitely] long road. A calculation like $9 + 6$ can be thought of as starting at kilometer marker 9, then driving for another 6 kilometers, which would bring you to kilometer marker 15 ([-negative_numbers] are analogous to driving along the road backwards). If the road is perfectly straight, you can never go back to a marker you've already visited by driving forward. But what if the road were a circle?
Modular arithmetic may seem strange, but in fact, you probably use it every day! The hours on the face of a clock "wrap around" from 12 to 1 in exactly the same way that a circular road wraps around on itself. Thus, while in ordinary arithmetic $9 + 6 = 15$, when figuring out what time it will be 6 hours after 9 o'clock, we use modular arithmetic to arrive at the correct answer of 3 o'clock, rather than 15 o'clock.