<s>[INST] maximum value of $xy+yz+zx.$ given $x+2y+z=4$ if $x+2y+z=4$ and $x,y,z$ are real number. then find maximum value of $xy+yz+zx$
putting $x+z=4-2z$ in $y(x+z)+zx = y(4-2z)+zx = 4y-2yz+zx$
i wan,t be able to  go further,could some help me with this 
 [/INST] Since $z=4-x-2y$, 
$$\begin{align}xy+yz+zx&=xy+y(4-x-2y)+(4-x-2y)x\\&=xy+4y-xy-2y^2+4x-x^2-2xy\\&=-x^2+(4-2y)x-2y^2+4y\\&=-(x^2+(2y-4)x)-2y^2+4y\\&=-\left((x+y-2)^2-(y-2)^2\right)-2y^2+4y\\&=-(x+y-2)^2+(y-2)^2-2y^2+4y\\&=-(x+y-2)^2-y^2+4\\&\le 4\end{align}$$
The equality is attained when $x+y-2=y=0$, i.e. $x=2,y=0,z=2$.
</s>