# Thread: "order of" equality question

1. ## "order of" equality question

Suppose we have three functions f(n), g(n), and h(n) such that f(n) = O(g(n)) and g(n) = O(h(n)). Must it be the case that f(n) = O(h(n))? Explain why or give a counterexample showing why not.

2. Originally Posted by inneedofhelp
Suppose we have three functions f(n), g(n), and h(n) such that f(n) = O(g(n)) and g(n) = O(h(n)). Must it be the case that f(n) = O(h(n))? Explain why or give a counterexample showing why not.
what do you mean by O(g(n)) and O(h(n))?

3. Originally Posted by Jhevon
what do you mean by O(g(n)) and O(h(n))?
He means the big O notation.*
(I am too lazy to post proofs now).

*)I hate that notation with a love.

4. Originally Posted by inneedofhelp
Suppose we have three functions f(n), g(n), and h(n) such that f(n) = O(g(n)) and g(n) = O(h(n)). Must it be the case that f(n) = O(h(n))? Explain why or give a counterexample showing why not.
$f(n)=O(g(n))$ means there exist $n_1$ and $M_1$ such that:

$|f(x)| \le M_1|g(n)|\ \forall n>n_1$

and $g(n)=O(g(n))$ means there exist $n_2$ and $M_2$ such that:

$|g(x)|\le M_2|h(n)|\ \forall n>n_2$

Hence:

$|f(x)|\le M_1 M_2 |h(n)|\ \forall n> \max(n_1,n_2)$

Therefore $f(n)=O(h(n))$

RonL