8 #69 Euclidean algorithm for the gcd forget
Euclidean algorithm: letting the remainder of dividing \(a\) by \(b\) be \(r\) (\(a = bq + r\)), the gcd of \(a\) and \(b\) equals the gcd of \(b\) and \(r\). Since remainders keep decreasing, the divisor at the moment 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\).
8.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\), by division Ldiv, \(a = bq + r\) and \(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 ,Lgstep ,Lbase ,Ldiv