# Need help with Lagrange Multipliers

I need to maximize $U = BM$ with constraits:

$6B +3M = 60$, $B>0$ and $M>0$.

The Lagrange function is $L=U + \lambda (6B+3M-60) + KB + HM$.

So

$$\partial_{\lambda}L= 6B+3M-60=0$$ $$\partial_{K}L = B=0$$ $$\partial_{H}L = M=0$$ $$\partial_{M}L = \partial_{M} (BM) +\lambda(3+6\partial_{M}B)+K\partial_{M}B +H=((-0.5)M+B)-0.5K+H$$

where $B=\frac{60-3M}{6}$ so $\partial_{M}B = -\frac{1}{2}$. But I am confused here by constrait $B=0$ and $M=0$, they cannot be. How can I make sure $B$ and $M$ are non-negative?

-
What are $K$ and $H$? Also, why did $60$ change to $30$? – anon Oct 2 '11 at 1:10
@anon: lagrange terms for contraints? $B>0$ and $M>0$. Fixed the err. – hhh Oct 2 '11 at 1:11
@anon: Constraits are $3B+3M=60$ and $B,M>0$. With $K$ and $H$, I want to make sure $B$ and $M$ are positive. – hhh Oct 2 '11 at 1:37

Edit: I have finally figured out what you were trying to do. The method of Lagrange multipliers incorporates constraints that are equalities, not inequalities. What you tried to do was, in effect, tack on the extra conditions $B=0$ and $M=0$ to the problem, which makes it inconsistent. When you deal with inequalities you simply throw out whatever solutions to $\nabla\Lambda=0$ do not satisfy them.

A solution should go like the following (I have changed the numbers slightly so that it is not the same exact problem).

Problem. Maximize the function $U(B,M)=B\cdot M$ under the constraints $$g(B,M)=B+2M=20,\qquad B,M>0.$$

• Step 1. The Lagrange function is $$\Lambda(B,M,\lambda)=U(B,M)+\lambda \cdot (g(B,M)-20)$$ $$=BM+\lambda(B+2M-20).$$

• Step 2. Set $\nabla_{}\Lambda=0$: $$\nabla_{B,M,\lambda}\Lambda(B,M,\lambda)=(0,0,0),\text{ i.e.}$$ $$\frac{\partial\Lambda}{\partial B}=M+\lambda=0;$$ $$\frac{\partial\Lambda}{\partial M}=B+2\lambda=0;$$ $$\frac{\partial\Lambda}{\partial\lambda}=B+2M-20=0.$$

• Step 3. Set $B=-2\lambda,M=-\lambda$, derived from the second and first equations above respectively, then substitute them into the third equation and solve for $\lambda$: $$(-2\lambda)+2(-\lambda)-20=0$$ $$\implies \lambda=-5.$$

• Step 4: Plug in $\lambda=-5$ into $B$ and $M$'s expressions from last step to find $B=10$ and $M=5$.

• Step 5: Check the work. The answer gives two positive values that satisfy the original linear constraint. It gives a maximum value of $U(10,5)=50$, whereas $U$ at the endpoints $B=0$ and $M=0$ simply evaluate to $0$, much lower than $50$, therefore the answer is correct.

-
what about in a situation where you get negative values for $B$ and $M$? Yes, this is the point I have not understood. I have seen people considering all equalities and inequalities similarly. How do you handle the inequalities? Do you introduce slack variable and change the inequalies to equalities (a bit like in Simplex)? – hhh Oct 2 '11 at 2:17
@hhh: Within the scope of the method of Lagrange multipliers, if the only solutions to $\nabla\Lambda=0$ are ones that don't satisfy the inequalities, then there is no extrema strictly inside the region bounded by the inequalities. Therefore (a) if the inequalities are all strict (as is the case here), there is no solution, or (b) if all of the inequalities are nonstrict, you can use the simplex method (as I understand it, at least; that sort of optimization is outside my present knowledge). – anon Oct 2 '11 at 2:38
@hhh: No, my implication is correct inside the correctly understood setting. Within the method of Lagrange multipliers, $B$ and $M$ are continuous variables and therefore the objective function $U(B,M)$ might not have any maximum or minimum, but rather a supremum or infimum. Inside a discrete mathematics / linear programming type setting, $B$ and $M$ are discrete variables so the implication doesn't apply. – anon Oct 2 '11 at 2:59
@hhh: If you look at the function $f(x)=x$ with constraints $x>0$ & $x<5$ (strict inequalities), there is no maximum and no minimum - but the function has infinimum $0$ and supremum $5$. However, if you make the inequalities nonstrict ($x\ge0$, $x\le5$), the max/min exist and are respectively $0,5$. Likewise, if you restrict yourself to integer arguments (with strict inequalities again), $f(4)=4$ is the maximum and $f(1)=1$ is the minimum, but the method of Lagrange multipliers in the continuous setting doesn't apply to discrete optimization. – anon Oct 2 '11 at 5:26
And the way I understand it, maximize means finding the argument (input) corresponding to the maximum value the objective function takes (max output). So the first meaning you cite. – anon Oct 2 '11 at 5:32