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

Click For Summary
The discussion focuses on demonstrating that the Euclidean Algorithm terminates in at most 7 times the number of digits of b. Participants explore the relationship between remainders, specifically showing that r_{i+2} is less than half of r_i, which is crucial for establishing the termination condition. They discuss using logarithmic properties to derive the number of steps required for the algorithm to complete, emphasizing the significance of the initial value b and its digit count. Ultimately, they conclude that the algorithm's termination can be bounded by 2 log_2(b), leading to the final assertion that it can take at most 7 times the number of digits of b to terminate. The conversation highlights the mathematical reasoning and proofs necessary to support this conclusion.
Terrell
Messages
316
Reaction score
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: 704
Physics news on Phys.org
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##..
 
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##
 
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?
 
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
Terrell said:
Can you give me hints?
The hint is the last paragraph of post #2.
 
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.
 
I figured that the inequality ##b(\frac{1}{2})^\frac{n}{2} < 1## then taking the log of both sides should be enough...?
 
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!
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
Replies
3
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 12 ·
Replies
12
Views
2K