# Thread: Lagrange Multipliers with two constraings

1. ## Lagrange Multipliers with two constraings

Describe the maximum value of OP, O being the origin of co ordinates where P describes the curve $x^2 + y^2 + 2z^2 = 5, x+2y+z = 5.$

While solving the problem, taking $G(x,y,z, \lambda_{1}, \lambda_{2}) = x^2 + y^2 + z^2 + \lambda_{1} (x^2 + y^2 + 2z^2 - 5) + \lambda_{2} (x+2y+z - 5)$ and framing the differential equations by differentiating $\ G$ with respect to $\ x, \ y, \ z, \lambda_{1}, \lambda_{2}$ and solving, I get the following relations: $x = \lambda, \ y = 2 \lambda, \ z = - \lambda$ where $\lambda = \frac{- \lambda_{2}}{2(1+\lambda_{1})}$

Now I have $\ x, \ y, \ z$ as functions of one variable and I have to satisfy two constraints. How is it possible? Where is my understanding of Lagrange's Multipliers flawed?

2. Wait, by saying "Describe the maximum value of OP..." do you mean find the maximum distance between O and the curve P? Also, you have written the two equations separated by a comma. By that I'm assuming you mean that P is the intersection?

By looking at G = ... I think I'm seeing the distance OP squared + the two constraints? I don't know how you do L Multipliers but the way I've learned is this:

You set $F(x,y,z) = x^2+y^2+z^2$ (if that's the distance squared).
Then set $G(x,y,z) = x^2+y^2+2z^2$ (from the first constraint)
Then set $H(x,y,z) = x+2y+z$ (from the second constraint)

Then you have to solve the system of equations:

$\displaystyle \nabla \Grad F(x,y,z) = \lambda_1 \nabla G(x,y,z) + \lambda_2 \nabla H(x,y,z)$
$\displaystyle G(x,y,z) = 5$
$\displaystyle H(x,y,z) = 5$

These become

$2x = 2x\lambda_1 + \lambda_2$
$2y = 2y\lambda_1 + 2\lambda_2$
$2z = 4z\lambda_1 + \lambda_2$
$x^2 + y^2 + 2z^2 = 5$
$x + 2y + z = 5$

Solve the first 3 equations in terms of x,y and z to get

[LaTeX ERROR: Compile failed]
[LaTeX ERROR: Compile failed]
[LaTeX ERROR: Compile failed]

These are not all the same! Then you plug them in the last two equations and simplifying a bit, you get

$\displaystyle \frac{\lambda_2^2}{4}\left(\frac{2}{(1-2\lambda_1)^2}+\frac{5}{(1-\lambda_1)^2}\right) = 5$
$\displaystyle \frac{\lambda_2(6-11\lambda_1)}{2-6\lambda_1+4\lambda_1^2} = 5$

Which is not very nice to solve.

3. I've learnt to do the Lagrange Multiplier differently but in essence its the same. I got the same set of equations as yours, but while solving them, I made algaebric mistakes which led me to get an expression for $z$ as $z = - \frac{\lambda_{2}}{\2(1+\lambda_{1})}$ which made me assume that $x, y, z$ are proportional to the constant $\frac{\lambda_{1}}{\2(1+\lambda_{2})}$. I'm sorry!

Do you know a better way to solve the equations? I always get x, y, z in terms of the constant and solve by plugging them in the constraint equations

4. Hey, don't be sorry! It's ok to make mistakes. Now that you've found them it should be easy to solve the equations. Make sure to post the two lambdas when you find them. And don't forget that there may be sneaky lambdas out there that will add a solution.

5. Because the values of the multipliers, $\lambda_1$ and $\lambda_2$ in this problem, are NOT part of the solution, I find it is often best to eliminate them first by dividing one equation by another.

for example, we have $2x= 2x\lambda_1+ \lambda_2$ and $2y= 2y\lambda_1+ 2\lambda_2$ which we can rewrite as $2x(1- \lambda_1)= \lambda_2$ and $2y(1- \lambda_1)= 2\lambda_2$. Dividing the first equation by the second, we have $\frac{2x(1- \lambda_1)}{2y(1- \lambda_1)}= \frac{\lambda_2}{2\lambda_2}$ which reduces to $\frac{x}{y}= \frac{1}{2}$ or y= 2x.

Putting y= 2x into $x^2+ y^2+ 2z^2= 5$ gives $x^2+ 4x^2+ 2z^2= 5x^2+ 2z^2= 5$ and putting it into $x+ 2y+ z= 5$ gives $x+ 4x+ z= 5x+ z= 5$. From the second, z= 5- 5x= 5(1- x). Putting that into $5x^2+ 2z^2= 5$ we have $5x^2+ 50(1- 2x+ x^2)= 51x^2- 100x+ 50= 5$ or $51x^2- 100x+ 45= 0$.

Solve that quadratic equation and then set y= 2x, z= 5- 5x.