The minimum value of the integral a) Find $a$ and $b$ such that $\displaystyle \int_0^1 |x^2 - ax - b| \,dx$ is minimum. 
b) How about $\displaystyle \int_0^1 |x^2 - ax - b|^2 \,dx$?

This is what I did for part a):
If $D=a^2+4b\leq 0$ then $|x^2-ax-b| =x^2-ax-b$ and we have:
$ I= \int_0^1 |x^2-ax-b|\,dx  = \int_0^1 (x^2-ax-b)\,dx ={1\over 3}-{a\over 2}-b$
and 
$I \geq {1\over 3}-{a\over 2}+{a^2\over 4} = {1\over 12}+{(a-1)^2\over 4} $
so $I_{min}\leq {1\over 12}$ and $I= {1\over 12}$ iff $a= 1$ and $b = -{1\over 4}$.
But, I can not handle easyl case $D>0$.
 A: Part a) seems to be improvable. Using a variational approach,
$$
\delta\int_0^1\left|\,x^2-ax-b\,\right|\,\mathrm{d}x
=-\int_0^1\operatorname{sgn}\left(x^2-ax-b\right)\,(x\delta a+\delta b)\,\mathrm{d}x
$$
This means that $\operatorname{sgn}\left(x^2-ax-b\right)$ must be orthogonal to $x$ and $1$ on $[0,1]$. This means that the parabola must be centered at $\frac12$ and must cross the $x$-axis at $\frac14$ and $\frac34$. This means that $a=1$ and $b=-\frac3{16}$. Thus, the minimum is
$$
\int_0^1\left|\,x^2-x+\tfrac3{16}\,\right|\,\mathrm{d}x=\tfrac1{16}
$$

We can also use a variational approach to part b):
$$
\delta\int_0^1\left(x^2-ax-b\right)^2\,\mathrm{d}x
=-\int_0^12\left(x^2-ax-b\right)\,(x\delta a+\delta b)\,\mathrm{d}x
$$
This means that both
$$
\int_0^1\left(x^2-ax-b\right)\,\mathrm{d}x=0\iff\tfrac13-\tfrac12a-b=0
$$
and
$$
\int_0^1\left(x^2-ax-b\right)x\,\mathrm{d}x=0\iff\tfrac14-\tfrac13a-\tfrac12b=0
$$
Solving these simultaneously gives $a=1$ and $b=-\frac16$ and
$$
\int_0^1\left(x^2-x+\tfrac16\right)^2\,\mathrm{d}x=\tfrac1{180}
$$
A: Part (b) is more immediately clear to me:
\begin{align*}
\int_0^1 |x^2+ax+b|^2 \, dx &= \int_0^1 (x^2+ax+b)^2 \, dx\\[0.3cm] &= \int_0^1 (x^4+2ax^3+(a^2+2b)x^2 + 2abx+b^2) \, dx\\[0.3cm] &= 1/5 + a^2/3 + 2 b/3 + b^2 + a/2 + ab
\end{align*}
Let $S=1/5 + a^2/3 + 2 b/3 + b^2 + a/2 + ab.$ This is extremised when $\partial S/\partial a = \partial S/\partial b = 0$ so $2a/3+b+1/2=0$ and $a+2b+2/3 =0$.
Solving we find $a=-1$, $b=1/6$.
As for (a):
Let's assume that both roots of the quadratic are in $[0,1]$, and call them $c$ and $d$ with $c \leq d$. Then 
$$ \int_0^1 |(x-c)(x-d)|dx = \int_0^1 (x-c)(x-d) dx - 2\int_c^d |(x-c)(x-d)|dx, $$ which is 
$T = 1/3 - c/2 - c^3/3 - d/2 + cd + c^2 d - c d^2 + d^3/3.$
Again we want $\partial T/\partial c = \partial T/\partial d = 0$, so $-1/2 - c^2 + d + 2cd - d^2 = 0$ and $-1/2 + c + c^2 - 2cd + d^2= 0$. This gives two solutions:
$c=1/2$, $d=1/2$ and $c=1/4$, $d=3/4$.
so the two solutions are $a=-1$, $b=1/4$ and $a=-1$, $b=3/16$.
But which is the minimum? Well, $\displaystyle\int_0^1 |x^2-x+1/4| dx = 1/12$ while $$\int_0^1 |x^2-x+3/16| dx=1/16$$
So the correct solution is $a=-1$, $b=3/16$.
