TITLE: (Proof) If $f$ and $g$ are continuous, then $\max\{f(x),g(x)\}$ is continuous
QUESTION [6 upvotes]: Consider the continuous functions $f,g:\mathbb{R}\rightarrow\mathbb{R}$.
Show that $F:\mathbb{R}\rightarrow\mathbb{R}$ with $x\mapsto \max\{f(x),g(x)\}$ is continuous using the $\epsilon - \delta$ definition of continuity.
I know there must be four cases.
If $f(x)\leq g(x)$ and $f(x_0)\leq g(x_0)$ or
if $g(x)\leq f(x)$ and $g(x_0)\leq f(x_0)$ it is easy.
However, assuming $f(x_0)\neq g(x_0)$, what if 
$g(x)\leq f(x)$ and $f(x_0)\leq g(x_0)$ or
$f(x)\leq g(x)$ and $g(x_0)\leq f(x_0)$?
For example:
$|f(x)-g(x_0)|$... how do I get from here to $|x-x_0|$?

REPLY [4 votes]: Trying to stick as close as possible to the definition of the maximum.
Take a point $x_0 \in \mathbb R$. You want to prove that $h(x)=\max (f(x),g(x))$ is continuous at $x_0$.
In fact you only have 3 cases:

$f(x_0) < g(x_0)$
$f(x_0)=g(x_0)$
$f(x_0) > g(x_0)$

$x$ will come into play afterwards.
Case 1.
As $g(x_0)-f(x_0) > 0$, you can find $\delta$ such that for $\vert x - x_0 \vert < \delta$ you have $\vert g(x) - g(x_0) \vert < \frac{g(x_0)-f(x_0)}{2}$. Hence for $x \in (x_0-\delta,x_0+\delta)$ you have $h(x)=g(x)$ and $h$ is therefore continuous at $x_0$.
Case 3.
Is similar to case 1.
Case 2. $f(x_0)=g(x_0)$
For $\epsilon > 0$, you can find $\delta_f$ such that $\vert f(x)-f(x_0) \vert < \epsilon$ for $\vert x - x_0 \vert < \delta_f$ and $\delta_g$ such that $\vert g(x)-g(x_0) \vert < \epsilon$ for $\vert x - x_0 \vert < \delta_g$.
Now for $\vert x- x_0 \vert < \inf(\delta_f,\delta_g)$, you have $f(x),g(x) \in (f(x_0)-\epsilon,f(x_0)+\epsilon)=(g(x_0)-\epsilon,g(x_0)+\epsilon)$ hence $h(x)=\max(f(x),g(x)) \in (f(x_0)-\epsilon,f(x_0)+\epsilon)$ which allows to conclude.