avewright/proofwiki-math huggingface dataset:
Theorem: Division Theorem/Positive Divisor

<onlyinclude>
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$
<onlyinclude>
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: Existence:
:$\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$.
{{qed|lemma}}
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: \size a = \tilde q b + \tilde r, 0 \le \tilde r < b$
where $\size a$ denotes the absolute value of $a$: by definition $\size a \ge 0$.
As $a < 0$ it follows by definition of absolute value that $\size a = -a$.
This gives:
{{begin-eqn}}
{{eqn | l = a
      | r = -\size a
      | c = 
}}
{{eqn | r = -\paren {\tilde q b + \tilde r}
      | c = 
}}
{{eqn | r = b \paren {-\tilde q} + \paren {-\tilde r}
      | c = 
}}
{{end-eqn}}
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:
{{begin-eqn}}
{{eqn | l = a
      | r = b \paren {-\tilde q} + \paren {-\tilde r}
      | c = 
}}
{{eqn | r = b \paren {-\tilde q} - b + b - \tilde r
      | c = 
}}
{{eqn | r = b \paren {-1 - \tilde q} + \paren {b - \tilde r}
      | c = 
}}
{{end-eqn}}
Taking:
:$q = \paren {-1 - \tilde q}$
and:
:$r = \paren {b - \tilde r}$
the required result follows.
Uniqueness of $q$ and $r$ follow from the Uniqueness of $\tilde q$ and $\tilde r$.
{{qed}}
Theorem: Division Theorem/Positive Divisor

<onlyinclude>
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$
<onlyinclude>
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:
Let:
: $q = \floor {\dfrac a b}, t = \dfrac a b - \floor {\dfrac a b}$
where $\floor {\, \cdot \,}$ denotes the floor function.
Thus $q \in \Z$ and $t \in \hointr 0 1$.
So:
:$\dfrac a b = q + t$
and so:
:$(1): \quad a = q b + r$
where $r = t d$.
Since $a, q, b \in \Z$, it follows from $(1)$ that:
:$r = a - q b$
and so $r \in \Z$ also.
Since $0 \le t < 1$ and $b > 0$, it follows that:
:$0 \le t b < b$
that is:
:$0 \le r < b$
{{qed}}
Theorem: Division Theorem/Positive Divisor

<onlyinclude>
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$
<onlyinclude>
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:
Let there exist $q \in Z$ such that $a - b q = 0$.
Then $a = b q$ as required, with $r = 0$.
Otherwise, let $S$ be defined as the set of all positive integers of the form $a - z b$ where $z$ is an integer:
:$S = \set {x \in \Z_{\ge 0}: \exists z \in \Z: x = a - z b}$
Setting $z = 0$ it is seen that $a \in S$, so $S \ne \O$.
From Set of Integers Bounded Below by Integer has Smallest Element, $S$ has a smallest element.
Let $r$ be the smallest element of $S$.
Let $r = a - b q$.
As there does not exist $q \in Z$ such that $a - b q = 0$:
:$r > 0$
Suppose $r = b$.
Then $a = b \paren {q + 1}$ and it has already been declared that there does not exist such a $q + 1 \in Z$.
Suppose $r > b$.
Then $x = a - b \paren {q + 1} \in S$ such that $x < r$, which contradicts the assumption that $r$ is the smallest element of $S$.
Hence the result.
{{qed}}
Theorem: Division Theorem/Positive Divisor

<onlyinclude>
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$
<onlyinclude>
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:
Let $a, b \in \Z$ such that $a \ge 0$ and $b > 0$ be given.
Let $S$ be defined as the set of all positive integers of the form $a - z b$ where $z$ is an integer:
:$S = \set {x \in \Z_{\ge 0}: \exists z \in \Z: x = a - z b}$
By setting $z = 0$ we have that $a \in S$.
Thus $S \ne \O$.
We have that $S$ is bounded below by $0$.
From Set of Integers Bounded Below by Integer has Smallest Element it follows that $S$ has a smallest element $r$.
Thus:
:$\exists q \in \Z: a - q b = r$
and so:
:$a = q b + r$
So we have proved the existence of $q$ and $r$ such that $a = q b + r$.
It remains to be shown that $0 \le r < b$.
We have that $r \in S$ which is bounded below by $0$.
Therefore $0 \le r$.
{{AimForCont}} $b \le r$.
So:
{{begin-eqn}}
{{eqn | l = b
      | o = \le
      | r = r
      | c = 
}}
{{eqn | o = <
      | r = r + b
      | c = as $b > 0$
}}
{{eqn | ll= \leadsto
      | l = 0
      | o = \le
      | r = r - b
      | c = 
}}
{{eqn | o = <
      | r = r
      | c = subtracting $b$ throughout
}}
{{end-eqn}}
But then:
{{begin-eqn}}
{{eqn | l = a
      | r = q b + r
      | c = from above
}}
{{eqn | ll= \leadsto
      | l = r - b
      | r = \paren {a - q b} - b
      | c = 
}}
{{eqn | r = a - b \paren {q + 1}
      | c = 
}}
{{eqn | ll= \leadsto
      | l = r - b
      | o = \in
      | r = S
      | c = as $r - b$ is of the correct form
}}
{{end-eqn}}
But $r - b < r$ contradicts the choice of $r$ as the least element of $S$.
Hence $r < b$ as required.
Thus the existence of $q$ and $r$ satisfying $a = q b + r, 0 \le r < b$ has been demonstrated.
{{qed}}
Theorem: Division Theorem/Positive Divisor

<onlyinclude>
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$
<onlyinclude>
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:
Let $a = 0$.
It is immediately apparent that $q = r = 0$ is the only possible solution with $0 \le r < b$.
{{qed|lemma}}
Let $a > 0$ and $b = 1$.
Then from the condition $0 \le r < b$ it follows that $r = 0$ and hence $q = a$.
{{qed|lemma}}
Let $a > 0$ and $b > 1$.
By the Basis Representation Theorem, $a$ has a unique representation to the base $b$:
{{begin-eqn}}
{{eqn | l = a
      | r = \sum_{k \mathop = 0}^s r_k b^k
      | c = 
}}
{{eqn | r = b \sum_{k \mathop = 0}^{s - 1} r_k b^{k - 1} + r_0
      | c = 
}}
{{eqn | r = b q + r
      | c = where $0 \le r = r_0 < b$
}}
{{end-eqn}}
{{qed}}
Theorem: Division Theorem/Positive Divisor

<onlyinclude>
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$
<onlyinclude>
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:
Let $a, b \in \Z$ such that $a \ge 0$ and $b > 0$ be given.
When $a = 0$, the integers $q = r = 0$ satisfy the conditions of the theorem.
Let $a > 0$.
For each $k \in \closedint 0 {a + 1}$, let $r_k = b k$.
(Note that here, as elsewhere in this proof, $\closedint 0 {a + 1}$ denotes an integer interval.)
Then $\sequence {r_k}_{0 \mathop \le k \mathop \le a + 1}$ is a strictly increasing sequence of positive integers.
It is also the case that:
:$a + 1 \in \closedint 1 {\map b {a + 1} }$
So from Strictly Increasing Sequence induces Partition there exists $q \in \closedint 0 a$ such that:
:$a + 1 \in \closedint {r_q + 1} {r_{q + 1} }$
Let $r = a - b q$.
Then $a = b q + r$.
We have:
{{begin-eqn}}
{{eqn | l = b q + 1
      | r = r_q + 1
      | c = 
}}
{{eqn | o = \le
      | r = a + 1
      | c = 
}}
{{eqn | o = \le
      | r = r_{q + 1}
      | c = 
}}
{{eqn | r = b q + b
      | c = 
}}
{{end-eqn}}
and so:
{{begin-eqn}}
{{eqn | l = 0
      | o = \le
      | r = r
      | c = 
}}
{{eqn | r = \paren {a + 1} - \paren {b q + 1}
      | c = 
}}
{{eqn | o = \le
      | r = \paren {b q + b} - \paren {b q + 1}
      | c = 
}}
{{eqn | r = b - 1
      | c = 
}}
{{eqn | o = <
      | r = b
      | c = 
}}
{{end-eqn}}
Hence the result.
{{qed}}
Theorem: Division Theorem/Positive Divisor

<onlyinclude>
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$
<onlyinclude>
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:
Suppose $q_1, r_1$ and $q_2, r_2$ are two pairs of $q, r$ that satisfy $a = q b + r, 0 \le r < b$.
That is:
{{begin-eqn}}
{{eqn | l = a
      | r = q_1 b + r_1, 0 \le r_1 < b
      | c = 
}}
{{eqn | l = a
      | r = q_2 b + r_2, 0 \le r_2 < b
      | c = 
}}
{{end-eqn}}
This gives:
:$0 = b \paren {q_1 - q_2} + \paren {r_1 - r_2}$
{{AimForCont}} that $q_1 \ne q_2$.
{{WLOG}}, suppose that $q_1 > q_2$.
Then:
{{begin-eqn}}
{{eqn | l = q_1 - q_2
      | o = \ge
      | r = 1
      | c = 
}}
{{eqn | ll= \leadsto
      | l = r_2 - r_1
      | r = b \paren {q_1 - q_2}
      | c = 
}}
{{eqn | o = \ge
      | r = b \times 1
      | c = as $b > 0$
}}
{{eqn | r = b
      | c = 
}}
{{eqn | ll= \leadsto
      | l = r_2
      | o = \ge
      | r = r_1 + b
      | c = 
}}
{{eqn | o = \ge
      | r = b
      | c = 
}}
{{end-eqn}}
This contradicts the assumption that $r_2 < b$.
A similar contradiction follows from the assumption that $q_1 < q_2$.
Therefore $q_1 = q_2$ and so $r_1 = r_2$.
Thus it follows that $q$ and $r$ are unique.
{{qed}}
Theorem: Division Theorem/Positive Divisor

<onlyinclude>
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$
<onlyinclude>
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:
It is given by Division Theorem: Positive Divisor: Positive Dividend: Existence that such $q$ and $r$ exist.
Let $a = 0$.
It is immediately apparent that $q = r = 0$ is the only possible solution with $0 \le r < b$.
{{qed|lemma}}
Let $a > 0$ and $b = 1$.
Then from the condition $0 \le r < b$ it follows that $r = 0$.
Hence $r = 0, q = a$ is the only possible solution.
{{qed|lemma}}
Let $a > 0$ and $b > 1$.
By the Basis Representation Theorem, $a$ has a unique representation to the base $b$:
{{begin-eqn}}
{{eqn | l = a
      | r = \sum_{k \mathop = 0}^s r_k b^k
      | c = 
}}
{{eqn | r = b \sum_{k \mathop = 0}^{s - 1} r_k b^{k - 1} + r_0
      | c = 
}}
{{eqn | r = b q + r
      | c = where $0 \le r = r_0 < b$
}}
{{end-eqn}}
Suppose a second pair $q', r'$ were to exist.
Then there would be a representation for $q'$ to the base $b$:
:$\displaystyle q' = \sum_{k \mathop = 0}^t u_k b^k$
so that:
{{begin-eqn}}
{{eqn | l = a
      | r = b q' + r'
      | c = $0 \le r < b$
}}
{{eqn | r = \sum_{k \mathop = 0}^t u_k b^{k + 1} + r'
      | c = 
}}
{{end-eqn}}
But there already exists a representation of $a$ to the base $b$:
:$\displaystyle a = \sum_{k \mathop = 0}^s r_k b^k$
By the Basis Representation Theorem, such a representation is unique.
So:
{{begin-eqn}}
{{eqn | l = t
      | r = s - 1
}}
{{eqn | l = u_k
      | r = r_{k + 1}
}}
{{eqn | l = r'
      | r = a_0
}}
{{eqn | r = r
}}
{{end-eqn}}
and hence $q' = q$.
{{qed}}
Theorem: Division Theorem/Positive Divisor

<onlyinclude>
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$
<onlyinclude>
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:
It is given by Division Theorem: Positive Divisor: Existence that such $q$ and $r$ exist.
{{:Division Theorem/Positive Divisor/Positive Dividend/Uniqueness/Proof 1}}
Theorem: Division Theorem/Positive Divisor

<onlyinclude>
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$
<onlyinclude>
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:
It is given by Division Theorem: Positive Divisor: Existence that such $q$ and $r$ exist.
Let $a = q b + r$ where $q, r \in \Z$ and $0 \le r < b$.
Thus:
:$\dfrac a b = q + \dfrac r b$
and:
:$0 \le \dfrac r b \le \dfrac {b - 1} b < 1$
So:
:$q = \floor {\dfrac a b}$
and so:
:$r = a - b \floor {\dfrac a b}$
Thus, given $a$ and $b$, the numbers $q$ and $r$ are unique determined.
{{qed}}
Theorem: Division Theorem/Positive Divisor

<onlyinclude>
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$
<onlyinclude>
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:
It is given by Division Theorem: Positive Divisor: Existence that such $q$ and $r$ exist.
Suppose that:
:$a = b q_1 + r_1 = b q_2 + r_2$
where both $0 \le r_1 < b$ and $0 \le r_2 < b$.
{{WLOG}}, suppose $r_1 \ge r_2$.
Then:
:$r_1 - r_2 = b \paren {q_2 - q_1}$
That is:
:$b \divides \paren {r_2 - r_1}$
where $\divides$ denotes divisibility.
But:
:$r_1 - r_2 < b$
while from Absolute Value of Integer is not less than Divisors: Corollary:
:$r_1 - r_2 \ge b$
unless from Integer Divides Zero $r_1 - r_2 = 0$.
So $r_1 = r_2$ and it follows directly that $q_1 = q_2$.
{{qed}}
Theorem: Division Theorem/Positive Divisor/Positive Dividend/Existence

For every pair of integers $a, b$ where $a \ge 0$ and $b > 0$, there exist integers $q, r$ such that $a = q b + r$ and $0 \le r < b$:
:$\forall a, b \in \Z, a \ge 0, b > 0: \exists q, r \in \Z: a = q b + r, 0 \le r < b$

Proof:
Let $a, b \in \Z$ such that $a \ge 0$ and $b > 0$ be given.
Let $S$ be defined as the set of all positive integers of the form $a - z b$ where $z$ is an integer:
:$S = \set {x \in \Z_{\ge 0}: \exists z \in \Z: x = a - z b}$
By setting $z = 0$ we have that $a \in S$.
Thus $S \ne \O$.
We have that $S$ is bounded below by $0$.
From Set of Integers Bounded Below by Integer has Smallest Element it follows that $S$ has a smallest element $r$.
Thus:
:$\exists q \in \Z: a - q b = r$
and so:
:$a = q b + r$
So we have proved the existence of $q$ and $r$ such that $a = q b + r$.
It remains to be shown that $0 \le r < b$.
We have that $r \in S$ which is bounded below by $0$.
Therefore $0 \le r$.
{{AimForCont}} $b \le r$.
So:
{{begin-eqn}}
{{eqn | l = b
      | o = \le
      | r = r
      | c = 
}}
{{eqn | o = <
      | r = r + b
      | c = as $b > 0$
}}
{{eqn | ll= \leadsto
      | l = 0
      | o = \le
      | r = r - b
      | c = 
}}
{{eqn | o = <
      | r = r
      | c = subtracting $b$ throughout
}}
{{end-eqn}}
But then:
{{begin-eqn}}
{{eqn | l = a
      | r = q b + r
      | c = from above
}}
{{eqn | ll= \leadsto
      | l = r - b
      | r = \paren {a - q b} - b
      | c = 
}}
{{eqn | r = a - b \paren {q + 1}
      | c = 
}}
{{eqn | ll= \leadsto
      | l = r - b
      | o = \in
      | r = S
      | c = as $r - b$ is of the correct form
}}
{{end-eqn}}
But $r - b < r$ contradicts the choice of $r$ as the least element of $S$.
Hence $r < b$ as required.
Thus the existence of $q$ and $r$ satisfying $a = q b + r, 0 \le r < b$ has been demonstrated.
{{qed}}
Theorem: Division Theorem/Positive Divisor/Positive Dividend/Existence

For every pair of integers $a, b$ where $a \ge 0$ and $b > 0$, there exist integers $q, r$ such that $a = q b + r$ and $0 \le r < b$:
:$\forall a, b \in \Z, a \ge 0, b > 0: \exists q, r \in \Z: a = q b + r, 0 \le r < b$

Proof:
Let $a = 0$.
It is immediately apparent that $q = r = 0$ is the only possible solution with $0 \le r < b$.
{{qed|lemma}}
Let $a > 0$ and $b = 1$.
Then from the condition $0 \le r < b$ it follows that $r = 0$ and hence $q = a$.
{{qed|lemma}}
Let $a > 0$ and $b > 1$.
By the Basis Representation Theorem, $a$ has a unique representation to the base $b$:
{{begin-eqn}}
{{eqn | l = a
      | r = \sum_{k \mathop = 0}^s r_k b^k
      | c = 
}}
{{eqn | r = b \sum_{k \mathop = 0}^{s - 1} r_k b^{k - 1} + r_0
      | c = 
}}
{{eqn | r = b q + r
      | c = where $0 \le r = r_0 < b$
}}
{{end-eqn}}
{{qed}}
Theorem: Division Theorem/Positive Divisor/Positive Dividend/Existence

For every pair of integers $a, b$ where $a \ge 0$ and $b > 0$, there exist integers $q, r$ such that $a = q b + r$ and $0 \le r < b$:
:$\forall a, b \in \Z, a \ge 0, b > 0: \exists q, r \in \Z: a = q b + r, 0 \le r < b$

Proof:
Let $a, b \in \Z$ such that $a \ge 0$ and $b > 0$ be given.
When $a = 0$, the integers $q = r = 0$ satisfy the conditions of the theorem.
Let $a > 0$.
For each $k \in \closedint 0 {a + 1}$, let $r_k = b k$.
(Note that here, as elsewhere in this proof, $\closedint 0 {a + 1}$ denotes an integer interval.)
Then $\sequence {r_k}_{0 \mathop \le k \mathop \le a + 1}$ is a strictly increasing sequence of positive integers.
It is also the case that:
:$a + 1 \in \closedint 1 {\map b {a + 1} }$
So from Strictly Increasing Sequence induces Partition there exists $q \in \closedint 0 a$ such that:
:$a + 1 \in \closedint {r_q + 1} {r_{q + 1} }$
Let $r = a - b q$.
Then $a = b q + r$.
We have:
{{begin-eqn}}
{{eqn | l = b q + 1
      | r = r_q + 1
      | c = 
}}
{{eqn | o = \le
      | r = a + 1
      | c = 
}}
{{eqn | o = \le
      | r = r_{q + 1}
      | c = 
}}
{{eqn | r = b q + b
      | c = 
}}
{{end-eqn}}
and so:
{{begin-eqn}}
{{eqn | l = 0
      | o = \le
      | r = r
      | c = 
}}
{{eqn | r = \paren {a + 1} - \paren {b q + 1}
      | c = 
}}
{{eqn | o = \le
      | r = \paren {b q + b} - \paren {b q + 1}
      | c = 
}}
{{eqn | r = b - 1
      | c = 
}}
{{eqn | o = <
      | r = b
      | c = 
}}
{{end-eqn}}
Hence the result.
{{qed}}
Theorem: Division Theorem/Positive Divisor/Positive Dividend/Uniqueness

For every pair of integers $a, b$ where $a \ge 0$ and $b > 0$, the integers $q, r$ such that $a = q b + r$ and $0 \le r < b$ are unique:
:$\forall a, b \in \Z, a \ge 0, b > 0: \exists! q, r \in \Z: a = q b + r, 0 \le r < b$

Proof:
Suppose $q_1, r_1$ and $q_2, r_2$ are two pairs of $q, r$ that satisfy $a = q b + r, 0 \le r < b$.
That is:
{{begin-eqn}}
{{eqn | l = a
      | r = q_1 b + r_1, 0 \le r_1 < b
      | c = 
}}
{{eqn | l = a
      | r = q_2 b + r_2, 0 \le r_2 < b
      | c = 
}}
{{end-eqn}}
This gives:
:$0 = b \paren {q_1 - q_2} + \paren {r_1 - r_2}$
{{AimForCont}} that $q_1 \ne q_2$.
{{WLOG}}, suppose that $q_1 > q_2$.
Then:
{{begin-eqn}}
{{eqn | l = q_1 - q_2
      | o = \ge
      | r = 1
      | c = 
}}
{{eqn | ll= \leadsto
      | l = r_2 - r_1
      | r = b \paren {q_1 - q_2}
      | c = 
}}
{{eqn | o = \ge
      | r = b \times 1
      | c = as $b > 0$
}}
{{eqn | r = b
      | c = 
}}
{{eqn | ll= \leadsto
      | l = r_2
      | o = \ge
      | r = r_1 + b
      | c = 
}}
{{eqn | o = \ge
      | r = b
      | c = 
}}
{{end-eqn}}
This contradicts the assumption that $r_2 < b$.
A similar contradiction follows from the assumption that $q_1 < q_2$.
Therefore $q_1 = q_2$ and so $r_1 = r_2$.
Thus it follows that $q$ and $r$ are unique.
{{qed}}
Theorem: Division Theorem/Positive Divisor/Positive Dividend/Uniqueness

For every pair of integers $a, b$ where $a \ge 0$ and $b > 0$, the integers $q, r$ such that $a = q b + r$ and $0 \le r < b$ are unique:
:$\forall a, b \in \Z, a \ge 0, b > 0: \exists! q, r \in \Z: a = q b + r, 0 \le r < b$

Proof:
It is given by Division Theorem: Positive Divisor: Positive Dividend: Existence that such $q$ and $r$ exist.
Let $a = 0$.
It is immediately apparent that $q = r = 0$ is the only possible solution with $0 \le r < b$.
{{qed|lemma}}
Let $a > 0$ and $b = 1$.
Then from the condition $0 \le r < b$ it follows that $r = 0$.
Hence $r = 0, q = a$ is the only possible solution.
{{qed|lemma}}
Let $a > 0$ and $b > 1$.
By the Basis Representation Theorem, $a$ has a unique representation to the base $b$:
{{begin-eqn}}
{{eqn | l = a
      | r = \sum_{k \mathop = 0}^s r_k b^k
      | c = 
}}
{{eqn | r = b \sum_{k \mathop = 0}^{s - 1} r_k b^{k - 1} + r_0
      | c = 
}}
{{eqn | r = b q + r
      | c = where $0 \le r = r_0 < b$
}}
{{end-eqn}}
Suppose a second pair $q', r'$ were to exist.
Then there would be a representation for $q'$ to the base $b$:
:$\displaystyle q' = \sum_{k \mathop = 0}^t u_k b^k$
so that:
{{begin-eqn}}
{{eqn | l = a
      | r = b q' + r'
      | c = $0 \le r < b$
}}
{{eqn | r = \sum_{k \mathop = 0}^t u_k b^{k + 1} + r'
      | c = 
}}
{{end-eqn}}
But there already exists a representation of $a$ to the base $b$:
:$\displaystyle a = \sum_{k \mathop = 0}^s r_k b^k$
By the Basis Representation Theorem, such a representation is unique.
So:
{{begin-eqn}}
{{eqn | l = t
      | r = s - 1
}}
{{eqn | l = u_k
      | r = r_{k + 1}
}}
{{eqn | l = r'
      | r = a_0
}}
{{eqn | r = r
}}
{{end-eqn}}
and hence $q' = q$.
{{qed}}
Theorem: Division Theorem/Positive Divisor/Existence/Proof 2

For every pair of integers $a, b$ where $b > 0$, there exist 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$

Proof:
Let:
: $q = \floor {\dfrac a b}, t = \dfrac a b - \floor {\dfrac a b}$
where $\floor {\, \cdot \,}$ denotes the floor function.
Thus $q \in \Z$ and $t \in \hointr 0 1$.
So:
:$\dfrac a b = q + t$
and so:
:$(1): \quad a = q b + r$
where $r = t d$.
Since $a, q, b \in \Z$, it follows from $(1)$ that:
:$r = a - q b$
and so $r \in \Z$ also.
Since $0 \le t < 1$ and $b > 0$, it follows that:
:$0 \le t b < b$
that is:
:$0 \le r < b$
{{qed}}