# Is this correct in term of big-oh notation: given $g = O(f)$ and $h = O(f)$ can we say $g = O(h)$?

We have two equations $$g = O(f)$$ and $$h = O(f)$$ , then can we derive that $$g = O(h)$$.
I came up with following proof but i dont know it's correct or not.
$$g = O(f)$$ $$g \le c_1*f$$ $$h \le c_2*f$$

Now we have to prove, $$g = O(h)$$ $$g \le c_3*h$$ $$g \le c_3*c_2*f$$ $$c1 \le c3*c2$$ We can find $$c_3$$ such that last equation $$c1 \le c3*c2$$ will be true.

Is this correct or not? If not what will be correct proof for this?

$$f(n)=n^2$$, $$g(n)=n$$, $$h(n)=1$$.
• Thank you for the test case. But is there any way we can mathematically prove $g = O(h)$ wrong. – user4828815 Sep 26 '18 at 20:13
• This counterexample is a proof (though you could prove that $n\neq O(1)$ if you wanted -- that follows quickly from the definition of $O$). – David Richerby Sep 26 '18 at 20:15