Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I understand that $f(n) \leq Ng(n)$ and $g(n) \leq Nh(n)$ so obviously $f(n) \leq Nh(n)$, but how would one go about proving this using proper semantics (using big $O$ notation)?

share|cite|improve this question
"obviously $f(n) \leq Nh(n)$": That's not quite right. – TonyK Dec 11 '11 at 10:20

Well, when $f(n)$ is $O(g(n))$, you should have an associated constant $K_f$ and some $N_f$. Then, when $g(n)$ is $O(h(n))$, you have an associated constant $K_h$ and some $N_h$.

Take the larger of the two $N$ (or their sum, or their product, etc) and take $K_f K_h$ to be the new constant. This will give you the asymptotic $n$ and $k$ so that $f(n) < kh(n)$ for all sufficiently large $n$.

share|cite|improve this answer
something like this then? f(n) = O(g(n)) f(n) <= N(g(n) g(n) = O(h(n)) g(n) <= N1(h(n)) so f(n) <= N(g(n)) and g(n) <= N1(h(n)) f(n) <= N(g(n)) <= N1*N(h(n)) – Doug Masters Dec 11 '11 at 3:43

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.