Remainder

Arithmetic

The remainder is the amount left over after dividing one integer by another when the division is not exact.

Formula

a = b \times q + r, \text{ where } 0 \le r < b

Definition

The remainder is what is left over after you divide as evenly as possible. It is always smaller than the number you divided by.

Example

$17 / 5 = 3$ remainder $2$. Five goes into $17$ three times ($= 15$), and $17 - 15 = 2$ is left over.

Key Insight

If the remainder is $0$, the division is exact and the divisor is a factor of the dividend. If the remainder is not $0$, the divisor does not divide the dividend evenly.

Definition

By the Division Algorithm, for integers $a$ and $b$ ($b > 0$), there exist unique integers $q$ (quotient) and $r$ (remainder) such that $a = bq + r$ and $0 \le r < b$. The remainder is denoted $a \bmod b$. If $r = 0$, then $b \mid a$ ($b$ divides $a$).

Example

$23 \bmod 7 = 2$ (since $23 = 7 \times 3 + 2$). $56 \bmod 8 = 0$ (since $56 = 8 \times 7 + 0$, so $8$ divides $56$).

Key Insight

The remainder (modulo operation) is the foundation of clock arithmetic. Hours on a clock are computed $\bmod 12$: $10$ hours after $5$ o'clock is $(5 + 10) \bmod 12 = 3$ o'clock.

Definition

The remainder function $r = a \bmod b$ defines an equivalence relation: $a$ is congruent to $b$ mod $n$ (written $a \equiv b \pmod n$) if $n \mid (a - b)$. Congruence classes form the ring $\mathbb{Z}/n\mathbb{Z}$. The Chinese Remainder Theorem states that if $\gcd(m, n) = 1$, then the system $x \equiv a \pmod m$, $x \equiv b \pmod n$ has a unique solution mod $mn$.

Example

RSA encryption uses modular exponentiation: $c = m^e \bmod n$. Decryption uses $d = c^d \bmod n$ where $ed \equiv 1 \pmod{\phi(n)}$. Security relies on the difficulty of factoring $n = pq$.

Key Insight

Modular arithmetic underpins modern cryptography, hash functions, error-correcting codes, and pseudorandom number generators. The remainder is not just a leftovers concept; it is a primary tool in applied mathematics.