3

I have calculated $d = 39$ but don't know how to find $u$ and $v$.


(source: gyazo.com)

Btw I know this is not really a cryptography question, but there isn't a tag for GCD.

MosesA
  • 471
  • 4
  • 7
  • 20

4 Answers4

5

$\newcommand{\GCD}{\operatorname{GCD}}$

Hint:

Use extended Euclid's division Algorithm as vonbrand suggested.

$ax+by=\GCD(a,b)$


$2184=975 \times 2+234$

$975=234 \times 3+39$

$234=39 \times 6+0$

$\GCD (2184,975)=39$

Now use the method of back-substitution:

$\ 975-(234 \times 3)=39 $

$\ 975-((2184-(975 \times 2)) \times 3)=39 $

Inceptio
  • 7,881
3

You can use a matrix technique. First, write

$$\left[ \begin{array}{cc|c} 1 & 0 & 2184 \\ 0 & 1 & 975 \end{array}\right]$$

Then perform repeated row operations, e.g.:

$$\left[ \begin{array}{cc|c} 1 & 0 & 2184 \\ 0 & 1 & 975 \end{array}\right] \stackrel{R_1-2R_2}{\longrightarrow} \left[ \begin{array}{cc|c} 1 & -2 & 234 \\ 0 & 1 & 975 \end{array}\right] \stackrel{R_2-4R_1}{\longrightarrow} \left[ \begin{array}{cc|c} 1 & -2 & 234 \\ -4 & 9 & 39 \end{array}\right]$$

$$\left[ \begin{array}{cc|c} 1 & -2 & 234 \\ -4 & 9 & 39 \end{array}\right] \stackrel{R_2-4R_1}{\longrightarrow} \left[ \begin{array}{cc|c} 1 & -2 & 234 \\ -4 & 9 & 39 \end{array}\right]$$

Since $39$ divides $234$ we stop and we get $\gcd(2184,975) = 39$ and, $(-4) \cdot 2184 + 9 \cdot 975 = 39$.

Fly by Night
  • 32,272
  • This is nice(+1) – Inceptio Apr 19 '13 at 15:04
  • What operations are you doing in between the matrices? – MosesA Apr 19 '13 at 15:30
  • Row operations. – Fly by Night Apr 19 '13 at 15:34
  • @FlybyNight I know. I meant what arithmetic operations? – MosesA Apr 19 '13 at 15:35
  • 1
    For example, $R_1-3R_2$ means subtract three lots of row two from row one. You subtract term by term. Because 975 goes into 2184 twice, leaving a remainder, I do $R_1-2R_2$. Then because 234 goes into 975 four times, leaving a remainder, I do $R_2-4R_1$. You keep juggling like this, taking as many lots of the smaller from the bigger until the smaller divides into the bigger without remainder. – Fly by Night Apr 19 '13 at 15:37
1

Cancelling the gcd: $\rm\ 56u + 25v = 1\:\Rightarrow\: mod\ 25\!:\ u \equiv \dfrac{1}{56}\equiv \dfrac{-24}6 \ \equiv -4,\ $ so $\rm\ u = -4\! +\! 25n,\: $ so $\rm\: v = (1\!-\!56u)/25\, =\, (1-56(-4\!+\!25n))/25\, =\, 9\!-\!56n,\: $ i.e. $\rm\: (u,v)\, =\, (-4,9)+(25,-26)n$.

Remark $\ $ Generally it is more efficient to employ the extended Euclidean algorithm.

Math Gems
  • 19,574
0

By using The Extended Euclidean Algorithm

$gcd(2184, 975) = x$

$2184 = 2*975 + 234$

$975 = 4*234 + 39$

$234 = 6*39$

Thus $gcd(2184, 975) = 39$

$d = 2184u + 975v$. Solve for $u$ and $v$.

$39 = 975 - 4*234$

$39 = 975 - 4(2184 - 2*975)$

$39 = 9*975 - 4*2184$

$u = -4$ and $v = 9$

Two more examples here.

MosesA
  • 471
  • 4
  • 7
  • 20