Proving f(n) = O(log n) with Induction

  • Thread starter Thread starter EvLer
  • Start date Start date
  • Tags Tags
    Induction
AI Thread Summary
To show that f(n) = f(n-1) + 1/n is O(log n), one can use induction to express f(n) as a sum involving the harmonic series. The harmonic series, which grows logarithmically, can be approximated as f(n) = a_0 + ∑(1/i) for i from 1 to n, where a_0 is a constant. It is established that for n > 2, f(n) can be bounded by a constant multiplied by log n. Analyzing the growth rates of the harmonic series and log n confirms that log n serves as an upper bound for f(n). Thus, f(n) is indeed O(log n).
EvLer
Messages
454
Reaction score
0
How can I show that function defined as

f(n) = f(n-1) + 1/n is O(logn) ?

Do I need to use induction here?

Thanks in advance.
 
Physics news on Phys.org
Note that, by induction, you have:
f(n)=a_{0}+\sum_{i=1}^{n}\frac{1}{i}
where a_{0} is some constant.
Now, you need to find "how fast" the harmonic series grows..
 
Last edited:
Thanks for reply.
Would it be right to describe it as:
for n0 > 2, c = 1, then f(n) < c * g(n) ?
Looking at the graphs, or rather how the harmonic series behaves compared to the graph of logn, it is kind of obvious that logn is the upper bound.
Thanks again.
 
Thread 'Variable mass system : water sprayed into a moving container'
Starting with the mass considerations #m(t)# is mass of water #M_{c}# mass of container and #M(t)# mass of total system $$M(t) = M_{C} + m(t)$$ $$\Rightarrow \frac{dM(t)}{dt} = \frac{dm(t)}{dt}$$ $$P_i = Mv + u \, dm$$ $$P_f = (M + dm)(v + dv)$$ $$\Delta P = M \, dv + (v - u) \, dm$$ $$F = \frac{dP}{dt} = M \frac{dv}{dt} + (v - u) \frac{dm}{dt}$$ $$F = u \frac{dm}{dt} = \rho A u^2$$ from conservation of momentum , the cannon recoils with the same force which it applies. $$\quad \frac{dm}{dt}...

Similar threads

Back
Top