\documentclass[numbers=enddot,12pt,final,onecolumn,notitlepage]{scrartcl}%
\usepackage[headsepline,footsepline,manualmark]{scrlayer-scrpage}
\usepackage[all,cmtip]{xy}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{framed}
\usepackage{comment}
\usepackage{color}
\usepackage[breaklinks=True]{hyperref}
\usepackage[sc]{mathpazo}
\usepackage[T1]{fontenc}
\usepackage{needspace}
\usepackage{tabls}
\usepackage{tikz}
\usepackage{bbding}
%TCIDATA{OutputFilter=latex2.dll}
%TCIDATA{Version=5.50.0.2960}
%TCIDATA{LastRevised=Saturday, December 16, 2023 23:48:29}
%TCIDATA{SuppressPackageManagement}
%TCIDATA{<META NAME="GraphicsSave" CONTENT="32">}
%TCIDATA{<META NAME="SaveForMode" CONTENT="1">}
%TCIDATA{BibliographyScheme=Manual}
%TCIDATA{Language=American English}
%BeginMSIPreambleData
\providecommand{\U}[1]{\protect\rule{.1in}{.1in}}
%EndMSIPreambleData
\usetikzlibrary{arrows.meta}
\usetikzlibrary{chains}
\usetikzlibrary{shapes}
\usetikzlibrary{decorations.pathmorphing}
\newcounter{exer}
\newcounter{exera}
\theoremstyle{definition}
\newtheorem{theo}{Theorem}[subsection]
\newenvironment{theorem}[1][]
{\begin{theo}[#1]\begin{leftbar}}
{\end{leftbar}\end{theo}}
\newtheorem{lem}[theo]{Lemma}
\newenvironment{lemma}[1][]
{\begin{lem}[#1]\begin{leftbar}}
{\end{leftbar}\end{lem}}
\newtheorem{prop}[theo]{Proposition}
\newenvironment{proposition}[1][]
{\begin{prop}[#1]\begin{leftbar}}
{\end{leftbar}\end{prop}}
\newtheorem{defi}[theo]{Definition}
\newenvironment{definition}[1][]
{\begin{defi}[#1]\begin{leftbar}}
{\end{leftbar}\end{defi}}
\newtheorem{remk}[theo]{Remark}
\newenvironment{remark}[1][]
{\begin{remk}[#1]\begin{leftbar}}
{\end{leftbar}\end{remk}}
\newtheorem{coro}[theo]{Corollary}
\newenvironment{corollary}[1][]
{\begin{coro}[#1]\begin{leftbar}}
{\end{leftbar}\end{coro}}
\newtheorem{conv}[theo]{Convention}
\newenvironment{convention}[1][]
{\begin{conv}[#1]\begin{leftbar}}
{\end{leftbar}\end{conv}}
\newtheorem{quest}[theo]{Question}
\newenvironment{question}[1][]
{\begin{quest}[#1]\begin{leftbar}}
{\end{leftbar}\end{quest}}
\newtheorem{warn}[theo]{Warning}
\newenvironment{warning}[1][]
{\begin{warn}[#1]\begin{leftbar}}
{\end{leftbar}\end{warn}}
\newtheorem{conj}[theo]{Conjecture}
\newenvironment{conjecture}[1][]
{\begin{conj}[#1]\begin{leftbar}}
{\end{leftbar}\end{conj}}
\newtheorem{exam}[theo]{Example}
\newenvironment{example}[1][]
{\begin{exam}[#1]\begin{leftbar}}
{\end{leftbar}\end{exam}}
\newtheorem{exmp}[exer]{Exercise}
\newenvironment{exercise}[1][]
{\begin{exmp}[#1]\begin{leftbar}}
{\end{leftbar}\end{exmp}}
\newenvironment{statement}{\begin{quote}}{\end{quote}}
\newenvironment{fineprint}{\begin{small}}{\end{small}}
\iffalse
\newenvironment{proof}[1][Proof]{\noindent\textbf{#1.} }{\ \rule{0.5em}{0.5em}}
\newenvironment{convention}[1][Convention]{\noindent\textbf{#1.} }{\ \rule{0.5em}{0.5em}}
\newenvironment{question}[1][Question]{\noindent\textbf{#1.} }{\ \rule{0.5em}{0.5em}}
\fi
\let\sumnonlimits\sum
\let\prodnonlimits\prod
\let\cupnonlimits\bigcup
\let\capnonlimits\bigcap
\renewcommand{\sum}{\sumnonlimits\limits}
\renewcommand{\prod}{\prodnonlimits\limits}
\renewcommand{\bigcup}{\cupnonlimits\limits}
\renewcommand{\bigcap}{\capnonlimits\limits}
\newcommand\arxiv[1]{\href{http://www.arxiv.org/abs/#1}{\texttt{arXiv:#1}}}
\setlength\tablinesep{3pt}
\setlength\arraylinesep{3pt}
\setlength\extrarulesep{3pt}
\setlength\textheight{22.5cm}
\setlength\textwidth{14.8cm}
\newenvironment{verlong}{}{}
\newenvironment{vershort}{}{}
\newenvironment{noncompile}{}{}
\excludecomment{verlong}
\includecomment{vershort}
\excludecomment{noncompile}
\newcommand{\defn}[1]{{\color{darkred}\emph{#1}}}
\newcommand{\CC}{\mathbb{C}}
\newcommand{\RR}{\mathbb{R}}
\newcommand{\QQ}{\mathbb{Q}}
\newcommand{\NN}{\mathbb{N}}
\newcommand{\ZZ}{\mathbb{Z}}
\newcommand{\KK}{\mathbb{K}}
\newcommand{\set}[1]{\left\{ #1 \right\}}
\newcommand{\abs}[1]{\left| #1 \right|}
\newcommand{\tup}[1]{\left( #1 \right)}
\newcommand{\ive}[1]{\left[ #1 \right]}
\newcommand{\floor}[1]{\left\lfloor #1 \right\rfloor}
\newcommand{\are}{\ar@{-}}
\newcommand{\arebi}[1][]{\ar@{<-}@/_/[#1] \ar@/^/[#1]}
\newcommand{\of}{\text{ of }}
\newtheoremstyle{plainsl}
{8pt plus 2pt minus 4pt}
{8pt plus 2pt minus 4pt}
{\slshape}
{0pt}
{\bfseries}
{.}
{5pt plus 1pt minus 1pt}
{}
\theoremstyle{plainsl}
\ihead{Lecture 8, version \today}
\ohead{page \thepage}
\cfoot{}
\begin{document}
\section*{Math 221 Winter 2023, Lecture 8: Elementary number theory}

\textbf{website:}
\texttt{\href{https://www.cip.ifi.lmu.de/~grinberg/t/23wd}{\texttt{https://www.cip.ifi.lmu.de/\symbol{126}%
grinberg/t/23wd}}}

\setcounter{section}{2}

\section{Elementary number theory}

\setcounter{subsection}{2}

\subsection{Division with remainder}

\subsubsection{The theorem}

What comes next is the most fundamental theorem of number theory:

\begin{theorem}
[division-with-remainder theorem]\label{thm.ent.quo-rem}Let $n$ be an integer.
Let $d$ be a positive integer. Then, there exists a \textbf{unique} pair
$\left(  q,r\right)  $ of integers%
\[
q\in\mathbb{Z}\ \ \ \ \ \ \ \ \ \ \text{and}\ \ \ \ \ \ \ \ \ \ r\in\left\{
0,1,\ldots,d-1\right\}
\]
such that%
\[
n=qd+r.
\]

\end{theorem}

We will prove this soon. First, let us introduce some notations:

\begin{definition}
\label{def.ent.quo-rem}Let $n$ be an integer. Let $d$ be a positive integer.
Let $\left(  q,r\right)  $ be the pair whose existence and uniqueness is
claimed in Theorem \ref{thm.ent.quo-rem}. Then:

\begin{itemize}
\item The number $q$ is called the \textbf{quotient} of the division of $n$ by
$d$, and will be denoted by $n//d$.

\item The number $r$ is called the \textbf{remainder} of the division of $n$
by $d$, and will be denoted by $n\%d$.

\item The pair $\left(  q,r\right)  $ is called the \textbf{quo-rem pair} of
$n$ and $d$.
\end{itemize}
\end{definition}

For now, of course, we do not yet know that these $q$ and $r$ exist and are
unique (because we haven't proved the theorem yet). Thus, we will take care to
speak of \textquotedblleft\textbf{a} quotient\textquotedblright,
\textquotedblleft\textbf{a} remainder\textquotedblright\ and \textquotedblleft%
\textbf{a} quo-rem pair\textquotedblright, never taking their existence and
uniqueness for granted until we have proved it.

\begin{example}
What are $8//5$ and $8\%5$ ? We have%
\[
\underbrace{8}_{=n}=\underbrace{1}_{=q}\cdot\underbrace{5}_{=d}+\underbrace{3}%
_{=r\in\left\{  0,1,2,3,4\right\}  },
\]
so $8//5=1$ and $8\%5=3$. (This is taking the uniqueness of $8//5$ and $8\%5$
for granted, but we will prove this soon.)
\end{example}

\begin{example}
What are $19//5$ and $19\%5$ ? We have $19=3\cdot5+4$, so $19//5=3$ and
$19\%5=4$.
\end{example}

\begin{example}
What are $\left(  -7\right)  //5$ and $\left(  -7\right)  \%5$ ? We have
\[
\underbrace{-7}_{=n}=\underbrace{\left(  -2\right)  }_{=q}\cdot\underbrace{5}%
_{=d}+\underbrace{3}_{=r\in\left\{  0,1,2,3,4\right\}  },
\]
so $\left(  -7\right)  //5=-2$ and $\left(  -7\right)  \%5=3$.
\end{example}

\bigskip

So Theorem \ref{thm.ent.quo-rem} is saying that for any integer $n$ and any
positive integer $d$, there is a unique quo-rem pair of $n$ and $d$. Let us
now prove this.

\begin{proof}
[Proof of Theorem \ref{thm.ent.quo-rem}.]We need to prove two things: that a
quo-rem pair of $n$ and $d$ exists, and that it is unique. Let me prove the
uniqueness part first.

\textit{Proof of the uniqueness part:} Fix an integer $n$ and a positive
integer $d$. We must show that there is \textbf{at most one} quo-rem pair
$\left(  q,r\right)  $ of $n$ and $d$. In other words, we must show that there
are no two distinct quo-rem pairs of $n$ and $d$.

We shall prove this by contradiction. So we assume that $\left(  q_{1}%
,r_{1}\right)  $ and $\left(  q_{2},r_{2}\right)  $ are two distinct quo-rem
pairs of $n$ and $d$. We want to derive a contradiction.

Since $\left(  q_{1},r_{1}\right)  $ is a quo-rem pair of $n$ and $d$, we have%
\[
q_{1}\in\mathbb{Z}\ \ \ \ \ \ \ \ \ \ \text{and}\ \ \ \ \ \ \ \ \ \ r_{1}%
\in\left\{  0,1,\ldots,d-1\right\}  \ \ \ \ \ \ \ \ \ \ \text{and}%
\ \ \ \ \ \ \ \ \ \ n=q_{1}d+r_{1}.
\]


Since $\left(  q_{2},r_{2}\right)  $ is a quo-rem pair of $n$ and $d$, we have%
\[
q_{2}\in\mathbb{Z}\ \ \ \ \ \ \ \ \ \ \text{and}\ \ \ \ \ \ \ \ \ \ r_{2}%
\in\left\{  0,1,\ldots,d-1\right\}  \ \ \ \ \ \ \ \ \ \ \text{and}%
\ \ \ \ \ \ \ \ \ \ n=q_{2}d+r_{2}.
\]


Subtracting the equation $n=q_{2}d+r_{2}$ from $n=q_{1}d+r_{1}$, we find%
\begin{align*}
0  &  =\left(  q_{1}d+r_{1}\right)  -\left(  q_{2}d+r_{2}\right)  =\left(
r_{1}-r_{2}\right)  -\left(  q_{2}d-q_{1}d\right) \\
&  =\left(  r_{1}-r_{2}\right)  -\left(  q_{2}-q_{1}\right)  d.
\end{align*}
In other words,%
\begin{equation}
r_{1}-r_{2}=\left(  q_{2}-q_{1}\right)  d. \label{pf.thm.ent.quo-rem.4}%
\end{equation}


We are in one of the following three cases:

\textit{Case 1:} We have $q_{1}<q_{2}$.

\textit{Case 2:} We have $q_{1}=q_{2}$.

\textit{Case 3:} We have $q_{1}>q_{2}$.

Let us first consider Case 1. In this case, we have $q_{1}<q_{2}$, so that
$q_{2}-q_{1}>0$. Since $q_{2}-q_{1}$ is an integer, this entails that
$q_{2}-q_{1}\geq1$. We can multiply this inequality by $d$ (since $d>0$), thus
obtaining $\left(  q_{2}-q_{1}\right)  d\geq1d=d$. In view of
(\ref{pf.thm.ent.quo-rem.4}), we can rewrite this as $r_{1}-r_{2}\geq d$.
However, $r_{1}\leq d-1$ (since $r_{1}\in\left\{  0,1,\ldots,d-1\right\}  $)
and $r_{2}\geq0$ (since $r_{2}\in\left\{  0,1,\ldots,d-1\right\}  $). Hence,
$r_{1}-\underbrace{r_{2}}_{\geq0}\leq r_{1}\leq d-1<d$. This contradicts
$r_{1}-r_{2}\geq d$. Thus, we have found a contradiction in Case 1.

Let us next consider Case 2. In this case, we have $q_{1}=q_{2}$. Hence, we
can rewrite (\ref{pf.thm.ent.quo-rem.4}) as $r_{1}-r_{2}=\underbrace{\left(
q_{2}-q_{2}\right)  }_{=0}d=0$, so that $r_{1}=r_{2}$. Combining $q_{1}=q_{2}$
with $r_{1}=r_{2}$, we obtain $\left(  q_{1},q_{2}\right)  =\left(
r_{1},r_{2}\right)  $, which contradicts our assumption that the two quo-rem
pairs $\left(  q_{1},r_{1}\right)  $ and $\left(  q_{2},r_{2}\right)  $ are
distinct. Thus, we have found a contradiction in Case 2.

Finally, in Case 3, we have $q_{1}>q_{2}$ and therefore $q_{2}<q_{1}$. Thus,
Case 3 is just a copy of Case 1 with the roles of the two pairs $\left(
q_{1},r_{1}\right)  $ and $\left(  q_{2},r_{2}\right)  $ switched (since the
two quo-rem pairs $\left(  q_{1},r_{1}\right)  $ and $\left(  q_{2}%
,r_{2}\right)  $ are playing identical roles). Hence, we obtain a
contradiction in Case 3.

We have now obtained contradictions in all three Cases 1, 2 and 3. Thus, we
always have a contradiction. Hence, our assumption was wrong. This completes
our proof of the uniqueness of the quo-rem pair of $n$ and $d$.

Now, let us come to the existence part. It is reasonable to try induction, but
there is a hurdle: Induction on $d$ does not work (there is no good way to use
the induction hypothesis), whereas induction on $n$ cannot be used as long as
$n$ can be negative. Fortunately, the latter hurdle is surmountable. One way
around it is to \textbf{first} prove the existence of a quo-rem pair in the
case when $n\in\mathbb{N}$ (that is, $n\geq0$), and \textbf{afterwards}
generalize this result to arbitrary integers $n$.

So let us prove the $n\in\mathbb{N}$ case:

\begin{lemma}
\label{lem.ent.quo-rem.existN}Let $n\in\mathbb{N}$, and let $d$ be a positive
integer. Then, there exists a quo-rem pair of $n$ and $d$.
\end{lemma}

\begin{proof}
[Proof of Lemma \ref{lem.ent.quo-rem.existN}.]Fix $d$. We apply strong
induction on $n$:

\textit{Induction step:}\footnote{Recall that a strong induction needs no base
case (\S 1.9.4, Lecture 4).} Let $n\in\mathbb{N}$. Assume (as the induction
hypothesis) that Lemma \ref{lem.ent.quo-rem.existN} is proved for all
nonnegative integers smaller than $n$ instead of $n$. In other words, assume
that for each nonnegative integer $k<n$, there exists a quo-rem pair of $k$
and $d$. We must prove that Lemma \ref{lem.ent.quo-rem.existN} also holds for
$n$, i.e., that there exists a quo-rem pair of $n$ and $d$.

If $n<d$, then such a pair can be explicitly constructed: it is $\left(
0,n\right)  $. (Indeed, $n=0d+n$ and $n\in\left\{  0,1,\ldots,d-1\right\}  $).

Otherwise, we have $n\geq d$, so that $n-d\in\mathbb{N}$. Thus, we can apply
the induction hypothesis to $n-d$ instead of $n$ (since $n-d<n$). We conclude
that there exists a quo-rem pair of $n-d$ and $d$. We denote this pair by
$\left(  q,r\right)  $. Then, I claim that $\left(  q+1,r\right)  $ is a
quo-rem pair of $n$ and $d$. Indeed, since $\left(  q,r\right)  $ is a quo-rem
pair of $n-d$ and $d$, we have%
\[
n-d=qd+r.
\]
Thus,%
\[
n=\left(  qd+r\right)  +d=qd+d+r=\left(  q+1\right)  d+r,
\]
which shows that $\left(  q+1,r\right)  $ is a quo-rem pair of $n$ and $d$
(since $r\in\left\{  0,1,\ldots,d-1\right\}  $). Thus, there exists a quo-rem
pair of $n$ and $d$. This completes our induction step, and thus Lemma
\ref{lem.ent.quo-rem.existN} is proved.
\end{proof}

We now return to proving Theorem \ref{thm.ent.quo-rem}. We have shown that

\begin{itemize}
\item there is always \textbf{at most one} quo-rem pair of $n$ and $d$, and

\item there is \textbf{at least one} quo-rem pair of $n$ and $d$ if
$n\in\mathbb{N}$.
\end{itemize}

What remains to be done is proving that there is \textbf{at least one} quo-rem
pair of $n$ and $d$ if $n<0$.

This can be done in several ways. One way is to proceed similarly to the proof
of Lemma \ref{lem.ent.quo-rem.existN}, but using strong induction on $-n$.

Alternatively, there is a slicker argument: We can reduce the
\textquotedblleft negative $n$\textquotedblright\ case to the
\textquotedblleft nonnegative $n$\textquotedblright\ case (which is already
covered by Lemma \ref{lem.ent.quo-rem.existN}). Namely, let $n\in\mathbb{Z}$
be negative. Then, the product $\left(  1-d\right)  n$ is nonnegative (since
both factors $1-d$ and $n$ are $\leq0$), so we can apply Lemma
\ref{lem.ent.quo-rem.existN} to $\left(  1-d\right)  n$ instead of $n$. Thus,
we conclude that there exists a quo-rem pair $\left(  q,r\right)  $ of
$\left(  1-d\right)  n$ and $d$. This pair $\left(  q,r\right)  $ satisfies%
\[
\left(  1-d\right)  n=qd+r
\]
(by the definition of a quo-rem pair). In other words,%
\[
n-dn=qd+r.
\]
Hence,%
\[
n=dn+qd+r=\left(  n+q\right)  d+r.
\]
This shows that $\left(  n+q,r\right)  $ is a quo-rem pair of $n$ and $d$.
Hence, such a quo-rem pair exists. Hence, we have proved the existence of a
quo-rem pair in the case when $n$ is negative. This completes our proof of
Theorem \ref{thm.ent.quo-rem}.
\end{proof}

\subsubsection{An application: even and odd integers}

We shall now use this theorem to derive some basic properties of even and odd
numbers. Recall what these words mean:

\begin{definition}
\textbf{(a)} An integer $n$ is said to be \textbf{even} if $2\mid n$.

\textbf{(b)} An integer $n$ is said to be \textbf{odd} if $2\nmid n$.
\end{definition}

In other words, an integer is called \textbf{even} if it is divisible by $2$,
and is called \textbf{odd} if it is not even.

Now we shall show the following:

\begin{proposition}
\label{prop.ent.odd=2k+1}Let $n$ be an integer.

\textbf{(a)} The integer $n$ is even if and only if there exists some
$k\in\mathbb{Z}$ such that $n=2k$.

\textbf{(b)} The integer $n$ is odd if and only if there exists some
$k\in\mathbb{Z}$ such that $n=2k+1$.
\end{proposition}

\begin{proof}
Part \textbf{(a)} is a direct consequence of the definition of divisibility.
But part \textbf{(b)} is not!

So let us prove part \textbf{(b)}. This is an \textquotedblleft if and only
if\textquotedblright\ statement, so we need to prove both directions:%
\[
\left(  n\text{ is odd}\right)  \Longrightarrow\left(  \text{there exists some
}k\in\mathbb{Z}\text{ such that }n=2k+1\right)
\]
and%
\[
\left(  \text{there exists some }k\in\mathbb{Z}\text{ such that }%
n=2k+1\right)  \Longrightarrow\left(  n\text{ is odd}\right)  .
\]


For the sake of brevity, I shall refer to these two directions as the
\textquotedblleft$\Longrightarrow$\textquotedblright\ and \textquotedblleft%
$\Longleftarrow$\textquotedblright\ directions (respectively).

\textit{Proof of the \textquotedblleft}$\Longrightarrow$%
\textit{\textquotedblright\ direction:} Assume that $n$ is odd. By Theorem
\ref{thm.ent.quo-rem}, there exists a quo-rem pair $\left(  q,r\right)  $ of
$n$ and $2$. Consider this $\left(  q,r\right)  $. By the definition of a
quo-rem pair, this pair satisfies%
\[
q\in\mathbb{Z}\ \ \ \ \ \ \ \ \ \ \text{and}\ \ \ \ \ \ \ \ \ \ r\in\left\{
0,1\right\}  \ \ \ \ \ \ \ \ \ \ \text{and}\ \ \ \ \ \ \ \ \ \ n=2q+r.
\]
If $r$ were $0$, then we would thus get $n=2q+\underbrace{r}_{=0}=2q$, which
would show that $n$ is even; but this is impossible because $n$ is odd.
Therefore, we must have $r\neq0$, so that $r=1$ (since $r\in\left\{
0,1\right\}  $). Thus, $n=2q+\underbrace{r}_{=1}=2q+1$. Hence, there exists
some $k\in\mathbb{Z}$ such that $n=2k+1$ (namely, $k=q$). Thus we have shown
the \textquotedblleft$\Longrightarrow$\textquotedblright\ direction.

\textit{Proof of the \textquotedblleft}$\Longleftarrow$%
\textit{\textquotedblright\ direction:} Assume that there exists some
$k\in\mathbb{Z}$ such that $n=2k+1$. Consider this $k$.

We must show that $n$ is odd. This means showing that $2\nmid n$. This means
proving that $n$ cannot be written as $2c$ for an integer $c$.

To prove this, we assume the contrary. That is, we assume that $n=2c$ for some
integer $c$. Consider this $c$.

Now, the two pairs $\left(  k,1\right)  $ and $\left(  c,0\right)  $ both are
quo-rem pairs of $n$ and $2$, because we have $n=2k+1$ and $n=2c=2c+0$ (and
$1$ and $0$ belong to $\left\{  0,1\right\}  $). However, Theorem
\ref{thm.ent.quo-rem} says that the quo-rem pair of $n$ and $2$ is unique, so
these two pairs $\left(  k,1\right)  $ and $\left(  c,0\right)  $ must be
identical. But this is absurd, since their second entries $1$ and $0$ are
different. So we find a contradiction. This concludes our proof that $n$ is
odd. Thus, we have shown the \textquotedblleft$\Longleftarrow$%
\textquotedblright\ direction of Proposition \ref{prop.ent.odd=2k+1}
\textbf{(b)}.

This completes the proof of Proposition \ref{prop.ent.odd=2k+1} \textbf{(b)}
(since both directions are proved).
\end{proof}

\begin{corollary}
\label{cor.ent.odd+odd}\textbf{(a)} The sum of any two even integers is even.

\textbf{(b)} The sum of any even integer with any odd integer is odd.

\textbf{(c)} The sum of any two odd integers is even.
\end{corollary}

\begin{proof}
We will only prove part \textbf{(c)}, since the other two parts are analogous
(and even simpler).

\textbf{(c)} Let $a$ and $b$ be two odd integers. We must prove that $a+b$ is even.

The integer $a$ is odd. Hence, Proposition \ref{prop.ent.odd=2k+1}
\textbf{(b)} shows that we can write $a$ as $a=2k+1$ for some integer $k$.

Similarly, we can write $b$ as $b=2\ell+1$ for some integer $\ell$.

Consider these $k$ and $\ell$. Now, from $a=2k+1$ and $b=2\ell+1$, we obtain%
\[
a+b=\left(  2k+1\right)  +\left(  2\ell+1\right)  =2k+2\ell+2=2\left(
k+\ell+1\right)  ,
\]
which is clearly even. This proves Corollary \ref{cor.ent.odd+odd}
\textbf{(c)}.
\end{proof}

\begin{remark}
Corollary \ref{cor.ent.odd+odd} \textbf{(c)} is a property specific to the
number $2$. For example, it is not true that the sum of any two integers not
divisible by $3$ is divisible by $3$.
\end{remark}

\subsubsection{Basic properties of quotients and remainders}

Here are some elementary facts about quotients and remainders:

\begin{proposition}
\label{prop.ent.quo-rem.basics}Let $n\in\mathbb{Z}$, and let $d$ be a positive
integer. Then:

\textbf{(a)} We have $n\%d\in\left\{  0,1,\ldots,d-1\right\}  $ and
$n\%d\equiv n\operatorname{mod}d$.

\textbf{(b)} We have $d\mid n$ if and only if $n\%d=0$.

\textbf{(c)} If $c\in\left\{  0,1,\ldots,d-1\right\}  $ satisfies $c\equiv
n\operatorname{mod}d$, then $c=n\%d$.

\textbf{(d)} We have $n=\left(  n//d\right)  d+\left(  n\%d\right)  $.

\textbf{(e)} If $n\in\mathbb{N}$, then $n//d\in\mathbb{N}$.
\end{proposition}

Note that part \textbf{(a)} of this proposition can be restated as follows:
The remainder $n\%d$ is an element of $\left\{  0,1,\ldots,d-1\right\}  $ that
is congruent to $n$ modulo $d$. Part \textbf{(c)} says that, conversely, any
element $c$ of $\left\{  0,1,\ldots,d-1\right\}  $ that is congruent to $n$
modulo $d$ must be this remainder $n\%d$. Thus, together, these two parts
uniquely characterize the remainder $n\%d$ as the only element of $\left\{
0,1,\ldots,d-1\right\}  $ that is congruent to $n$ modulo $d$. This
characterization is good to keep in mind, as it describes the remainder
independently of the quotient.

\begin{proof}
[Proof of Proposition \ref{prop.ent.quo-rem.basics}.]We set%
\[
q:=n//d\ \ \ \ \ \ \ \ \ \ \text{and}\ \ \ \ \ \ \ \ \ \ r:=n\%d.
\]
Thus, $\left(  q,r\right)  $ is a quo-rem pair of $n$ and $d$ (by the
definition of a quo-rem pair). In other words, we have $n=qd+r$ and
$q\in\mathbb{Z}$ and $r\in\left\{  0,1,\ldots,n-1\right\}  $. We can now prove
all five parts of the proposition: \medskip

\textbf{(d)} We have $n=\underbrace{q}_{=n//d}d+\underbrace{r}_{=n\%d}=\left(
n//d\right)  d+\left(  n\%d\right)  $. This proves Proposition
\ref{prop.ent.quo-rem.basics} \textbf{(d)}. \medskip

\textbf{(a)} We have $n\%d=r\in\left\{  0,1,\ldots,d-1\right\}  $. Moreover,
from $n=qd+r$, we obtain $r-n=r-\left(  qd+r\right)  =-qd$, which is clearly
divisible by $d$. Hence, $d\mid r-n$. Equivalently, $r\equiv
n\operatorname{mod}d$. In other words, $n\%d\equiv n\operatorname{mod}d$
(since $r=n\%d$). Thus, Proposition \ref{prop.ent.quo-rem.basics} \textbf{(a)}
is proved (since we have shown that $n\%d\in\left\{  0,1,\ldots,d-1\right\}  $
as well). \medskip

\textbf{(c)} Let $c\in\left\{  0,1,\ldots,d-1\right\}  $ satisfy $c\equiv
n\operatorname{mod}d$. We must show that $c=n\%d$.

From $c\equiv n\operatorname{mod}d$, we obtain $d\mid c-n$. In other words,
$c-n=de$ for some $e\in\mathbb{Z}$. Consider this $e$. From $c-n=de$, we
obtain $c=n+de$, so that $n=c-de=\left(  -e\right)  d+c$. This (combined with
$c\in\left\{  0,1,\ldots,d-1\right\}  $) shows that $\left(  -e,c\right)  $ is
a quo-rem pair of $n$ and $d$. However, $\left(  q,r\right)  $ is also a
quo-rem pair of $n$ and $d$ (by its definition). Since there is only one
quo-rem pair of $n$ and $d$ (by Theorem \ref{thm.ent.quo-rem}), this shows
that $\left(  -e,c\right)  =\left(  q,r\right)  $. Hence, $c=r=n\%d$. This
proves Proposition \ref{prop.ent.quo-rem.basics} \textbf{(c)}. \medskip

\textbf{(b)} Again, this is an \textquotedblleft if and only
if\textquotedblright\ statement, and we shall prove its \textquotedblleft%
$\Longrightarrow$\textquotedblright\ and \textquotedblleft$\Longleftarrow
$\textquotedblright\ directions separately:

$\Longrightarrow:$ Assume that $d\mid n$. We must prove that $n\%d=0$. In
other words, we must prove that $r=0$.

Indeed, $d\mid n$ yields that $n\equiv0\operatorname{mod}d$ (by Proposition
3.2.3 in Lecture 7). In other words, $0\equiv n\operatorname{mod}d$. Since we
furthermore have $0\in\left\{  0,1,\ldots,d-1\right\}  $, we can thus apply
Proposition \ref{prop.ent.quo-rem.basics} \textbf{(c)} to $c=0$, and conclude
that $0=n\%d$. In other words, $n\%d=0$. This proves the \textquotedblleft%
$\Longrightarrow$\textquotedblright\ direction (i.e., it proves that if $d\mid
n$, then $n\%d=0$).

$\Longleftarrow:$ If $n\%d=0$, then $d\mid n$ because%
\[
n=qd+\underbrace{r}_{=n\%d=0}=qd.
\]
This proves the \textquotedblleft$\Longleftarrow$\textquotedblright%
\ direction. Thus, both directions are proved, so that Proposition
\ref{prop.ent.quo-rem.basics} \textbf{(b)} holds. \medskip

\textbf{(e)} Assume that $n\in\mathbb{N}$. Recall that $r\in\left\{
0,1,\ldots,d-1\right\}  $, so that $r\leq d-1<d$. But $n=qd+\underbrace{r}%
_{<d}<qd+d$. Hence, $qd+d>n\geq0$ (since $n\in\mathbb{N}$). In other words,
$qd>-d$.

If we had $q<0$, then we would have $q\leq-1$ (since $q$ is an integer) and
therefore $qd\leq\left(  -1\right)  d$ (since we can multiply the inequality
$q\leq-1$ by the positive number $d$); but this would contradict
$qd>-d=\left(  -1\right)  d$. Hence, we cannot have $q<0$. Thus, $q\geq0$, so
that $q\in\mathbb{N}$. In other words, $n//d\in\mathbb{N}$ (since $q=n//d$).
This proves Proposition \ref{prop.ent.quo-rem.basics} \textbf{(e)}.
\end{proof}

Quotients and remainders are closely connected to the so-called
\href{https://en.wikipedia.org/wiki/Floor_and_ceiling_functions}{floor
function}:

\begin{definition}
The \textbf{integer part} (aka \textbf{floor}) of a real number $x$ is defined
to be the largest integer that is $\leq x$. It is denoted by $\left\lfloor
x\right\rfloor $.
\end{definition}

For example,%
\begin{align*}
\left\lfloor 3.8\right\rfloor  &  =3,\ \ \ \ \ \ \ \ \ \ \left\lfloor
4.2\right\rfloor =4,\ \ \ \ \ \ \ \ \ \ \left\lfloor 5\right\rfloor
=5,\ \ \ \ \ \ \ \ \ \ \left\lfloor \sqrt{2}\right\rfloor =1,\\
\left\lfloor \pi\right\rfloor  &  =3,\ \ \ \ \ \ \ \ \ \ \left\lfloor
0.5\right\rfloor =0,\ \ \ \ \ \ \ \ \ \ \left\lfloor -1.2\right\rfloor =-2
\end{align*}
(make sure you understand the last example! $-1$ is not $\leq-1.2$, but $-2$ is).

Now, here is the connection to quotients and remainders:

\begin{proposition}
[\textquotedblleft explicit formulas\textquotedblright\ for quotient and
remainder]\label{prop.ent.quo-rem-floor}Let $n\in\mathbb{Z}$, and let $d$ be a
positive integer. Then,%
\[
n//d=\left\lfloor \dfrac{n}{d}\right\rfloor \ \ \ \ \ \ \ \ \ \ \text{and}%
\ \ \ \ \ \ \ \ \ \ n\%d=n-d\cdot\left\lfloor \dfrac{n}{d}\right\rfloor .
\]

\end{proposition}

\begin{proof}
Proposition \ref{prop.ent.quo-rem.basics} \textbf{(a)} yields $n\%d\in\left\{
0,1,\ldots,d-1\right\}  $. Hence, $n\%d\geq0$ and $n\%d\leq d-1<d$.

Proposition \ref{prop.ent.quo-rem.basics} \textbf{(d)} yields $n=\left(
n//d\right)  d+\left(  n\%d\right)  $. Thus,%
\[
n=\left(  n//d\right)  d+\underbrace{\left(  n\%d\right)  }_{<d}<\left(
n//d\right)  d+d=\left(  \left(  n//d\right)  +1\right)  d.
\]
Dividing both sides of this inequality by $d$ (we can do this, since $d>0$),
we obtain $\dfrac{n}{d}<\left(  n//d\right)  +1$.

On the other hand,
\[
n=\left(  n//d\right)  d+\underbrace{\left(  n\%d\right)  }_{\geq0}\geq\left(
n//d\right)  d.
\]
Dividing both sides of this inequality by $d$ (we can do this, since $d>0$),
we obtain $\dfrac{n}{d}\geq n//d$.

Now, the integer $n//d$ is $\leq\dfrac{n}{d}$ (since $\dfrac{n}{d}\geq n//d$),
but the next-larger integer $\left(  n//d\right)  +1$ is not (since $\dfrac
{n}{d}<\left(  n//d\right)  +1$). Thus, $n//d$ is the largest integer that is
$\leq\dfrac{n}{d}$. In other words, $n//d=\left\lfloor \dfrac{n}%
{d}\right\rfloor $ (by the definition of the floor $\left\lfloor \dfrac{n}%
{d}\right\rfloor $).

Solving the equation $n=\left(  n//d\right)  d+\left(  n\%d\right)  $ for
$n\%d$, we find%
\[
n\%d=n-\underbrace{\left(  n//d\right)  }_{=\left\lfloor \dfrac{n}%
{d}\right\rfloor }d=n-\left\lfloor \dfrac{n}{d}\right\rfloor d=n-d\cdot
\left\lfloor \dfrac{n}{d}\right\rfloor .
\]
Thus, Proposition \ref{prop.ent.quo-rem-floor} is proved.
\end{proof}

\subsubsection{Base-$b$ representation of nonnegative integers}

Division with remainder is the main ingredient in a feature of integers that
you may well be taking for granted, but actually needs to proved: the fact
that every integer can be uniquely expressed in decimal notation, or, more
generally, in base-$b$ notation for any given integer $b>1$.

What does this mean? For example,%
\begin{align*}
3401  &  =3\cdot1000+4\cdot100+0\cdot10+1\cdot1\\
&  =3\cdot10^{3}+4\cdot10^{2}+0\cdot10^{1}+1\cdot10^{0}.
\end{align*}
Thus, we have written the fairly large number $3401$ as a pretty short sum of
powers of $10$, with the coefficients being integers between $0$ and $9$
(commonly known as \textquotedblleft digits\textquotedblright).

This can be done for any nonnegative integer. This can also be done with any
fixed integer $b>1$ instead of $10$, except that the coefficients
(\textquotedblleft generalized digits\textquotedblright) will then be integers
between $0$ and $b-1$. This is called the \textquotedblleft base-$b$
representation\textquotedblright\ of the integer.

For instance, let us find the base-$4$ representation of the integer $3401$:
This will be a representation of $3401$ in the form%
\[
3401=r_{6}4^{6}+r_{5}4^{5}+r_{4}4^{4}+r_{3}4^{3}+r_{2}4^{2}+r_{1}4^{1}%
+r_{0}4^{0},
\]
where each $r_{i}$ is a \textquotedblleft base-$4$ digit\textquotedblright%
\ (i.e., an element of $\left\{  0,1,2,3\right\}  $). Here, we are tacitly
assuming that $4^{6}$ is the highest power of $4$ that we need; but we don't
actually know this yet, so we must be prepared to add higher powers
($4^{7},4^{8},4^{9},\ldots$) if needed.

How do we find these base-$4$ digits $r_{0},r_{1},\ldots,r_{6}$?

We start by identifying $r_{0}$. Indeed, on the RHS\footnote{\textquotedblleft
RHS\textquotedblright\ means \textquotedblleft right hand
side\textquotedblright.} of the equation%
\[
3401=r_{6}4^{6}+r_{5}4^{5}+r_{4}4^{4}+r_{3}4^{3}+r_{2}4^{2}+r_{1}4^{1}%
+r_{0}4^{0},
\]
all but the last addends are multiples of $4$, whereas the last addend is
$r_{0}4^{0}=r_{0}$. Hence, we can rewrite this equation as follows (factoring
out the $4$):%
\[
3401=4\cdot\left(  r_{6}4^{5}+r_{5}4^{4}+r_{4}4^{3}+r_{3}4^{2}+r_{2}%
4^{1}+r_{1}4^{0}\right)  +r_{0}.
\]
Since $r_{0}\in\left\{  0,1,2,3\right\}  $, this equation reveals that the
pair%
\[
\left(  r_{6}4^{5}+r_{5}4^{4}+r_{4}4^{3}+r_{3}4^{2}+r_{2}4^{1}+r_{1}%
4^{0},\ r_{0}\right)
\]
is a quo-rem pair of $3401$ and $4$. In particular, we must have%
\begin{align*}
r_{0}  &  =3401\%4=1\ \ \ \ \ \ \ \ \ \ \text{and}\\
r_{6}4^{5}+r_{5}4^{4}+r_{4}4^{3}+r_{3}4^{2}+r_{2}4^{1}+r_{1}4^{0}  &
=3401//4=850.
\end{align*}


Thus, we have identified the last base-$4$ digit $r_{0}$ as $1$. In order to
find the remaining digits, we analyze the latter equation%
\[
850=r_{6}4^{5}+r_{5}4^{4}+r_{4}4^{3}+r_{3}4^{2}+r_{2}4^{1}+r_{1}4^{0}.
\]
In this equation, the only addend on the RHS not divisible by $4$ is
$r_{1}4^{0}=r_{1}$, so we can rewrite this equation as%
\[
850=4\cdot\left(  r_{6}4^{4}+r_{5}4^{3}+r_{4}4^{2}+r_{3}4^{1}+r_{2}%
4^{0}\right)  +r_{1},
\]
and thus conclude that
\begin{align*}
r_{1}  &  =850\%4=2\ \ \ \ \ \ \ \ \ \ \text{and}\\
r_{6}4^{4}+r_{5}4^{3}+r_{4}4^{2}+r_{3}4^{1}+r_{2}4^{0}  &  =850//4=212.
\end{align*}


Thus, we have identified the base-$4$ digit $r_{1}$ as $2$. In order to find
the remaining digits, we analyze the latter equation%
\[
212=r_{6}4^{4}+r_{5}4^{3}+r_{4}4^{2}+r_{3}4^{1}+r_{2}4^{0}.
\]
In this equation, the only addend on the RHS not divisible by $4$ is
$r_{2}4^{0}=r_{2}$, so we can rewrite this equation as%
\[
212=4\cdot\left(  r_{6}4^{3}+r_{5}4^{2}+r_{4}4^{1}+r_{3}4^{0}\right)  +r_{2},
\]
and thus conclude that
\begin{align*}
r_{2}  &  =212\%4=0\ \ \ \ \ \ \ \ \ \ \text{and}\\
r_{6}4^{3}+r_{5}4^{2}+r_{4}4^{1}+r_{3}4^{0}  &  =212//4=53.
\end{align*}


Thus, we have identified the base-$4$ digit $r_{2}$ as $0$. In order to find
the remaining digits, we analyze the latter equation%
\[
53=r_{6}4^{3}+r_{5}4^{2}+r_{4}4^{1}+r_{3}4^{0}.
\]
In this equation, the only addend on the RHS not divisible by $4$ is
$r_{3}4^{0}=r_{3}$, so we can rewrite this equation as%
\[
53=4\cdot\left(  r_{6}4^{2}+r_{5}4^{1}+r_{4}4^{0}\right)  +r_{3},
\]
and thus conclude that
\begin{align*}
r_{3}  &  =53\%4=1\ \ \ \ \ \ \ \ \ \ \text{and}\\
r_{6}4^{2}+r_{5}4^{1}+r_{4}4^{0}  &  =53//4=13.
\end{align*}


Thus, we have identified the base-$4$ digit $r_{3}$ as $1$. In order to find
the remaining digits, we analyze the latter equation%
\[
13=r_{6}4^{2}+r_{5}4^{1}+r_{4}4^{0}.
\]
In this equation, the only addend on the RHS not divisible by $4$ is
$r_{4}4^{0}=r_{4}$, so we can rewrite this equation as%
\[
13=4\cdot\left(  r_{6}4^{1}+r_{5}4^{0}\right)  +r_{4},
\]
and thus conclude that
\begin{align*}
r_{4}  &  =13\%4=1\ \ \ \ \ \ \ \ \ \ \text{and}\\
r_{6}4^{1}+r_{5}4^{0}  &  =13//4=3.
\end{align*}


Thus, we have identified the base-$4$ digit $r_{4}$ as $1$. In order to find
the remaining digits, we analyze the latter equation%
\[
3=r_{6}4^{1}+r_{5}4^{0}.
\]
In this equation, the only addend on the RHS not divisible by $4$ is
$r_{5}4^{0}=r_{5}$, so we can rewrite this equation as%
\[
3=4\cdot\left(  r_{6}4^{0}\right)  +r_{5},
\]
and thus conclude that
\begin{align*}
r_{5}  &  =3\%4=3\ \ \ \ \ \ \ \ \ \ \text{and}\\
r_{6}4^{0}  &  =3//4=0.
\end{align*}


Thus, we have identified the base-$4$ digit $r_{5}$ as $3$. Moreover, the
equation $r_{6}4^{0}=0$ shows that $r_{6}=0$.

Thus, altogether, we have found the representation of $3401$ we were looking
for:%
\[
3401=\underbrace{r_{6}}_{=0}4^{6}+\underbrace{r_{5}}_{=3}4^{5}%
+\underbrace{r_{4}}_{=1}4^{4}+\underbrace{r_{3}}_{=1}4^{3}+\underbrace{r_{2}%
}_{=0}4^{2}+\underbrace{r_{1}}_{=2}4^{1}+\underbrace{r_{0}}_{=1}4^{0}.
\]


In analogy to the decimal system, we can state this as \textquotedblleft the
number $3401$ written in base-$4$ is $0311021$\textquotedblright\ (since the
base-$4$ digits $r_{6},r_{5},\ldots,r_{0}$ have been identified as
$0,3,1,1,0,2,1$). Commonly, one would omit the leading zeroes, so this would
become $311021$.

The method we just used can be used for any given integer $b>1$ instead of
$4$: To find the \textquotedblleft base-$b$ digits\textquotedblright\ of a
nonnegative integer $n$, we first divide $n$ by $b$ with remainder, then
divide the resulting quotient again by $b$ with remainder, then divide the
resulting quotient again by $b$ with remainder, and so on, until we are left
with the quotient $0$. The remainders obtained in the process will then be the
base-$b$ digits of $n$ (from right to left). This process must eventually come
to an end because (since $b>1$) each quotient will be smaller than the
preceding one.

We can summarize this as a theorem:

\begin{theorem}
\label{thm.ent.base-b.main}Let $b>1$ be an integer. Let $n\in\mathbb{N}$. Then:

\textbf{(a)} We can write $n$ in the form%
\[
n=r_{k}\cdot b^{k}+r_{k-1}\cdot b^{k-1}+\cdots+r_{1}\cdot b^{1}+r_{0}\cdot
b^{0}%
\]
with%
\[
k\in\mathbb{N}\ \ \ \ \ \ \ \ \ \ \text{and}\ \ \ \ \ \ \ \ \ \ r_{0}%
,r_{1},\ldots,r_{k}\in\left\{  0,1,\ldots,b-1\right\}  .
\]


\textbf{(b)} If $n<b^{k+1}$ for some $k\in\mathbb{N}$, then we can write $n$
in the form%
\[
n=r_{k}\cdot b^{k}+r_{k-1}\cdot b^{k-1}+\cdots+r_{1}\cdot b^{1}+r_{0}\cdot
b^{0}%
\]
with%
\[
r_{0},r_{1},\ldots,r_{k}\in\left\{  0,1,\ldots,b-1\right\}  .
\]


\textbf{(c)} These $r_{0},r_{1},\ldots,r_{k}$ are unique (when $k$ is given).
Moreover, they can be explicitly computed by the formula%
\[
r_{i}=\left(  n//b^{i}\right)  \%b\ \ \ \ \ \ \ \ \ \ \text{for each }%
i\in\left\{  0,1,\ldots,k\right\}  .
\]
That is, they can be explicitly computed by%
\begin{align*}
r_{0}  &  =n\%b,\\
r_{1}  &  =\left(  n//b\right)  \%b,\\
r_{2}  &  =\left(  n//b^{2}\right)  \%b,\\
r_{3}  &  =\left(  n//b^{3}\right)  \%b,\\
&  \ldots,\\
r_{k}  &  =\left(  n//b^{k}\right)  \%b.
\end{align*}

\end{theorem}

\begin{fineprint}
\begin{proof}
Forget that $n$ was fixed (but keep $b$ fixed). We shall prove the following
two claims:

\begin{statement}
\textit{Claim 1:} Let $n\in\mathbb{N}$ and $k\in\mathbb{N}$ be such that
$n<b^{k+1}$. Then, we can write $n$ in the form%
\[
n=r_{k}\cdot b^{k}+r_{k-1}\cdot b^{k-1}+\cdots+r_{1}\cdot b^{1}+r_{0}\cdot
b^{0}%
\]
with%
\[
r_{0},r_{1},\ldots,r_{k}\in\left\{  0,1,\ldots,b-1\right\}  .
\]

\end{statement}

\begin{statement}
\textit{Claim 2:} Let $n\in\mathbb{N}$ and $k\in\mathbb{N}$. Assume that $n$
has been written in the form%
\[
n=r_{k}\cdot b^{k}+r_{k-1}\cdot b^{k-1}+\cdots+r_{1}\cdot b^{1}+r_{0}\cdot
b^{0}%
\]
with%
\[
r_{0},r_{1},\ldots,r_{k}\in\left\{  0,1,\ldots,b-1\right\}  .
\]
Then,
\[
r_{i}=\left(  n//b^{i}\right)  \%b\ \ \ \ \ \ \ \ \ \ \text{for each }%
i\in\left\{  0,1,\ldots,k\right\}  .
\]

\end{statement}

Once these two claims are proved, Theorem \ref{thm.ent.base-b.main} will
follow, because

\begin{itemize}
\item Theorem \ref{thm.ent.base-b.main} \textbf{(b)} follows directly from
Claim 1.

\item Theorem \ref{thm.ent.base-b.main} \textbf{(c)} follows directly from
Claim 2.

\item Theorem \ref{thm.ent.base-b.main} \textbf{(a)} follows from Claim 1
(since we can pick $k\in\mathbb{N}$ high enough that $n<b^{k+1}$
holds\footnote{Indeed, the assumption $b>1$ ensures that the sequence $\left(
b^{0},b^{1},b^{2},\ldots\right)  $ is strictly increasing and thus eventually
outgrows any given integer, including our $n$. Or we can argue this directly:
An easy induction (on $n$) shows that $n<b^{n+1}$, and thus we can simply take
$k=n$.}).
\end{itemize}

Hence, it remains to prove Claim 1 and Claim 2.

\begin{proof}
[Proof of Claim 1.]We proceed by induction on $k$:

\textit{Base case:} For $k=0$, Claim 1 is saying that every $n\in\mathbb{N}$
satisfying $n<b$ can be written in the form $n=r_{0}\cdot b^{0}$ with
$r_{0}\in\left\{  0,1,\ldots,b-1\right\}  $. But this is obvious: Since
$n\in\mathbb{N}$ and $n<b$, we have $n\in\left\{  0,1,\ldots,b-1\right\}  $,
and thus we can just pick $r_{0}=n$ and have $n=r_{0}\cdot b^{0}$ (since
$r_{0}\cdot\underbrace{b^{0}}_{=1}=r_{0}=n$). Hence, Claim 1 is proved for
$k=0$.

\textit{Induction step:} We make a step from $k-1$ to $k$. Thus, we let $k$ be
a positive integer. Assume (as the induction hypothesis) that Claim 1 holds
for $k-1$ instead of $k$. We must now show that Claim 1 holds for $k$ as well.

So let $n\in\mathbb{N}$ be such that $n<b^{k+1}$. Then, Proposition
\ref{prop.ent.quo-rem.basics} \textbf{(e)} (applied to $d=b$) yields
$n//b\in\mathbb{N}$. Moreover, $n\%b\in\left\{  0,1,\ldots,b-1\right\}  $ (by
the definition of a remainder). Hence, $n\%b\geq0$. Now, Proposition
\ref{prop.ent.quo-rem.basics} \textbf{(d)} (applied to $d=b$) yields
\[
n=\left(  n//b\right)  b+\underbrace{\left(  n\%b\right)  }_{\substack{\geq
0}}\geq\left(  n//b\right)  b.
\]
Hence, $\left(  n//b\right)  b\leq n<b^{k+1}$. Dividing this inequality by the
positive number $b$, we obtain $n//b<b^{k+1}/b=b^{k}$.

Now, recall our induction hypothesis, which says that Claim 1 holds for $k-1$
instead of $k$. In other words, if $m\in\mathbb{N}$ is such that $m<b^{\left(
k-1\right)  +1}$, then we can write $m$ in the form\footnote{We are
deliberately using the letters $m$ and $s_{i}$ instead of $n$ and $r_{i}$
here, since the letter $n$ is already taken (and the letters $r_{i}$ will be
needed for something different).}%
\[
m=s_{k-1}\cdot b^{k-1}+s_{k-2}\cdot b^{k-2}+\cdots+s_{1}\cdot b^{1}+s_{0}\cdot
b^{0}%
\]
with%
\[
s_{0},s_{1},\ldots,s_{k-1}\in\left\{  0,1,\ldots,b-1\right\}  .
\]
We can apply this to $m=n//b$ (since $n//b\in\mathbb{N}$ and $n//b<b^{k}%
=b^{\left(  k-1\right)  +1}$), and conclude that we can write $n//b$ in the
form%
\[
n//b=s_{k-1}\cdot b^{k-1}+s_{k-2}\cdot b^{k-2}+\cdots+s_{1}\cdot b^{1}%
+s_{0}\cdot b^{0}%
\]
with%
\[
s_{0},s_{1},\ldots,s_{k-1}\in\left\{  0,1,\ldots,b-1\right\}  .
\]
Let us do this. Thus,%
\begin{align*}
n  &  =\underbrace{\left(  n//b\right)  }_{=s_{k-1}\cdot b^{k-1}+s_{k-2}\cdot
b^{k-2}+\cdots+s_{1}\cdot b^{1}+s_{0}\cdot b^{0}}b+\left(  n\%b\right) \\
&  =\left(  s_{k-1}\cdot b^{k-1}+s_{k-2}\cdot b^{k-2}+\cdots+s_{1}\cdot
b^{1}+s_{0}\cdot b^{0}\right)  b+\left(  n\%b\right) \\
&  =s_{k-1}\cdot b^{k}+s_{k-2}\cdot b^{k-1}+\cdots+s_{1}\cdot b^{2}+s_{0}\cdot
b^{1}+\underbrace{\left(  n\%b\right)  }_{=\left(  n\%b\right)  \cdot b^{0}}\\
&  =s_{k-1}\cdot b^{k}+s_{k-2}\cdot b^{k-1}+\cdots+s_{1}\cdot b^{2}+s_{0}\cdot
b^{1}+\left(  n\%b\right)  \cdot b^{0}.
\end{align*}
Note that the coefficients $n\%b,s_{0},s_{1},\ldots,s_{k-1}$ on the right hand
side here all belong to $\left\{  0,1,\ldots,b-1\right\}  $ (as we know).
Thus, through this equality, we have written $n$ in the form%
\[
n=r_{k}\cdot b^{k}+r_{k-1}\cdot b^{k-1}+\cdots+r_{1}\cdot b^{1}+r_{0}\cdot
b^{0}%
\]
with%
\[
r_{0},r_{1},\ldots,r_{k}\in\left\{  0,1,\ldots,b-1\right\}
\]
(namely, with $r_{0}=n\%b$ and $r_{1}=s_{0}$ and $r_{2}=s_{1}$ and $\ldots$
and $r_{k-1}=s_{k-2}$ and $r_{k}=s_{k-1}$). Hence, $n$ can be written in this form.

We have thus proved that if $n\in\mathbb{N}$ is such that $n<b^{k+1}$, then we
can write $n$ in the form%
\[
n=r_{k}\cdot b^{k}+r_{k-1}\cdot b^{k-1}+\cdots+r_{1}\cdot b^{1}+r_{0}\cdot
b^{0}%
\]
with%
\[
r_{0},r_{1},\ldots,r_{k}\in\left\{  0,1,\ldots,b-1\right\}  .
\]
In other words, we have proved Claim 1 for our $k$. This completes the
induction step. Thus, Claim 1 is proved by induction.
\end{proof}

\begin{proof}
[Proof of Claim 2.]We could prove this by induction as well, but let us
instead go for a direct proof.

By assumption, we have%
\[
n=r_{k}\cdot b^{k}+r_{k-1}\cdot b^{k-1}+\cdots+r_{1}\cdot b^{1}+r_{0}\cdot
b^{0}=\sum_{j=0}^{k}r_{j}\cdot b^{j}=\sum_{j=0}^{k}r_{j}b^{j}.
\]


Now, we must prove that $r_{i}=\left(  n//b^{i}\right)  \%b$ for each
$i\in\left\{  0,1,\ldots,k\right\}  $. So let us fix an $i\in\left\{
0,1,\ldots,k\right\}  $.

We have
\begin{equation}
n=\sum_{j=0}^{k}r_{j}b^{j}=\sum_{j=0}^{i-1}r_{j}b^{j}+\sum_{j=i}^{k}r_{j}b^{j}
\label{pf.thm.ent.base-b.main.c2.pf.1}%
\end{equation}
(here, we have split our sum into two parts: one part which contains the
addends for $j\in\left\{  0,1,\ldots,i-1\right\}  $, and one part which
contains the addends for $j\in\left\{  i,i+1,\ldots,k\right\}  $). We can
rewrite the second sum as follows:%
\[
\sum_{j=i}^{k}r_{j}\underbrace{b^{j}}_{=b^{i}b^{j-i}}=\sum_{j=i}^{k}r_{j}%
b^{i}b^{j-i}=b^{i}\sum_{j=i}^{k}r_{j}b^{j-i}.
\]
Thus, we can rewrite (\ref{pf.thm.ent.base-b.main.c2.pf.1}) as%
\begin{equation}
n=\sum_{j=0}^{i-1}r_{j}b^{j}+b^{i}\sum_{j=i}^{k}r_{j}b^{j-i}.
\label{pf.thm.ent.base-b.main.c2.pf.2}%
\end{equation}


Let us set%
\[
q^{\prime}:=\sum_{j=i}^{k}r_{j}b^{j-i}\ \ \ \ \ \ \ \ \ \ \text{and}%
\ \ \ \ \ \ \ \ \ \ r^{\prime}:=\sum_{j=0}^{i-1}r_{j}b^{j}.
\]
With these notations, we can rewrite (\ref{pf.thm.ent.base-b.main.c2.pf.2})
as
\begin{equation}
n=r^{\prime}+b^{i}q^{\prime}=q^{\prime}b^{i}+r^{\prime}.
\label{pf.thm.ent.base-b.main.c2.pf.3}%
\end{equation}


Note that both sums $q^{\prime}=\sum_{j=i}^{k}r_{j}b^{j-i}$ and $r^{\prime
}=\sum_{j=0}^{i-1}r_{j}b^{j}$ are integers (indeed, $b^{j-i}$ is always an
integer in the first sum, since $j\geq i$ entails $j-i\in\mathbb{N}$).

We have assumed that $r_{0},r_{1},\ldots,r_{k}\in\left\{  0,1,\ldots
,b-1\right\}  $. In particular, the integers $r_{0},r_{1},\ldots,r_{k}$ are
all $\geq0$ and $\leq b-1$. In other words, each $j\in\left\{  0,1,\ldots
,k\right\}  $ satisfies $r_{j}\geq0$ and $r_{j}\leq b-1$. Hence, $r^{\prime
}=\sum_{j=0}^{i-1}r_{j}b^{j}\geq0$ (since all the integers $r_{j}$ are $\geq
0$, and so is $b$) and%
\begin{align*}
r^{\prime}  &  =\sum_{j=0}^{i-1}\underbrace{r_{j}}_{\leq b-1}b^{j}\leq
\sum_{j=0}^{i-1}\left(  b-1\right)  b^{j}=\left(  b-1\right)  \underbrace{\sum
_{j=0}^{i-1}b^{j}}_{\substack{=b^{0}+b^{1}+\cdots+b^{i-1}\\=\dfrac{b^{i}%
-1}{b-1}\\\text{(by Corollary 1.6.3 from Lecture 3,}\\\text{applied to
}b\text{ and }i\text{ instead of }q\text{ and }n\text{)}}}\\
&  =\left(  b-1\right)  \cdot\dfrac{b^{i}-1}{b-1}=b^{i}-1.
\end{align*}
Thus, $r^{\prime}\in\left\{  0,1,\ldots,b^{i}-1\right\}  $.

The equality (\ref{pf.thm.ent.base-b.main.c2.pf.3}) says that $n=q^{\prime
}b^{i}+r^{\prime}$. In light of $q^{\prime}\in\mathbb{Z}$ and $r^{\prime}%
\in\left\{  0,1,\ldots,b^{i}-1\right\}  $, this shows that $\left(  q^{\prime
},r^{\prime}\right)  $ is a quo-rem pair of $n$ and $b^{i}$. Therefore, in
particular, $q^{\prime}$ is the quotient of the division of $n$ by $b^{i}$. In
other words,%
\[
q^{\prime}=n//b^{i}.
\]


However,%
\begin{align*}
q^{\prime}  &  =\sum_{j=i}^{k}r_{j}b^{j-i}=r_{i}b^{0}+r_{i+1}b^{1}%
+r_{i+2}b^{2}+\cdots+r_{k}b^{k-i}\\
&  =r_{i}\underbrace{b^{0}}_{=1}+\underbrace{\left(  r_{i+1}b^{1}+r_{i+2}%
b^{2}+\cdots+r_{k}b^{k-i}\right)  }_{=\left(  r_{i+1}b^{0}+r_{i+2}b^{1}%
+\cdots+r_{k}b^{k-i-1}\right)  b}\\
&  =r_{i}+\left(  r_{i+1}b^{0}+r_{i+2}b^{1}+\cdots+r_{k}b^{k-i-1}\right)  b.
\end{align*}
Thus, $q^{\prime}-r_{i}=\left(  r_{i+1}b^{0}+r_{i+2}b^{1}+\cdots
+r_{k}b^{k-i-1}\right)  b$, which is clearly divisible by $b$. That is, $b\mid
q^{\prime}-r_{i}$. In other words, $q^{\prime}\equiv r_{i}\operatorname{mod}%
b$. In other words, $r_{i}\equiv q^{\prime}\operatorname{mod}b$. Since we
furthermore have $r_{i}\in\left\{  0,1,\ldots,b-1\right\}  $ (because
$r_{0},r_{1},\ldots,r_{k}\in\left\{  0,1,\ldots,b-1\right\}  $), we thus
conclude that $r_{i}=q^{\prime}\%b$ (by Proposition
\ref{prop.ent.quo-rem.basics} \textbf{(c)}, applied to $q^{\prime}$, $b$ and
$r_{i}$ instead of $n$, $d$ and $c$). In view of $q^{\prime}=n//b^{i}$, we can
rewrite this as $r_{i}=\left(  n//b^{i}\right)  \%b$.

Forget that we fixed $i$. We thus have shown that $r_{i}=\left(
n//b^{i}\right)  \%b$ for each $i\in\left\{  0,1,\ldots,k\right\}  $. This
proves Claim 2.
\end{proof}

Now, both Claims 1 and 2 are proved. As explained above, this completes the
proof of Theorem \ref{thm.ent.base-b.main}.
\end{proof}
\end{fineprint}

\begin{fineprint}
The inductive proof of Claim 1 in the above proof is just a formal avatar of
the algorithm for writing a nonnegative integer $n$ in base $b$ that we
demonstrated on an example before the theorem. The formula $r_{i}=\left(
n//b^{i}\right)  \%b$ from Claim 2, on the other hand, gives an alternative
way of computing each base-$b$ digit of $n$ directly.
\end{fineprint}


\end{document}