If $f$ and $g$ are both uniformly continuous, show that $\max(f, g)$ is uniformly continuous My friend asked me this question and I gave him a sketch of proof. My idea is that to construct a function
$$h = \begin{cases}
f-g & \textrm{if $f \ge g$}\\
0 & \textrm{if $f < g$}
\end{cases}$$
and show that $h$ is uniformly continuous. Then since $\max(f, g) = g + h$, so it is uniformly continuous.
He believed that I oversimplified, and show me this site: http://www.math.unm.edu/~crisp/courses/math402/sol-hw5.pdf
The proof of this statement is on the second page. I completely don't see why the third (and fourth) case should be consider, since there is a theorem that for a continuous function $f$, if $f(x_0) > 0$, then there exist a nbhd $U(x_0)$ of $x_0$ s.t. $f(x) > 0$ for all $x \in U(x_0)$. In other words, I can just consider the nbhd s.t. $f(x) > g(x)$ if $f(x_0) > g(x_0)$. For a larger $\epsilon$, I can simply maintain the $\delta$ and everything is fine.
So my questions are:


*

*Is my sketch correct?

*Why do we need to consider 4 cases as shown in the "answer"?

 A: It is much simpler if you use the formula (proved here)
$$\max(f, g) = \frac{1}{2}\left(f + g + |f - g| \right)$$ and then we can reason in the following manner. Sum and difference of two uniformly continuous functions is uniformly continuous. Hence both $(f + g)$ and $(f - g)$ are also uniformly continuous. If we note the inequality $||a| - |b|| \leq |a - b|$, then we get that modulus of an uniformly continuous function is also uniformly continuous. Hence $|f - g|$ is uniformly continuous. By sum property $h = (f + g + |f - g|)/2$ is also uniformly continuous.
A: (The proof proposed by @Paramanand is quick and elegant, but most textbooks proceed in the reverse order: first we show that $\max(f,g)$ is uniformly continuous, and then we show that $|f|$ is uniformly continuous because $|f| = \max(f,-f)$. Thus, I propose an alternative sketch/idea of proof below.)
Let be $f,g : X \to \mathbb{R}$ two uniformly continuous functions, let be $f \oplus g : X \to \mathbb{R}^2$ the direct sum of $f$ and $g$ (i.e., $f \oplus g(x) = (f(x), g(x))$ for all $x \in \mathbb{R}$), and let be $h : \mathbb{R}^2 \to \mathbb{R}$ the maximum function (i.e., $h(x,y) = \max(x,y)$). You can simply see the function $\max(f,g)$ as the composition $h \circ (f \oplus g)$. If you already know that:

*

*the composition of two uniformly functions is uniformly continuous

*the direct sum of two uniformly functions is uniformly continuous

then you're done. (And this is usually the case: those results are usually introduced before the result about $\max(f,g)$. If this is not the case, the two properties I mentioned above are not too difficult to prove and will be a pretty good exercise!)
