<s>[INST] Calculus - Functions How do I go about this question? Also how exactly will its graph be?
$$ f(x) = 1 + 4x -x^2 $$
$$g(x) = \begin{cases} 
\max f(t) & x \le t \le (x+1) ;\quad 0 \le x < 3 \\
\min (x+3) & 3 \le x \le 5
\end{cases}
$$
Verify continuity of $g(x)$ for all $x$ in $[0,5]$
 [/INST] here is a way to think of solving this problem geometrically. note that $1 + 4x - x^2$ is a parabola symmetric about $x = 2,$ opens downward, a has a local max at $x = 2, y = 5.$ think of the function $g$ as the global max on the moving window $x, x+1]$ of length $1.$ for $0 \le x \le 1,$ this max occurs at the right end point 
$x + 1$ and the value is $f(x+1).$ for $1 \le x \le 2,$ the global max is at $x = 2$ and the value is $f(2)$ and finally for $2 \le x \le 3,$ the global max occurs at the left end point $x$ and the value is $f(x).$ we can write this as piecewise function 
$g(x) = \left\{ \begin{array}{ll} f(x+1) & if 0 \le x \le 1 \cr
                                  f(2)   & if 1 \le x \le 2 \cr
                                  f(x)   & if 2 \le x \le 3 \cr
                                  x + 1  & if 3 \le x \end{array} \right.$
you can verify the continuity of $g$ at the boundary points $1, 2, $ and $3.$
</s>