7 #69 The Euclidean algorithm for the gcd forget
Euclidean algorithm: if the remainder of dividing \(a\) by \(b\) is \(r\) (\(a = bq + r\)), then the gcd of \(a\) and \(b\) equals the gcd of \(b\) and \(r\). The remainders keep decreasing, so the divisor at the time the remainder becomes \(0\) is the gcd.
"\(g\) is the gcd of \(a\) and \(b\)" means \(g \mid a\), \(g \mid b\), and every common divisor of \(a\) and \(b\) divides \(g\).
7.1 Main theorem
One step of the Euclidean algorithm: if \(a = bq + r\), the common divisors of \(a\) and \(b\) are the same as those of \(b\) and \(r\), so \(g\) is the gcd of \(a\) and \(b\) if and only if it is the gcd of \(b\) and \(r\).
Lgstep …
\(a , b , q , r , g \in \mathbb{M} , a = b \cdot q + r \Longrightarrow ( g \mid a , g \mid b , \forall d \in \mathbb{M} . ( d \mid a , d \mid b \Longrightarrow d \mid g ) \Longleftrightarrow g \mid b , g \mid r , \forall d \in \mathbb{M} . ( d \mid b , d \mid r \Longrightarrow d \mid g ) )\) \(\blacktriangleleft\) ⋅𝕄:D ,\(\mathbb{W}.\) ,Axℤ ,∣M ,∣sub ,∣+When the remainder becomes \(0\): the gcd of \(a\) and \(0\) is \(a\).
Lbase …
\(a \in \mathbb{M} \Longrightarrow a \mid a , a \mid 0 , \forall d \in \mathbb{M} . ( d \mid a , d \mid 0 \Longrightarrow d \mid a )\) \(\blacktriangleleft\) ⋅𝕄:D ,\(\mathbb{W}.\) ,Axℤ ,∣RThe Euclidean algorithm terminates and returns the gcd (strong induction on \(b\); if \(b \ne 0\), divide with Ldiv to get \(a = bq + r\), \(r < b\)).
\(a , b \in \mathbb{M} \Longrightarrow \exists g \in \mathbb{M} . g \mid a , g \mid b , \forall d \in \mathbb{M} . ( d \mid a , d \mid b \Longrightarrow d \mid g )\) \(\blacktriangleleft\) ⋅𝕄:D ,\(\mathbb{W}.\) ,Axℤ ,∣M ,∣sub ,∣+ ,∣R