<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] We will use the quadratic equation approach to determine the min and max values of $x$. We have: $y+z = 5-x$, and $yz + x(y+z) = 3\implies 3- x(5-x)= yz\implies x^2-5x+3= yz\le \dfrac{(y+z)^2}{4}= \dfrac{(5-x)^2}{4}\implies 4x^2-20x+12 \le 25-10x+x^2\implies 3x^2-10x-13 \le 0 \implies (3x -13)(x + 1)\le 0\implies -1 \le x \le \dfrac{13}{3}\implies x_{\text{min}} = -1, x _{\text{max}} = \dfrac{13}{3}$ .
</s>