1
$\begingroup$

I was hoping that someone could verify that my proof is correct. Okay, here we go.

$$max(g(n), f(n)) \le 1(g(x) + f(x)) \text{ for all x > 0} $$ $$\text{Let A = 1 and }n_0 = 1$$ $$max(g(n), f(n)) \le A(g(x) + f(x)) \text{ for all n >=}n_0 $$ by definition of Big O notation, we have shown that $$ max(g(n),f(n))~=~O(f(n)+g(n))$$ and therefore $$O(max(g(n),f(n))~\subseteq~O(f(n) + g(n))$$

1 Answers 1

1

This isn't really correct. You've shown that $\max(f,g)=O(f,g)$. In order to show that $O(\max(f,g))\subseteq O(f+g)$ you need to show that if $h=O(\max(f,g))$ then $h=O(f+g)$.

This is true by reasoning similar to what you have said. The correct reasoning is that $\exists N,k$ such that $\forall n>N$, $h(n)\leq k\max(f(n),g(n))\leq k(f(n)+g(n))$