Division Theorem/Positive Divisor

Theorem
For every pair of integers $a, b$ where $b > 0$, there exist unique integers $q, r$ such that $a = q b + r$ and $0 \le r < b$:


 * $\forall a, b \in \Z, b > 0: \exists! q, r \in \Z: a = q b + r, 0 \le r < b$

In the above equation:
 * $a$ is the dividend
 * $b$ is the divisor
 * $q$ is the quotient
 * $r$ is the principal remainder, or, more usually, just the remainder.

Proof
From Division Theorem: Positive Divisor: Positive Dividend:
 * $\forall a, b \in \Z, a \ge 0, b > 0: \exists! q, r \in \Z: a = q b + r, 0 \le r < b$

That is, the result holds for positive $a$.

It remains to be shown that the statement holds for $a < 0$.

From Division Theorem: Positive Divisor: Positive Dividend:
 * $\exists \tilde q, \tilde r \in \Z: \left|{a}\right| = \tilde q b + \tilde r, 0 \le \tilde r < b$

where $\left|{a}\right|$ denotes the absolute value of $a$: by definition $\left|{a}\right| \ge 0$.

As $a < 0$ it follows by definition of absolute value that $\left \vert {a} \right \vert = -a$.

This gives:

Let $\tilde r = 0$.

Then:
 * $q = -\tilde q, r = \tilde r = 0$

which gives:
 * $a = q b + r, 0 \le r < b$

as required.

Otherwise:
 * $0 < \tilde r < b \implies 0 < b - \tilde r < b$

which suggests a rearrangement of the expression for $a$ above:

Taking:
 * $q = \left({-1 - \tilde q}\right)$

and:
 * $r = \left({b - \tilde r}\right)$

the required result follows.

Uniqueness of $q$ and $r$ follow from the Uniqueness of $\tilde q$ and $\tilde r$.