1

2^n=O(3^n) : This is true or it is false if n>=0 or if n>=1 since 2^n may or not be element of O(3^n) I need a hint to figure the problem

Raphael
  • 73,212
  • 30
  • 182
  • 400
geometry18
  • 21
  • 1

1 Answers1

4

It is a common misconception that O(g(N)) notation represents a function. It actually represents a set of functions whose asymptotic complexity is bounded by the function g(N) as N approaches infinity. In your example, g(N) = 3^N.

So to ask is 2^n = O(3^n) is mixing apples and oranges, or in this case you are comparing a function with a set of functions. We often write it this way, but it is understood that we are talking about membership in a set of functions, not equality.

The more correct way to state this is:

Is function 2^n contained in the set of functions represented by O(3^n)?

With the question phrased this way, the exact values of n do not enter into it because now you are asking if the function 2^n is a member of the set O(3^n).

The short answer is: yes it is.

But to understand why, you need to understand the formal definition of big-O notation which is:

   f(x) is contained in O(g(x)) 

if and only if for all sufficiently large values of x, the absolute value of f(x) is at most a positive constant multiple of g(x). That is, f(x) = O(g(x)) if and only if there exists a positive real number M and a real number x0 such that

|f(x)| <= Mg(x) for all x >= x0 

So for 2^n and O(3^n), we can set M to 1 and x0 to 1, and we get:

|2^n| <= 3^n for all n >= 1

With n=1, we have 2 <= 3, which is true. With n=2, we have 4 <= 9, which is also true, and informally we can see that 3^n grows faster than 2^n, so we know this relationship holds for all n > 2 as well, and thus:

2^n is contained in O(3^n)

For a more complete description of big-o notation, refer to this excellent post https://cs.stackexchange.com/a/23594/87624 or for something specific to BigO notation, read the Wikipedia article on big-o notation

ScottK
  • 208
  • 3
  • 10