2023-05-03 11:15:35 -07:00
\section { Challenge Problems}
2022-11-13 13:02:25 -08:00
2023-05-03 11:15:35 -07:00
\problem { }
Prove \ref { mod_ has_ inverse} : \\
$ a $ has an inverse mod $ m $ iff $ \gcd ( a, m ) = 1 $ \\
\begin { hint}
To prove an iff statement, prove each direction separately: \\
Assume that the left side is true and show that left $ \implies $ right, \\
then do the reverse.
\end { hint}
2022-11-13 13:02:25 -08:00
2023-05-03 11:15:35 -07:00
\begin { solution}
Assume $ a ^ \star $ is the inverse of $ a \pmod { m } $ . \\
Then $ a ^ \star \times a \equiv 1 \pmod { m } $ \\
2022-11-13 13:02:25 -08:00
2023-05-03 11:15:35 -07:00
Therefore, $ aa ^ \star - 1 = km $ , and $ aa ^ \star - km = 1 $ \\
We know that $ \gcd ( a, m ) $ divides $ a $ and $ m $ , therefore $ \gcd ( a, m ) $ must divide $ 1 $ . \\
$ \gcd ( a, m ) = 1 $ \\
2022-11-13 13:02:25 -08:00
2023-05-03 11:15:35 -07:00
Now, assume $ \gcd ( a, m ) = 1 $ . \\
By the Extended Euclidean Algorithm, we can find $ ( u, v ) $ that satisfy $ au + mv = 1 $ \\
So, $ au - 1 = mv $ . \\
$ m $ divides $ au - 1 $ , so $ au \equiv 1 \pmod { m } $ \\
$ u $ is $ a ^ \star $ .
\end { solution}
2022-11-13 13:02:25 -08:00
2023-05-03 11:15:35 -07:00
\vfill
2022-11-13 13:02:25 -08:00
2023-05-03 11:15:35 -07:00
\problem { } <eua_ runtime>
The Euclidean Algorithm (From \ref { euclid_ algorithm} ) can be written as follows: \\
2022-11-13 13:02:25 -08:00
2023-05-03 11:15:35 -07:00
Assume $ a > b $ .
Set $ e _ 0 = a $ and $ e _ 1 = b $ . \\
Let $ e _ { n + 1 } = \text { remainder } ( r _ { n - 1 } \div r _ { n } ) $ \\
Stop when $ e _ { k } = 0 $ .
Then, $ \gcd ( a, b ) = e _ { k - 1 } $ . \\
2022-11-13 13:02:25 -08:00
2023-05-03 11:15:35 -07:00
Let $ F _ n $ be the $ n ^ { \text { th } } $ Fibonacci number. ($ F _ 0 = 0 $ ; $ F _ 1 = 1 $ ; $ F _ 2 = 1 $ ; $ \dots $ )\\
Show that if the Euclidean algorithm requires $ n $ steps for an input $ ( a, b ) $ , then $ a \geq F _ { n + 2 } $ and $ b \geq F _ { n + 1 } $ .
2022-11-13 13:02:25 -08:00
2023-05-03 11:15:35 -07:00
(In other words, show that the longest-running input of a given size is a Fibonacci pair.)
2022-11-13 13:02:25 -08:00
2023-05-03 11:15:35 -07:00
\begin { solution}
The easiest way to go about this is induction on $ n $ : \\
2022-11-13 13:02:25 -08:00
2023-05-03 11:15:35 -07:00
\textcolor { gray} { \textit { Base Case:} }
2022-11-13 13:02:25 -08:00
2023-05-03 11:15:35 -07:00
If $ n = 1 $ , $ b $ divides $ a $ with no remainder, and the smallest possible $ a, b $ for which this is true is $ ( 2 , 1 ) = ( F _ 3 , F _ 2 ) $ .
2022-11-13 13:02:25 -08:00
2023-05-03 11:15:35 -07:00
\linehack { }
2022-11-13 13:02:25 -08:00
2023-05-03 11:15:35 -07:00
\textcolor { gray} { \textit { Induction:} }
2022-11-13 13:02:25 -08:00
2023-05-03 11:15:35 -07:00
Assume that for $ n $ steps, $ a \geq F _ { n + 2 } $ and $ b \geq F _ { n + 1 } $ .
2022-11-13 13:02:25 -08:00
2023-05-03 11:15:35 -07:00
Now, say the algorithm takes $ n + 1 = m $ steps. \\
2022-11-13 13:02:25 -08:00
2023-05-03 11:15:35 -07:00
The first step gives us $ a = q _ 0 b + r _ 0 $ \\
Therefore, the pair $ ( b, r _ 0 ) $ must take $ m - 1 $ steps. \\
We thus know that $ b \geq F _ { m + 1 } $ and $ r _ 0 \geq F _ m $ \hfill \textcolor { gray} { by our induction hypothesis} \\
Therefore, $ a = q _ 0 b + r _ 0 \geq b + r _ 0 $ \\
But $ b + r _ 0 = F _ { m + 1 } + F _ { m } = F _ { m + 2 } $ , \\
so $ a \geq F _ { m + 2 } $ .
\end { solution}
2022-11-13 13:02:25 -08:00
2023-05-03 11:15:35 -07:00
\vfill
\pagebreak
2022-11-13 13:02:25 -08:00
2023-05-03 11:15:35 -07:00
\problem { Chinese Remainder Theorem}
There are certain things whose number is unknown. If we count them by threes, we have two left over; by fives, we have three left over; and by sevens, two are left over. How many things are there?
2022-11-13 13:02:25 -08:00
2023-05-03 11:15:35 -07:00
\begin { solution}
$ x \equiv 2 \pmod { 3 } $ \\
$ x \equiv 3 \pmod { 5 } $ \\
$ x \equiv 2 \pmod { 7 } $ \\
2022-11-13 13:02:25 -08:00
2023-05-03 11:15:35 -07:00
$ x = 23 + 105 k \ \forall k \in \mathbb { Z } $
\end { solution}
2022-11-13 13:02:25 -08:00
2023-05-03 11:15:35 -07:00
\vfill
2022-11-13 13:02:25 -08:00
2023-05-03 11:15:35 -07:00
\problem { } <flt_ prereq>
Show that if $ p $ is prime, $ \binom { p } { i } \equiv 0 \pmod { p } $
for $ 0 < i < p $ .
2022-11-13 13:02:25 -08:00
2023-05-03 11:15:35 -07:00
\begin { solution}
$ \binom { p } { i } = \frac { p ! } { i ! ( p - i ) ! } $ tells us that $ i ! ( p - i ) ! $ divides $ p ! = p ( p - 1 ) ! $ . \\
However, $ i ! ( p - i ) ! $ and $ p $ are coprime, since all factors of $ i ! ( p - i ) ! $ are smaller than $ p $ . \\
Therefore, $ i ! ( p - i ) ! $ must divide $ ( p - 1 ) ! $ \\
2022-11-13 13:02:25 -08:00
2023-05-03 11:15:35 -07:00
So, $ \binom { p } { i } = p \times \frac { ( p - 1 ) ! } { i ! ( p - i ) ! } $ , and $ \binom { p } { i } \equiv 0 \pmod { p } $ .
\end { solution}
2022-11-13 13:02:25 -08:00
2023-05-03 11:15:35 -07:00
\vfill
2022-11-13 13:02:25 -08:00
2023-05-03 11:15:35 -07:00
\problem { Fermat's Little Theorem}
Show that if $ p $ is prime and $ a \not \equiv 0 \pmod { p } $ , then $ a ^ { p - 1 } \equiv 1 \pmod { p } $ . \\
You may want to use \ref { flt_ prereq} .
2022-11-13 13:02:25 -08:00
2023-05-03 11:15:35 -07:00
\begin { hint}
It may be easier to show that $ a ^ p \equiv a \pmod { p } $
\end { hint}
2022-11-13 13:02:25 -08:00
2023-05-03 11:15:35 -07:00
\begin { solution}
Use induction:
2022-11-13 13:02:25 -08:00
2023-05-03 11:15:35 -07:00
$ 1 \equiv 1 \pmod { p } $ \\
2022-11-13 13:02:25 -08:00
2023-05-03 11:15:35 -07:00
Using \ref { flt_ prereq} and the binomial theorem, we have
2022-11-13 13:02:25 -08:00
2023-05-03 11:15:35 -07:00
$ 2 ^ p = ( 1 + 1 ) ^ p = 1 + \binom { p } { 1 } + \binom { p } { 2 } + \dots + \binom { p } { p - 1 } + 1 \equiv 1 + 0 + ... + 0 + 1 \equiv 2 \pmod { p } $ \\
2022-11-13 13:02:25 -08:00
2023-05-03 11:15:35 -07:00
Then,
2022-11-13 13:02:25 -08:00
2023-05-03 11:15:35 -07:00
$ 3 ^ p = ( 1 + 2 ) ^ p = 1 + \binom { p } { 1 } 2 + \binom { p } { 2 } 2 ^ 2 + \dots + \binom { p } { p - 1 } 2 ^ { p - 1 } + 2 ^ p \equiv 1 + 0 + ... + 0 + 2 \equiv 3 \pmod { p } $ \\
2022-11-13 13:02:25 -08:00
2023-05-03 11:15:35 -07:00
We can repeat this for all $ a $ . This proof can be presented more formally with a bit of induction.
2022-11-13 13:02:25 -08:00
2023-05-03 11:15:35 -07:00
\end { solution}
2022-11-13 13:02:25 -08:00
2023-05-03 11:15:35 -07:00
\vfill
2022-11-13 13:02:25 -08:00
2023-05-03 11:15:35 -07:00
%\problem{}
%Prove \ref{theorem:gcd_abc}: \\
%For any integers $a, b, c$, \\
%$\gcd(ac + b, a) = \gcd(a, b)$\\
2022-11-13 13:02:25 -08:00
2023-05-03 11:15:35 -07:00
%\begin{solution}
% This problem is hard, \\
% I'll write a solution eventually.
%\end{solution}
2022-11-13 13:02:25 -08:00
2023-05-03 11:15:35 -07:00
%\vfill
2022-11-13 13:02:25 -08:00
2023-05-03 11:15:35 -07:00
[Note on \ref { eua_ runtime} ] This proof can be used to show that the Euclidean algorithm finishes in logarithmic time, and it is the first practical application of the Fibonacci numbers. If you have finished all challenge problems, finish the proof: show that the Euclidean runs in $ O ( \log { n } ) $
\pagebreak