<s>[INST] 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? 
 [/INST] 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*}
</s>