Suppose $f$ is continuous on $[a,b]$. Show that the functions defined by $m(x)=\inf\{f(y):y\in[a,x]\}$ and $M(x)=\sup\{f(y):y\in[a,x]\}$ are well defined and are also continuous on $[a,b]$
I have already managed to prove that they are well defined, since $f$ is continuous on $[a,b]$ so it is bounded. Therefore for every $x\in[a,b]$, the set $\{f(y):y\in[a,x]\}$ has a supremum and an infimum. To prove that they are continuous on $[a,b]$, I've taken an arbitrary sequence $\{x_n\}$ contained in $[a,b]$ converging to some number $c\in[a,b]$ and am attempting to show that $m(x_n)\rightarrow m(c)$ and $M(x_n)\rightarrow M(c)$, but I'm not quite sure how. Any help would be appreciated, thanks!