Math Fundamentals18 sections · 814 units
Open in Course

Properties of Modulo

Addition and multiplication

Modulo has special properties that make calculations easier:

\bullet (a+b)modm=((amodm)+(bmodm))modm(a + b) \bmod m = ((a \bmod m) + (b \bmod m)) \bmod m

\bullet (a×b)modm=((amodm)×(bmodm))modm(a \times b) \bmod m = ((a \bmod m) \times (b \bmod m)) \bmod m

These let you take modulo at each step instead of waiting until the end. This prevents overflow when working with large numbers.