Is $\sqrt{(f(n)^2+g(n)^2)/{2}} = O(\max(f(n),g(n)))$

46 Views Asked by At

I have two statements:

$$\sqrt{\frac{f(n)^2+g(n)^2}{2}} = O(\max(f(n),g(n)))$$

Here I don' t know how to approach this.

The second statement is

$\log(f(n)) = $ $O(\log(g(n)))$ for $f(n) = O(g(n))$?

After inserting I'd get

$\log(O(g(n))) = O(\log(g(n)))$, which is not the same.

Is that correct?

2

There are 2 best solutions below

0
On BEST ANSWER

For the second one we must assume $f(n) \to \infty$ or something like that.

Example
$f(n) = 1+\frac{1}{n}$, $g(n) = 1+\frac{1}{n^2}$. Then $$ \lim_{n\to \infty}\frac{f(n)}{g(n)} = 1\quad\text{so}\quad f(n) = O(g(n)). $$ But $$ \lim_{n\to \infty} \frac{\log(f(n))}{\log(g(n))} = \infty,\quad\text{so}\quad \log(f(n)) \ne O(\log(g(n))) $$

0
On

Hint for the first: $$\sqrt{\frac{f(n)^2+g(n)^2}{2}} \leq \max(f(n),g(n))$$ for all $n$. Can you see why?

Hint for the second: if $f(n) \leq g(n)$ then $\log(f(n)) \leq \log(g(n))$ because $\log$ is a monotonically increasing function.