Big O / Functions Question.

33 Views Asked by At

For all $x > 0, f(x) > 0 $ and $g(x) > 0$.
$f(x) \leq cg(x)$, but $log(f(x) > c*log(g(x))$.

Can we find examples of $f$ and $g$ that make this statement true?

2

There are 2 best solutions below

2
On

Yes, you can find such examples, loads of them. However your question seems to be related to the big O notation so I'll answer in the spirit.

Just because $\log(f)>c\log(g)$ for this particular c doesn't mean that $\log(f)$ is not a $O(\log(g))$.

In @dxiv 's example, for instance, $\log(f)$ is a $O(\log(g))$, but you need a bigger constant than $c$ to prove it.

Edit: take any two continuous positive-valued functions $ f $ and $ g $ on an open domain containing $0 $, say, such that $ f(0)\neq 1 $ and $ g (0)=1 $. Then $ f $ is a big O of $ g $ near $0 $ but $\log f $ isn't a big O of $\log g $. Big Os are tricky. If you don't like this example because it happens near $0 $, feel free to replace $0 $ by $\infty $.

2
On

Take for example $\,f(x) = g(x) = \dfrac{1}{2}\,$, $\,c=2\,$, then:

  • $f(x) \le c g(x)\,$ holds because $\,\dfrac{1}{2} \le 2 \cdot \dfrac{1}{2}$

  • $\log\big(f(x)\big) \gt c \cdot \log\big(g(x)\big)\,$ holds because $\log\big(\dfrac{1}{2}\big) \gt 2 \cdot \log\big(\dfrac{1}{2}\big) = \log\big(\dfrac{1}{4}\big)$