Is the maximum function of a continuous function continuous? Suppose $f(x)$ is continuous on the closed interval $[a,b]$. Define $m(x)=\max_{a\leq s\leq x}\, f(s)$, $a\leq x\leq b$. Is $m(x)$ continuous necessarily? Thank you.
 A: Yes it is.
HINT: Clearly $m(s)$ is monotonically non-decreasing on $[a,b]$. Thus, if it is discontinuous at some $x\in[a,b]$, it must have a jump discontinuity at $x$: either $\lim\limits_{s\to x^-}m(s)<m(x)$, or $m(x)<\lim\limits_{s\to x^+}m(s)$.


*

*Suppose first that $\lim\limits_{s\to x^-}m(s)<m(x)$ for some $x\in(a,b]$. Show that $\lim\limits_{s\to x^-}f(s)<f(x)$, contradicting the continuity of $f$.

*Then suppose that $m(x)<\lim\limits_{s\to x^+}m(s)$ for some $x\in[a,b)$. Show that $f(x)<\lim\limits_{s\to x^+}f(s)$, again contradicting the continuity of $f$.
Added: Here’s a little more help with (1). Let $u=\lim\limits_{s\to x^-}m(s)$. For all $s\in[a,x)$ we have $$f(s)\le m(s)\le u<m(x)=\max\{f(s):a\le s\le x\}\;.$$ In other words, $f(s)\le u$ for every $s\in[a,x)$, but $\max\{f(s):a\le s\le x\}=m(x)>u$; this is possible only if $f(x)=m(x)$. But then $\lim\limits_{s\to x^-}f(s)\le u<f(x)$.
(2) can be dealt with very similarly.
A: $f$ is uniformly continuous on $[a,b]$. Fix $\varepsilon>0$, choose $\delta$ such that $|f(x)-f(y)|\leq\varepsilon$ when $|x-y|\leq \delta$ and let $x\in [a,b]$. We have to show that $|m(x)-m(x+t)|\leq\varepsilon$ if $|t|\leq \delta$. We have for $t>0$ that 
$$m(x+t)=\max_{0\leq s\leq x+t}f(s)=\max\{f(x),\max_{x\leq s\leq x+t}f(s)\},$$ 
and for $t<0$ that 
$$m(x+t)=\max\{f(x-t),\max_{x-t\leq s\leq x}f(s)\}.$$
We have $|f(x)-\max_{x\leq s\leq x+t}f(s)\}|\leq\varepsilon$ when $0<t<\delta$ and $|f(x-t)-\max_{x-t\leq s\leq x}f(s)|<\varepsilon$ when $0>t>-\delta$.
