How to do the extended euclidean algorithm

AI Thread Summary
The discussion centers on understanding the Extended Euclidean Algorithm, particularly in finding the multiplicative inverse of 28 modulo 75. The algorithm requires that the two numbers be coprime, which is not the case with 15 and 75, as their gcd is 5. The user is confused about the steps to derive the values in the example and specifically questions whether the inverse is -8, which is clarified to be 67 after applying the modulo operation. The conversation highlights that using a prime number for the modulus would yield a valid inverse for all integers in that range, unlike 75. A better understanding of the algorithm's application in finite field math is suggested for clearer insights.
SpiffyEh
Messages
191
Reaction score
0
Here's the definition I have:
Extended Euclidean algorithm
Takes a and b
Computes r, s, t such that
r=gcd(a, b) and, sa + tb = r
(only the last two terms in each of these sequences at any point in the algorithm)
Corollary. Suppose gcd(r0, r1)=1. Then
r_1-1 mod r_0=t_m mod r_0.

The example is in the attached image.

I don't understand the steps used to obtain all the values in the table or how to get the inverse which I'm assuming is -8 in that example?
If someone could guide me though it that would be very helpful, I've been struggling with it for hours now.

Thank you!
 

Attachments

  • example.png
    example.png
    26.4 KB · Views: 1,160
Technology news on Phys.org
The goal here is to find the multiplicative inverse of 28, (1/28), modulo 75 so that

(t x 28) mod (75) = 1

it will also turn out that

(s x 75) mod (28) = 1

The algorithm iterates until it finds

(s x 75) + (t x 28) = 1

where s and t will have opposite signs. This only works if a and b are coprime, gcd(a,b) = 1. (Otherwise the algorithm iterates to 0 and the previous remainder will not be 1). Note that there is no inverse for 15 mod (75), since gcd(15, 75) = 5. For finite field math modulo(a), a should be a prime number.

Wiki article:

http://en.wikipedia.org/wiki/Extended_Euclidean_algorithm

SpiffyEh said:
inverse which I'm assuming is -8 in that example?
Modulo(x) should have the same sign as x, in this case the range of (...) mod (75) are positive integers in the set {0 ... 74}.

(-8) mod (75) = 67, resulting in

(67 x 28) mod (75) = 1
 
Last edited:
I still don't understand it. I need someone to literally walk me through it so that I understand each step. I get what the algorithm is for but I don't understand that example I posted.

So the inverse is 67 in this case?
 
SpiffyEh said:
So the inverse is 67 in this case?
Yes 67 x 28 = 1876, and the nearest multiple of 75 less than 1876 is 25 x 75 = 1875, so (67 x 28) mod (75) = 1. Divide (67 x 28) / 75 = 1876/75, quotient = 25, remainder = 1. You could also use (-8 x 28) / 75, = -224/75, quotient = -3, remainder = 1.

SpiffyEh said:
literally walk me through it.
The article linked to below includes a better explanation of the extended euclidean algorithm, but without the requirement that the gcd(a,b) = 1.

extended-euclidean.html

It would help me to futher explain extended euclid algorithm if I knew what class your are taking, a math class, a programming class, something related to finite field math? If this is for finite field math, then 75 was a bad example because it's not a prime number. If a prime number was used instead, such as 79, then all integers from 1 to 78 would have an inverse modulo 79. This isn't true for 75, since any number that is a multiple of 3 or 5 will not have an inverse modulo 75.
 
Last edited:
Thread 'Is this public key encryption?'
I've tried to intuit public key encryption but never quite managed. But this seems to wrap it up in a bow. This seems to be a very elegant way of transmitting a message publicly that only the sender and receiver can decipher. Is this how PKE works? No, it cant be. In the above case, the requester knows the target's "secret" key - because they have his ID, and therefore knows his birthdate.
I tried a web search "the loss of programming ", and found an article saying that all aspects of writing, developing, and testing software programs will one day all be handled through artificial intelligence. One must wonder then, who is responsible. WHO is responsible for any problems, bugs, deficiencies, or whatever malfunctions which the programs make their users endure? Things may work wrong however the "wrong" happens. AI needs to fix the problems for the users. Any way to...
Back
Top