The Division Algorithm

Number theory begins with a single, humble fact about whole numbers — one so familiar from primary-school remainders that it is easy to overlook how much rests on it. Divide one whole number by another and you get a quotient and a remainder, and the remainder is always smaller than what you divided by. Despite its name, the division algorithm is not really an algorithm at all — it is a theorem guaranteeing those two numbers always exist, and are unique.

The statement

Given any integer a and any positive integer b, there is exactly one pair of integers q (the quotient) and r (the remainder) with

The condition 0 \le r < b is the whole point: it pins the remainder down to a single value. Without it you could write 17 = 5\cdot 1 + 12 or 17 = 5 \cdot 2 + 7 and never agree on an answer. Forcing r below b leaves only one choice: 17 = 5\cdot 3 + 2.

A picture

Think of laying out a counters and grouping them into rows of b. The quotient q is how many full rows you make; the remainder r is the short final row that couldn't be completed. There is never enough left over to form another full row — that is exactly what r < b says.

a = \underbrace{b + b + \dots + b}_{q \text{ rows}} + r, \qquad 0 \le r < b.

Negative numbers behave too

The theorem allows a to be negative — and the rule 0 \le r < b still forces a non-negative remainder. To divide -17 by 5, we cannot take q = -3 (that gives r = -2, which is not allowed); we must go one step further down:

-17 = 5\cdot(-4) + 3, \qquad 0 \le 3 < 5.

So the quotient rounds down, not towards zero. This non-negative remainder is what makes the whole theory of modular arithmetic run smoothly.

Divisibility: the special case r = 0

When the remainder is zero, a = bq exactly: we say b divides a, written b \mid a. This is the relationship at the heart of everything that follows — factors and multiples are just another name for it.

b \mid a \iff a = bq \text{ for some integer } q \iff \text{the remainder is } 0.