Maximizing the Integral 
Find the interval $[a,b]$ for which the value of the integral $\int_{a}^{b} (2+x-x^2)dx$ is maximized.

To solve this problem, I believe I need to the largest interval over which the integrand is nonnegative. To that end, $2+x-x^2 \ge 0$ if and only if $(x+1)(x-2) \le 0$. This occurs if $x \ge -1$ and $x \le 2$ or $x \le -1$ and $x \ge 2$. Obviously the latter condition is contradictory in nature, so we conclude that $f(x)$ is nonnegative if and only if  $x \in [-1,2]$. Now we prove that this is the interval over which the integral is maximized.
Let $[a,b] \subseteq \Bbb{R}$ be some other interval. If $[a,b]$ is contained in either $(- \infty, -1]$ or $[2,\infty)$, then the integral is negative and therefore smaller. If $[a,b]$ is strictly contained in $[-1,2]$, then $\int_{-1}^{2} f(x)dx = \int_{-1}^{a} f(x)dx + \int_{a}^{b} f(x) dx + \int_{b}^{2} f(x)dx \ge \int_{a}^{b} f(x) dx$. The only remaining case is when $[a,b]$ and $[-1,2]$ overlap but the latter is not contained in the former. Suppose that $a \le -1 \le b$. Then 
$$\int_{a}^{b} f(x) dx = \int_{a}^{-1}f(x) dx + \int_{-1}^{b} f(x) dx \le \int_{-1}^{b} f(x) dx + \int_{b}^{2} f(x) dx.$$ The $a \le 2 \le b$ case is similar.
Finally, it's possible to have $[-1,2] \subseteq [a,b]$, but that case can be handled in a similar fashion, and so I omit it. 
As one can see, I had to deal with more cases than I cared to. Is there a simpler solution, or have I no such recourse?

How about this:
Let $a$ be a fixed number. Consider the function
$$F(t)= \int_a^t (2+x-x^2) \ \mathrm dx$$
Then, $F'(t)= 2+t-t^2 = - (t+1)(t-2)$.
Observe that $F'$ is positive on $(-1,2)$ and negative on $(2,\infty)$.
This implies that $t=2$ is a local maximum for $F$.
Now similarly, you can consider $$G(t)= \int_t^2(2+x-x^2) \ \mathrm dx = -\int_2^t(2+x-x^2) \ \mathrm dx$$
and observe that $t=-1$ is a local max for $G$.
