Evaluating $\max(ab+bc+ac)$ 
Let a,b,c be real numbers such that $a+2b+c=4$. What is the value of $\max(ab+bc+ac)$

My attempt:
Squaring both the sides: 
$a^2 +4b^2+c^2+2ac+4bc+4ab=16$
Then I tried factoring after bringing 16 to LHS but couldn't. It's not even a quadratic in one variable or else I could have directly found the maximum. 
How do I proceed? 
 A: From the given condition $\,2b=4-a-c\,$, then:
$$\require{cancel}
\begin{align}
2(ab+bc+ca) &= 2b(a+c)+2ac \\
 &= (a+c)(4-a-c)+2ac= \\
 &= 4a - a^2 - \bcancel{ac} + 4c - \bcancel{ac} - c^2 + \bcancel{2ac} = \\
 &= \color{red}{8} -a^2 + 4a \color{red}{-4} - c^2 +4c \color{red}{-4} = \\
 &= 8 - (a-2)^2 - (c-2)^2 \\
 &\le 8
\end{align}
$$
Equality is attained for $a=c=2\,$, so the upper bound is in fact a maximum.
A: Lagrange multipliers will give the solution
\begin{eqnarray*}
L=ab+bc+ca+ \lambda (a+2b+c-4)
\end{eqnarray*}
Differentiating gives
\begin{eqnarray*}
b+c+ \lambda =0 \\
c+a +2\lambda =0 \\
a+b+ \lambda =0 \\
\end{eqnarray*}
Add these equation together and substitute to get $ \lambda = \frac{b-4}{2}$ now substitute this back into the equations above and we get $b=0, a=c=2$. So the maximum value is $\color{blue}{4}$.
Edit : Ooops ... it is a precalculus question ... 
\begin{eqnarray*}
L=ab+bc+ca=ab+(a+b)(4-a-2b)=-a^2-2ab-2b^2+4(a+b) = \\ \underbrace{-\frac{1}{2}(2b+a-2)^2}_{2b+a=2}-\underbrace{\frac{1}{2}(a-2)^2}_{a=2}+\color{blue}{4}
\end{eqnarray*}
A: Note that $4xy \leq (x+y)^2$ for all $x$, $y$.
You have $$ab+bc+ca = b(a+c) + ac \leq b(a+c) + \frac{1}{4}(a+c)^2 = (a+c) \frac{a+c+4b}{4} = \frac{1}{4}(a+c)(8-(a+c)) \leq \frac{1}{4}\frac{1}{4}8^2 = 4.$$
Equality is happen when $a=c$ and $a+c = 8-(a+c)$, or $a+c=4$.
