1

SETUP: Henri Cohen gives the extended Euclid algorithm as follows: Given $a, b \in \mathbb{N},$ find $(u,v,d) \in \mathbb{Z}^2 \times \mathbb{N}$ s.t. $$au+bv = d$$ and $d = \text{g.c.d.}(a,b).$ The algorithm uses auxiliary variables $v_1, v_3, t_1, t_3.$ (The proof uses extra auxiliary variables $v_2$ and $t_2$.)

  1. [Initialize] Set $u \leftarrow 1, d \leftarrow a.$ If $b = 0,$ set $v \leftarrow 0$ and terminate the algorithm. Otherwise set $v_1 \leftarrow 0$ and $v_3 \leftarrow b$.
  2. [Finished?] If $v_3 = 0$ then set $v \leftarrow (d-au)/b$ and terminate the algorithm.
  3. [Euclidean step] Let $q \leftarrow \lfloor d/v_3 \rfloor$ and simultaneously $t_3 \leftarrow d \mod v_3.$ Then set $t_1 \leftarrow u - q v_1, u \leftarrow v_1, d \leftarrow v_3, v_1 \leftarrow t_1, v_3 \leftarrow t_3,$ and go to step 2.

PROBLEM: show that, at the end of the algorithm, $v_1 = \pm b/d$.

When one includes the auxiliary variables $t_2$ and $v_2$ (with $v$ initialized to 0, $v_2$ initialized to 1, and the Euclidean updates $t_2 \leftarrow v - q v_2, v \leftarrow v_2, v_2 \leftarrow t_2$), then one can show that at the beginning of any step 2, the equations $$(A) \ \ \ \ \ \ \ \ \ at_1 + bt_2 = t_3,$$ $$(B) \ \ \ \ \ \ \ \ \ au+bv = d,$$ and $$(C) \ \ \ \ \ \ \ \ \ av_1 + bv_2 = v_3$$ hold.

WHAT I HAVE DONE: I have run this algorithm by hand a few times & confirmed that $v_1 = \pm b/d$ at the end. I have tried including upper indices (such as $v_2^i, t_2^i, q^i, ...$) to keep track of the steps of the algorithm, applying equations (A,B,C), and writing out several pages of algebra. I conjectured that at any step, $|v_1| = \lfloor b/d \rfloor,$ but this didn't work out.

CTVK
  • 457

0 Answers0