Search code examples
algorithmprooftheorem-provingbig-o

Prove that f(n) = Θ(g(n)) iff g(n) = Θ(f(n))


I have been given the problem:

f(n) are asymptotically positive functions. Prove f(n) = Θ(g(n)) iff g(n) = Θ(f(n)). 

Everything I have found points to this statement being invalid. For example an answer I've come across states:

f(n) = O(g(n)) implies g(n) = O(f(n))
f(n) = O(g(n)) means g(n) grows faster than f(n). It cannot imply that f(n) grows
faster than g(n). Hence not true.

Another states:

 If f(n) = O(g(n)) then O(f(n)). This is false. If f(n) = 1 and g(n) = n 
 for all natural numbers n, then f(n) <= g(n) for all natural numbers n, so
 f(n) = O(g(n)). However, suppose g(n) = O(f(n)). Then there are natural
 numbers n0 and a constant c > 0 such that n=g(n) <= cf(n) = c for all n >= 
 n0 which is impossible.

I understand that there are slight differences between my exact question and the examples I have found, but I've only been able to come up with solutions that do not prove it. I am correct in thinking that it is not able to be proved or am I looking over some detail?


Solution

  • You can start from here:

    Formal Definition: f(n) = Θ (g(n)) means there are positive constants c1, c2, and k, such that 0 ≤ c1g(n) ≤ f(n) ≤ c2g(n) for all n ≥ k.

    Because you have that iff, you need to start from the left side and to prove the right side, and then start from the right side and prove the left side.

    Left -> right

    We consider that:

    f(n) = Θ(g(n))
    

    and we want to prove that

    g(n) = Θ(f(n))
    

    So, we have some positive constants c1, c2 and k such that:

    0 ≤ c1*g(n) ≤ f(n) ≤ c2*g(n), for all n ≥ k
    

    The first relation between f and g is:

    c1*g(n) ≤ f(n)     =>     g(n) ≤ 1/c1*f(n)    (1)
    

    The second relation between f and g is:

    f(n) ≤ c2*g(n)     =>     1/c2*f(n) ≤ g(n)    (2)
    

    If we combine (1) and (2), we obtain:

    1/c2*f(n) ≤ g(n) ≤ 1/c1*f(n)
    

    If you consider c3 = 1/c2 and c4 = 1/c1, they exist and are positive (because the denominators are positive). And this is true for all n ≥ k (where k can be the same).

    So, we have some positive constants c3, c4, k such that:

    c3*f(n) ≤ g(n) ≤ c4*f(n), for all n ≥ k
    

    which means that g(n) = Θ(f(n)).

    Analogous for right -> left.