Explainer: The impact of modular arithmetic on our lives

Alarm clock

Modular arithmetic is a mathematical system that underpins the way we live and do things every day – from communicating through technology to planning our daily routines. So, what is modular arithmetic? Professor Andy Hone, Professor of Mathematics at the School of Mathematics, Statistics and Actuarial Science, explains:

‘Modular arithmetic, also known as clock arithmetic, is something we all get used to as soon as we learn to tell the time. It is also a mathematical technique that, perhaps without realising, we rely on every time we do online shopping, internet banking, or send private messages to our friends via social media.

‘Suppose you have to travel somewhere early tomorrow morning: you go to bed at 10pm in the evening, and you have to get up in 8 hours’ time, so you know you need to set your alarm for 6am the next morning. Or, perhaps you are driving to meet someone for tea at 4pm – if the digital clock in your car reads 16:00 hours, then you know you are going to be late.

‘The way modular arithmetic works is just like the hands of a clock going round: you count 1,2,3,…,12, and then start at 1 again, so for each number you only care about the remainder that is left over when you divide by 12. The hour number starts over after it reaches 12, this is arithmetic modulo 12 (mod 12). for example, 10am + 8 hours = 6am (mod 12). Moreover, it doesn’t just make sense with adding, but also multiplying – 10 x 8 = 80 = 6 x 12 +8, so 10 x 8 = 8 (mod 12), because 8 is the remainder when you divide 80 by 12.

‘In practice, computers also use modular arithmetic for sending encrypted messages or doing secure transactions online, but there is nothing special about the number 12: you can do modular arithmetic by taking remainders with respect to any fixed choice of positive whole number, called the modulus. In perspective, when you send and receive messages via a social media app on your mobile phone or laptop, it is based on a method called the RSA public-key cryptosystem. This involves choosing a very large modulus (typically a number with at least 200 digits), and another number, called the key, which are shared with the devices of anyone you are in touch with. Then they can send you messages privately, which only you can read. Nobody else will be able to break the code and eavesdrop on your conversation without knowing particular mathematical properties of the modulus (its prime factors). These are a kept a secret, and it is incredibly hard to find them when the modulus is very large.’

Andy Hone is Professor of Mathematics at SMSAS. His research areas are: nonlinear differential and difference equations, and their applications in physics and biology, discrete and continuous integrable systems, cluster algebras and number theory.