Let $f:[a,b] \to \Bbb R$ be continuous . Define $g:[a,b] \to \Bbb R$ by $$g(x) = \sup[f(t) | t \in [a,x]].$$
Then is $g$ continuous? I tried to show the inequality $$|g(x)-g(y)| \le \sup(f(t) | t \in [x,y])$$ but wasn’t able to. Any hints or suggestions will be appreciated.
Your inequality is false. Suppose that $f:[0,1]\rightarrow \mathbf{R}$ is given by
$$f(x) = 2x-1.$$
then $g(x) = 2x-1$. What is $|g(1/4)-g(3/4)|$ and what is $\sup\{f(t)\mid t\in [1/4,3/4]\}$?
For a given $x>0$ consider that $\exists \xi_x$ such that $f(\xi_x) = g(x)$ for every $x$ (why is that?). Suppose that $f(x)<f(\xi_x)$ then $f(x+\delta)<f(\xi_x)$ for $|\delta|<d$ where $d$ is sufficiently small (why is that?). Then $g$ is constant on $(x-d,x+d)$ and hence continuous.
Suppose now that $f(x) = f(\xi_x) = g(x)$, given $\varepsilon>0$ pick $\delta>0$ such that $|y-x|<\delta$ implies that $|f(x)-f(y)|<\varepsilon$. What can then be said about $\sup\{f(t)\mid t\in [0,x+\delta]\}$?