$f(x, y, z)$ with both $\leq$ and $=$ constraints. General questions.

156 Views Asked by At

I need to ask you for this question, which is a rather general one, in order to understand how to behave when studying maxima and minima with constraints, in many variables. The specific question is the following: suppose I have some $f(x, y, z)$ (in this case I'm specifically asking for three variables) subject to two constraint: $$ \begin{cases} g(x, y, z) \leq 0 \\\\ h(x, y, z) = 0\end{cases}$$

  • Question: I use Langrange multipliers in the usual way, by building the Lagrangian

$$L(x, y, z, \lambda, \mu) = f(x, y, z) - \lambda g(x, y, z) - \mu h(x, y, z)$$

(then I know how to proceed).

Say I will be able to reduce the problem to a two dimensiona one, and I cannot go further than this. Then I study $\nabla f(x, y) = (0, 0)$ and I hopefully find some points. What now? Should I use them to find the third point $z$ by using the constraints, or should I study $f(x, y)$ with the Hessian matrix?

Thank you!

AN EXAMPLE

Just to make things more concrete, I thought to write here an example for what I meant. Say $$f(x, y, z) = xyz$$

Subject to $$\begin{cases} x^2+y^2+z^2 \leq 1 \\\\ x+y+z = 1 \end{cases}$$

So a sphere and a plane, which intersect to form a cicumference.

$$L(x, y, z, \lambda, \mu) = xyz - \lambda(x^2+y^2+z^2-1) - \mu(x+y+z-1)$$

And the derived equations read

$$ \begin{cases} yz = 2\lambda x + \mu \\ xz = 2\lambda y + \mu \\ xy = 2\lambda z + \mu \\ \text{the two constraints} \end{cases} $$

I was able to write down:

$$\mu = zy - 2\lambda x$$ hence from arranging the second with this one:

$$\lambda = \frac{-z}{2}$$

And then subtituting all in the third:

$$xy = -z^2 + zy + zx$$

Using the second constraint for $z \to z = 1-x-y$ I conclude with

$$f(x, y) = 2x^2+ 2y^2-3x-3y+xy +1$$

So at this point: $\nabla f(x, y) = (0, 0)$ gives the points

$$x = 0 \qquad \qquad y = 0$$

$$x = \frac{3}{5} \qquad \qquad y = \frac{3}{5}$$

and fron this, question two: should I find $z$ and then simply evaluate $f$ on this points, or should I go on with $f(x, y)$ with eh Hessian?

  • Bonus question: am I reasoning right or wrong? Am I missing something?

EDIT

I understood that with mixed constraints I have to set up Kuhn Tucker conditions. So I did it and the result reads:

$$\begin{cases} x^2+y^2+z^2 -1 \leq 0 \\ x+y+z-1 = 0 \\ \lambda(x^2+y^2+z^2-1) = 0 \\ \lambda \geq 0 \\ \nabla L = 0 \end{cases} $$

And the last one, creating

$$L(x, y, z, \lambda, \mu) = xyz - \lambda(x^2+y^2+z^2-1) -\mu(x+y+z-1) $$

then reads

$$\begin{cases} yz - 2\lambda x-\mu = 0 \\ xz - 2\lambda y - \mu =0 \\ xy - 2\lambda z - \mu = 0 \end{cases} $$

Now, for the case $\lambda = 0$, all beautiful, I solve and obtain the point

$\left(\frac{1}{3}, \frac{1}{3}, \frac{1}{3}\right)$

Which shoudl be a max (?)

When $\lambda \neq 0$ the mess starts.

Arranging, I obtain $\lambda = -\frac{z}{2}$, which results in

$$z^2 - z(x+y) + xy = 0$$

And using th constraints I can reduce it to

$$3xy - x - y+1 = 0$$

And I am stuck.

If I try the gradient, I get the same points I got above.

W. Mathematica says

$(\text{ at } x,y,z) \left(\min \left\{x y z\left|x^2+y^2+z^2\leq 1\land x+y+z=1\right.\right\}=-\frac{4}{27}\right)=\frac{2}{3},\frac{2}{3},-\frac{1}{3}$

And at two other very similar points, but $z$ is not negative in those ones...

2

There are 2 best solutions below

2
On

Let us solve the proposed example using the Lagrange multipliers technique. This technique should be used only on regular differentiable manifolds. The restriction $x^2+y^2+z^2\le 1$ is not differentiable at the boundary so we will use an equivalent restriction introducing a slack variable $s$ as $x^2+y^2+z^2+s^2 = 1$. Now the lagrangian reads:

$$ L(x,y,z,\lambda,\mu,s) = x y z + \lambda(x^2+y^2+z^2+s^2 - 1)+\mu(x+y+z-1) $$

and the stationary points are the solutions for

$$ \nabla L = 0 = \cases{yz + 2\lambda x+\mu \\ x z + 2\lambda y + \mu \\ x y + 2\lambda z + \mu\\ x^2+y^2+z^2+s^2 - 1\\ x+y+z-1 \\ \lambda s } $$

six equations and six unknowns. Solving we have

$$ \left[ \begin{array}{ccccccc} xyz&x&y&z&\lambda&\mu&s^2\\ -\frac{4}{27} & -\frac{1}{3} & \frac{2}{3} & \frac{2}{3} & \frac{1}{3} & -\frac{2}{9} & 0 \\ -\frac{4}{27} & \frac{2}{3} & -\frac{1}{3} & \frac{2}{3} & \frac{1}{3} & -\frac{2}{9} & 0 \\ -\frac{4}{27} & \frac{2}{3} & \frac{2}{3} & -\frac{1}{3} & \frac{1}{3} & -\frac{2}{9} & 0 \\ 0 & 0 & 0 & 1 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 & 0 & 0 & 0 \\ \frac{1}{27} & \frac{1}{3} & \frac{1}{3} & \frac{1}{3} & 0 & -\frac{1}{9} & \frac{2}{3} \\ \end{array} \right] $$

As we can observe, the maximum is internal to the feasible region ($s \ne 0$). Attached a plot showing the objective function level curves over the plane $x+y+z=1$ as well as the stationary points location (in red).

NOTE

The lagrangian approach gives us the stationary points which need qualification. In our solution, the first three points are local minima, the following three are saddle points (local maxima over the boundary) and the last represents a maximum. The points located at the boundary can be qualified according to the simplification of

$$ \cases{f = x y z\\ x^2+y^2+z^2=1 \\ x+y+z = 1} $$

giving $f = (z-1)z^2$, etc.

enter image description here

0
On

As I suggested in a comment and was also the option in another answer we can can add a new variable to transform all constraints in equalities. Specifically, we would be searching for extrema of $f(x,y,x,s) = xyz$ in the set $$ M =\{(x,y,z,s)\in \mathbb{R}^4: x^2+y^2+z^2+s^2=1, x+y+z=1 \}. $$

Since $f$ is continuous and $M \subset \mathbb{R}^4$ is a compact set, $f$ will attain global maximum and minimum on $M$. Further more, since all involved functions are regular enough and the rank of $$ J = \begin{pmatrix} 2x & 2y & 2x & 2s\\ 1 & 1 & 1 & 0 \end{pmatrix} $$

is maximal (=2) for any point in $M$, these global extrema will occur in stationary points of the Lagrangian $$ L(x,y,z,s,\lambda_1, \lambda_2) = xyz -\lambda_1(x^2+y^2+z^2+s^2-1) - \lambda_2(x+y+z-1). $$

These stationary points are the solutions of $$ \begin{cases} yz-2x\lambda_1-\lambda_2 = 0\\ xz-2y\lambda_1-\lambda_2 = 0\\ xy -2z\lambda_1-\lambda_2 = 0\\ -2s \lambda_1 = 0\\ x^2+y^2+z^2+s^2=1\\ x+y+z=1 \end{cases} $$

If $\lambda_1=0$, you get the points $$ (0,1,0); (1,0,0); (0,0,1);\left(\frac 13, \frac 13, \frac 13 \right).$$

If $s=0$, you get no real solutions. In conclusion, the global maximum is 1 and is attained at the points $(1,0,0), (0,1,0),(0,0,1)$ and the global minimum is $\frac{1}{27}$ and is attained at the point $(\frac 13, \frac 13, \frac 13)$.