Is 3n = O(2n)? how about (3/2)n = O(2n)? Can you explain the answers?
I got false for the first since, 3n grows faster then 2n no matter what constant C you multiply 2n by. And same for the second?
How about log(3n) = O(log (2n) )? I think we can’t determine this because we don’t know the base of the log.
Let’s actually prove a stronger result: for any constants r0 and r1 where 1 ≤ r0 < r1, it is true that r0n = O(r1n) and it is false that r1n = r0n. This proves your result as a special case, since 1 < 3/2 < 2.
To prove the first part, we’ll show that r0n = O(r1n). To do this, we’ll use the definition of big-O and find values of n0 and c such that for any n > n0, we have that
We can choose n = n0 and can choose c = 1. The above inequality then holds, so by definition we have that r0n = O(r1n).
To prove the second part, we’ll show that r1n ≠ O(r0n). To do this, we’ll proceed by contradiction. Assume for the sake of contradiction that there exists a choice of c and n0 such that for any n > n0, we have that
Take the log of both sides to get
But now we’re in trouble, since this statement should hold for any choice of n. However, if we pick any choice of n greater than log c / (log(r1 / r0)), the statement becomes false.
We have reached a contradiction, so our assumption must have been wrong. Thus if 1 < r0 < r1, we have that r1n ≠ O(r0n).
Hope this helps!