Arithmetic modulo $n$ is arithmetic performed on residue classes modulo $n$. Instead of distinguishing all integers separately, we identify integers that have the same...
Modular Arithmetic
Arithmetic modulo is arithmetic performed on residue classes modulo . Instead of distinguishing all integers separately, we identify integers that have the same remainder after division by .
Thus, modulo , every integer is represented by one of
For example, modulo ,
So in arithmetic modulo , the integer behaves like , and the integer behaves like .
Addition Modulo
To add two residue classes modulo , add representatives and then reduce the result modulo .
For example, modulo ,
Therefore,
The sum wraps around after reaching . This is why modular arithmetic is often called clock arithmetic. On a clock modulo ,
Subtraction Modulo
Subtraction works in the same way. Subtract first, then reduce modulo .
For example, modulo ,
Since
we have
Negative numbers cause no difficulty because every integer has a unique representative among
Multiplication Modulo
Multiplication modulo is defined by
For example, modulo ,
Thus
Multiplication modulo is associative, commutative, and distributive over addition, because these laws hold for ordinary integers and congruence respects arithmetic.
Powers Modulo
Powers are repeated multiplication modulo . They are computed by reducing intermediate results.
For example, modulo ,
After that, the pattern repeats:
Such periodic behavior is common in modular arithmetic.
Additive Identity and Additive Inverses
The class
is the additive identity because
Every class has an additive inverse. The inverse of is
For example, modulo , the additive inverse of is , since
Thus addition modulo behaves like addition in a finite cyclic system.
Multiplicative Identity and Units
The class
is the multiplicative identity:
However, not every nonzero residue class has a multiplicative inverse.
A class has a multiplicative inverse modulo if there exists a class such that
Equivalently,
This occurs exactly when
For example, modulo ,
so is its own inverse.
But has no inverse because
Zero Divisors
A nonzero residue class is called a zero divisor if there exists a nonzero class such that
For example, modulo ,
Thus and are zero divisors.
Zero divisors occur precisely because is composite. In contrast, modulo a prime , there are no zero divisors among nonzero classes.
Prime Moduli
When the modulus is prime, arithmetic modulo has especially good behavior.
Every nonzero class modulo has a multiplicative inverse. Indeed, if
then
Therefore is a unit.
The set
is then a finite field. This means addition, subtraction, multiplication, and division by nonzero elements are all possible.
For example, modulo ,
because
Composite Moduli
When is composite, the arithmetic of is more complicated.
Some nonzero classes may fail to have inverses, and some may be zero divisors.
For example, modulo ,
is a unit because
But
is not a unit because
Also,
so both and are zero divisors.
Role in Number Theory
Arithmetic modulo is one of the central tools of number theory. It reduces questions about infinitely many integers to questions about a finite set of residue classes.
This makes many problems tractable. Congruences can test divisibility, solve equations, analyze powers, study primes, and construct cryptographic systems.
The passage from integers to
is therefore a fundamental move: it replaces global arithmetic by finite arithmetic while preserving the divisibility information encoded by the modulus.