Continuity of max function. Say you have two continuous functions $f: D \to \mathbb{R}$ and $g:D \to \mathbb{R}$. Now, define  $F: D \to \mathbb{R}$ to be $$F(x) = \text{max} \{f(x),g(x) \}, \text{  } x \in D.$$ I need to prove using an $\epsilon - \delta$ proof that $F(x)$ is also continuous.
We know that if $\epsilon > 0$ and $x_0 \in D$, $\exists \delta_1 , \delta_2 > 0$ such that $|x-x_0| < \delta_1$ $\Rightarrow |f(x)-f(x_0)|< \epsilon$ and  $|x-x_0| < \delta_2$ $\Rightarrow |g(x)-g(x_0)|< \epsilon$.
I tried to pick $\delta = $ min$\{\delta_1 , \delta_2 \}$, combine the above inequalities and connect the max function to them. However, my attempts have not yielded any results.
Any help would be useful!
 A: The trouble here is whether or not $F$ behaves like $f$ or $g$ or both at $x_0$. The idea here is that if $F$ takes on values of either $f$ or $g$ then it is identically $f$ or $g$ on some small neighborhood about that point.
Fix $\varepsilon > 0$. Assume $f(x_0) > g(x_0)$, hence $F(x_0) = f(x_0)$. The goal is to show $F=f$ on a small neighborhood around $x_0$, at which point we may use the continuity at $f$.
Since $f(x_0) > g(x_0)$ then we know the function $h=f-g$ is continuous and $h(x_0)>0$. Therefore for $\varepsilon_0=h(x_0)>0$ there exists $\delta_0>0$ where $|h(x) - h(x_0)| < \varepsilon_0$ whenever $|x-x_0|<\delta_0$. A little manipulation and and we can conclude
$$f(x) > g(x) \quad \text{when}\quad |x-x_0| < \delta_0.$$ Aha! So we can use the continuity of $f$ to imply $F$ is continuous at $x_0$ since $F(x) = f(x)$ when $|x - x_0|<\delta_0$, taking the minimum of the $\delta_0$ and your $\delta_1$ from the continuity of $f$. This argument is identical for when $g(x_0) > f(x_0)$.
Now what about $x_0$ values where $f(x_0) = g(x_0)$? Well now on either side of $x_0$ we can have $F$ act like either $f$ or $g$. The idea here is $|F(x) - F(x_0)|$ can differ no more than either $g$ or $f$. In this case the minimum of your $\delta_1$ and $\delta_2$ do imply continuity of $F$ at $x_0$. To see this, consider the two cases for any $x$ such that $|x-x_0|<\min\{\delta_1, \delta_2\}$: if $F(x)=f(x)$ then $$|F(x)-F(x_0)|=|f(x) - f(x_0)|<\varepsilon,$$ otherwise if $F(x)=g(x)$ then $$|F(x) - F(x_0)|=|g(x) - g(x_0)|<\varepsilon.$$
A: Suppose at $x_0$ we have that $F(x_0) = f(x_0) > g(x_0)$. Then let $\epsilon = f(x_0)-g(x_0)$. Then there is a $\delta_1, \delta_2$ such that if $|x-x_0| < \delta_1$ then $|f(x)-f(x_0)| < \epsilon/3$ and if $|x-x_0| < \delta_2$ then $|g(x) - g(x_0)| < \epsilon/3$.
Thus, if $\delta = \min(\delta_1, \delta_2)$, and $|x - x_0| <\delta$, then $F(x) = f(x)$ and you can use continuity of $f$.
Similarly, we can check all points, where $F(x_0) = g(x_0) > f(x_0)$.
Then only points left to check are when $f(x_0) = g(x_0)$. If this the case, then there exists a $|x - x_0| < \delta$ (as you've shown), we have that $|f(x)-f(x_0)| < \epsilon$ and $|g(x) - g(x_0)| < \epsilon$. Now if $F(x) = f(x)$ we use the fact that $F(x_0) = f(x_0)$ and $|f(x)-f(x_0)| < \epsilon$ to get continuity. If $F(x) = G(x)$, then we use $F(x_0) = g(x_0)$ and $|g(x)-g(x_0)| < \epsilon$ to get continuity.
A: Hint: Try using $$|\max\{f(x),g(x)\}-\max\{f(x_0),g(x_0)\}| \le \\
|\max\{f(x),g(x)\}-\max\{f(x_0),g(x)\}|+|\max\{f(x_0),g(x)\}-\max\{f(x_0),g(x_0)\}|$$
and prove
$$|\max\{a,c\}-\max\{b,c\}| \le |a-b|$$
analizing the cases:

*

*$c$ is bigger than $a$ and $b$


*$c$ is between $a$ and $b$


*$c$ is smaller than $a$ and $b$
