I have to prove or disprove the following Landau-equalities:
$$ O(f+g) = O(max(f,g))$$ and $$O(f-g) = O(min(f,g))$$ with $f,g: \mathbb N \to \mathbb R^+$ . To show equality of two sets, one has to show that the first is a subset of the second and vice versa, thus:
$O(f+g) \subseteq O(max(f,g)) $ and $ O(max(f,g)) \subseteq O(f+g)$
My problem is the step from sets to functions . Can you help me out?
We set $h=O(f+g)$.
So it suffices to prove that $h=O(\max\{f,g\})$, i.e. that $\exists c>0, n_0 \in \mathbb{N}$ such that $\forall n \geq n_0$: $h \leq c \max\{ f,g \}$
We know that $h=O(f+g)$. By definition that means that $\exists c_1>0, n_1 \in \mathbb{N}$ such that $\forall n \geq n_1:$
$$h \leq c_1(f+g)$$
So, we have
$\forall n \geq n_1:$
$$h \leq c_1(f+g) \Rightarrow h \leq c_1 (\max\{ f,g \}+\max\{ f,g \})=2c_1 \max\{ f,g \}$$
We pick $n_0=n_1$ and $c=2c_1$ and we have that:
$$h=O(\max\{ f,g \}) \Rightarrow O(f+g)=O(\max\{ f,g \}) $$