Modular arithmetic: you may not know it but you use it every day

That’s Maths: Modular arithmetic is used to calculate checksums for ISBNs and Ibans

Gauss’s work extended the theory of numbers in several directions, and its influence continued into the 20th century

Gauss’s work extended the theory of numbers in several directions, and its influence continued into the 20th century

 

You may never have heard of modular arithmetic, but you use it every day without the slightest difficulty. In this system, numbers wrap around when they reach a certain size called the modulus; it is the arithmetic of remainders. When reckoning hours, we count up to 12 and start again from one. Thus, four hours after 9 o’clock it is 1 o’clock. Numbers that differ by a multiple of the modulus 12 are said to be congruent modulo 12.

A similar situation arises for the days of the week, which are computed modulo seven. Suppose today is Thursday. What weekday will it be 1,000 days from today? We don’t have to count through the thousand days, just calculate the remainder when 1,000 is divided by seven, which is six. Then the weekday 1,000 days from today will be the same as in six days, a Wednesday.

It is much the same for other time measurements. With 52 weeks in a year, the week number is reset to 1 at the beginning of each year, so it is confined to the range 1 to 52. Likewise, for the months, we use modulo 12 arithmetic.

The prince

Modular arithmetic was introduced by Carl Friedrich Gauss on the very first page of his magnum opus Arithmetical Investigations, or Disquisitiones Arithmeticae. Gauss was one of the most brilliant mathematicians of all time. His genius became evident at an early age. His primary school teacher set a task for the class: hoping for some peace, he asked his pupils to add up the first 100 numbers. While his classmates attacked the problem head on, Gauss, who was just eight, spotted a pattern that led directly to the answer. He paired 1 with 100, 2 with 99 and so on to 50 with 51. Since each of the 50 pairs added to 101, the grand total must be 5,050. Gauss gave this correct answer within a minute or so, thwarting the teacher’s plan.

Historians have not recorded the reaction of the teacher, but he might have gained some respite by asking Gauss for the product that results when the first hundred numbers are multiplied, a number called factorial 100, having 158 digits.

Disquisitiones Arithmeticae was completed when Gauss was only 21, and published three years later in 1801. This work revolutionised number theory, bringing together many previous results and containing much that was original. It was one of the last mathematical texts to be written in Latin. The logical structure of this book set a standard that was followed in many later texts. Gauss’s work extended the theory of numbers in several directions, and its influence continued into the 20th century.

Ibans and ISBNs

Modular arithmetic is used extensively in pure mathematics, where it is a cornerstone of number theory. But it also has many practical applications. It is used to calculate checksums for international standard book numbers (ISBNs) and bank identifiers (Iban numbers) and to spot errors in them.

Modular arithmetic also underlies public key cryptography systems, which are vital for modern commerce. It is also widely used in computer science. Finally, in music theory, modulo 12 arithmetic is used to analyse the 12-tone equal temperament system, when notes separated by an octave of 12 semi-tones are treated as equivalent.

The Irish Times Logo
Commenting on The Irish Times has changed. To comment you must now be an Irish Times subscriber.
SUBSCRIBE
GO BACK
Error Image
The account details entered are not currently associated with an Irish Times subscription. Please subscribe to sign in to comment.
Comment Sign In

Forgot password?
The Irish Times Logo
Thank you
You should receive instructions for resetting your password. When you have reset your password, you can Sign In.
The Irish Times Logo
Please choose a screen name. This name will appear beside any comments you post. Your screen name should follow the standards set out in our community standards.
Screen Name Selection

Hello

Please choose a screen name. This name will appear beside any comments you post. Your screen name should follow the standards set out in our community standards.

The Irish Times Logo
Commenting on The Irish Times has changed. To comment you must now be an Irish Times subscriber.
SUBSCRIBE
Forgot Password
Please enter your email address so we can send you a link to reset your password.

Sign In

Your Comments
We reserve the right to remove any content at any time from this Community, including without limitation if it violates the Community Standards. We ask that you report content that you in good faith believe violates the above rules by clicking the Flag link next to the offending comment or by filling out this form. New comments are only accepted for 3 days from the date of publication.