Quotient Remainder

Suppose that \( a , b \in \mathbb{Z} \), but that \( b \ne 0 \), then there exists unique integers \( q
, r \) such that \( a = b \cdot q + r \) where \( 0 \le r \lt \left | b \right | \)

Let \( a , b \in \mathbb{Z} \) and assume \( b \ne 0 \). Define \( S = \left \lbrace x \in \mathbb{Z} : x \ge 0 \text{ and } x = a + \left | b \right | \cdot k \text{ where } k \in \mathbb{Z} \right \rbrace \subseteq \mathbb{N}_{0} \), we'll show that \( S \) is non-empty. We can think of \( S \) as taking \( a \) and then either adding muliples of \( \left | b \right | \) or subtracting them to \( a \), each time leaving some remainder, thinking ahead we can guess that the smallest value of this set should be the smallest remainder and possibly the \( r \) we are looking for.

If \( a \ge 0 \) then when \( k = 0 \) we have \( a + \left | b \right | \cdot k = a \ge 0 \) thus \( a \in S \), on the other hand if \( a \lt 0 \), then observe that since \( 0 \le r \lt \left | b \right | \), then \( 1 \le \left | b \right | \iff 0 \le \left | b \right | - 1 \) and also \( - a \gt 0 \), then we have \( 0 \le \left ( \left | b \right | - 1 \right ) \cdot \left ( - a \right ) \). But also we can see that \( \left ( \left | b \right | - 1 \right ) \cdot \left ( - a \right ) = \left | b \right | \cdot \left ( - a \right ) + a \) so it's of the form of an element in \( S \) and since it's non-negative, it must be an element of \( S \). Therefore this paragraph shows us that \( S \) has at least one element, no matter the value of \( a \).

Due to this and since \( S \subseteq \mathbb{N}_{0} \), then by the well ordering principle there is some smallest element \( s \in S \), we know that this value satisfies \( s = a - \left | b \right | \cdot k \). Now we will show that \( 0 \le s \lt \left | b \right | \).

\( s \in S \) so therefore \( s \ge 0 \), if we were to assume that \( s \ge \left | b \right | \) then \( s - \left | b \right | \ge 0 \). By recalling the equality that \( s \) satisifies we can write \( s - \left | b \right | = \left ( a - \left | b \right | \cdot k \right ) - \left | b \right | = a - \left | b \right | \left ( k + 1 \right ) \), therefore \( s - \left | b \right | \in S \) but since \( \left | b \right | \gt 1 \) then \( s - \left | b \right | \lt s \) which is a contradiction because we assumed that \( s \) was the smallest element in \( S \), thus we must have that \( s < \left | b \right | \)

At this point we have \( a = \left | b \right | \cdot k + s \) where \( 0 \le s \lt \left | b \right | \) so take \( q = \text{sgn} \left ( b \right ) \cdot k \) and \( r = s \). If \( b \ge 0 \), then \( \left | b \right | = b \) and \( \text{sgn} \left ( b \right ) = 1 \), so we obtain \( a = b \cdot k + s \), if \( b < 0 \), then \( \left | b \right | = - b \) and \( \text{sgn} \left ( b \right ) = - 1 \) so again we have \( a = \left ( - b \right ) \cdot \left ( - 1 \right ) k + s \). We'll finish the proof by showing that these values are unique.

Assume we have another pair \( \overline{q} , \overline{r} \) satisfying \( a = b \cdot \overline{q} + \overline{r} \) with \( 0 \le \overline{r} \le \left | b \right | \) but \( \overline{q} \ne q \) and \( \overline{r} \ne r \), therefore we have \( b \cdot q + r = b \overline{q} + \overline{r} \iff \overline{r} - r = b \cdot \left ( \overline{q} - q \right ) \).

Without loss of generality assume \( \overline{r} \gt r \), then \( \overline{r} - r \gt 0 \) and since \( 0 \le r \lt \left | b \right | \) then \( 0 \le \overline{r} - r \le \overline{r} \lt \left | b \right | \), recalling that \( \overline{r} - r = \left | b \right | \cdot \left ( \overline{q} - q \right ) \), we can re-write our last inequality as \( 0 \le \left | b \right | \cdot \left ( \overline{q} - q \right ) \lt \left | b \right | \) and since \( b \ne 0 \) we can divide by \( \left | b \right | \) to get \( 0 \lt \overline{q} - q \lt 1 \) but since \( q , \overline{q} \in \mathbb{Z} \) this force \( q = \overline{q} \), which then shows \( r = \overline{r} \) by previous equalities, therefore assuming we have another solution, it turns out it must be our original one, and thus our solution is unique.

Note that the requirement that \( b \) be non-zero is important, because if it were zero we'd be asking "how many times do you have to multiply \( 0 \) and add \( r \) to get \( a \)" which in itself doesn't intuitively make sense, formally since we require \( 0 \le r \lt \lvert b \rvert \) then if \( b = 0 \) no such \( r \) could ever exist.

Remainder Function

Given two integers \( a , b \in \mathbb{Z} \) such that \( b \ne 0 \), then we get some \( q , r
\in \mathbb{Z} \) with \( 0 \le r \lt \left | b \right | \) such that \( a = b \cdot q + r \) and we
define
\[
a ~\%~ b := r
\]

Quotient Function

Given two integers \( a , b \in \mathbb{Z} \) such that \( b \ne 0 \), then we get some \( q , r
\in \mathbb{Z} \) with \( 0 \le r \lt \left | b \right | \) such that \( a = b \cdot q + r \) and we
define
\[
a ~//~ b := q
\]

Quotient Remainder using Quotient and Remainder Function

For any \( a, b \in \mathbb{ Z } \) such that \( b \neq 0 \) then
\[
a = b \left( a // b \right) + a ~\%~ b
\]

Specific Value of the Divisor Function

We note that \[ a ~//~ b = \left\lfloor \frac{b}{a} \right\rfloor \]

Specific Value of the Remainder Function

We note that \[ a ~\%~ b = b - \left\lfloor \frac{b}{a} \right\rfloor a \]

Quotient Remainder on Positive Integer has Positive Divisor

Suppose that \( a , b \in \mathbb{N}_{1} \) such that \( a \ge b \) then \( a / / b \ge 1 \)

For brevity define \( q = a / / b \), we know that \( a = b \cdot q + r \) with \( 0 \le r \lt b \), thus far we know that \( q \in \mathbb{Z} \), though if \( q < 0 \), then we know that \( b \cdot q < r \cdot q \le 0 \), therefore \( a = b \cdot q + r < r \cdot q + r = r \left ( q + 1 \right ) \)

For a contradiction assume that \( q \lt 1 \iff q \le 0 \), therefore \( r \left ( q + 1 \right ) \le r \left ( 0 + 1 \right ) = r \), which shows that \( a \lt r \), since \( 0 \le r \lt b \), then we have \( a \lt b \) which is a contradiction because we know that \( a \ge b \).

Since by assuming \( q \lt 1 \), we have a contradiction, so therefore \( q \ge 1 \), which is the same as \( a / / b \ge 1 \).

Divides iff Zero Remainder

For any \( a, b \in \mathbb{ Z } \)
\[
a \mid b \iff a ~\%~ b = 0
\]

Note that \( a \mid b \) iff \( b = ka = k a + 0 \) iff \( a ~//~ b = k \) and \( a ~\%~ b = 0 \). The last iff comes from the fact that there are unique integers that satisfy the equation laid out by the quotient remainder theorem.

Every integer is either Odd or Even

Let \( z \in \mathbb{Z} \) and then we know that \( z ~\%~ 2 \in \left \lbrace 0 , 1 \right \rbrace \), if \( z ~\%~ 2 = 1 \) then there is some \( q \in \mathbb{Z} \) such that \( z = q \cdot 2 + 1 \), and thus odd, if \( z ~\%~ 2 = 0 \), then we have some \( q \in \mathbb{Z} \) such that \( z = q \cdot 2 + 0 \) and is thus even

Exactly one of any two Consecutive Numbers is Even

For any \( n \in \mathbb{ Z } \) exactly one of \( n, n + 1 \) is even (and the other odd)

If \( n \) is even, we are done, if \( n \) is odd, then there is a \( k \in \mathbb{ Z } \) such that \( n = 2k + 1 \) therefore \( n + 1 = 2 \left( k + 1 \right) \) which is even as needed.

When the Remainder Function does Nothing

Suppose that \( m \in \mathbb{ N } _ 1 \) and that \( a \in \left[ 0, \ldots , m - 1 \right] \) then
\[
a ~\%~ m = a
\]

Repeated Application of the Remainder Function does Nothing

Suppose that \( a, m \in \mathbb{ Z } \) such that \( m \neq 0 \) then
\[
a ~\%~ m = \left( a ~\%~ m \right) ~\%~ m
\]

Quotient Remainder and Addition

Suppose that \( a, b, m \in \mathbb{ Z } \) then
\[
\left( a + b \right) ~\%~ m = \left( \left( a ~\%~ m \right) + \left( b ~\%~ m \right) \right) ~\%~ m
\]
and
\[
\left( a + b \right) // m = a // m + b // m + \left( a ~\%~ m + a ~\%~ b \right) // m
\]

We know
\[
a = m \left( a // m \right) + a ~\%~ m \text{ and } b = m \left( b // m \right) + b ~\%~ m
\]
therefore
\[
a + b = m \left( \left( a // m \right) + b // m \right) + \left( a ~\%~ m + b ~\%~ m \right)
\]
Let \( x = \left( a ~\%~ m + b ~\%~ m \right) \), and so by the quotient remainder theorem we get some \( q _ x, r _ x \) such that
\[
x = m q _ x + r _ x
\]
so that
\[
a + b = m \left( \left( a // m \right) + \left( b // m \right) + q _ x \right) + r _ x
\]
therefore \( \left( a + b \right) ~\%~ m = r _ x \) and \( \left( a + b \right) // m = \left( a // m \right) + \left( b // m \right) + q _ x \). Finally note that \( r _ x = \left( a ~\%~ m + b ~\%~ m \right) ~\%~ m \) and \( q _ x = \left( a ~\%~ m + b ~\%~ m \right) // m \) as needed.

If a Number Divides a Sum and Already Divides one of the Summands it Must Divide the Other

Suppose that \( d \mid a + b \) and \( d \mid a \) then \( d \mid b \)

We know that \( \left( a + b \right) ~\%~ d = 0 \) and that \( a ~\%~ d = 0 \) since
\[
\begin{align}
0 &= \left( a + b \right) ~\%~ d \\
&= \left( a ~\%~ b + b ~\%~ d \right) ~\%~ d \\
&= \left( 0 + b ~\%~ d \right) ~\%~ d \\
&= b ~\%~ d
\end{align}
\]
therefore \( d \mid b \)

Adding Multiples of the Divisor Never changes the Remainder

Let \( m \in \mathbb{ Z } ^ { \neq 0 } \) and \( a, k \in \mathbb{ Z } \) then
\[
a ~\%~ m = \left( a + k m \right) ~\%~ m
\]

n Factorial Plus or Minus One Restricts Factors

Suppose \( n \in \mathbb{ N } _ 1 \) then for every \( m \in \left[ 2, \ldots , n \right] \)
\[
m \nmid n! \pm 1
\]

Recall that \( m \mid n! \) therefore \( n! ~\%~ m = 0 \). But then
\[
\begin{align}
\left( n! \pm 1 \right) ~\%~ m &= \left( n! ~\%~ m \pm 1 ~\%~ m \right) ~\%~ m \\
&= \left( \pm 1 ~\%~ m \right) ~\%~ m \\
&= \pm 1 ~\%~ m
\end{align}
\]
Note that in going from the second to the third line we used this fact.

if \( \pm = + \) then we have \( \left( n! + 1 \right) ~\%~ m = 1 \) otherwise we have \[ \left( n ! + 1 \right) ~\%~ m = -1 ~\%~ m = m - 1 \] and since \( m \neq 1 \) then \( m - 1 \neq 0 \) therefore in both cases we see that \( \left( n ! + 1 \right) ~\%~ m \neq 0 \) therefore \( m \nmid \left( n! + 1 \right) \) as needed.

Every Perfect Square has Remainder Zero or One Upon Division by Four

For any \( n \in \mathbb{ Z } \) we have
\[
n ^ 2 ~\%~ 4 \in \left\{ 0, 1 \right\}
\]

We know that \( n \) is either odd or even and therefore in the case that \( n = 2k \) then \( n ^ 2 = 4 k ^ 2 = 2 \left( 2 k ^ 2 \right) + 0 \) so \( n ^ 2 ~\%~ 4 = 0 \), on the other hand if \( n = 2k + 1 \) then \( n ^ 2 = 4 k ^ 2 + 4k + 1 = 2 \left( 2 k ^ 2 + 2k \right) + 1 \) therefore \( n ^ 2 ~\%~ 4 = 1 \) as needed.

Note that we also see that every odd perfect square has remainder 1 mod 8 as an intermediate stage in the above proof.

Every Odd Perfect Square has Remainder 1 mod 8

As per title.

Suppose that \( n ^ 2 = 2k + 1 \) it's impossible for \( n \) to be even, because then \( n ^ 2 \) would be, since every number is either even or odd, then \( n \) must have been even, therefore there is a \( j \in \mathbb{ Z } \) such that \( n = 2j + 1 \) therefore \( n ^ 2 = 4j ^ 2 + 4j + 1 = 4 \left( j \left( j + 1 \right) \right) + 1 \). Recall that at least one of \( j, j + 1 \) is even , therfore \( j \left( j + 1 \right) \) is even and therefore \( 4 \left( j \left( j + 1 \right) \right) \) is divisible by \( 8 \) in other words we have some \( m \in \mathbb{ Z } \) such that \( n ^ 2 = 8 m + 1 \) as needed.

composite number

A number \( n \in \mathbb{N}_{1} \) is said to be composite, when it has a positive divisor other than \( 1 \)
and itself

multiplicative function

an arithmetic function is said to be
multiplicative when

\( f{\left ( m \right )} \cdot f{\left ( n \right )} = f{\left ( m \cdot n \right )} \)

for all coprime positive integers \( m , n \)
Suppose that \( d \left ( n \right ) \) is the number of divisors of \( n \), then \( d \) is a
multiplicative function.

Let \( m , n \in \mathbb{Z}^{+} \) and assume that \( \gcd{\left ( m , n \right )} = 1 \), we'd like to prove that \( d \left ( m \right ) \cdot d \left ( n \right ) = d \left ( m \cdot n \right ) \)

Suppose that the divisors of \( m \) are \( P = \left \lbrace p_{1} , \ldots , p_{j} \right \rbrace \) and the divisors of \( n \) are \( Q = \left \lbrace q_{1} , \ldots , q_{k} \right \rbrace \)

Claim that the set \( P \cdot Q = \left \lbrace p_{x} \cdot q_{y} : x \in \left [ j \right ] , y \in \left [ k \right ] \right \rbrace \) is exactly equal to the divisors of \( m \cdot n \)