Using epsilon delta, prove the max function of continuous functions f,g is also continuous First of all I know that this question has been asked already, but I'm looking for a proof simply using the definition of continuity ($\epsilon$, $\delta$)
Suppose $f,g:D \to R$ are both continuous on $D$. Define $h:D \to R$ by $h(x)=$max{$f(x),g(x)$}. Show $h$ is continuous on $D$.
So, there should be two cases. Let $a$ be fixed.
Case 1: $\lvert f(a)-g(a) \rvert >0$
Case 2: $f(a)=g(a)$
I'm not sure what to do from here
I'm having trouble grasping how to carry out proofs regarding continuous functions. If anyone can give me some insight, that'd be much appreciated.
 A: The first case is easy.  If $|f(a) - g(a)|>0$, then there is a small neighborhood of $a$ where this is always true.  Hence $h(x)$ is equal to $f$ or $g$ in this neighborhood and $h(x)$ is continuous for $a$.
The second case, if $f(a) = g(a)$  Let $\epsilon >0$.
Since $f$ is continuous there is a $\delta_1 > 0$ such that $|f(x) - f(a)|<\epsilon$ for $|x - a|< \delta_1$
Since $g$ is continuous there is a $\delta_2 > 0$ such that $|g(x) - g(a)|<\epsilon$ for $|x - a|< \delta_2$
$$|h(x) - h(a)| = |\max\{f(x),g(x)\} - h(a)| \leq \max\{|f(x) - h(a)|,|g(x)-h(a)|\}$$
Since $h(a) = f(a) = g(a)$
$$\max\{|f(x) - h(a)|,|g(x)-h(a)|\} = \max\{|f(x) - f(a)|,|g(x)-g(a)|\}$$
Let $\delta = \min\{\delta_1, \delta_2\}$, if $|x - a|<\delta$, then 
$$|f(x) -f(a)|<\epsilon \qquad \text{and} \qquad |g(x) - g(a)|<\epsilon$$
then
$$|h(x) - h(a)| \leq \max\{|f(x) - f(a)|,|g(x)-g(a)|\} < \epsilon$$
A: Fix $\varepsilon>0$ and $a\in D$. For the given $\varepsilon$, there exists $\delta_1>0$ such that if $|x-a|<\delta_1$ then $$|f(x)-f(a)|<\varepsilon/2 \qquad  \quad (1)$$ and a $\delta_2>0$ such that if $|x-a|<\delta_2$ then $$|g(x)-g(a)|<\varepsilon/2 \qquad  \quad (2)$$ (because $f,g$ are continuous). Now, you must prove that, for the given $\varepsilon$, there exist a $\delta_3$ such that if $|x-a|<\delta_3$ then $|h(x)-h(a)|<\varepsilon$. It may be helpful to think that if $\delta_3 = \min\{\delta_1, \delta_2\}$ and if $|x-a|<\delta_3$ then $(1)$ and $(2)$ holds (because in this case, $|x-a|<\delta_1$ and $|x-a|<\delta_2$). But
$$h(x) = \max\{f(x),g(x)\} \leq f(x)+g(x)$$
Try to finish the proof now
