\documentclass[../main.tex]{subfiles} \begin{document} \section{The Euclidean Algorithm} \definition{} The \textit{greatest common divisor} of $a$ and $b$ is the greatest integer that divides both $a$ and $b$. \\ We denote this number with $\gcd(a, b)$. For example, $\gcd(45, 60) = 15$. \theorem{The Division Algorithm} Given two integers $a, b$, we can find two integers $q, r$, where $0 \leq r < b$ and $a = qb + r$. \\ In other words, we can divide $a$ by $b$ to get $q$ remainder $r$. \theorem{} For any integers $a, b, c$, \\ $\gcd(ac + b, a) = \gcd(a, b)$ \problem{} Find $\gcd(20, 14)$ by hand. \begin{solution} $\gcd(20, 14) = 2$ \end{solution} \vfill \problem{} Using the theorems above, detail an algorithm for finding $\gcd(a, b)$.\\ Then, compute $\gcd(1610, 207)$ by hand. \\ Have an instructor check your work before moving on. \begin{solution} Using \ref{gcd_abc} and the division algorthm, % Minipage prevents column breaks inside body \begin{multicols}{2} \begin{minipage}{\columnwidth} $\gcd(1610, 207)$ \\ $= \gcd(207, 161)$ \\ $= \gcd(161, 46)$ \\ $= \gcd(46, 23)$ \\ $= \gcd(23, 0) = 23$ \\ \end{minipage} \columnbreak \begin{minipage}{\columnwidth} $1610 = 207 \times 7 + 161$ \\ $207 = 161 \times 1 + 46$ \\ $161 = 46 \times 3 + 23$ \\ $46 = 23 \times 2 + 0$ \\ \end{minipage} \end{multicols} \end{solution} \vfill \pagebreak \problem{Divide and Conquer} If we are given $a, b, c$, when can we find $u, v$ that satisfy $au + bv = c$? \problempart{Divide} Show that if we find a solution $(u, v)$ to $au + bv = \gcd(a, b)$, we can easily find a $(u, v)$ for any other value of $c$. \\ \textcolor{gray}{\textit{Note: } We are not looking for \textit{all} $(u, v)$ that solve $au + bv = c$, we are looking for an easy way to find \textit{any} $(u, v)$.} \begin{solution} Note that $\gcd(a, b)$ divides both a and b. \\ Therefore, any $c$ must be divisible by $\gcd(a, b)$. The smallest such $c$ is $\gcd(a, b)$ itself, and we can get all other tuples $(u, v, c)$ by scaling. \end{solution} \vfill \problempart{Conquer} Using the output of your algorithm\footnotemark{} from \ref{euclid_algorithm}, \footnotetext{Your solution to \ref{euclid_algorithm} is called the \textit{Euclidean Algorithm}} \begin{itemize} \item[-] find a pair $(u, v)$ that satisfies $20u + 14v = \gcd(20, 14)$ \item[-] find a pair $(u, v)$ that satisfies $541u + 34v = \gcd(541, 34)$ \\ % gcd = 1 % u = 11; v = -175 \end{itemize} For which numbers $c$ can we find a $(u, v)$ so that $541u + 34v = c$? \\ For every such $c$, what are $u$ and $v$? \begin{solution} Using the output of the Euclidean Algorithm, we can use substitution and a bit of algebra to solve such problems. Consider the following example: \begin{multicols}{2} \begin{minipage}{\columnwidth} \textit{Euclidean Algorithm:} \\ $20 = 14 \times 1 + 6$ \\ $14 = 6 \times 2 + 2$ \\ $6 = 2 \times 3 + 0$ \\ \end{minipage} \columnbreak \begin{minipage}{\columnwidth} \textit{Rearranged:} \\ $6 = 20 - 14 \times 1$ \\ $2 = 14 - 6 \times 2 = \gcd(20, 14)$ \\ \end{minipage} \end{multicols} Using the right table, we can replace $6$ in $2 = 14 - 6 \times 2$ to get $2 = 14 - (20 - 14) \times 2$, \\ which gives us $2 = \gcd(20, 14) = (3)14 + (-2)20$. \\ \textcolor{gray}{\textit{Note to instructors:} You can present the $(20, 14)$ case as an example.} \linehack{} $(-2)20 + (3)14 = \gcd(20, 14) = 2$ \\ $(11)541 + (-175)34 = \gcd(541, 34) = 1$ \linehack{} We can find a solution $(u, v)$ when $c$ is any integer multiple of $\gcd(541, 34)$. \\ If $c = k \times \gcd(541, 34)$, \\ $u = k \times u_0 = 11k$ and $v = k \times v_0 = -175k$. \\ (See Part A) \end{solution} \vfill \pagebreak \end{document}