- Sometimes referred to as:
- modulus arithmetic or clock arithmetic
- Related Topics:
- arithmetic
modular arithmetic
-
What is modular arithmetic?
Modular arithmetic is math with a count that resets to zero each time a whole number N, called the modulus, is reached. An example is a 24-hour clock, which resets to 0 at midnight (N = 24).
Under modular arithmetic (mod N), the only numbers are 0, 1, 2, …, N − 1, known as residues modulo N. Residues are added by taking the usual arithmetic sum, then subtracting the modulus to reduce the sum to a number M between 0 and N − 1.
Using notation by Carl Friedrich Gauss, 2 + 4 + 3 + 7 ≡ 6 (mod 10), where ≡ means "is congruent to". Modular arithmetic is a tool for solving Diophantine equations and led to modern algebra.
2 Britannica SourcesCreated from Britannica articles using AI. AI can make mistakes, so verify using Britannica articles. -
How does modular arithmetic work with remainders?
Modular arithmetic, in its basic form, involves counting that resets to zero once a whole number N, known as the modulus, is reached. The only numbers are 0, 1, 2, …, N − 1, known as residues modulo N. Residues are added by taking the usual arithmetic sum, then subtracting the modulus to reduce the sum to a number M between 0 and N − 1.
Using notation by Carl Friedrich Gauss, 2 + 4 + 3 + 7 ≡ 6 (mod 10). The symbol ≡ means "is congruent to.". Modular arithmetic is a fundamental tool in solving Diophantine equations and has led to the development of modern algebra.
2 Britannica SourcesCreated from Britannica articles using AI. AI can make mistakes, so verify using Britannica articles. -
What does 'modulus' mean in modular arithmetic?
In modular arithmetic, the "modulus" is a whole number N greater than one. With the modulus N, the count resets to zero each time N is reached.
In mod N, the only numbers are 0, 1, 2, …, N − 1, known as residues modulo N. You add residues by taking the arithmetic sum and subtracting the modulus from the sum as many times as necessary to reduce the sum to a number M between 0 and N − 1. M is the sum of the numbers modulo N.
A practical example is a 24-hour digital clock, where N=24, which resets itself to 0 at midnight.
2 Britannica SourcesCreated from Britannica articles using AI. AI can make mistakes, so verify using Britannica articles. -
How do you add and subtract numbers using modular arithmetic?
Modular arithmetic, in its basic form, is math with a count that resets to zero once a whole number ( N ), called the modulus, is reached. In modular arithmetic with modulus 5, 3 multiplied by 4 is 2.
To add or subtract, perform the usual arithmetic operation, then adjust the result to be within the range of 0 to ( N-1 ). This is done by adding or subtracting the modulus ( N ) as many times as needed until the result falls within this range. The result ( M ) is the sum or difference of the numbers modulo ( N ).
For example, using notation introduced by Carl Friedrich Gauss, 2 + 4 + 3 + 7 ≡ 6 (mod 10). The symbol ≡ means "is congruent to".
2 Britannica SourcesCreated from Britannica articles using AI. AI can make mistakes, so verify using Britannica articles. -
What are some real-life examples where modular arithmetic is used?
Modular arithmetic is math with a count that resets to zero once a number N, called the modulus, is reached.
Real-world examples include:
* Digital clocks In a 24-hour system, the clock resets to 0 at midnight (N = 24).
* Circular protractors These are marked in 360 degrees (N = 360).
* Calendars and astronomy These involve cycles, whether man-made or natural.Modular arithmetic is a tool for solving Diophantine equations and led to modern algebra.
2 Britannica SourcesCreated from Britannica articles using AI. AI can make mistakes, so verify using Britannica articles. -
How do you solve equations in modular arithmetic, like finding x if x + 3 ≡ 1 (mod 5)?
In modular arithmetic, you solve equations much like regular algebra, but with a focus on remainders after division by the modulus.
To solve (x + 3 \equiv 1 \pmod{5}):
-
Isolate (x): Subtract 3 from both sides of the congruence:
[x \equiv 1 - 3 \pmod{5}]
2. Simplify:[x \equiv -2 \pmod{5}]
3. Find the smallest positive integer: Since (-2) is negative, add the modulus (5) to find the equivalent positive residue:[x \equiv -2 + 5 \pmod{5}]
[x \equiv 3 \pmod{5}]
Therefore, (x = 3) is the solution, meaning (x) is any number that leaves a remainder of 3 when divided by 5.
3 Britannica SourcesCreated from Britannica articles using AI. AI can make mistakes, so verify using Britannica articles. -
modular arithmetic, in its most elementary form, arithmetic done with a count that resets itself to zero every time a certain whole number N greater than one, known as the modulus (mod), has been reached. Examples are a digital clock in the 24-hour system, which resets itself to 0 at midnight (N = 24), and a circular protractor marked in 360 degrees (N = 360). Modular arithmetic is important in number theory, where it is a fundamental tool in the solution of Diophantine equations (particularly those restricted to integer solutions). Generalizations of the subject led to important 19th-century attempts to prove Fermat’s last theorem and the development of significant parts of modern algebra.
Under modular arithmetic (with mod N), the only numbers are 0, 1, 2, …, N − 1, and they are known as residues modulo N. Residues are added by taking the usual arithmetic sum, then subtracting the modulus from the sum as many times as is necessary to reduce the sum to a number M between 0 and N − 1 inclusive. M is called the sum of the numbers modulo N. Using notation introduced by the German mathematician Carl Friedrich Gauss in 1801, one writes, for example, 2 + 4 + 3 + 7 ≡ 6 (mod 10), where the symbol ≡ is read “is congruent to.”
Examples of the use of modular arithmetic occur in ancient Chinese, Indian, and Islamic cultures. In particular, they occur in calendrical and astronomical problems since these involve cycles (man-made or natural), but one also finds modular arithmetic in purely mathematical problems. An example from a 3rd-century-ad Chinese book, Sun Zi’s Sunzi suanjing (Master Sun’s Mathematical Manual), asks
We have a number of things, but we do not know exactly how many. If we count them by threes we have two left over. If we count by fives we have three left over. If we count by sevens there are two left over. How many things are there?
This is equivalent to asking for the solution of the simultaneous congruences X ≡ 2 (mod 3), X ≡ 3 (mod 5), and X ≡ 2 (mod 7), one solution of which is 23. The general solution of such problems came to be known as the Chinese remainder theorem.
The Swiss mathematician Leonhard Euler pioneered the modern approach to congruence about 1750, when he explicitly introduced the idea of congruence modulo a number N and showed that this concept partitions the integers into N congruence classes, or residue classes. Two integers are in the same congruence class modulo N if their difference is divisible by N. For example, if N is 5, then −6 and 4 are members of the same congruence class {…, −6, −1, 4, 9, …}. Since each congruence class may be represented by any of its members, this particular class may be called, for example, “the congruence class of −6 modulo 5” or “the congruence class of 4 modulo 5.”
In Euler’s system any N numbers that leave different remainders on division by N may represent the congruence classes modulo N. Thus, one possible system for arithmetic modulo 5 would be −2, −1, 0, 1, 2. Addition of congruence classes modulo N is defined by choosing any element from each class, adding the elements together, and then taking the congruence class modulo N that the sum belongs to as the answer. Euler similarly defined subtraction and multiplication of residue classes. For example, to multiply −3 by 4 (mod 5), first multiply −3 × 4 = −12; since −12 ≡ 3 (mod 5), the solution is −3 × 4 ≡ 3 (mod 5). Euler showed that one would get the same result with any two elements from the corresponding congruence classes.
Note that when the modulus N is not prime, division is not always possible. For example, 1 ÷ 2 ≡ 3 (mod 5), since 2 × 3 ≡ 1 (mod 5). However, the equation 1 ÷ 2 ≡ X (mod 4) does not have a solution, since there is no X such that 2 × X ≡ 1 (mod 4). When the modulus N is not prime, it is possible to divide a class represented by r by a class represented by s if and only if s and N are relatively prime (that is, if their only common factor is the number 1). For example, 7 ÷ 4 ≡ 4 (mod 9) since 4 × 4 ≡ 7 (mod 9)—in this case, 7 and 9 are relatively prime.

" height="20" alt="HEW Logo">