<s>[INST] find the maximum value of $xy + yz +zx$ find the maximum value of $$xy + yz +zx$$given that $x+2y+z=4$
my attempt :
$(x+y+z)^2=x^2+y^2+z^2+2(xy+yz+zx) $ 
or $2S=2(xy+zx+zy)=(x+y+z)^2 -x^2-y^2-z^2=(4-y)^2-x^2-y^2-z^2$
$2S=-x^2-z^2-8y+16=-x^2-z^2+4x+4z$
from the the above we can say due to symmetry maximum value occurs at $x=z$
hence $S=-x^2+4x$ whose maximum is 4
is this right or/and is there a better way ??
 [/INST] Using $$\color{red}{ab\leq \frac{1}{4}(a+b)^2}\;\forall\; a,b \in \mathbb{R}$$
Equality hold when $\color{red}{a=b}$
So $$(x+y)(y+z)\leq \frac{1}{4}\bigg[(x+y)+(y+z)\bigg]^2$$ 
$$xy+yz+zx+y^2\leq 4\Rightarrow \color{Red}{xy+yz+zx\leq 4-y^2\leq 4}$$
equality hold when $y=0$ and $x=z=2$
</s>