Exercise 1.2.3 (Bézout algorithm)

Find values of x and y to satisfy

(a)
423 x + 198 y = 9 ;
(b)
71 x 50 y = 1 ;
(c)
43 x + 64 y = 1 ;
(d)
93 x 81 y = 3 ;
(e)
6 x + 10 y + 15 z = 1 .

Answers

Proof. I give intermediate calculations with arrays similar to the array of page 15.

(a)
q i + 1 r i x i y i 423 1 0 2 198 0 1 7 27 1 2 3 9 7 15

So ( x , y ) = ( 7 , 15 ) satisfies 423 x + 198 y = 9

( 7 × 423 + 15 × 198 = 9 ).

(b)
71 1 0 1 50 0 1 2 21 1 1 2 8 2 3 1 5 5 7 1 3 7 10 1 2 12 17 2 1 19 27

Since 1 = 71 × ( 19 ) + 50 × 27 = 1 , we obtain

1 = 71 × ( 50 19 ) + 50 × ( 71 + 27 ) = 71 × 31 50 × 44 ,

so ( x , y ) = ( 31 , 44 ) satisfies 71 x 50 y = 1 .

(c)
43 1 0 0 64 0 1 1 43 1 0 2 21 1 1 21 1 3 2

(Note that the first step in Bézout’s algorithm exchanges a , b if 0 < a < b .)

This gives 3 × 43 2 × 64 = 1 , so ( x , y ) = ( 3 , 2 ) satisfies 43 x + 64 y = 1 .

(d)
93 1 0 1 81 0 1 6 12 1 1 1 9 6 7 3 3 7 8

So 7 × 93 8 × 81 = 1 : ( x , y ) = ( 7 , 8 ) is a solution of 93 x 81 y = 3 .

(e)
Since gcd ( 2 × 3 , 2 × 5 , 3 × 5 ) = 1 , there is a solution to 6 x + 10 y + 15 z = 1 . To give such a solution of 2 ( 3 x + 5 y ) + 15 z , definng a new variable t = 3 x + 5 y , we search first a solution ( t 0 , y 0 ) to 2 t + 15 z = 1 . (1)

If ( x 0 , y 0 ) is a solution of

3 x + 5 y = t 0 , (2)

then ( x 0 , y 0 , z 0 ) is a solution to 6 x + 10 y + 15 z = 1 .

A solution of (1) is ( t 0 , z 0 ) = ( 7 , 1 ) , and a solution of 3 x + 5 y = 1 is ( 2 , 1 ) , so ( x 0 , y 0 ) = ( 14 , 7 ) is a solution to 3 x + 5 y = 7 .

This gives ( x 0 , y 0 , z 0 ) = ( 14 , 7 , 1 ) as a solution of 6 x + 10 y + 15 z = 1 .

Note : the preceding arrays are given by the following Python function.

def bezout(a,b):
    sgn_a = 1 if a >= 0 else -1
    sgn_b = 1 if b >= 0 else -1
    (r0, r1)=(abs(a), abs(b))
    (u0, v0) = (1, 0)
    (u1, v1) = (0, 1)
    while r1 != 0:
        q = r0 // r1
        (r2, u2, v2) = (r0 - q * r1, u0 - q * u1, v0 - q * v1)
        (r0, r1) = (r1, r2)
        (u0, u1) = (u1, u2)
        (v0, v1) = (v1, v2)
    x , y, d  = sgn_a * u0, sgn_b * v0, r0
    if x <= 0: x, y = x + abs(b), y - sgn_b * a
    return x, y, d

To obtain intermediate calculations, add

   print(q,r0,’\t’,u0,’\t’,v0)

in the loop. □

User profile picture
2024-06-16 09:30
Comments