-1

I am learning about the Euclidean algorithm, and here is an image with the workings.

enter image description here

I got stuck towards the end.

My friend tried to help me, saying just put the three together. I understand that on the second line the equation is rearranged, however I do not understand how we got to the third line:

3 - 1*26 + 8*3 
= 3 + 8*3 - 1*26 
= (1+8)*3 - 1*26

In the image, I can see that v = 9 because of the 3v where 9 * 3. However, I do not understand why w = -1 when on the last line 9*3 = 1+1 * 26 has no negative numbers?

Bill Dubuque
  • 272,048
questioner
  • 135
  • 5
  • $9\cdot 3=1+1\cdot 26$ is equivalent to $9\cdot 3 - 1\cdot 26 = 1$, hence the $-1$. – Sil Apr 09 '21 at 22:46
  • 1
    There is an extended Euclidean algorithm that makes the calculation of Bézout's coefficients automatic (and which less error-prone). – Bernard Apr 09 '21 at 22:50
  • 1
    The last line is not in the form $3v + 26w = 1$. It is int the form $3m= 1 + 26n$ i.e. $3\cdot 9 = 1 + 1\cdot 26$. To get it in the form $3v + 26w = 1$ we must subtract $1\cdot 26$ from each side so get $3\cdot 9 - 1\cdot 26 = 1$. NOW it is in the form of $3v + 26w = 1$. .... (Note: If $3v+26w =1$ and $3,26 >1$ we know from the get go that one of the numbers will have to be negative. Otherwise you'd get a number much bigger than $1$) – fleablood Apr 09 '21 at 22:59
  • See here for a much simpler and much less error- prone version of the extended Euclidean algorithm. Once you learn this forward method you'll never use the cumbersome backward method again – Bill Dubuque Apr 09 '21 at 23:07

1 Answers1

1

The last line is not in the form $3v + 26w = 1$.

So you aren't done yet.

To get $3\cdot 9 = 1 + 1\cdot 26$ to the form $3w +26v = 1$ where the $3w$ and $26v$ are both on the LEFT HAND SIDE and the $1$ is all by itself on the RIGHT HAND SIDE, we will have to subtract $26\cdot 1$ from both side.

$3\cdot 9 = 1 + 1\cdot 26$
$3\cdot 9 - 1\cdot 26 = 1 $

NOW it is in the form of $3v + 26w = 1$. ...

(Note: If $3v+26w =1$ and $3,26 >1$ we know from the get-go that one of the numbers will have to be negative. Otherwise you'd get a number much bigger than $1$)

.....

Actually, it is funny how (at least to me) the equation

$9 w + 26v = 1$

looks a feels very different to me than

$9 w = 1 + 26b$

But the are completely equivalent.

fleablood
  • 124,253
  • I will be honest that I did not understand. Could you perhaps walk me through step by step from the beginning, rather than me trying to fit this into potentially the wrong place? Sorry to be a pain. – questioner Apr 10 '21 at 17:10
  • What's to not understand? If you want to find numbers $w,v$ so that $3v + 26w = 1$ then $v=9$ and $w=-1$ are such a pair of numbers because $3\cdot 9 + 26\cdot (-1) = 27-26 = 1$. We know that $9, -1$ is such a pair becaue $3\times 9 = 1 + 26\cdot 1$ so that means $3\times 9 - 26\cdot 1 = 1$. – fleablood Apr 10 '21 at 20:40