# Optimize $xyz$ where $x+y+z=1$ and $x^2+y^2+z^2=1$?

Im trying to optimize

$$f(x,y,z)=xyz$$ restricted to $$g(x,y,z)=x+y+z=1$$ and $$h(x,y,z)=x^2+y^2+z^2=1$$.

$$∇f=(yz,xz,xy)$$, $$∇g=(1,1,1)$$ and $$∇h=(2x,2y,2z)$$.

I tried using the determinant $$det(∇f,∇g,∇h)=yz(2z-2y)-xz(2z-2x)+xy(2y-2x)=0$$ which I dont know what to do with and I cant simplify the determinant in a good way with row operations.

I also tried solving $$z$$ from $$g=1$$. $$z=1-x-y$$.

$$f(x,y,1-x-y)=xy-x^2y-xy^2$$ restricted to $$h(x,y)=2x^2+2y^2-2x-2y+2xy+1$$ with Lagrange multiplier but I made no progress there either as the partial derivatives got too messy.

• The Lagrange multiplier method is effective. See my answer. Jun 25 at 20:21

Another possible approach is noticing that the intersection of the sphere and the plane produces a circle which can be parametrized by the equation $$\left(\frac{1-\sqrt{3}\cos(t)+\sin(t)}{3},\frac{1+\sqrt{3}\cos(t)+\sin(t)}{3},\frac{1-2\sin(t)}{3}\right)\qquad t\in[0,2\pi].$$ Now plugging this into the function gives $$f(t)=-\frac{2}{27}\cdot \left(4 \sin^3(t) - 3 \sin(t) + 1\right)=\frac{2}{27}\cdot \left(\sin(3t)-1\right)\qquad t\in[0,2\pi]$$ which is a function in just one variable that can be simply optimized.

$$z = 1-x-y\implies f(x,y,z) = xyz = xy(1-x-y)=xy-xy(x+y)=g(x,y)$$, subject to: $$x^2+y^2+(1-x-y)^2 = 1$$, or $$2(x^2+y^2)-2x-2y+2xy=0$$, or $$x^2+y^2-x-y+xy=0$$, or $$(x+y)^2-xy-(x+y)=0\implies g(x,y) = xy(1-(x+y))=((x+y)^2-(x+y))(1-(x+y))=(x+y)^2-(x+y)^3-(x+y)+(x+y)^2 = -t^3+2t^2-t,t = x+y$$. Observe that: $$(x+y)^2 - (x+y) = xy \le \dfrac{(x+y)^2}{4}\implies t^2-t \le \dfrac{t^2}{4}\implies 3t^2-4t \le 0 \implies t(3t-4) \le 0\implies 0 \le t \le \dfrac{4}{3}$$. Thus the problem boils down to finding the max and min of $$h(t) = -t^3+2t^2-t, 0 \le t \le \dfrac{4}{3}$$. You have: $$h'(t) = -3t^2+4t-1 = 0\implies (-3t+1)(t-1) = 0\implies t = \dfrac{1}{3}, 1$$. Evaluating $$h$$ at end points and at critical points: $$h(0) = 0, h(\frac{4}{3})= -\dfrac{4}{27}, h(1) = 0, h(\frac{1}{3}) = -\dfrac{4}{27}$$. This shows that the min value is $$-\dfrac{4}{27}$$, and the max value is $$0$$.

The Lagrange multiplier method is effective for this problem. First of all observe that the case $$x=y=z$$ is inadmissible. By symmetry we may assume that $$z\neq x$$ and $$z\neq y.$$ We have to solve for $$\nabla(xyz)=\lambda \nabla(x+y+z)+\mu\,\nabla(x^2+y^2+z^2)$$ i.e. $$\begin{eqnarray*} yz &=& \lambda +2\mu x\\ xz &=& \lambda +2\mu y \\ xy &=& \lambda +2\mu z \end{eqnarray*}$$ Subtracting the third equation from the first two ones gives $$\begin{eqnarray*}y(z-x)=-2\mu(z-x)\\ x(z-y)=-2\mu(z-y) \end{eqnarray*}$$ Therefore $$x=y.$$ We thus get $$2x+z=1,\quad 2x^2+z^2=1$$ This leads to two solutions $$x=y=0,$$ $$z=1$$ and $$x=y={2\over 3},$$ $$z=-{1\over 3}.$$ Thus $$M=0,\qquad m={2\over 3}\cdot {2\over 3}\cdot \left (-{1\over 3}\right )=-{4\over 27}$$

Notice that $$1=1^2=(x+y+z)^2=x^2+y^2+z^2+2(xy+yz+xy)=1+2(xy+yz+xy)$$

Solving for the products, we learn all elementary symmetric polynomials in $$(x,y,z)$$: \begin{align*} x+y+z&=1 \\ xy+xz+yz&=0 \\ xyz&=f \end{align*} where $$f$$ is what we want to maximize. By Vietá's formulae, $$x$$, $$y$$, and $$z$$ are the roots of $$g(t)=t^3-t^2-f=0$$

We must maximize $$f$$ so that $$g$$ has $$3$$ real roots. To do this, analyze $$g$$ geometrically.

At local extrema, $$0=g'(t)=3t^2-2t=t(3t-2)$$ There are two extrema: one at $$0$$ and one at $$\frac{2}{3}$$. Since $$g(t)$$ is increasing at large $$|t|$$, the former extremum is a maximum; the latter a minimum.

Thus $$g$$ has three real roots iff $$g(0)\geq0\geq g\left(\frac{2}{3}\right)$$ From the left-hand inequality, $$f\leq0$$, which is clearly sharp (take $$x=y=0$$, $$z=1$$).

The intersection locus of the sphere $$x^2 + y^2 + z^2 = 1$$ and the plane $$x + y + z = 1$$ is a circle with center at $$(\dfrac{1}{3}, \dfrac{1}{3}, \dfrac{1}{3})$$ and radius $$\sqrt{\dfrac{2}{3}}$$ spanned by the orthogonal unit vectors

$$u_1 = \dfrac{1}{\sqrt{2}} (1, -1, 0)$$

and

$$u_2 = \dfrac{1}{\sqrt{6}} (1, 1, -2 )$$

Therefore, the circle parametrically is given by $$q(t) = (x(t), y(t), z(t))$$ where

$$x(t) = \dfrac{1}{3} + \dfrac{1}{\sqrt{3}} \cos(t) + \dfrac{1}{3} \sin(t)$$

$$y(t) = \dfrac{1}{3} - \dfrac{1}{\sqrt{3}} \cos(t) + \dfrac{1}{3} \sin(t)$$

$$z(t) = \dfrac{1}{3} - \dfrac{2}{3} \sin(t)$$

It follows that

$$x(t) y(t) = \bigg( \dfrac{1}{3} (1 + \sin(t) ) \bigg)^2 - \dfrac{1}{3} \cos^2(t)$$

and this simplifies to

$$x(t) y(t) = - \dfrac{2}{9} + \dfrac{2}{9} \sin(t) + \dfrac{4}{9} \sin^2(t)$$

Multiplying by $$z(t)$$ gives

$$f(t) = x(t) y(t) z(t) = \dfrac{2}{27} (-1 + \sin(t) + 2 \sin^2(t) ) ( 1 - 2 \sin(t) ) \\ = \dfrac{2}{27} (2 \sin(t) - 1)(\sin(t) + 1 )(1 - 2 \sin(t) )$$

Let $$g(r) = (2 r - 1)(r + 1)(1 - 2r) = -(r + 1)(4 r^2 - 4 r + 1 ) = - (4 r^3 - 3 r + 1 )$$

$$g'(r) = - (12 r^2 - 3 ) = -3 ( 4 r^2 - 1)$$

Hence the the critical points are $$r = \pm \dfrac{1}{2}$$. And we have a local minimum at $$r = - \dfrac{1}{2}$$ where $$g(- \dfrac{1}{2}) = -2$$ and a local maximum at $$r = \dfrac{1}{2}$$ where $$g(\dfrac{1}{2}) = 0$$. And we also have $$g(-1) = 0$$ and $$g(1) = -2$$

Based upon all that, we deduce that

The maximum is $$0$$ and the minimum is $$\dfrac{-4}{27}$$