74 lines
1.9 KiB
TeX
Executable File
74 lines
1.9 KiB
TeX
Executable File
\section{Modular Arithmetic}
|
|
|
|
\definition{}
|
|
$\mathbb{Z}_n$ is the set of integers mod $n$. For example, $\mathbb{Z}_5 = \{0, 1, 2, 3, 4\}$. \par
|
|
|
|
\problem{}
|
|
Create a multiplication table for $\mathbb{Z}_4$:
|
|
|
|
\begin{center}
|
|
\begin{tabular}{c | c c c c}
|
|
$\times$ & 0 & 1 & 2 & 3 \\
|
|
\hline
|
|
0 & ? & ? & ? & ? \\
|
|
1 & ? & ? & ? & ? \\
|
|
2 & ? & ? & ? & ? \\
|
|
3 & ? & ? & ? & ? \\
|
|
\end{tabular}
|
|
\end{center}
|
|
|
|
|
|
|
|
|
|
|
|
\definition{}
|
|
Let $a, b \in \mathbb{Z}_n$. \par
|
|
If $a \times b = 1$, we say that $b$ is the \textit{inverse} of $a$ in $\mathbb{Z}_n$.
|
|
|
|
\vspace{2mm}
|
|
|
|
We usually write \say{$a$ inverse} as $a^{-1}$. \par
|
|
Inverses are \textbf{not} guaranteed to exist.
|
|
|
|
\theorem{}<mod_has_inverse>
|
|
$a$ has an inverse in $\mathbb{Z}_n$ iff $\gcd(a, n) = 1$ \par
|
|
|
|
\problem{}
|
|
Find the inverse of $3$ in $\mathbb{Z}_4$, if one exists. \par
|
|
Find the inverse of $20$ in $\mathbb{Z}_{14}$, if one exists. \par
|
|
Find the inverse of $4$ in $\mathbb{Z}_7$, if one exists.
|
|
\vfill
|
|
|
|
|
|
\problem{}
|
|
Today, we will often assume that $n$ is prime. \par
|
|
Why? What is special about $\mathbb{Z}_n$ with a prime $n$?
|
|
|
|
\vfill
|
|
\pagebreak
|
|
|
|
\problem{}<general_inverse>
|
|
In general, how can we find the inverse of $a$ in $\mathbb{Z}_n$? Assume $a$ and $n$ are coprime.\par
|
|
\hint{You can find that $34^{-1}$ is $-175$ in $\mathbb{Z}_{541}$ by looking at a previous problem.}
|
|
|
|
\begin{solution}
|
|
We need an $a^{-1}$ so that $a \times a^{-1} = 1$. \par
|
|
This means that $aa^{-1} - mk = 1$. \par
|
|
Since $a$ and $m$ are coprime, $\gcd(a, m) = 1$ and $aa^{-1} - mk = \gcd(a, m)$ \par
|
|
Now use the extended Euclidean algorithm from \ref{extendedeuclid} to find $a^\star$.
|
|
\end{solution}
|
|
|
|
\vfill
|
|
|
|
\definition{}
|
|
Elements in $\mathbb{Z}_n$ that have an inverse are called \textit{units}. \par
|
|
The set of units in $\mathbb{Z}_n$ is called $\mathbb{Z}_n^\times$, which is read \say{$\mathbb{Z}$ mod $n$ cross}.
|
|
|
|
\problem{}
|
|
What is $\mathbb{Z}_5^\times$? \par
|
|
What is $\mathbb{Z}_{12}^\times$? \par
|
|
|
|
\vfill
|
|
\pagebreak
|
|
|