3

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.

templatetypedef
  • 362,284
  • 104
  • 897
  • 1,065
Kalon
  • 111
  • 1
  • 10
  • 2
    The base of the log changes the numbers by a constant factor, so it doesn't matter. – Joni Feb 13 '13 at 07:01

1 Answers1

5

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

r0n ≤ c r1n

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

r1n ≤ c r0n

Take the log of both sides to get

n log r1 ≤ log (c r0n)

n log r1 ≤ log c + n log r0

n (log r1 - log r0) ≤ log c

n log(r1 / r0) ≤ log c

n ≤ log c / (log(r1 / r0))

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!

templatetypedef
  • 362,284
  • 104
  • 897
  • 1,065