Search code examples
algorithmmathtime-complexitycomplexity-theory

how can I solve the limes of $n*log_2(n)$ vs $n^{log_3(4)}$


I want to manually calculate which of these two functions ($n*log_2(n)$ vs. $n^{log_3(4)}$) has a higher asymptotic increasing without using a calculator or any software.

My approach till now was:

lim n-> inf: \frac {$n*log:2(n)$} {$n^{log_3(4)}$}

Now use L´Hospital and derive each function: \frac {$log_2(n)$ + $1/ln(2)n$ } {$log_3(4) n^{log_3(4) -1}}

Now use L´Hospital again: \frac {$1/(ln(2)*n)$ + $1/(ln(2)*n) $} {$1/ln(3)4 $ * $n^{log_3(4)-1}$ + $log_3(4)-1 * n^{log_3(4)-2} * log_3(4) $}

My problem: If I calculate like that it results to a wrong solution. Does anyone have an idea how to solve that correctly?


Solution

  • Edit: I also noticed that your first derivative was incorrect.

    Your first derivative and second evaluation of L' Hopitals rule is incorrect.

    You start with:
    f(n)=n*log2(n)
    g(n)=n^(log3(4))

    This gives:
    f'(n)=log2(n) + n * (1/ln(2)) * n^(-1)
    =log2(n) + 1/ln(2)
    g'(n)=log3(4) * n^(log3(4)-1)

    This gives:
    f''(n)=(1/ln(2)) * n^(-1)
    g''(n)=log3(4) * (log3(4)-1) * n^(log3(4)-2)

    With your error in the first derivate you would have gotten f''(n)=(1/ln(2)) * n^(-1) - (1/ln(2)) * n^(-2), which still allows you to factor out n and results in the same final result.

    Now that you have n in all of it, you can factor that out:
    f''(n)/g''(n) = 1/[ln(2) * log3(4) * (log3(4)-1) * n^(log3(4)-2+1)]
    = 1/[ln(2) * log3(4) * (log3(4)-1)] * n^(1-log3(4))]
    Which now can be represented as:
    k * n^(1-log3(4)) where k>0.
    And the limit as this approaches infinity is 0. That means n^log3(4) has a greater asymptote than n * log2(n).

    Alternatively, you can simplify first. Note that both have a factor of n which can be removed, so instead you can have:
    f(n)=log2(n)
    g(n)=n^(log3(4)-1)

    f'(n)=(1/ln(2)) * n^(-1)
    g'(n)=(log3(4)-1) * n^(log3(4)-2)

    f'(n)/g'(n) = (1/ln(2)) * n^(-1-log3(4)+2)/(log3(4)-1)
    =(1/ln(2)) * n^(1-log3(4))/(log3(4)-1)

    Again, the limit is 0, meaning that n^(log3(4)) has a greater asymptote.

    The only thing extra that is needed to know is that log3(4) is greater than 1 as 4 is greater than 3. That means (log3(4)-1)>0 and (1-log3(4))<0.

    Also remember that the correct result may not be what you think it is. These 2 equations cross when n~= 30 000

    Also, I'm not sure if this belongs here or on math.