Can Sequence r_n Be Bounded by O(log2(log2 n))?

AI Thread Summary
The discussion revolves around proving that the sequence defined by r1 = 1 and rn = 1 + rfloor(√n) for n≥2 is O(log2(log2 n)) using mathematical induction. The main challenge lies in the inductive step, where participants discuss how to apply the induction hypothesis (IH) effectively to show that rn+1 ≤ c log2(log2(n+1)). There is a focus on the monotonicity of the logarithmic function and the sequence itself, with suggestions to simplify expressions involving the floor function. The conclusion emphasizes the need for a proper choice of c, with the realization that the proof requires n to be at least 3 for validity. The participants express gratitude for the collaborative problem-solving process.
NATURE.M
Messages
298
Reaction score
0

Homework Statement


We are given the sequence r defined by: r1 = 1, and rn = 1 + rfloor(√n)
, n≥2
We need to show by induction that rn is O (log2 (log2 n)).

The Attempt at a Solution



Definition of big oh: ∃c∈ℝ+, ∃B∈ℕ, ∀n∈ℕ, n≥B => f(n) ≤ cg(n)
[/B]
So the basic proof format is fairly simple. My issue is with the inductive step. We let for n≥3, P(n): rn ≤ 4log2(log2n)). Now this comes from the defn. of big oh and is what we have to use induction to prove. In addition, from the definition of big oh, we defined c = 4, since it seems to work.

My issue is in the inductive step I have to show P(n+1) but have no idea how to proceed. How do I get from rn+1 = 1 + rfloor(√(n+1)) to 4log2(log2n+1) ? I'm trying to invoke the IH but don't know how to simplify either expression. Any hints would be appreciated.

Also maybe this thread should belong to the computer science section instead.
 
Last edited:
Physics news on Phys.org
I would suggest not assuming c=4 just yet. Leave it as c.
What do you get when you substitute for rfloor(√(n+1)) using the IH?
 
haruspex said:
I would suggest not assuming c=4 just yet. Leave it as c.
What do you get when you substitute for rfloor(√(n+1)) using the IH?

Ok I'll assume c is arbitrary for now. But i can't just use the IH directly on rfloor(√(n+1)) since i have to simplify it first. My issue is I have no idea how to go about simplifying it.
And as a note: We let n∈ℕ, then the IH is P(n) or for complete induction it would be for 3≤k<n, P(k).
 
NATURE.M said:
Ok I'll assume c is arbitrary for now. But i can't just use the IH directly on rfloor(√(n+1)) since i have to simplify it first. My issue is I have no idea how to go about simplifying it.
And as a note: We let n∈ℕ, then the IH is P(n) or for complete induction it would be for 3≤k<n, P(k).
Like haruspex suggested, assume the IH to be true:
$$
r_n = 1 + r_{\lfloor\sqrt{n}\rfloor} \leq 1 + c\log(\log\sqrt{n})
$$
Recall then that you'd like a ##c\log(\log n)## term on the RHS of the inequality.

Edit: I did the problem using different notation, and it came out as nonsense here. Removed that part.
 
Last edited:
milesyoung said:
Like haruspex suggested, assume the IH to be true:
$$
r_n = 1 + r_{\lfloor\sqrt{n}\rfloor} \leq 1 + c\log(\log\sqrt{n})
$$
Recall then that you'd like a ##c\log(\log n)## term on the RHS of the inequality.

Edit: I did the problem using different notation, and it came out as nonsense here. Removed that part.
So I'm kinda confused where did the square root come from in the expression log2(log2√n)
 
NATURE.M said:
But i can't just use the IH directly on rfloor(√(n+1)) .
You want to show rn+1 <= something, call it X. So you want to show rfloor(√(n+1)) <= X. The simplification is to find some Y such that rfloor(√(n+1)) is clearly <= Y, then show Y <= X. Is the r sequence monotonic?
 
haruspex said:
You want to show rn+1 <= something, call it X. So you want to show rfloor(√(n+1)) <= X. The simplification is to find some Y such that rfloor(√(n+1)) is clearly <= Y, then show Y <= X. Is the r sequence monotonic?
We aren't given whether the sequence is monotonic or not. So I understand that I need to find Y. My issue is I don't know how to reduce rfloor(√(n+1)) into some Y, from which I can employ the IH.
 
NATURE.M said:
We aren't given whether the sequence is monotonic or not. So I understand that I need to find Y. My issue is I don't know how to reduce rfloor(√(n+1)) into some Y, from which I can employ the IH.
Sorry, I asked the wrong question. I should have asked whether the log function is monotonic.
 
NATURE.M said:
We aren't given whether the sequence is monotonic or not. So I understand that I need to find Y. My issue is I don't know how to reduce rfloor(√(n+1)) into some Y, from which I can employ the IH.
Can you show that the sequence is monotonic?

Try writing out the first part of the sequence. It increases very slowly, which is not a surprise, considering what you're asked to prove.

For what values of n is ##\ r_{n+1}>r_n \ ## ?
 
  • #10
SammyS said:
Can you show that the sequence is monotonic?

Try writing out the first part of the sequence. It increases very slowly, which is not a surprise, considering what you're asked to prove.

For what values of n is ##\ r_{n+1}>r_n \ ## ?
But let's say its monotonic, in what way does that help us ? Maybe if it was monotonically decreasing, then it would help us in the proof as follows:
rfloor(√(n+1)) ≤ rfloor(√(n)) , and then we can invoke the inductive hypothesis. But if its increasing which it is than how does it help us ?
 
  • #11
NATURE.M said:
But let's say its monotonic, in what way does that help us ?
As I wrote in post #8, what's useful is to think about monotonicity of the log function.
Apply the IH to 1 + rfloor(√n). What do you get? What's an upper bound for that?
 
  • #12
haruspex said:
As I wrote in post #8, what's useful is to think about monotonicity of the log function.
Apply the IH to 1 + rfloor(√n). What do you get? What's an upper bound for that?
Okay that makes more sense since the log function is increasing monotonically.

Applying the induction hypothesis: 1 + rfloor(√n) ≤ clog2(log2n)., and from here we can use the monotonicity of the logarithmic function to get to clog2(log2n+1). Although, we will have to prove the monotonicity of the log function separately I guess.

And I'm still unsure how to get from 1 + rfloor(√(n+1)) to 1 + rfloor(√n) ?
 
  • #13
NATURE.M said:
Applying the induction hypothesis: 1 + rfloor(√n) ≤ clog2(log2n)
No, not just 'n' inside the logs on the right. What does n represent in the IH?
 
  • #14
haruspex said:
No, not just 'n' inside the logs on the right. What does n represent in the IH?
Just to clarify which IH are you referring to, for simple induction of for complete induction. If the latter, than n is the upper bound. This is the case we want to show is true. Not sure if that is what you mean.
 
  • #15
NATURE.M said:
Just to clarify which IH are you referring to, for simple induction of for complete induction. If the latter, than n is the upper bound. This is the case we want to show is true. Not sure if that is what you mean.
I mean in rn ≤ c log2(log2n)). How do you apply that to rfloor(√(n+1))?
 
  • #16
haruspex said:
I mean in rn ≤ c log2(log2n)). How do you apply that to rfloor(√(n+1))?
But that was my initial question ? I'm not sure how to apply it to rfloor(√(n+1)).
 
  • #17
NATURE.M said:
But that was my initial question ? I'm not sure how to apply it to rfloor(√(n+1)).
Maybe it would help if we used two different indexes. The inductive hypothesis is, say, rk≤ c log2(log2k)). What do you have to set k to so that it applies to rfloor(√(n+1))?
 
  • #18
haruspex said:
Maybe it would help if we used two different indexes. The inductive hypothesis is, say, rk≤ c log2(log2k)). What do you have to set k to so that it applies to rfloor(√(n+1))?
We would have to set k = n + 1. So then we have 1+ rfloor(√(n+1) = 1+ rfloor(√(k) but we can't conclude that its ≤ c log2(log2k))
since our induction hypothesis only assume rn to be true.
 
  • #19
NATURE.M said:
We would have to set k = n + 1.
No. You need to set k to something which will make the left hand side look like rfloor(√(n+1). I'm not asking you to do anything difficult here.
 
  • #20
haruspex said:
No. You need to set k to something which will make the left hand side look like rfloor(√(n+1). I'm not asking you to do anything difficult here.
Oh just set it equal to k = floor(√(n+1)). Then rk is ≤ the log term by the IH.
 
  • #21
NATURE.M said:
Oh just set it equal to k = floor(√(n+1)).
Right. What inequality does the IH give you? Can you see how to get rid of the floor function by exploiting monotonicity of log?
 
  • #22
So here is my logic (by complete induction)
Induction Hypothesis: rk ≡ 1 + rfloor(√(k)) ≤ clog2(log2k) for 3≤k<n.
Then, rn = 1+ r floor(√(n)). By the IH, we know rfloor(√(n)) ≤ clog2(log2floor(√(n))) since floor(√(n)) < n.
So then we have 1+ r floor(√(n)) ≤ 1 + clog2(log2floor(√(n))). And the log function is increasing, so 1 + clog2(log2floor(√(n))) ≤ 1 + clog2(log2n).

So I think the above should be right for the most part, I'm a bit uncertain what to do with the 1 however.
 
  • #23
NATURE.M said:
since floor(√(n)) < n
No, you've thrown away too much. You're only trying to get rid of the floor function.
 
  • #24
haruspex said:
No, you've thrown away too much. You're only trying to get rid of the floor function.
Isn't that what I did ? I got rid of the rfloor(√n) function, since rfloor(√n) = 1 + rfloor(√(floor(√n)) ≤ clog2(log2floor(√(n))) by IH.

As an aside, thanks for being so patient.
 
  • #25
In doing this:
NATURE.M said:
1 + c log2(log2floor(√(n))) ≤ 1 + c log2(log2n).
you've thrown away the √ as well as the floor. Only get rid of the floor.
 
  • #26
haruspex said:
In doing this:

you've thrown away the √ as well as the floor. Only get rid of the floor.
Oh I figured it out, cause then you use that to break the log term and to cancel out the + 1 term.

And just two last questions then. Should i just leave c as is for the entire proof, as an arbitrary positive real ?
And since I'm using complete induction in my IH, I said P(k) for 2 ≤ k < n. Now is it true that floor(√(n)) < √n only if n > 1. So its fair if I prove for ≥2.
 
  • #27
NATURE.M said:
Should i just leave c as is for the entire proof, as an arbitrary positive real ?
It isn't arbitrary. You should find it has to be at least some value for the result to work. Please post your working from where it left off.
NATURE.M said:
Now is it true that floor(√(n)) < √n only if n > 1
Putting n = x2, x > 0, (and correcting from '<' to '<=') you are asking whether floor(x) <= x only if x > 1. Is it?
 
  • #28
haruspex said:
It isn't arbitrary. You should find it has to be at least some value for the result to work. Please post your working from where it left off.

Putting n = x2, x > 0, (and correcting from '<' to '<=') you are asking whether floor(x) <= x only if x > 1. Is it?

Okay, so 1+ r floor(√(n)) ≤ 1 + clog2(log2floor(√(n))) ≤ 1 + clog2(log2(√(n))) = 1 + clog2(1/2)(log2(n))
= 1 + clog21/2 + clog2(log2(n)) = clog2(log2(n)), as desired.

Now I'm not entirely sure how to solve for c.

And well floor(0) <= 0, so no. However, since the sequence is only defined for n>=1 that case wouldn't be important. The case where n = 1, we can prove as a separate case (or directly) since the sequence is defined differently. However, this would require us knowing what c is. And for n>=2 we proceed as above.
 
  • #29
NATURE.M said:
1 + c log21/2 + c log2(log2(n)) = c log2(log2(n)),
There's a mistake there. You have effectively assumed a value for c.
 
  • #30
haruspex said:
There's a mistake there. You have effectively assumed a value for c.
Oops I missed that. In that case, can't we just let c = 1, at the beginning of the proof since the definition of big oh asks for you to choose a c. (∃c∈ℝ+).
 
  • #31
NATURE.M said:
Oops I missed that. In that case, can't we just let c = 1, at the beginning of the proof since the definition of big oh asks for you to choose a c. (∃c∈ℝ+).
Sure. The choice for c is 1 or greater. Since you'd generally look for the tightest bound, choose 1.
 
  • #32
haruspex said:
Sure. The choice for c is 1 or greater. Since you'd generally look for the tightest bound, choose 1.

Ok. And also just realized that n has to be ≥3 otherwise the proof fails. Namely, in the definition of big oh our choice of B should be 3. Since n = 1 is undefined for the double log term and n=2 doesn't satisfy the predicate with c = 1.
 
  • #33
NATURE.M said:
Ok. And also just realized that n has to be ≥3 otherwise the proof fails. Namely, in the definition of big oh our choice of B should be 3. Since n = 1 is undefined for the double log term and n=2 doesn't satisfy the predicate with c = 1.
OK.
All done?
 
  • #34
haruspex said:
OK.
All done?
Yeah I believe that is it. I can't thank you enough for your efforts and being patient with me throughout.
 
  • #35
NATURE.M said:
Yeah I believe that is it. I can't thank you enough for your efforts and being patient with me throughout.
A pleasure.
 
  • #36
haruspex said:
A pleasure.
So it turns out when I was writing the proof, I stumbled upon a little issue. Basically, in order to be able to use the IH on rfloor(√n) we require 3 ≤floor(√n) < n which is just not the case. Like take n = 3, then floor(√3) < 3. Even if you try to lower bound floor(√n) by 0 or 1 it doesn't work since then the log term in the predicate becomes undefined. In other words, P(n) just isn't true for n = 0, 1. This is rather unfortunate. I'm not really sure how to get around this ?
 
  • #37
NATURE.M said:
So it turns out when I was writing the proof, I stumbled upon a little issue. Basically, in order to be able to use the IH on rfloor(√n) we require 3 ≤floor(√n) < n which is just not the case. Like take n = 3, then floor(√3) < 3. Even if you try to lower bound floor(√n) by 0 or 1 it doesn't work since then the log term in the predicate becomes undefined. In other words, P(n) just isn't true for n = 0, 1. This is rather unfortunate. I'm not really sure how to get around this ?
You could change your base step to something like: P(n) is true for 3 ≤ n ≤ 8.
 
  • #38
milesyoung said:
You could change your base step to something like: P(n) is true for 3 ≤ n ≤ 8.
Okay that makes sense. So if i understand correctly, I can prove each individual case from let's say 3≤n≤8. Then proceed with complete induction from 8≤k<n. Would that make sense ? Because then when I do the proof, I wouldn't by just invoking the IH, I would also have to specify the truth of the base cases.
 
  • #39
NATURE.M said:
Okay that makes sense. So if i understand correctly, I can prove each individual case from let's say 3≤n≤8. Then proceed with complete induction from 8≤k<n. Would that make sense ? Because then when I do the proof, I wouldn't by just invoking the IH, I would also have to specify the truth of the base cases.
No, it'll be a problem if you change your IH. You could instead formulate it as:

Base step: Show that P(n) is true for 3 ≤ n < 9.
Induction hypothesis: P(k) is true for 3 ≤ k < n.
Induction step: Assume IH holds, and show that P(n) is true for n ≥ 9.
 
  • #40
milesyoung said:
No, it'll be a problem if you change your IH.
Would it necessarily? Seems to me it could be generalised to rn <= A + B l2 l2 n. With the same algebra as before, the A's cancel out and again produce B>=1.
Yes, the base of the induction needs to be broadened. If we make the base N0 <= n < N1, we need N1 >= N02. As you say, keeping N0=3 means means 3 to 8 have to be demonstrated separately to satisfy the IH, but consider N0=2. We need r2 = 2 <= A + B l2 l2 2 = A.
 
  • #41
But a new issue i just noticed that none of the base cases satisfy if we take c = 1. Like r3 = 2, and r

Should i choose c = 4 instead ?
 
  • #42
NATURE.M said:
But a new issue i just noticed that none of the base cases satisfy if we take c = 1. Like r3 = 2, and r

Should i choose c = 4 instead ?
Did you see my post #40?
 
  • #43
haruspex said:
Would it necessarily? Seems to me it could be generalised to rn <= A + B l2 l2 n. With the same algebra as before, the A's cancel out and again produce B>=1.
It was probably not clear, but I just meant that the OP should keep the IH as 'P(k) is true for 3 ≤ k < n' instead of 'P(k) is true for 8 ≤ k < n'.

How do the A's cancel?
 
  • #44
milesyoung said:
How do the A's cancel?
##r_n = 1 + r_{\lfloor\sqrt{n}\rfloor} \leq 1 + A + B l_2 l_2 (\lfloor\sqrt{n}\rfloor) \leq 1 + A + B l_2 l_2 (\sqrt{n}) ##
##= 1 + A + B (l_2 l_2 (n) - 1) = 1 + A -B + B l_2 l_2 (n)##.
If B >= 1, ##1 + A -B + B l_2 l_2 (n) \leq A + B l_2 l_2 (n)##.
With A=2, that IH is true for n = 2, 3. The induction takes it from there.
 
  • #45
Okay what does the A represent ? If I'm not mistaken the B is just c but what's the A term ?
Otherwise I understand what your saying.
 
  • #46
NATURE.M said:
Okay what does the A represent ? If I'm not mistaken the B is just c but what's the A term ?
Otherwise I understand what your saying.
A is just adding a sufficient buffer to ensure that the IH is true (with the least possible B) as soon as possible. With A=2 you get to start the IH at n=2. It doesn't affect the asymptotic behaviour.
Making B as low as possible, at the expense of a larger A, gives the asymptotically tightest bound. You could instead start the IH at a higher n0, but as we have seen that requires a lot more calculation because you have to cover from n0 to n02-1 by hand.
 
  • #47
haruspex said:
A is just adding a sufficient buffer to ensure that the IH is true (with the least possible B) as soon as possible. With A=2 you get to start the IH at n=2. It doesn't affect the asymptotic behaviour.
Making B as low as possible, at the expense of a larger A, gives the asymptotically tightest bound. You could instead start the IH at a higher n0, but as we have seen that requires a lot more calculation because you have to cover from n0 to n02-1 by hand.
Oh that makes a lot of sense. So more generally, we can write f is in 0(g(n) + A) and it wouldn't actually make a difference since A is only a constant.
 
  • #48
SammyS said:
...

Try writing out the first part of the sequence. It increases very slowly, which is not a surprise, considering what you're asked to prove.

For what values of n is ##\ r_{n+1}>r_n \ ## ?
As I mentioned in Post #9 above:

I would have approached this problem somewhat differently. Look at how this sequence progresses.

r2 & r3: ## \ \lfloor \sqrt{2}\rfloor=\lfloor \sqrt{3}\rfloor=1 \ ## Therefore, r2 = r3 = 1 + r1 = 2 .

r2 and r3 both refer to r1, so they have the same value.

The smallest n for which rn refers to r2 is n = 4, a perfect square, in fact 22.

The smallest n for which rn refers to r3 is n = 9, in fact 32. But r2 = r3 there is no increase going from r8 to r9.

The smallest n for which rn refers to r4 is n = 42 = 16. Note that: r4 = ... = r15 = 4.

From here, there are a whole slew of n values for which the rn refer back to these members of the sequence having value of 4. Starting with r16 they all have a value of 5.

The smallest n for which rn refers to r16 is n = 162 = 256. ...

So, r1 = 1

rn increases to 2 when n goes to 2.

rn increases to 3 when n goes to 4 = 22.

rn increases to 4 when n goes to 16 = 42 = (22)2.

rn increases to 5 when n goes to 256 = 162 = ((22)2)2.

You can relate the value of rn to the overall exponent on 2 for the value of n at which rn is incremented. Perhaps induction may be used to prove that this relationship holds for each value of n and/or rn .
 
  • #49
SammyS said:
As I mentioned in Post #9 above:

I would have approached this problem somewhat differently. Look at how this sequence progresses.

r2 & r3: ## \ \lfloor \sqrt{2}\rfloor=\lfloor \sqrt{3}\rfloor=1 \ ## Therefore, r2 = r3 = 1 + r1 = 2 .

r2 and r3 both refer to r1, so they have the same value.

The smallest n for which rn refers to r2 is n = 4, a perfect square, in fact 22.

The smallest n for which rn refers to r3 is n = 9, in fact 32. But r2 = r3 there is no increase going from r8 to r9.

The smallest n for which rn refers to r4 is n = 42 = 16. Note that: r4 = ... = r15 = 4.

From here, there are a whole slew of n values for which the rn refer back to these members of the sequence having value of 4. Starting with r16 they all have a value of 5.

The smallest n for which rn refers to r16 is n = 162 = 256. ...

So, r1 = 1

rn increases to 2 when n goes to 2.

rn increases to 3 when n goes to 4 = 22.

rn increases to 4 when n goes to 16 = 42 = (22)2.

rn increases to 5 when n goes to 256 = 162 = ((22)2)2.

You can relate the value of rn to the overall exponent on 2 for the value of n at which rn is incremented. Perhaps induction may be used to prove that this relationship holds for each value of n and/or rn .
Seems like a lot more work than the solution already posted.
 
  • #50
haruspex said:
Seems like a lot more work than the solution already posted.
Perhaps.

... but, it wasn't clear to me that OP had fully comprehended the details of that solution.
 

Similar threads

Back
Top