<s>[INST] About using the lagrange multiplier. Today I have seen a question like the following;
$x+y+z=5$ and $xy+yz+xz=3$ and $x,y,z \in \mathbb{R}^+$
What is the maximum value $x$ can get?
Now it is pretty obvious that question is solvable using many simple elementary methods like say $(x+y+z)^2=x^2+y^2+z^2+2(xy+yz+xz)=25$
$25=x^2+y^2+z^2+6 \rightarrow x^2+y^2+z^2=19$
Applying Cauchy-Schwarz $(y^2+z^2)(1+1)\geq (z+y)^2$
$2(19-x^2)\ge(5-x)^2$
$x_{max}=\dfrac{13}{3}$
However I would also like to solve it by the lagrange multiplier, here are my efforts
$f(x,y,z,k)=x+5-(y+z)+k(x+y+z-5)$
$f_k'=0$
$f_x'=k+1$
$f_y'=k-1$
$f_z'=k-1$
$k=1,-1$ and $x$ goes nowhere near $\dfrac{13}{3}$

So my question is where am I wrong and how can I fix it?
Besides are there maxima minima questions that can't be solved with lagrange,
is this one of them?

 [/INST] Your function $f(x,y,z,k)=x+5-(y+z)+k(x+y+z-5)$ is not the right function fot Lagrange. The right function is given by
$f(x,y,z,k)=x+5-(y+z)+k(xy+yz+xz-3)$:
</s>