-4

I am supposed to Prove that 92675*2^n=0(2^n) and use the mathematical definition of 0(f(n)). I came up with following answer not sure if this is the right way to approach it though

Answer: Since 92875 is a constant, we can replace it with K and F(n)=K+2n therefore O(f(n)=O(K+2n) and since K is a constant it can be taken away from the formula and we are therefore left with O(f(n)=O(2n)

Can someone please confirm if this is right or not? Thanks in advance

Edit: Just realized that I wrote + instead of * and forgot a couple of ^ signs

Answer: Since 92675 is a constant, we can replace it with K and F(n)=K*2^n therefore O(f(n)=O(K*2^n) and since K is a constant it can be taken away from the formula and we are therefore left with O(f(n)=O(2n)

  • Yes, you are right. Constant "928675" won't affect situation when n will become big. – QtRoS Jan 29 '15 at 13:17
  • Can you please check if the answer is correct with the edit @QtRoS – saleh mohsen Jan 29 '15 at 13:39
  • http://stackoverflow.com/questions/28178877/big-o-algebra-simplification-issue/28180125#28180125 **Definition/Rules** 2. – luk32 Jan 29 '15 at 13:39
  • 1
    You are using `O(f(x)) = O(k*f(x))` to prove that `O(k*f(x)) = O(f(x))`. That's a tautology. – Juan Lopes Jan 29 '15 at 13:40
  • 1
    Being explicit: your answer does not prove it. You are supposed to use the big-o definition. – Juan Lopes Jan 29 '15 at 13:43
  • `>>Flag pls I must take this down now okay i will take this down now<<` Is this `jeopardy` and I have to guess the original question? You make your question useless for other people if you edit your question like a chat without history. – Gren Jan 29 '15 at 14:46

1 Answers1

2

You are supposed to prove exactly that proposition (O(f(n))=O(K*2^n)). You can't use it to prove itself.

The definition of f(x) is O(g(x)) is that, for some constant real numbers k and x_0, |f(x)| <= |k*g(x)| for x>=x_0.

That's why if f(x) = k*g(x) we can say that f(x) is O(g(x)) (|k*g(x)| <= |k*g(x)| for any x). In special, it is also true for g(x)=2^x and k=928675.

Juan Lopes
  • 10,143
  • 2
  • 25
  • 44