How find this maximum $f=\dfrac{8a^2-6ab+b^2}{4a^2-2ab+ac}$ The quadratic equation $ax^2+bx+c=0$ has two roots in the interval $[0,2]$,Find the maximum of
$$f=\dfrac{8a^2-6ab+b^2}{4a^2-2ab+ac}$$
my idea:we have 
(1):if $a>0$,then let $g(x)=ax^2+bx+c$
$$\Delta=b^2-4ac>0,g(0)\ge 0,g(2)\ge 0$$
then we have $$b^2>4ac,c\ge0,4a+2b+c\ge0$$
(2):if $a<0$,then we have
$$b^2-4ac>0,c\le 0,4a+2b+c\le 0$$.
so I think  this method is very ugly. can someone have nice methods? Thank you 
by the @Yimin hint:we have
$x_{1}+x_{2}=-\dfrac{b}{a},x_{1}x_{2}=\dfrac{c}{a}$,then we have $$f=\dfrac{8a^2-6ab+b^2}{4a^2-2ab+ac}=\dfrac{8-\dfrac{b}{a}+\left(\dfrac{b}{a}\right)^2}{4-2\dfrac{b}{a}+\dfrac{c}{a}}=\dfrac{8+x_{1}+x_{2}+(x_{1}+x_{2})^2}{4+2(x_{1}+x_{2})+x_{1}x_{2}},0\le x_{1},x_{2}\le 2$$
 A: First of all, simultaneously multiplying $a$, $b$, and $c$ a constant does change the roots, and $f$, so we can set $a = 1$ without loss of generality. This yields
$$
f =
\frac{ 8 - 6 b + b^2 } { 4 - 2 b + c }.
$$
Next, let $b = -2p$, $c = p^2 - q^2$ ($q > 0$). 
The target function is now
$$
f(p, q)
 = \frac{
8 + 12 p + 4 p^2
}
{
4 + 4 p + p^2 - q^2
}
= \frac{ 4 (p + 1)(p + 2) }
{ (2 + p)^2 - q^2 }.
$$
The quadratic equation becomes,
$$ (x - p)^2 = q^2 $$
and the two roots are $x_1 = p-q$, and $x_2 = p+q$, with
\begin{align}
0 &\le p \le 2, \\
q &\le \min\{p, 2 - p\}, \\
\end{align}
to satisfy $0 \le x_1 \le x_2 \le 2$.
Now $f$ increases with $q$, so $q$ must take the maximal possible value.
If $p \le 1$, $q = p$ satisfies the above constraints, and
\begin{align}
f(p, q)
&\le
f(p, p)
\\
&=
\frac{4(p+1)(p+2)}
{(2+p)^2 - p^2}
\\
&=p+2 \le 3
\qquad
(p \le 1).
\end{align}
If $p \ge 1$, $q$ should assume the value of $2-p$ to maximize $f(p, q)$,
\begin{align}
f(p, q)
&\le
f(p, 2 - p)
\\
&=
\frac{4(p+1)(p+2)}
{(2+p)^2-(2-p)^2}
\\
&=
\frac{1}{2}
\left(
p+\frac{2}{p} + 3
\right)
\qquad
(p \ge 1).
\end{align}
The function has a minimum at $p = \sqrt 2 \approx 1.414$, so we only need to check the value at the two boundaries.  We know that at $p = 1$, $f = 3$.  For $p = 2$
$$
f \le
\frac{1}{2}
\left(
2+\frac{2}{2}+3
\right)
=3.
$$
So the maximum is $3$, which is achieved at $a = 1, b = -2, c = 0$ or $a = 1, b = -4, c = 4$.
A: Suppose the roots are $x_1,x_2$, then represent the objective function with the roots.
