Euclid & GCD algorithm

Description:

  • def EuclidAgl(a,b):
        if b = 0:
      	  return a
        else:
      	  return EuclidAlg(b, a mod b)
    • If then lemma
  • Euclid’s algorithm, on input EuclidAlg(a, b) for not both 0, always terminates and produces the correct output.theorem
  • For every two recursive calls made by EuclidAlg, the first argument a is at least reduced by halved.claim
  • theorem Euclid’s algorithm, on input EuclidAlg(a, b) for , a, b not both 0, always terminates in time proportional to
    • if a larger, algorithm increase logarithmically, not linearly

Theorem 11 (Bézout Theorem)

  • Let a, b ∈ N+, a, b not both 0. Then, there exist s, t (Bézout coefficients) ∈ Z such that (Bézout identity)
  • How to compute from
    • write out a = b.q + r for each recursive call (from , for eg) of solving EuclidAlg(a, b), until there is no remainder left
    • writing in backward order, from z = elements of
    • compute so that you get the form