\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=Thursday, February 09, 2023 00:33:19}
%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{\arinj}{\ar@{_{(}->}}
\newcommand{\arinjrev}{\ar@{^{(}->}}
\newcommand{\arsurj}{\ar@{->>}}
\newcommand{\arelem}{\ar@{|->}}
\newcommand{\arback}{\ar@{<-}}
\newcommand{\are}{\ar@{-}}
\newcommand{\arebi}[1][]{\ar@{<-}@/_/[#1] \ar@/^/[#1]}
\newcommand{\of}{\text{ of }}
\definecolor{darkgreen}{rgb}{0,.5,0}
\newtheoremstyle{plainsl}
{8pt plus 2pt minus 4pt}
{8pt plus 2pt minus 4pt}
{\slshape}
{0pt}
{\bfseries}
{.}
{5pt plus 1pt minus 1pt}
{}
\theoremstyle{plainsl}
\ihead{Lecture 13, version \today}
\ohead{page \thepage}
\cfoot{}
\begin{document}
\section*{Math 332 Winter 2023, Lecture 13: Rings}

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

\section{Rings and ideals (cont'd)}

\setcounter{subsection}{11}

\subsection{The Chinese Remainder Theorem}

\subsubsection{Introduction}

In \S 1.10.3 (Lecture 12), we saw some examples of direct products. These
examples were rather transparent: The direct product structure of each ring
was obvious from how the ring was defined (usually signalled by the fact that
its elements are pairs or tuples, and by a word like \textquotedblleft
entrywise\textquotedblright\ or \textquotedblleft pointwise\textquotedblright).

However, this is not always the case! The ring $\mathbb{Z}/6$ does not look
like a direct product at all (its elements are $\overline{0},\overline
{1},\overline{2},\overline{3},\overline{4},\overline{5}$; these don't look
like tuples in any nontrivial way), and yet it is isomorphic to a direct
product: I claim that%
\[
\mathbb{Z}/6\cong\left(  \mathbb{Z}/2\right)  \times\left(  \mathbb{Z}%
/3\right)  .
\]
Specifically, there is a ring isomorphism%
\begin{align*}
\mathbb{Z}/6  &  \rightarrow\left(  \mathbb{Z}/2\right)  \times\left(
\mathbb{Z}/3\right)  \ \ \ \ \ \ \ \ \ \ \text{that sends}\\
\overline{0}  &  \mapsto\left(  \overline{0},\overline{0}\right)
\ \ \ \ \ \ \ \ \ \ \left(  \text{that is, }0+6\mathbb{Z}\mapsto\left(
0+2\mathbb{Z},\ 0+3\mathbb{Z}\right)  \right)  ,\\
\overline{1}  &  \mapsto\left(  \overline{1},\overline{1}\right)  ,\\
\overline{2}  &  \mapsto\left(  \overline{2},\overline{2}\right)  =\left(
\overline{0},\overline{2}\right)  ,\\
\overline{3}  &  \mapsto\left(  \overline{3},\overline{3}\right)  =\left(
\overline{1},\overline{0}\right)  ,\\
\overline{4}  &  \mapsto\left(  \overline{4},\overline{4}\right)  =\left(
\overline{0},\overline{1}\right)  ,\\
\overline{5}  &  \mapsto\left(  \overline{5},\overline{5}\right)  =\left(
\overline{1},\overline{2}\right)  .
\end{align*}


Of course, you can check this by hand, but this is not an isolated incident.
The reason why this isomorphism exists is that $2$ and $3$ are coprime (i.e.,
that $\gcd\left(  2,3\right)  =1$). More generally, the following holds:

\begin{theorem}
[The Chinese Remainder Theorem for two integers]\label{thm.CRT-2-ints}Let $n$
and $m$ be two coprime integers. Then,%
\[
\mathbb{Z}/\left(  nm\right)  \cong\left(  \mathbb{Z}/n\right)  \times\left(
\mathbb{Z}/m\right)  \ \ \ \ \ \ \ \ \ \ \text{as rings.}%
\]
More concretely, there is a ring isomorphism%
\begin{align*}
\mathbb{Z}/\left(  nm\right)   &  \rightarrow\left(  \mathbb{Z}/n\right)
\times\left(  \mathbb{Z}/m\right)  ,\\
\overline{r}  &  \mapsto\left(  \overline{r},\overline{r}\right)
\ \ \ \ \ \ \ \ \ \ \left(  \text{that is, }r+nm\mathbb{Z}\mapsto\left(
r+n\mathbb{Z},\ r+m\mathbb{Z}\right)  \right)  .
\end{align*}

\end{theorem}

(As usual, the notation $\overline{r}$ is intuitive and confusing at the same
time. It stands for the residue class of $r$ modulo an ideal, but what ideal
that is depends on the context. In the above context of a map from
$\mathbb{Z}/\left(  nm\right)  $ to $\left(  \mathbb{Z}/n\right)
\times\left(  \mathbb{Z}/m\right)  $, it should be clear that the first
$\overline{r}$ has to be a residue class modulo $nm$ (since it is an element
of $\mathbb{Z}/\left(  nm\right)  $), whereas the other two $\overline{r}$'s
are residue classes modulo $n$ and modulo $m$, respectively (since they form
the pair $\left(  \overline{r},\overline{r}\right)  $, which belongs to
$\left(  \mathbb{Z}/n\right)  \times\left(  \mathbb{Z}/m\right)  $). In
general, I will rely on the context to disambiguate such notations.) \medskip

Rather than prove Theorem \ref{thm.CRT-2-ints} directly, I will generalize it
and then prove the generalization. Specifically, I will replace $\mathbb{Z}$
by an arbitrary commutative ring $R$, and replace the integers $n$ and $m$ by
two ideals $I$ and $J$ of $R$. The assumption \textquotedblleft$n$ and $m$ are
coprime\textquotedblright\ will be replaced by the condition \textquotedblleft%
$I+J=R$\textquotedblright.

\subsubsection{The Chinese Remainder Theorem for two ideals}

The latter condition actually has a standard name:

\begin{definition}
\label{def.ideals.comax}Let $I$ and $J$ be two ideals of a ring $R$. We say
that $I$ and $J$ are \textbf{comaximal} if $I+J=R$.
\end{definition}

Now we can generalize Theorem \ref{thm.CRT-2-ints} to ideals:

\begin{theorem}
[The Chinese Remainder Theorem for two ideals]\label{thm.CRT-2-ids}Let $I$ and
$J$ be two comaximal ideals of a commutative ring $R$. Then:

\textbf{(a)} We have $I\cap J=IJ$.

\textbf{(b)} We have $R/\left(  IJ\right)  \cong\left(  R/I\right)
\times\left(  R/J\right)  $.

\textbf{(c)} More concretely, there is a ring isomorphism%
\begin{align*}
R/\left(  IJ\right)   &  \rightarrow\left(  R/I\right)  \times\left(
R/J\right)  ,\\
\overline{r}  &  \mapsto\left(  \overline{r},\overline{r}\right)
\ \ \ \ \ \ \ \ \ \ \left(  \text{that is, }r+IJ\mapsto\left(
r+I,\ r+J\right)  \right)  .
\end{align*}

\end{theorem}

As we will soon see, parts \textbf{(b)} and \textbf{(c)} of this theorem
generalize Theorem \ref{thm.CRT-2-ints} (while part \textbf{(a)} generalizes
the fact that $\operatorname{lcm}\left(  n,m\right)  =\pm nm$ for any two
coprime integers $n$ and $m$).

Let us now prove Theorem \ref{thm.CRT-2-ids}. We agree to understand the
notation $R/I\times R/J$ as $\left(  R/I\right)  \times\left(  R/J\right)  $,
so that we need to write fewer parentheses. Also, the notation $R/IJ$ will
mean $R/\left(  IJ\right)  $. Thus, we can restate Theorem \ref{thm.CRT-2-ids}
\textbf{(b)} as $R/IJ\cong R/I\times R/J$.

\begin{proof}
[Proof of Theorem \ref{thm.CRT-2-ids}.] We have $1\in R=I+J$ (since $I$ and
$J$ are comaximal). In other words, we can write $1$ as
\[
1=i+j\ \ \ \ \ \ \ \ \ \ \text{for some }i\in I\text{ and some }j\in J.
\]
Consider these $i$ and $j$. \medskip

\textbf{(a)} Recall that the ideal $IJ$ consists of all finite sums of
$\left(  I,J\right)  $-products. But any $\left(  I,J\right)  $-product lies
in both $I$ and $J$ (since it has a factor in $I$ and a factor in $J$, but
both $I$ and $J$ are ideals and thus satisfy the second ideal axiom). Thus,
any $\left(  I,J\right)  $-product lies in $I\cap J$. Hence, any finite sum of
$\left(  I,J\right)  $-products also lies in $I\cap J$. In other words,
$IJ\subseteq I\cap J$.

Let us now prove that $I\cap J\subseteq IJ$.

So let $a\in I\cap J$. Then, $a\in I$ and $a\in J$. Now,%
\[
a=a\cdot\underbrace{1}_{=i+j}=a\cdot\left(  i+j\right)  =\underbrace{ai}%
_{=ia}+aj=ia+aj.
\]
This is a sum of two $\left(  I,J\right)  $-products (indeed, $ia$ is an
$\left(  I,J\right)  $-product since $i\in I$ and $a\in J$; moreover, $aj$ is
an $\left(  I,J\right)  $-product since $a\in I$ and $j\in J$). Hence, this
belongs to $IJ$ (by the definition of $IJ$). In other words, $a\in IJ$.

So we have shown that $a\in IJ$ for each $a\in I\cap J$. Hence, $I\cap
J\subseteq IJ$. Combined with $IJ\subseteq I\cap J$ (which was proved above),
this results in $IJ=I\cap J$. This proves part \textbf{(a)} of Theorem
\ref{thm.CRT-2-ids}. \medskip

\textbf{(c)} First, we define a map%
\begin{align*}
f:R &  \rightarrow\left(  R/I\right)  \times\left(  R/J\right)  ,\\
r &  \mapsto\left(  \overline{r},\overline{r}\right)
\end{align*}
(where the $\left(  \overline{r},\overline{r}\right)  $ means $\left(
r+I,\ r+J\right)  $, as explained above). It is straightforward to see that
this map $f$ is a ring morphism. Its kernel is%
\begin{align*}
\operatorname*{Ker}f &  =\left\{  r\in R\ \mid\ \left(  \overline{r}%
,\overline{r}\right)  =0_{\left(  R/I\right)  \times\left(  R/J\right)
}\right\}  \\
&  =\left\{  r\in R\ \mid\ \left(  r+I,\ r+J\right)  =\left(
0+I,\ 0+J\right)  \right\}  \\
&  \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \left(  \text{since }\left(
\overline{r},\overline{r}\right)  =\left(  r+I,\ r+J\right)  \text{ and
}0_{\left(  R/I\right)  \times\left(  R/J\right)  }=\left(  0+I,\ 0+J\right)
\right)  \\
&  =\left\{  r\in R\ \mid\ r+I=0+I\text{ and }r+J=0+J\right\}  \\
&  =\left\{  r\in R\ \mid\ r\in I\text{ and }r\in J\right\}  \\
&  =I\cap J=IJ\ \ \ \ \ \ \ \ \ \ \left(  \text{by Theorem \ref{thm.CRT-2-ids}
\textbf{(a)}}\right)  .
\end{align*}


Now I claim that the image of $f$ is the whole ring $\left(  R/I\right)
\times\left(  R/J\right)  $ (that is, the map $f$ is surjective).

Indeed, recall that $1=i+j$. Hence, $1-i=j\in J$. Therefore, $\overline
{1}=\overline{i}$ in $R/J$ (because two elements $u,v\in R$ satisfy
$\overline{u}=\overline{v}$ in $R/J$ if and only if $u-v\in J$). In other
words, $\overline{i}=\overline{1}$ in $R/J$. Similarly, $\overline
{j}=\overline{1}$ in $R/I$.

On the other hand, $\overline{i}=\overline{0}$ in $R/I$ (since $i\in I$), and
$\overline{j}=\overline{0}$ in $R/J$ (since $j\in J$).

Now, for every $x\in R$ and $y\in R$, we have\footnote{In the following, the
notation $\overline{r}$ (for a given $r\in R$) means the residue class of $r$
modulo $I$ if it stands in the first entry of a pair, and means the residue
class of $r$ modulo $J$ if it stands in the second entry of a pair.}%
\begin{align}
f\left(  yi+xj\right)   &  =f\left(  y\right)  f\left(  i\right)  +f\left(
x\right)  f\left(  j\right)  \ \ \ \ \ \ \ \ \ \ \left(  \text{since }f\text{
is a ring morphism}\right)  \nonumber\\
&  =\left(  \overline{y},\overline{y}\right)  \left(  \underbrace{\overline
{i}}_{=\overline{0}},\underbrace{\overline{i}}_{=\overline{1}}\right)
+\left(  \overline{x},\overline{x}\right)  \left(  \underbrace{\overline{j}%
}_{=\overline{1}},\underbrace{\overline{j}}_{=\overline{0}}\right)
\nonumber\\
&  \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \left(  \text{by the definition of
}f\right)  \nonumber\\
&  =\left(  \overline{y},\overline{y}\right)  \left(  \overline{0}%
,\overline{1}\right)  +\left(  \overline{x},\overline{x}\right)  \left(
\overline{1},\overline{0}\right)  \nonumber\\
&  =\left(  \overline{y}\cdot\overline{0},\ \overline{y}\cdot\overline
{1}\right)  +\left(  \overline{x}\cdot\overline{1},\ \overline{x}%
\cdot\overline{0}\right)  \ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{since multiplication in a}\\
\text{direct product is entrywise}%
\end{array}
\right)  \nonumber\\
&  =\left(  \overline{0},\overline{y}\right)  +\left(  \overline{x}%
,\overline{0}\right)  \nonumber\\
&  =\left(  \overline{0}+\overline{x},\ \overline{y}+\overline{0}\right)
\ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{since addition in a}\\
\text{direct product is entrywise}%
\end{array}
\right)  \nonumber\\
&  =\left(  \overline{x},\overline{y}\right)  .\label{pf.thm.CRT-2-ids.c.1}%
\end{align}
However, \textbf{any} element of $\left(  R/I\right)  \times\left(
R/J\right)  $ can be written as $\left(  \overline{x},\overline{y}\right)  $
for some $x,y\in R$. Using (\ref{pf.thm.CRT-2-ids.c.1}), we can rewrite this
as follows: Any element of $\left(  R/I\right)  \times\left(  R/J\right)  $
can be written as $f\left(  yi+xj\right)  $ for some $x,y\in R$. In
particular, this means that any element of $\left(  R/I\right)  \times\left(
R/J\right)  $ is a value of the map $f$. In other words, the map $f$ is
surjective. Hence, its image is%
\[
f\left(  R\right)  =\left(  R/I\right)  \times\left(  R/J\right)  .
\]


So we know that $f$ is a ring morphism with kernel $\operatorname*{Ker}f=IJ$
and image $f\left(  R\right)  =\left(  R/I\right)  \times\left(  R/J\right)
$. But the first isomorphism theorem for rings (Theorem 1.9.10 \textbf{(c)} in
Lecture 11) says that the map%
\begin{align*}
f^{\prime}:R/\operatorname*{Ker}f &  \rightarrow f\left(  R\right)  ,\\
\overline{r} &  \mapsto f\left(  r\right)
\end{align*}
is well-defined and is a ring isomorphism.

Since $\operatorname*{Ker}f=IJ$ and $f\left(  R\right)  =\left(  R/I\right)
\times\left(  R/J\right)  $ and $f\left(  r\right)  =\left(  \overline
{r},\overline{r}\right)  $ for all $r\in R$, we can rewrite this as follows:
The map%
\begin{align*}
f^{\prime}:R/IJ &  \rightarrow\left(  R/I\right)  \times\left(  R/J\right)
,\\
\overline{r} &  \mapsto\left(  \overline{r},\overline{r}\right)
\end{align*}
is well-defined and is a ring isomorphism. This proves part \textbf{(c)} of
Theorem \ref{thm.CRT-2-ids}. Thus, part \textbf{(b)} follows.
\end{proof}

\subsubsection{Application to integers}

Now, we can get Theorem \ref{thm.CRT-2-ints} (the Chinese Remainder Theorem
for two integers) as a corollary of Theorem \ref{thm.CRT-2-ids} (the Chinese
Remainder Theorem for two ideals):

\begin{proof}
[Proof of Theorem \ref{thm.CRT-2-ints}.] Let $R=\mathbb{Z}$ and $I=n\mathbb{Z}%
$ and $J=m\mathbb{Z}$. Then, Proposition 1.11.3 \textbf{(a)} in Lecture 12
yields $IJ=nm\mathbb{Z}$.

Also, Proposition 1.11.3 \textbf{(c)} in Lecture 12 yields
\[
I+J=\underbrace{\gcd\left(  n,m\right)  }_{\substack{=1\\\text{(since }n\text{
and }m\text{ are coprime)}}}\mathbb{Z}=1\mathbb{Z}=\mathbb{Z}.
\]
In other words, the ideals $I$ and $J$ are comaximal. Hence, we can apply
Theorem \ref{thm.CRT-2-ids}. In particular, Theorem \ref{thm.CRT-2-ids}
\textbf{(b)} yields that%
\begin{align*}
R/IJ &  \cong\left(  R/I\right)  \times\left(  R/J\right)
,\ \ \ \ \ \ \ \ \ \ \text{that is,}\\
\mathbb{Z}/nm &  \cong\left(  \mathbb{Z}/n\right)  \times\left(
\mathbb{Z}/m\right)
\end{align*}
(since $IJ=nm\mathbb{Z}$ and $I=n\mathbb{Z}$ and $J=m\mathbb{Z}$). Likewise,
Theorem \ref{thm.CRT-2-ids} \textbf{(c)} yields the specific isomorphism we
are looking for.
\end{proof}

\begin{exercise}
Apply this to $n=6$ and $m=5$ to obtain a ring isomorphism%
\[
\mathbb{Z}/30\rightarrow\left(  \mathbb{Z}/6\right)  \times\left(
\mathbb{Z}\mathbf{/}5\right)  .
\]
Find the preimage of $\left(  \overline{2},\overline{3}\right)  $ under this
isomorphism. (The first step is to write $1$ as $i+j$ where $i\in6\mathbb{Z}$
and $j\in5\mathbb{Z}$.)
\end{exercise}

More generally, if $n$ and $m$ are two coprime integers, then the
\textbf{extended Euclidean algorithm} is a fairly efficient algorithm for
writing $1$ as $i+j$ with $i\in n\mathbb{Z}$ and $j\in m\mathbb{Z}$ (that is,
for writing $1$ as a sum of a multiple of $n$ and a multiple of $m$). For this
algorithm, see, e.g.,
\href{https://en.wikipedia.org/wiki/Extended_Euclidean_algorithm}{the
Wikipedia page} or any textbook on elementary number theory (e.g.,
\cite[\S 9.2.2]{LeLeMe} explains the algorithm on an example, and
\cite[Algorithm 2.3.7]{Stein09} gives a simple recursive implementation).

\begin{thebibliography}{99999999}                                                                                         %
\bibitem[LeLeMe18]{LeLeMe}Eric Lehman, F. Thomson Leighton, Albert R. Meyer,
\textit{Mathematics for Computer Science}, revised Tuesday 6th June
2018.\newline\url{https://courses.csail.mit.edu/6.042/spring18/mcs.pdf} .

\bibitem[Stein09]{Stein09}\href{https://doi.org/10.1007/b13279}{William Stein,
\textit{Elementary Number Theory: Primes, Congruences, and Secrets}, Springer
2009}.
\end{thebibliography}


\end{document}