-2

What is the complexity of function f(n),preferably the Big-O notation, and f(n) satisfies the condition n = f(n).log(f(n)) ,f(n) > 1 .Let assume that log in base 2.

I tried to isolate f(n) from the condition but could not get it done. After using excel to get the graph of function f(n). It seems that f(n) = O(n^2) but I cant figure out how to get it out?

Am_I_Helpful
  • 18,735
  • 7
  • 49
  • 73
huynq9
  • 522
  • 8
  • 22
  • 3
    `n = f.log(f)`? WTH does that mean? – Rerito Feb 12 '15 at 07:25
  • 1
    f(n) is the function of n with n = f(n). log(f(n)). It's same as we say x = ylogy – huynq9 Feb 12 '15 at 08:18
  • You realize that this condition defines a particular set of numbers `n` which has _nothing_ to do with `f`'s complexity? – Rerito Feb 12 '15 at 08:31
  • @Rerito No, This is my exercise. The problem is that we could not isolate f from the condition so I'm asking for help. – huynq9 Feb 12 '15 at 08:42
  • Then make yourself **clear** (mathematically speaking)! A sentence like `f` satisfies `n = f(n).log(f(n))` for any (real) number `n` – Rerito Feb 12 '15 at 08:44
  • I'm voting to close this question as off-topic because it's about a math exercise. – Bakuriu Feb 12 '15 at 08:51
  • I don't understand the condition in the question. – Codor Feb 12 '15 at 08:54
  • Let _g_ be the function such that _g(x) = x.log(x)_ for any _x_. We have then _g(f(x)) = x_. In other terms, _f_ is the inverse function of _g_. And this gives us [something to feed](http://www.wolframalpha.com/input/?i=inverse+of+x*log2%28x%29) to our friend Wolfram Alpha. – Rerito Feb 12 '15 at 08:56
  • Solving for f in the equation n = f * log f, gives f = e^W(n) where W is what is called the Lambert W, which is implicitly defined as the solution to n=W e^W. As far as I know, there is no simple forward definition of the Lambert W. That's disappointing, and I have a feeling this is an x-y problem. Please give us some context as to why you're asking such an obscure question. – thang Feb 12 '15 at 09:05
  • @thang: It's problem about complexity theory. suppose n = f(n)log(f(n)). The question is finding the g(n) function such that f(n) = O(g(n))? – huynq9 Feb 12 '15 at 09:09
  • As I used excel to get the graph of f(n). I guest that I g(n) could be n^2. therefore, f(n) = O(g(n)) = O(n^2). But I am not sure how to get it done using mathematical proof. – huynq9 Feb 12 '15 at 09:12
  • Big O notation is <= M|-|, so anything that grows quicker than f would work. In this case, it is clear that f is sublinear, so if you want a tight bound, just do O(n). You can easily prove that it is O(n) by just using the definition of O and the f as defined by the equation. Likewise for O(n^2). Remember that a function is O(n) then it is O(n^2) (the converse is not necessarily true). If you want to be more precise, just say O(e^W(n)), but remember that this is not exponential growth rate because W(n) is implicitly defined (just as O(e^(log n)) is not exponential growth rate). – thang Feb 12 '15 at 09:24
  • @thang using definition of O. I guest I need to prove that limit of f(n)/g(n) <= M with n -> infinity. Suppose that g(n) = n^2. I'm getting stuck at solving this limit (Because we could not get f(n) directly from the given condition). Greatly appreciate any help – huynq9 Feb 12 '15 at 09:33

2 Answers2

1

I think the complexity is even lower than O(n) - namely, O(n/ln(n)). Semi-proof:

(substituting n/ln(n) for f(n))

RHS = n/ln(n) * ln(n/ln(n)) = n/ln(n) * (ln(n) -ln(ln(n))) = = n - n * ln(ln(n))/ln(n) = n * (1-ln(ln(n))/ln(n)) = n*Theta(1) = Theta(n) = LHS

For clarity, I skipped Theta notation almost everywhere.

akrasuski1
  • 820
  • 1
  • 8
  • 25
  • I don't buy the semi-proof. can you clarify: n * (1-ln(ln(n))/ln(n)) = n*Theta(1). It is clear that n * (1-ln(ln(n))/ln(n)) = O(n), but theta isn't true. Now if you take that n * (1-ln(ln(n))/ln(n)) = O(n), then what you have shown is actually that n/log(n) = O(f(n)). We know that g = O(h) doesn't necessarily mean h = O(g). In fact, f actually grows faster than n/log(n). You can examine it numerically, but it can also be shown... It is true that f is sublinear. The exact function is e^W(n) where W is the Lambert W. Maybe someone can come up with a clever function between e^W(n) and n. – thang Feb 12 '15 at 10:32
  • Well, the definition of Theta notation requires two constants: `c1`,`c2`, such that `f*c1 – akrasuski1 Feb 12 '15 at 11:51
  • I agree that the complexity is even lower than o(n), In fact f(n) = theta(n/log(n)). Proof: *for the lower bound: we need to find c1 and n1 such that f(n) >= c1. f(n). log(f(n))/log(f(n).log(f(n))) with n > n1 => log(f(n)) + log(log(f(n)) >= c1.log(f(n)) => log(log(f(n))) >= (c1 - 1) log(f(n)) let take n1 > 2 and c1 = 1 then LHS = log(log(f(n)) > RHS = 0 *for the upper bound: take n2 > 2 and c2 > 2 then LHS = log(log(f(n)) <= (c2 - 1)log(f(n)). Correct me if i am wrong – huynq9 Feb 13 '15 at 07:37
0

Comments are getting long, so here's a sketch of a proof for you. This is probably homework, so please make sure you learn something instead of just copying it down.

In order to show that f is O(n), you have to show that there is an M and n1 where f(n) < M|n| for all n > n1.

We know that n = f(n) log(f(n)), so M |n| = M |f(n)| |log(f(n))|.

So what we are trying to find is an M and n1 for which

  f(n) < M |n| = M |f(n)| |log(f(n))|

for n > n1.

n, f, and log f are all positive, so we can drop the |.| to get

  f(n) < M f(n) log(f(n)) = M |n|

Our goal is to find an M and n1 for which

  f(n) < M f(n) log(f(n)) = M |n|

is true for all n > n1. Pick M = 1, n1 = 10, then

  f(n) < f(n) log(f(10)) <= f(n) log(f(n)) = |n|  (where M is now set to 1)

for n > n1. f(n) log(f(10)) <= f(n) log(f(n)) is true because log(f(n)) is monotonic for n>n1 (homework exercise: show that this is true). f(n) < f(n) log(f(10)) is trivially true because log(f(10)) > 1.

This shows, then, that f(n) is O(n).

thang
  • 3,466
  • 1
  • 19
  • 31
  • `Pick M = 1, n1 = 10, then f(n) < f(n) log(f(10)) <= f(n) log(f(n)) = |n| (where M is now set to 1) for n > n1. f(n) log(f(10)) <= f(n) log(f(n)) is true because log(f(n)) is monotonic for n>n1 (homework exercise: show that this is true). ` Doesn't make any sense at all to me!!!!! – Am_I_Helpful Feb 12 '15 at 14:01
  • Thank you @thang. I got it now. Just make it more clearly. Pick M= 1, our goal is to find n1 such that f(n) < f(n).log(f(n)) with n > n1. We need to make sure log(f(n)) = n/f(n) > 1 with consider that f(n) > 1 as the given condition. So we could take any value of n1 > 1, then n/f(n) = log(f(n)) >1 and therefore, f(n) < f(n).log(f(n)) with n > n1 – huynq9 Feb 12 '15 at 16:07
  • Because your solution is trying to guess the g(n) first then we prove that it is the one satisfying the condition. I wonder if we could find g(n) such that f(n) = theta(g(n)). Can we guess it too? – huynq9 Feb 12 '15 at 16:21