Mistake in my NLP using Lagrange Multipliers?

413 Views Asked by At

I have the following NLP

\begin{matrix}\text{Minimize:} &x^2+y^2+z^2 \\ \text{Subject To:} & x+2y+z-1=0 \\ &2x -y -3z-4=0\end{matrix}

I need to solve this using the Lagrange Multiplier Method.

My attempt:

$$L(x,y,z,\lambda_1, \lambda_2) = x^2+y^2 +z^2 +\lambda_1(x+y+z-1) + \lambda_2(2x -y-3z-4)$$

Now we need to solve the following system of equations \begin{align}\nabla L(x,y,z,\lambda_1,\lambda_2) &= \bar{0} \\\therefore\begin{bmatrix}2x+\lambda_1 + 2\lambda_2 \\ 2y+2\lambda_1-\lambda_2 \\2z+\lambda_1-3\lambda_2 \\ x +2y+z-1 \\ 2x-y-3z-4\end{bmatrix}&=\begin{bmatrix}0\\0\\0\\0\\0\end{bmatrix}\end{align}

Now, I know that you can use matrix methods in order to solve this, but I tried to do it manually as follows:

From the first three lines we get \begin{align}x &=\frac{-\lambda_1-2\lambda_2}{2} \\ y &= \frac{-2\lambda_1 + \lambda_2}{2}\\ z &=\frac{-\lambda_1 + 3\lambda_2}{2}\end{align}

Now substituting this into the fourth equation \begin{align}\bigg(\frac{-\lambda_1-2\lambda_2}{2}\bigg)+2\bigg(\frac{-2\lambda_1 + \lambda_2}{2}\bigg) + \bigg(\frac{-\lambda_1 + 3\lambda_2}{2}\bigg)-1 &=0 \\ \therefore -6\lambda_1 + 3\lambda_2 -2 &=0 \\ \therefore \lambda_2 &= \frac{2+6\lambda_1}{3}\end{align}

Substituting $x,y,z$ into our fifth equation gives \begin{align}2\bigg(\frac{-\lambda_1-2\lambda_2}{2}\bigg) - \bigg(\frac{-2\lambda_1 + \lambda_2}{2}\bigg) -3\bigg(\frac{-\lambda_1 + 3\lambda_2}{2}\bigg) -4 &=0 \\ \therefore 6\lambda_1 -23\lambda_2 -8 &=0\end{align} Substituting for $\lambda_2$ as calculated earlier this becomes \begin{align}-40\lambda_1 - \frac{70}{3} &=0 \\ \therefore \lambda_1 &= -\frac{7}{12}\end{align} Hence we also get that $$\lambda_2 = -\frac{1}{2}$$

Which we can then use to get our final answers of $$(x,y,z)= \bigg(\frac{19}{24},\frac{1}{3},-\frac{11}{24}\bigg) $$

However, the problem is, when I substitute these values back into my original constraints, the first one is satisfied perfectly, however, the second equality contraint fails to hold. I cannot seem to think where I went wrong?

1

There are 1 best solutions below

0
On BEST ANSWER

The right values (solving the system by row reduction) are $$ x=\frac{16}{15},\ y=\frac13\, z=-\frac{11}{15},\ \lambda_1=-\frac{52}{75},\ \lambda_2=-\frac{18}{25}. $$

Plugging the values you can check that you made a mistake in your second equation for the lambdas. It should have been $$ 3\lambda_1-14\lambda_2-8=0. $$