Maximum value of a function

I need some help with the following problem. Find the maximum value of the function $f(x)=|3x^2+2ax-1|$ for $x\in[-1,1]$ if $-2 \leq a \leq 2$.

-
I think we should consider the function as two variables function $f(x,a)$ defined on a rectangular as you noted and then search for its maximum regarding to this region. – Babak S. Nov 28 '12 at 17:01
There must be a simple approach. Isn't the maximum value obtained when the distance between the roots of the function $g(x)=3x^2+2ax-1$ is greatest? – Adam Nov 28 '12 at 17:04
Honestly, I have not seen or noted such this claim (or fact) before. – Babak S. Nov 28 '12 at 17:11

Consider the function $f(x,a)=3x^2+2ax-1$. The maximum of this function is the same as for $|f|$. We can consider also a region: $$-2 \leq a \leq 2, \;\; -1 \leq x \leq 1$$ By the method which you do know that we find the origin as a interior critical point in which the function $f$ vanishes. Now, we consider the border which are $$x=-1,x=1,a=-2,a=2$$. A simple calculating shows us that at the point $(x,a)=(1,2)$ or $(-1,-2)$ the function reaches at $6$. and other points along side these borders are $$(2/3,-2),(-2/3,2)$$ which make the value $-7/3$. So the max would be $6$.