Eroxl's Notes
Modular Arithmetic

Modular arithmetic is a system of operations for integers where numbers "wrap around" when they reach a certain value, called the modulus.

Congruence

Given an integer such that , two integers and are said to be congruent if . This congruency is written as follows:

The parentheses mean that applies to the entire equation, not just to the right-hand side (here, ).

Occasionally, the parentheses are omitted (ie. ) but it still has the same meaning.

Formally, two integers and are said to be congruent modulo if there exists an integer such that:

Alternatively, this can be written as:

Fundamental Theorem of Modular Arithmetic

The fundamental theorem of modular arithmetic means that it doesn’t matter if you do a sequence of operations, and then take the remainder at the end or take the remainder every time you perform an operation in the sequence.

Formally the fundamental theorem of modular arithmetic is stated as follows:

If and mod m then .