%! TEX root = NT.tex
% vim: tw=50
% 11/10/2023 10AM

\begin{flashcard}[euler-fermat-thm]
\begin{proposition}[Euler-Fermat Theorem]
  \label{euler_fermat_thm}
  \cloze{
  If $a, N \in \ZZ$, $N > 1$, $\gcdbrack(a, N) = 1$, then
  \[ a^{\totient(N)} \equiv 1 \pmod{N} \]
  }
\end{proposition}

\begin{proof}
  \cloze{
  Lagrange's theorem says: if $G$ is a finite
  group, $g \in G$, then $\ub{g \cdot g \cdot \cdot
  \cdot g}_{\text{$\#G$ times}} = e$. We take $G =
  (\ZZ / N\ZZ)^\times$, $g = a + N\ZZ$, so
  $a^{\totient(N)} \equiv 1 \pmod{N}$.
  }
\end{proof}
\end{flashcard}

\begin{flashcard}[fermats-little-thm]
\begin{corollary}[Fermat's Little Theorem]
  \label{fermats_little_thm}
  \cloze{
  If $p$ is a \gls{prime} number, $a \in \ZZ$, then $a^p
  \equiv a \pmod{p}$.
  }
\end{corollary}

\begin{proof}
  \cloze{
  If $p \divides a$, then $a^p \equiv 0 \equiv a
  \pmod{p}$, so done.

  If $p \ndivides a$, then $\gcdbrack(a, p) = 1$, so by
  \nameref{euler_fermat_thm} $a^{p - 1} \equiv 1 \pmod{p}$, so
  $a^p \equiv a \pmod{p}$.
  }
\end{proof}
\end{flashcard}

\begin{example*}
  Can we find $x \in \ZZ$ such that $x \equiv 7
  \pmod{10}$ and $x \equiv 3 \pmod{13}$? In other
  words, is the intersection $(7 + 10\ZZ) \cap (3
  + 13\ZZ)$ non-empty?

  We can write down a solution if we can find $u,
  v \in \ZZ$ such that
  \begin{align*}
    u
    &\equiv 1 \pmod{10}
    &v
    &\equiv 0 \pmod{10} \\
    u
    &\equiv 0 \pmod{13}
    &v
    &\equiv 1 \pmod{13}
  \end{align*}
  because then $x=  7u + 3v$ is a solution.
  As $(10, 13) = 1$, we can find $r, s \in \ZZ$
  such that $10r + 13s = 1$. Then $10r + 13s = 1
  \implies 10r = 1 - 13s$, so can take $v = 10r$
  and $13s = 1 - 10r$, so can take $u = 13s$.

  We can take $r = 4$, $s = -3$. Then $v = 40$, $u
  = -39$, so a solution is $x = -39 \times 7 + 40
  \times 3$.
\end{example*}

\begin{flashcard}[chinese-remainder-thm]
\begin{theorem}[Chinese Remainder Theorem]
  \label{CRT}
  \cloze{
  Let $m_1, \ldots, m_k \in \NN$ be pairwise
  \gls{coprime}, i.e. such that $\gcdbrack(m_i, m_j) = 1$ if $i
  \neq j$. Let $M = m_1 \cdots m_k$ and suppose
  again $a_1, \ldots, a_k \in \ZZ$.

  Then there exists $x \in \ZZ$ such that $x$
  satisfies
  \[ \begin{cases}
    x \equiv a_1 \pmod{m_1} \\
    ~~~\,\vdots \\
    x \equiv a_k \pmod{m_k}
  \end{cases} \]
  Moreover, any other solution is congruent to $x
  \pmod{M}$.
  }
\end{theorem}

\begin{proof}
  \cloze{
  If $x$ is a solution, then $x + rM$ is also a
  solution for any $r \in \ZZ$. Why? $m_i \divides M$,
  so $x + rM \equiv x \pmod{m_i}$. If $y$ is
  another solution, then $x \equiv y \pmod{m_i}$
  for all $i = 1, \ldots, k$. So $m_i \divides (x -
  y)$, hence $M \divides (x - y)$ as $m_i$ are
  pairwise \gls{coprime} (so they have no
  \gls{prime} factors
  in common). So $x \equiv y \pmod{M}$.

  To find a solution, let's define $M_i =
  \frac{M}{m_i} = \prod_{j \neq i m_j}$. Since
  $m_j$ are pairwise \gls{coprime}, $\gcdbrack(m_i, M_i) = 1$,
  there exist $r_i, s_i$ such that $r_i m_i +
  s_i M_i = 1$. Then
  \begin{align*}
    s_i M_i =
    &\equiv 1 \pmod{m_i} \\
    &\equiv 0 \pmod{M_i} \\
    &\equiv 0 \pmod{m_j}
    &&\text{(for $j \neq i$, as $m_j \divides M_i$)}
  \end{align*}
  We take
  \[ x = \sum_{i = 1}^k s_i M_i a_i \]
  Then
  \[ x \equiv \sum_{i = 1}^k s_i M_i a_i
  \pmod{m_j} \equiv s_j M_j a_j \equiv a_j
  \pmod{m_j} \qedhere \]
  }
\end{proof}
\end{flashcard}

\begin{flashcard}[crt-ring-iso-thm]
\begin{theorem}
  \label{CRT_ring_iso}
  Let $m_1, \ldots, m_k \in \NN$ be pairwise
  \gls{coprime}, $M = \prod_{i = 1}^k m_i$. Then the map
  \cloze{
  \begin{align*}
    \theta : \ZZ / M\ZZ
    &\to \ZZ / m_1 \ZZ \times \cdots \times \ZZ /
    m_k \ZZ \\
    a + M\ZZ
    &\mapsto (a + m_1 \ZZ, \ldots, a + m_k \ZZ)
  \end{align*}
  }
  is a ring isomorphism, i.e. a bijection that
  preserves addition and multiplication.
\end{theorem}

\begin{proof}
  \cloze{
  \begin{align*}
    \theta(a + b + M\ZZ)
    &= \theta(a + M\ZZ) + \theta(b + M\ZZ) \\
    \theta(ab + M\ZZ) = \theta(a + M\ZZ)
    \theta(b + M\ZZ)
  \end{align*}
  because addition and multiplication are defined
  pointwise on RHS.

  $\theta$ being bijective is exactly the content
  of the \nameref{CRT}.
  }
\end{proof}
\end{flashcard}

\begin{flashcard}[crt-field-iso-coro]
\begin{corollary}
  \label{CRT_field_iso}
  Let $m_1, \ldots, m_k$ be pairwise \gls{coprime}
  integers such that $m_i > 1$ for all $i = 1,
  \ldots, k$, $M = \prod_{i = 1}^k m_i$. Then
  there's a group isomorphism
  \[ \multbrack(\ZZ / M\ZZ) \equiv \cloze{\multbrack(\ZZ / m_1
  \ZZ) \times \cdots \times \multbrack(\ZZ / m_k
  \ZZ)} \]
\end{corollary}

\begin{proof}
  \cloze{
  Restrict $\theta$ from \cref{CRT_ring_iso} to
  the group of elements which have a
  multiplicative inverse. Just check that the
  image is what we expect.
  }
\end{proof}
\end{flashcard}

We will now show that if $p$ is a prime, then
$\multbrack(\ZZ / p\ZZ)$ is a cyclic group.
Consequence of this and \cref{CRT_field_iso}: if
$N \in \NN$ is odd, $N > 1$, then $N$ has at least
2 distinct \gls{prime} factors if and only if
$\multbrack(\ZZ / N\ZZ)$ is not cyclic.

\begin{flashcard}[multiplicative-defn]
\begin{definition}[Multiplicative Function]
  \glsadjdefn{mult_fn}{multiplicative}{function}
  \glsadjdefn{tot_mult_fn}{totally multiplicative}{function}
  \cloze{A function $f : \NN \to \CC$ is
  \emph{multiplicative} if $\forall m, n \in \NN$ such
  that $\gcdbrack(m, n) = 1$, $f(mn) = f(m)f(n)$.

  We say $f$ is \emph{totally multiplicative} if $f(mn) =
  f(m)f(n)$ for all $m, n \in \NN$.}
\end{definition}
\end{flashcard}

\begin{example*}
  For example $f(n) = n^k$, $k \in \NN$ is
  \gls{tot_mult_fn}, while $\totient$ is not
  \gls{tot_mult_fn} (for example
  $\totient(4) = 2$, but $\totient(2)\totient(2) = 1^2 \neq 2$).
  The next lemma will show that we can extend
  $\totient$ to a \gls{mult_fn} function.
\end{example*}

\begin{flashcard}[phi-multiplicative-defn]
\begin{lemma}
  $\totient$ is \gls{mult_fn} if we extend
  $\totient$ to
  $\NN$ by setting $\totient(1) = 1$.
\end{lemma}

\begin{proof}
  \cloze{
  Let $m, n \in \NN$, $\gcdbrack(m, n) = 1$, $m, n > 1$.
  Then there's an isomorphism
  \[ \multbrack(\ZZ / mn\ZZ) \equiv \multbrack(\ZZ /
  m\ZZ) \times \multbrack(\ZZ / n\ZZ) \]
  Note $\totient(mn)$ is equal to the cardinality of
  the LHS, and $\totient(m)\totient(n)$ is equal to the
  cardinality of the RHS.
  }
\end{proof}
\end{flashcard}

\begin{flashcard}[multiplicative-fn-summed-over-factors-is-multiplicative]
\begin{proposition}
  Let $f : \NN \to \CC$ be \cloze{a
  \fcemph{\gls{mult_fn}}
  function}, and define $g : \NN \to \CC$ by $g(n)
  = \sum_{d \divides n} f(d)$ ($\sum_{d \divides n}$ means
  sum over \emph{positive} divisors of $n$,
  including $1$ and $n$).
\end{proposition}

\begin{proof}
  \cloze{
  Let $m, n \in \NN$, $\gcdbrack(m, n) = 1$. Then $g(mn) =
  \sum_{d \divides mn} f(d)$. Since $\gcdbrack(m, n) = 1$, each
  $d \divides mn$ admits a unique expression $d = d_1
  d_2$, where $d_1 \divides m$, $d_2 \divides n$. So
  \begin{align*}
    g(mn)
    &= \sum_{d_1 \divides m} \sum_{d_2 \divides n} f(d_1
    d_2) \\
    &= \sum_{d_1 \divides m} \sum_{d_2 \divides n} f(d_1)
    f(d_2) \\
    &= \left( \sum_{d_1 \divides m} f(d_1) \right)
    \left( \sum_{d_2 \divides n} f(d_2) \right) \\
    &= g(m) g(n) \qedhere
  \end{align*}
  }
\end{proof}
\end{flashcard}

\begin{example*}
  \glssymboldefn{sum_of_factors}{$\sigma$}{$\sigma$}
  If $f(n) = n^k$, then $g(n) = \sum_{d \divides n}
  d^k \eqdef \sigma_k(n)$ is \gls{mult_fn}.
\end{example*}
