How to do the extended euclidean algorithm

Click For Summary

Discussion Overview

The discussion revolves around the Extended Euclidean Algorithm, specifically its application in finding multiplicative inverses in modular arithmetic. Participants are exploring the steps involved in the algorithm, its requirements, and the implications of using non-prime moduli.

Discussion Character

  • Exploratory
  • Technical explanation
  • Homework-related

Main Points Raised

  • One participant defines the Extended Euclidean Algorithm and expresses confusion about the steps to compute values and the inverse from an example.
  • Another participant clarifies that the goal is to find the multiplicative inverse of 28 modulo 75, noting that the algorithm requires a and b to be coprime.
  • It is mentioned that if gcd(a, b) is not 1, the algorithm will not yield a valid inverse, as illustrated with the example of 15 mod 75.
  • There is a discussion about the result of the inverse, with one participant suggesting that the inverse is -8, while another confirms it is 67 after applying the modulo operation.
  • Further clarification is sought on the steps of the algorithm, with a request for a detailed walkthrough of the example provided.
  • One participant points out that using a non-prime modulus like 75 complicates the situation, as not all integers will have an inverse, contrasting it with a prime modulus scenario.

Areas of Agreement / Disagreement

Participants express confusion and seek clarification on the algorithm's steps and the concept of inverses. There is no consensus on the understanding of the example, and multiple viewpoints regarding the applicability of the algorithm with non-prime moduli are present.

Contextual Notes

Participants mention that the algorithm's effectiveness is contingent on the coprimality of the numbers involved. The discussion highlights the limitations of using composite numbers in modular arithmetic, particularly in the context of finite fields.

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,196
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:

Similar threads

  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K
Replies
6
Views
2K
  • · Replies 11 ·
Replies
11
Views
2K
  • · Replies 2 ·
Replies
2
Views
8K
Replies
7
Views
3K
Replies
1
Views
4K
  • · Replies 7 ·
Replies
7
Views
9K
Replies
8
Views
6K
  • · Replies 8 ·
Replies
8
Views
5K