# Find the interval of $[a, b]$ to obtain a maximum integral.

Find the interval $[a, b]$ for which the value of the integral $$\int_a^b (2 + x − x^2) dx$$ is a maximum.

My Approach:

I've considered to let $f(x) = 2 + x - x^2 \implies f(x) = (2-x)(1+x)$. I've also considered that this is a negative quadratic graph, which shows that the positive area under the curve is bounded by the interval $-1$ to $2$. How do i then continue to maximise the value of the integral from the given interval $[a,b]$?

Define $F(a,b)=\int_a^b f(x)~dx$ and you are looking for the global maximum of $F$ with the restriction $a\leq b$. You can do it by computing $$\nabla F(a,b)=\begin{pmatrix}f(b)\\-f(a)\end{pmatrix}.$$ and consider first the case $a<b$. So you have just $(-1,2)$ as a critical point.

Further, the Hessian matrix of $F$ at $(-1,2)$ $$H_f(-1,2)=\begin{pmatrix}-3&0\\0&-3\end{pmatrix}$$ yields, that $(-1,2)$ is a local maximum of $F$.

Since $F(a,a)=0$ and $F(-1,2)>0$ you can drop the boundary $a=b$.

Finally you can check that $F(a,b)\to c\in [-\infty,0]$ for $\|(a,b)\|\to \infty$ (with the restriction $a<b$) while $F(-1,2)>0$. From this you can deduce that $(-1,2)$ has to be the global maximum of $F$.

For the final step you also can show that $F(a,b)<0$ if $a>2$ or $b<-1$. Hence $F$ is nonpositive outside of a bounded area and the positive local maximum has to be the global maximum.

So the area is maximized on the positive part area, the interval is then $[-1,2]$.

• How did you deduce that the maximum area is on the positive area? Nov 23 '17 at 8:01
• @idolo Because negative numbers are less than positive ones. Nov 23 '17 at 8:01
• Just look at what happen if we put $[-1,3]$, the part $[2,3]$ contributes negative area, and eliminates part of area of $[-1,2]$. Nov 23 '17 at 8:05

Well, in general you're trying to find:

$$\begin{cases} \frac{\partial}{\partial\text{a}}\left\{\int_\text{a}^\text{b}\left(\text{n}_1\cdot x^2+\text{n}_2\cdot x+\text{n}_3\right)\right\}=-\text{n}_3-\text{a}\cdot\left(\text{n}_2+\text{n}_1\cdot\text{a}\right)=0\\ \\ \frac{\partial}{\partial\text{b}}\left\{\int_\text{a}^\text{b}\left(\text{n}_1\cdot x^2+\text{n}_2\cdot x+\text{n}_3\right)\right\}=\text{n}_3+\text{b}\cdot\left(\text{n}_2+\text{n}_1\cdot\text{b}\right)=0 \end{cases}\tag1$$

You need the values of $a$ and $b$ such that the following is maximum $$\int_a^b (2 + x − x^2) dx.$$ Consider the function $$g(a,b)=\int_a^b (2 + x − x^2) dx=2(b-a)+\dfrac{b^2}{2}-\dfrac{a^2}{2}+\dfrac{a^3}{3}-\dfrac{b^3}{3}$$.Then taking partial derivatives with respect to $a$ and $b$ gives

$$g_a(a,b)=-2-a+a^2=(a+1)(a-2)$$ $$g_b(a,b)=2+b-b^2=-(b+1)(b-2)$$.

Take double derivatives of $g$ with respect to $a$ and $b$ to check the maxima criterion and get the values $a=-1,b=2$.

Check the graph of $f(x)=2+x-x^2$. For a continuous function, you can view its integration as the area under the curve. So in this case as @user284331 wrote, the area is maximized for $-1\le x\le2$.