3

The maximum value of the function

$$f(x, y, z) = \left(x -\frac{1}{3}\right)^2 + \left(y - \frac{1}{3}\right)^2 + \left(z - \frac{1}{3}\right)^2$$

subject to the constraints-

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

what is the actual method to find that ? it may be simple but i dont know , please help me to understand .

Macavity
  • 46,381
kumar
  • 291

3 Answers3

5

First expand the function:

$$f(x, y, z) = \left(x -\frac{1}{3}\right)^2 + \left(y - \frac{1}{3}\right)^2 + \left(z - \frac{1}{3}\right)^2$$

$$f(x, y, z) = x^2 - \frac 23 x + \frac 19 + y^2 -\frac 23 y + \frac 19 + z^2 - \frac 23 z + \frac 19$$

$$f(x, y, z) = x^2 + y^2 + z^2 - \frac 23 x - \frac 23 y - \frac 23z + \frac 13$$

To minimize/maximize a function with a given constain it's best to apply Lagrange multiplier. So after applying it the function will look like this:

$$F(x, y, z, \lambda) = x^2 + y^2 + z^2 - \frac 23 x - \frac 23 y - \frac 23z + \frac 13 + \lambda (x+y+z-1)$$

Now we take partial derivatives and we set them to $0$.

$$F_x = 2x - \frac 23 + \lambda = 0$$ $$F_y = 2y - \frac 23 + \lambda = 0$$ $$F_z = 2z - \frac 23 + \lambda = 0$$ $$F_{\lambda} = x + y + z -1 = 0$$

Now we get three relation:

$$x = y = z = \frac{\frac {2}{3} - \lambda}{2} = \frac{2-3\lambda}{6}$$

Plugging this into the fourth partial derivative relation we have:

$$x+y+z = 1$$ $$\frac{2-3\lambda}{6} + \frac{2-3\lambda}{6} + \frac{2-3\lambda}{6} = 1$$ $$3(2-3\lambda) = 6$$ $$6-3\lambda = 6$$ $$-3\lambda = 0 \implies \lambda = 0$$

This would imply that:

$$x = y = z = \frac 13$$

But this is the minima, because we have:

$$f(\frac 13, \frac 13, \frac 13) = 0$$

So because this is the only stationary point, the maxima must be on the boundary. And indeed the maxima occurs at these 3 point $$(x,y,z) = (1,0,0), (0,1,0), (0,0,1)$$ $$f(1,0,0) = f(0,1,0) = f(0,0,1) = \frac 23$$


Note that because all these terms are from the same form and we don't have terms of the for $xy$ in the expansion it means that the partial derivatives will have same forms, implying that at the stationary point we'll find the variables will all be the same.

When you check all statinary point in a certain region and you don't get what you want like in this case, then check the boundaries. In this case the region is bounded between $0$ and $1$ so we set one variable at a time to this boundaries and this becomes a 2 variable function which is much easier to maximize.

Stefan4024
  • 35,843
4

This is a smooth function defined in a closed interval and as such would achieve its maximum (and minimum) on the boundary or where the gradient is $0$. Calculus (particularly Lagrangian formulation) is an effective way to handle this. Other ways include using a suitable substitution (if you can find one), using suitable inequalities etc.

Here I will demonstrate the inequality way. WLOG, let $x \ge y \ge z$. We can show that $f(1, 0, 0) - f(x, y, z) \ge 0$.

$$f(1, 0, 0) - f(x, y, z) = \frac{2}{3} - \left(x -\frac{1}{3}\right)^2 - \left(y - \frac{1}{3}\right)^2 - \left(z - \frac{1}{3}\right)^2 \\ = \frac{1}{3} + \frac{2}{3}(x+y+z) - (x^2+y^2 + z^2) = 1 - (x^2+y^2 + z^2)$$

Now $x^2 + y^2 + z^2 \le (x+y+z)^2 = 1$ completes this proof. The maximum is $f(1, 0, 0) =\frac{2}{3}$ which is achieved on the boundary at $(x, y, z) = (1, 0, 0)$ or any permutation.

Macavity
  • 46,381
  • Great solution. Nice and simple solution, not using the much more complex Lagrange multiplier. – Stefan4024 Sep 15 '13 at 21:11
  • @Stefan4024 Thanks. Am partial to inequalities, though unfortunately they are not always so nice, and Lagrange saves the day. – Macavity Sep 15 '13 at 21:19
  • I would first apply Lagrange, because you know you can hardly make a mistake, but this is nice and elegant solution. The trick part is that there might be a boundary when the gradient is 0. – Stefan4024 Sep 15 '13 at 21:27
1

One way to do this would be to substitute $z=1-x-y$ into the function to get

$g(x,y)=\big(x-\frac{1}{3}\big)^2+\big(y-\frac{1}{3}\big)^2+\big(\frac{2}{3}-x-y\big)^2$, and then find the maximum of this function

on the region in the first quadrant bounded by $x=0, y=0$ and $y=1-x$.

Since the only local extremum inside the region is a minimum at $(1/3,1/3)$, the maximum will occur on the boundary.

user84413
  • 27,211