If g(x) is the maximum value of f(t)

Let f be continuous on [a,b] and define a function g(x) on [a,b] as follows

g(a)=f(a) and for a $\lt\$x $\le\$b then g(x) be the maximum value of f(t) on [a,x]. Prove that g(x) is continuous of [a,b].

I was following along with an example in the text that I have that states

If f and g are continuous real functions on [a,b] which are differentiable in (a,b) then there is a point $x \in$ (a,b) at which

$$[f(b)-f(a)]g'(x) = [g(b)-g(a)]f'(x)$$

the proof is the "generalized mean value theorem" I was wondering if it was ok to use it in this case and where it would apply in the question.

• You can't use the generalised mean value theorem to answer the original question, since you don't know that the $f$ and $g$ from the original question are differentiable (you only know continuous). – Christopher Apr 7 '15 at 15:24

1. If $f(t)$ does not increase after some point $t = t_0$ then $g(t) = g(t_0)$ for $t \geq t_0$. Since lines are continuous, $g(t)$ must be continuous on this segment. On the image below, this is represented by the red line on the interval $(0.2, 0.7)$.
2. Because $f(t)$ was continuous up to $t_0$, $g(t)$ must be as well, and thus is continuous from $0$ until the end of the horizontal line segment.
3. If $f(t)$ increases to a value greater than its value at $t_0$, then there must first exist a value $t_1 \geq t_0$ such that $f(t_1) = f(t_0)$. That is, it must first pass through the old maximum value (because $f(t)$ is continuous). This is represented by the behaviour of the red line around the value $0.75$.
With these two points in mind, the main part of the proof is to show that, roughly: if $f(t)$ 'dips down and comes back up again', then $g(t)$ 'meets back up' with $f(t)$. How could we frame this using the definition of a continuous function? Note that this works without reference to a compact interval.
Above: a plot of $f(t) = t\cos(2\pi t)$ on $t\in[0,1]$ and $g(t) := \max_{0\leq x \leq t} f(x)$.