How to find $\max\int_{a}^{b}\left (\frac{3}{4}-x-x^2 \right )\,dx$ over all possible values of $a$ and $b$, $(a<b)$?

Hint: Over what interval is the integrand $\frac{3}{4}-x-x^2$ non-negative?

It may be useful to sketch the curve $y=\frac{3}{4}-x-x^2$ to see what's going on.


Given $$f(a,b) = \int_{a}^{b}\left(\frac{3}{4}-x-x^2\right)dx$$

Do the integration to get:

$$f(a,b) = \frac{a^3}{3}+\frac{a^2}{2}-\frac{3 a}{4}-\frac{b^3}{3}-\frac{b^2}{2}+\frac{3 b}{4} $$

Diff $f(a,b)$ with w.r.t $a$ and set to $0$

$$a^2+a-\frac{3}{4} =0$$

Solve. We get these $2$ critical points:

$$a = - \frac{3}{2} \ \ a=\frac{1}{2} $$

Diff $f(a,b)$ with wrt $b$ and set to $0$

$$-b^2-b+\frac{3}{4} = 0$$

We get these $2$ critical points:

$$ b = - \frac{3}{2} \ \ b=\frac{1}{2} $$

only $\displaystyle a = -\frac{3}{2} \ \ b = \frac{1}{2} $ need to be tried. $( a < b )$

$$f\left( - \frac{3}{2} , \frac{1}{2}\right) = \frac{4}{3} .$$


Let's look at a brute force approach.

$$f(a,b)=\int_a^b\left({3\over 4}-x-x^2\right)dx={3\over 4}(b-a)-{b^2-a^2\over 2}-{b^3-a^3\over 3}$$

Now this is maximum when

$$\begin{align} {{\partial{f(a,b)}\over\partial{a}}}&=0\\{{\partial{f(a,b)}\over\partial{b}}}&=0\end{align}$$

Which leads to

$$\begin{align} -{3\over 4}+a+a^2=0\\{3\over 4}-b-b^2=0\end{align}$$

This means the maximum is attained for $a$ and $b$ roots of the quadratic

$$X^2+X-{3\over 4}=0$$

This means $a=-{3\over 2}$ and $b={1\over 2}$