<s>[INST] 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.
 [/INST] $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$.
</s>