Popular Mechanics (South Africa)

MODULAR ARITHMETIC 101

-

You already know modular maths, thanks to how we read clocks.

Modular arithmetic gets its name from the modulo operator (mod for short), which dictates how you’ll count through a series of numbers. On a clock, the mod is 12. We count up to 12 and then start over again. Which is why 3 pm is not 15 pm, but 3 is congruent (essentiall­y, equal) with 15 (mod 12).

The modulo operator can be any positive number, and acts as the key for understand­ing how the values of numbers have changed. For example, in mod 2, the numbers 3 and 5 are the same.

In modular arithmetic, your mod value is how many numbers are in your mod.

But unlike the numbers on a clock, we start with 0 where 12 would be. So mod 2 includes the numbers 0 and 1 but not 2. There are two numbers in the mod, but the actual number of the mod (say, mod 2) is not in the mod, because we start at zero. 3 and 5 are congruent in mod 2 because they’re both 1. Likewise, 0, 2, and 4 are all 0.

 ?? ??

Newspapers in English

Newspapers from South Africa