# Find $x,y,z>0$ such that $x+y+z=1$ and $x^2+y^2+z^2$ is minimal

How can I find $3$ positive numbers that have a sum of $1$ and the sum of their squares is minimum?

So far I have:

$$x+y+z=1 \qquad \implies \qquad z=1-(x+y)$$ So, $$f(x,y)=xyz=xy(1-x-y)$$

But I'm stuck from here. Hints?

• Note: the header and text references the "sum of their squares" but the question itself appears to refer to the product $xyz$. – lulu Dec 12 '15 at 13:50
• @lulu that was my attempt, it could very well be incorrect – hax0r_n_code Dec 12 '15 at 13:50
• Got it. In looking at the posted solutions, be sure to check the boundary ($x,y,z≥0$). It is true that in this case Lagrange does identify the minimum, but a priori that is not obvious. – lulu Dec 12 '15 at 13:54

$x \mapsto x^2$ is a convex function. By Jensen's inequality,

$$x^2+y^2+z^2 = 3\left(\frac{x^2+y^2+z^2}{3}\right) \ge 3\left(\frac{x+y+z}{3}\right)^2 = 3\left(\frac{1}{3}\right)^2 = \frac13$$

Since the equality $x^2+y^2+z^2 = \frac13$ is achieved at $x = y = z = \frac13$, this is the solution you seek.

If you want a more elementary approach, you can use the fact

\begin{align} x^2 + y^2 + z^2 =& \left(x-\frac13+\frac13\right)^2 + \left(y-\frac13+\frac13\right)^2 + \left(z -\frac13 + \frac13\right)^2\\ =& \left(x-\frac13\right)^2 + \left(y-\frac13\right)^2 + \left(z -\frac13\right)^2\\ &+ \frac23\left[\left(x-\frac13\right) + \left(y-\frac13\right) + \left(z -\frac13\right)\right] + 3\left(\frac13\right)^2\\ =& \left(x-\frac13\right)^2 + \left(y-\frac13\right)^2 + \left(z -\frac13\right)^2 + \frac13 \end{align} to arrive at same conclusion.

By Cauchy-Schwarz, for every $x,y,z\in\Bbb R$ we have $$x+y+z=\langle(1,1,1),(x,y,z)\rangle \leq \left\|(1,1,1)\right\|_2\cdot \|(x,y,z)\|_2=\sqrt{3}\cdot \sqrt{x^2+y^2+z^2}$$ Now, if $x+y+z=1$, then squaring both sides and dividing by $3$ gives $$\frac{1}{3}\leq x^2+y^2+z^2$$ This lower bound is then attained for $|x|=|y|=|z|=1/3$.

• definitely the most elegant way. – Kuifje Dec 12 '15 at 17:38

By elementary geometry. You are looking for a point on the plane given by $x+y+z=1$ that is closest to the origin, which means that the vector $(x,y,z)$ from the origin to that point is a normal vector to the plane. This happens if $x=y=z$, which gives you three independent linear equations in $x,y,z$ to solve.

Lagrange multipliers? So $f(x,y,z,\lambda) = x^2 + y^2 + z^2 - \lambda(x+y+z-1)$.

So critical points obey: $2x - \lambda = 0, 2y - \lambda = 0, 2z - \lambda = 0, x+y+z-1 = 0$. So $x = y = z = \frac{1}{3}$, which gives sum of squares $\frac{1}{3}$.

• Thank you, but I'm not understanding how you got $\frac{1}{3}$? – hax0r_n_code Dec 12 '15 at 13:53
• @free_mind $(\frac{1}{3})^2 + (\frac{1}{3})^2 +(\frac{1}{3})^2 = \frac{3}{9} = \frac{1}{3}$. – Henno Brandsma Dec 12 '15 at 13:59
• This is not a solution. You need to understand what happens in the critical points; what if they were local maxima, or saddle points? – Federico Poloni Dec 13 '15 at 7:36

$x+y+z = 1$ is a plane intersecting the positive quadrant in an equilateral triangle through $(0,0,1), (0,1,0), (1,0,0)$. Minimising the sum of squares of the numbers corresponds to finding the point in the triangle closest to the origin. By symmetry, $x=y=z=\dfrac{1}{3}$.

$$f(x,y)=x^2+y^2+(1-x-y)^2$$ $$\frac{\partial f}{\partial x}=2x+2(1-x-y)(-1)=0\tag 1$$ $$\frac{\partial f}{\partial y}=2y+2(1-x-y)(-1)=0\tag 2$$ by subtracting $$x=y$$ substitute in 1 to get $$x=\frac{1}{3}$$ so $$y=\frac{1}{3}$$ and then $$z=1-x-y=\frac{1}{3}$$ to check the critical point, we can reduce the original function, which has three variables, to one varible as follow $$f(x)=x^2+x^2+(1-x-x)^2=2x^2+(1-2x)^2$$ it is very easy to find the critical point if there is one variable

• How would reducing to one variable help "to check the critical point"? I believe that it is not a substitute for a proper analysis. – Federico Poloni Dec 13 '15 at 7:37
• I guess E.H.E means that after reducing to one variable, we have a very easily analyzed quadratic function in one variable. – justhalf Dec 14 '15 at 2:11
• @justhalf Yes, but analyzing that function doesn't tell you whether the point is a minimum or a maximum (or something else) of the original function. – Federico Poloni Dec 14 '15 at 10:15

You want to minimize:

$$min ~ x^2 + y^2 +z^2$$

With restrictions:

$$x,y,z \ge 0$$ $$x + y +z=1$$

Now to solve this problem you can apply the method of Lagrange multipliers and minimize:

$$x^2+y^2+z^2+ \lambda (x+y+z-1))$$

Restating:

Find x,y,z such that the squared distance from the origin $d^2 := x^2 + y^2 + z^2$ to the plane $g(x,y,z) = x+ y+ z - 1 = 0$ is minimal.

The gradient of g(x,y,z) is a vector normal to the surface at ( x,y,z).

A normal to the plane:

$\nabla g= (\frac{\partial g}{\partial x},\frac{\partial g}{\partial y}, \frac{\partial g}{\partial z}) = (1,1,1)$.

Consider a vector $\vec{r} = a (1,1,1)$ from (0,0) to the plane.

The vector components satisfy $x + y + z - 1 = 0,$

$a + a + a - 1 = 0 ,$

$a = 1/3.$

$\vec{r} = a (1,1,1) = (1/3,1/3,1/3)$, i.e.

$x = y = z = 1/3.$

The min value:

$d^2 = x^2 + y^2 + z^2 = 1/3$.

Another way to see that the optimum is attained at a constant vector is via majorization and the Karamata inequality.

Credit for pointing this out goes to @zeb in this answer to a question of mine.

By C-S $$3(x^2+y^2+z^2)=(1+1+1)(x^2+y^2+z^2)\geq(x+y+z)^2=1.$$ Thus, $x^2+y^2+z^2\geq\frac{1}{3}$.

The equality occurs for $x=y=z=\frac{1}{3}$, which is also the answer.