Question:
Let $m, n, q, r \in \mathbb Z$. If $m = qn + r$, show that $\gcd(m, n) = \gcd(n, r)$. Hence justify the Euclidean Algorithm.
I found this question in a past test paper, but cannot seem to find a reference in my textbook that indicates how I can go about "proving" the above statement. Can anyone please point me in the right direction?
To Prove $\gcd(m, n) = \gcd (n, r)$ if $m = qn + r$
Let $\gcd(m, n) = d$.
So $d \mid m$ and $d \mid n$ implies $d \mid r$ (read $d$ divides...)
Similarly if $n = q_1r + r_1$ and $d \mid n$ and $d \mid r$ implies $d \mid r_1$.
Note $r_i$ are reducing by each successive terms, hence this algorithm is guaranteed to terminate.
Now suppose the last expression (say algorithm takes $n$ steps) reads like this:
$$r_{n - 3} = q_{n - 3}r_{n - 2} + r_{n - 1}$$ $$r_{n - 2} = q_{n - 2}r_{n - 1} + r_n$$
For uniqueness by the above logic $d \mid r_n$, let $d_1 \mid r_n$ and $d_1 \mid r_{n - 2}$) [$d_1$ is some divisor of $n, r$], therefore $d_1 \mid (q_{n - 2}r_{n - 1})$.
Now $d_1 \mid r_{n - 3}$ because $d_1 \mid r_{n - 2}$ and $d_1 \mid r_{n - 1}$ and so on $d_1 \mid m$ and $d_1 \mid n$.
Therefore $m = nd$ and $m = nd_1$ but by definition $d$ is the greatest divisor, hence $d > d_1$ and we know that since the choice of $d_1$ was arbitrary, we are sure that $d \mid n$ and $d \mid r$ is the greatest possible $d$, hence the proof.