1

I know that log(n)=O(n^1/100), according to Is complexity O(log(n)) equivalent to O(sqrt(n))? how do you formally show that? you need to find the n_0 so that for every n>n_0 it is true that log(n) < k*n^(1/100) for some constant k, how do you find those n_0 and k?

ihadanny
  • 4,377
  • 7
  • 45
  • 76
  • 1
    Uhm... how do you know `log(n)=O(n^1/100)` ? As written that is a dubious statement at best... Did you mean `O(log(n)) = O(n^1/100) ? That is easier in the sense that O(n^1/100) will always contain O(log(n)) for a suitable constant C. (Depending on how = is defined for O() it is not commutative, so that might explain it) – user268396 Oct 02 '20 at 20:27
  • 1
    @user268396: I guess formally, `O(f)` is defined as a set of functions, so one probably should say `log(n) ∈ O(n^(1/100))`. But `=` is a pretty common and well-understood abuse of notation, and anyway OP has given the precise statement of what is to be proved. – Nate Eldredge Oct 02 '20 at 20:33
  • 1
    Easy way to see: pick n such that log(n) < n^(1/100) which is easy to solve for. Then observe that both functions are monotonous increasing functions for n>0 (the domain of log(n)). – user268396 Oct 02 '20 at 20:34
  • 2
    I don't think that quite does it; in general, two monotone increasing functions can cross each other's graphs arbitrarily many times. – Nate Eldredge Oct 02 '20 at 20:35
  • Right, the missing ingredient here is that one derivative is going to be larger than that of the other. – user268396 Oct 02 '20 at 20:38

1 Answers1

4

Finding an n_0 such that log(n_0) < (n_0)^(1/100)

You don't need to find the n_0. You just have to find one n_0 that works. You can just pick an incredibly big n_0.

Let n_0 = 10^1000. It's a 1 followed by 1000 zeroes. Then:

  • (n_0)^(1/100) = 10^10 = 10000000000;
  • log(n_0) = log_10(n_0) / log_10(e) = 1000 / log_10(e) < 4000.

I am assuming log meant natural logarithm. But as you can see, binary logarithm, natural logarithm and decimal logarithm only vary by a small constant factor anyway.

So we have found an n_0 such that log(n_0) < (n_0)^(1/100). Now we need to prove that for all n > n_0, log(n) < n^(1/100).

Proving for all n > n_0, log(n) < n^(1/100)

To do that, we can prove that the difference f(n) = n^(1/100) - log(n) is an increasing function of n.

This function is differentiable on the positive reals; its derivative is:

f'(n) = 100 / (n^(99/100)) - (1 / n)
f'(n) = (100 n - n^(99/100)) / (n * n ^(99/100))
f'(n) > 99 n / (n * n ^(99/100)) = 99 / (n ^ (99/100))
f'(n) > 0

Hence the difference is strictly increasing; since f(n_0) > 0, we have f(n) > f(n_0) > 0 for all n > n_0.

Stef
  • 13,242
  • 2
  • 17
  • 28