Euclidean Algorithm terminates in at most 7x the digits of b

In summary, the conversation discusses the need to show that the remainder in a given algorithm is always less than half of the previous remainder. It is shown that this is the case and it is then discussed how to use this information to determine the number of steps needed for the algorithm to terminate. It is ultimately concluded that the number of steps is at most 7 times the number of digits in the initial remainder, as long as the remainder is less than half of the initial remainder.
  • #1
Terrell
317
26

Homework Statement


please see the image

Homework Equations


I'm not sure if this is relevant:
##r_2 \leq \frac{1}{2}r_1## ... ##r_n \leq (\frac{1}{2})^nr_1##

The Attempt at a Solution


i have shown that ##r_{i+2} < r_i## by showing the ##r_{i+2} - r_i## is negative, but how do I show that the number of steps is at most ##2 \log_{2}b##
 

Attachments

  • CH5.1.png
    CH5.1.png
    12 KB · Views: 637
Physics news on Phys.org
  • #2
Terrell said:
i have shown that ##r_{i+2} < r_i##
That is not what the question requires though. It requires to show that ##r_{i+2} < \frac12 r_i##. Have you shown that?
how do I show that the number of steps is at most ##2 \log_{2}b##
Once you have shown ##r_{i+2} < \frac12 r_i## you can work out how many steps it takes to reduce the remainder to 1 or less, as the algorithm terminates when the remainder reaches 1 or 0. Use the fact that the remainder halves every two steps and that initially it is no greater than ##b##..
 
  • #3
andrewkirk said:
That is not what the question requires though. It requires to show that ##r_{i+2} < \frac12 r_i##. Have you shown that?
Once you have shown ##r_{i+2} < \frac12 r_i## you can work out how many steps it takes to reduce the remainder to 1 or less, as the algorithm terminates when the remainder reaches 1 or 0. Use the fact that the remainder halves every two steps and that initially it is no greater than ##b##..
Sorry I meant ##2r_{i+2} < r_i##
 
  • #4
andrewkirk said:
Use the fact that the remainder halves every two steps and that initially it is no greater than bbb..
I am not sure if I am doing this completely right or wrong.

proof of ##r_{i+2} < \frac{1}{2}r_i:##

Let ##a - bq_1 = r_1## s.t. ##b=r_0##

##(case 1):##
If ##b=r_0< \frac{1}{2}a## then ##q_1 \geq 2## so that ##r_1 < r_0##.
Furthermore, in ##r_0 - r_1q_2 = r_2##, since ##r_1 \leq \frac{1}{2}r_0## then it must be that ##q_2 \geq 2## so that ##r_2 < r_1##.
Therefore, ##r_2 < r_1 < \frac{1}{2}r_0## or ##r_{i+2}<r_{i+1}< \frac{1}{2}r_i## or simply ##r_{i+2}<\frac{1}{2}r_i##.

##(case 2):##
If ##b=r_0> \frac{1}{2}a## then ## a- r_0q_1 = r_1## such that ##r_1 < \frac{1}{2}a## and ##r_1 < r_0## and ##q_1=1##

##(subcase 2.1):## If ##r_1 > \frac{1}{2}r_0## then definitely, ##r_2 < \frac{1}{2}r_0## or ##r_{i+2}<\frac{1}{2}r_i##

##(subcase 2.2)## If ##r_1 < \frac{1}{2}r_0## then ##q_2 \geq 2## so that ##r_2 < r_1##.
Therefore, ##r_2<r_1< \frac{1}{2}r_0## or ##r_{i+2}<r_{i+1}< \frac{1}{2}r_i##

From here, I am struggling to apply logarithms to show the final step. Can you give me hints?
 
  • #5
You may get more response if you show the image rather than just giving the link. I'll do that much for you.

The image for the link you posted:
ch5-1-png.png

Notice that if ##\ b\ ,\ ## which is also ##\ r_0\ ,\ ## has k decimal digits, then b < 10k .
 
Last edited:
  • Like
Likes Terrell
  • #6
Terrell said:
Can you give me hints?
The hint is the last paragraph of post #2.
 
  • #7
Terrell said:
Can you give me hints?

Another hint:

What upper bound on rn will ensure that the algorithm terminates in at most n steps.
 
  • #8
I figured that the inequality ##b(\frac{1}{2})^\frac{n}{2} < 1## then taking the log of both sides should be enough...?
 
  • #9
SammyS said:
What upper bound on rn will ensure that the algorithm terminates in at most n steps.
##r_n \leq 1##

SammyS said:
Notice that if b , b , \ b\ ,\ which is also r0 , r0 , \ r_0\ ,\ has k decimal digits, then b < 10k .
yes i do notice, but can this be helpful to particularly show that it takes less than 7 times the no. of digits of b?
 
  • #10
Terrell said:
I figured that the inequality ##b(\frac{1}{2})^\frac{n}{2} < 1## then taking the log of both sides should be enough...?
It's probably enough for ##\displaystyle b(\frac{1}{2})^\frac{n}{2} < 2\ .\ ## Right.

Combine this with b < 10k .

So if ##\displaystyle 10^k (\frac{1}{2})^\frac{n}{2} < 2\ ,\ ## then ...
 
  • Like
Likes Terrell
  • #11
SammyS said:
Combine this with b < 10k
##2\log_2(b)<n## then by letting ##b = 10^k## we get ##2k\log_2(10)<n##. Also ##2\log_2(b)=6.6438...## therefore it can be at most 7 times the number of digits of ##b##. Thank you Sammy!
 

1. What is the Euclidean Algorithm?

The Euclidean Algorithm is a mathematical method for finding the greatest common divisor (GCD) of two numbers. It is based on the principle that the GCD of two numbers is equal to the GCD of the smaller number and the remainder when the larger number is divided by the smaller number.

2. How does the Euclidean Algorithm work?

The Euclidean Algorithm works by repeatedly dividing the larger number by the smaller number and using the remainder as the new smaller number in the next iteration. This process continues until the remainder is equal to 0, at which point the last non-zero remainder is the GCD of the two numbers.

3. Why does the Euclidean Algorithm terminate in at most 7x the digits of b?

This is because the number of iterations required for the Euclidean Algorithm to terminate is equal to the number of digits in the smaller number. Since the smaller number can never be greater than half of the larger number, the maximum number of digits in the smaller number is 7 times the number of digits in the larger number.

4. Does the Euclidean Algorithm always terminate in at most 7x the digits of b?

Yes, the Euclidean Algorithm will always terminate in at most 7 times the digits of b. This is because the algorithm will always eventually result in a remainder of 0, and the number of iterations required is directly related to the number of digits in the smaller number.

5. What are the practical applications of the Euclidean Algorithm?

The Euclidean Algorithm has many practical applications in mathematics and computer science. It is commonly used to simplify fractions, find the lowest common denominator, and perform modular arithmetic. It is also used in cryptography to generate public and private keys.

Similar threads

  • Calculus and Beyond Homework Help
Replies
3
Views
539
  • Calculus and Beyond Homework Help
Replies
1
Views
1K
  • General Math
Replies
4
Views
3K
  • Calculus and Beyond Homework Help
Replies
3
Views
1K
  • Calculus and Beyond Homework Help
Replies
2
Views
890
  • Calculus and Beyond Homework Help
Replies
1
Views
1K
  • Calculus and Beyond Homework Help
Replies
4
Views
1K
  • Introductory Physics Homework Help
Replies
1
Views
218
  • Topology and Analysis
Replies
3
Views
160
  • Calculus and Beyond Homework Help
Replies
2
Views
2K
Back
Top