Euclid's Algorithm Explained: Modulo n & Remainders

  • Thread starter skook
  • Start date
  • Tags
    Algorithm
In summary, Euclid's algorithm is a way of finding the greatest common divisor of two positive integers by successive divisions. It states that for positive integers m and n with greatest common divisor p, there exist two integers a and b such that am+ bn= p. The algorithm involves finding a and b through successive divisions, and can be used to solve problems such as finding the greatest common divisor of 18 and 8 (a= 1, b= -2) and 31 and 7 (a= 8, b= -31).
  • #1
skook
15
0
I can do it, but can't understand how it works. Is there a straightforward expalnation in terms of
[tex]
\ \mathbb{Z}_{n}
[/tex]
the set of remainers in modulo n? Could someone try to explain, pls.
 
Physics news on Phys.org
  • #2
skook said:
I can do it, but can't understand how it works. Is there a straightforward expalnation in terms of
[tex]
\ \mathbb{Z}_{n}
[/tex]
the set of remainers in modulo n? Could someone try to explain, pls.

It's not clear to me what you want. "Explaining" Euclid's algorithm in terms of Zn seem much to complicated to me. Euclid certainly didn't know anything about Zn! Euclids algorithm asserts that if m and n are two positive integers, with greatest common divisor p, there exist two integers, a and b, such that am+ bn= p. The "algorithm" itself is a way of finding a and b by successive divisions. For example, if m= 18 and b= 8, then the greatest common divisor is 2. 8 divides into 18 twice, with remainder 2, 2 divides into 8 4 times with remainder 0, showing that 18- 2(8)= 2: a= 1, b= -2.
Second example, the greatest common divisor of 31 and 7 is 1: 7 divides into 31 4 times with remainder 3: 31= (4)(7)+ 3 or 31- 4(7)= 3. 3 divides into 7 twice with remainder 1: 1= 7- 2(3)= 7- 2(31- 4(7))= 8(7)- 2(31).
a= 8, b= -31.
 
  • #3


Euclid's Algorithm is a mathematical method for finding the greatest common divisor (GCD) of two numbers. This algorithm involves repeatedly dividing the larger number by the smaller number until the remainder is equal to zero. The last non-zero remainder is the GCD of the two numbers.

In terms of modulo n, the algorithm can be explained as follows:

1. Start with two numbers, a and b, and set the remainder r = a % b (where % represents the modulo operator).

2. If r = 0, then b is the GCD of a and b. If r ≠ 0, then continue to step 3.

3. Set a = b and b = r. This means that the larger number is now replaced by the smaller number, and the smaller number is replaced by the remainder.

4. Repeat steps 1-3 until the remainder is equal to zero.

In terms of the set of remainders in modulo n, \mathbb{Z}_{n}, the algorithm can be explained as finding the GCD of two numbers by repeatedly subtracting multiples of n until the remainder is zero. This process is essentially the same as the one described above, but instead of using the modulo operator, we are working with remainders in modulo n.

For example, if we want to find the GCD of 15 and 6 in modulo 10, we can use the following steps:

1. Set r = 15 % 6 = 3.

2. Since r ≠ 0, we continue to step 3.

3. Set 15 = 6*2 + 3. This means that we subtracted 2 multiples of 6 from 15, leaving us with a remainder of 3.

4. We now set a = 6 and b = 3, and repeat the process.

5. Set r = 6 % 3 = 0. Since r = 0, we know that 3 is the GCD of 15 and 6 in modulo 10.

In summary, Euclid's Algorithm in terms of modulo n involves finding the GCD of two numbers by repeatedly subtracting multiples of n until the remainder is zero, and the last non-zero remainder is the GCD. This can be seen as a more efficient way of finding the GCD, as it reduces the number of steps needed compared to other methods.
 

FAQ: Euclid's Algorithm Explained: Modulo n & Remainders

What is Euclid's algorithm?

Euclid's algorithm is a mathematical method used to find the greatest common divisor (GCD) of two numbers, also known as the highest common factor (HCF). It is named after the ancient Greek mathematician, Euclid.

How does Euclid's algorithm work?

The algorithm involves repeatedly dividing the larger number by the smaller number and using the remainder as the new divisor. This process is repeated until the remainder is equal to zero. The last non-zero remainder is then the GCD of the original two numbers.

What is the significance of Euclid's algorithm?

Euclid's algorithm is significant because it is an efficient and reliable method for finding the GCD of two numbers. It is also the basis for other important mathematical concepts such as modular arithmetic and the Extended Euclidean algorithm.

How does Euclid's algorithm relate to modular arithmetic?

Euclid's algorithm can be used to calculate the modular inverse of a number. This is useful in modular arithmetic, where the inverse of a number is needed to solve equations like ax ≡ b (mod n). The algorithm helps find the value of x in such equations.

Can Euclid's algorithm be used for numbers other than integers?

Yes, Euclid's algorithm can be used for other types of numbers, such as rational numbers. The process is the same, but the calculations may be more complex due to the presence of fractions.

Similar threads

Replies
5
Views
2K
Replies
11
Views
2K
Replies
96
Views
11K
Replies
3
Views
2K
Replies
1
Views
3K
Replies
12
Views
2K
Back
Top