# A high school optimization problem

$x$,$y$ and $z$ are real numbers.

We have two equations which are given by the following:

$x+y+z=5$

$xy+yz+zx=3$

By using the two equations above, find the maximum value of $z$.

How can we solve that question by using derivatives or without using

derivatives? Can we find an answer without using Lagrange multiplier? Because I

have to tell the solution to my student in a high school:)

Substituting $y=5-x-z$ from the first equation into the second gives:

$$x^2+(z-5)x + z^2 - 5z + 3 =0$$

Considering this as a quadratic in $x\,$, for it to have real roots, its discriminant must be non-negative:

$$0 \le \Delta = (z-5)^2 - 4(z^2-5z+3) = -3z^2+10z+13=-(z+1)(3z-13)$$

Therefore $z \in \left[-1, \cfrac{13}{3}\right]\,$, so the maximum value of $z$ is $\cfrac{13}{3}\,$.

The first equation is that of a plane, and the second one that of a quadric. Their intersection must be a conic, and because of the symmetry $x\leftrightarrow y\leftrightarrow z$ it must be a circle, centered at $C=\left({5\over3},{5\over3},{5\over3}\right)$.

The point of that circle with the largest $z$ must be of the form $P=\left({5\over3}-d,{5\over3}-d,{5\over3}+2d\right)$: plugging that into the second equation gives $d={4\over3}$ and consequently $z={13\over3}$.

Notice that,

$$(x+y+z)^2=x^2+y^2+z^2+2(xy+xz+yz)=25$$

So,

$$x^2+y^2+z^2+6=25$$

$$z^2=19-x^2-y^2=19-r^2$$

From the second equation we have,

$$xy+z(x+y)=3$$

From the first,

$$z=5-x-y$$

So,

$$xy+(5-x-y)(x+y)=3$$

This is an ellipse, and when we switch $x$ with $y$ and $y$ with $x$ we end up with the same equation so it is symmetric about $x=y$. Hence the minimum of $r^2$ must occur when $x=y=\frac{1}{3}$ (or $=3$ which doesn't work), since no two points on an ellipse can both be the closest to a point outside an ellipse. That implies $z=\sqrt{19-2(\frac{1}{3})^2}=\frac{13}{3}$ is maximum.

• the answer was given as 13/3 Ahmed. It seems to be wrong, I agree with u. Jan 17 '17 at 22:48
• And also let me try Lagrange. Jan 17 '17 at 22:49
• Actually I think that is right $x=y=0$ does not work. I will edit me answer later @ötarcan Jan 17 '17 at 22:53

You can formalize this by using the target function $f(x,y,z)=z$ and equality constraints $g(x,y,z) = x+y+z-5=0$ and $h(x,y,z) = xy+yz+zx-3=0$. You can use the method of Lagrange-multiplier. Namely solving the (unconstraint) optimization-problem $$\mathcal{L}(x,y,z,\lambda_1, \lambda_2) = f(x,y,z) + \lambda_1 \cdot g(x,y,z) + \lambda_2\cdot h(x,y,z) \\ =z + \lambda_1 \cdot (x+y+z-5) + \lambda_2 \cdot (xy +yz+zx-3)$$ You know have two more variables but are unconstrained. Solve this by finding all fives partial derivatives to zero and you find your critical point.