I am from engineering background and I am currently studying calculus. I had a question from assignment to be solved from a course on coursera but I could not do it. People have posted solution in the discussion but I cannot understand it. The question is as follows:

Minimize the following function using the Lagrangean method: \begin{cases} f(x,y) = 6x+\frac{96}{x}+\frac{4y}{x}+\frac{x}{y}\\ x+y=6 \end{cases} Can anyone help me in understanding the approach of how to apply Lagrangean method here. Thank you.

  • $\begingroup$ Do you know how to apply it in any other problem or is this your first one? $\endgroup$ – Git Gud Apr 10 '14 at 14:24
  • $\begingroup$ I know how to apply it on problems where the variables are not there in the denominator. $\endgroup$ – Bhoot Apr 10 '14 at 14:28
  • $\begingroup$ Here, when i differentiate the equations, there are square terms present in the denominator. I don't know how to tackle those for finding minima. $\endgroup$ – Bhoot Apr 10 '14 at 14:29
  • $\begingroup$ The computations seem annoying. I don't have time right now to go over them. If no one helps you, I'll give it a try tomorrow. $\endgroup$ – Git Gud Apr 10 '14 at 14:38
  • $\begingroup$ If using $y=x−6$ isn't working out, maybe you can try using $1+\dfrac yx=\dfrac 6x$. You got a lot of similar terms in the equations, that might help. $\endgroup$ – Git Gud Apr 10 '14 at 14:51

You can learn the method of Lagrange multipliers here and here. Maybe, the second link is more useful for you because it is using a problem-solving approach.

In your case, you have: $$ f(x,y)=6x+\frac{96}{x}+\frac{4y}{x}+\frac{x}{y} $$ and $$ g(x,y)=x+y=6. $$ Now, applying the method of Lagrange multipliers. $$ \Lambda(x,y,\lambda)=f(x,y)-\lambda(g(x,y)-6). $$ It turns to be $$ \begin{align} \frac{\partial f}{\partial x}&=\lambda\frac{\partial g}{\partial x}\\ 6-\frac{96}{x^2}-\frac{4y}{x^2}+\frac{1}{y}&=\lambda\tag1 \end{align} $$ and $$ \begin{align} \frac{\partial f}{\partial y}&=\lambda\frac{\partial g}{\partial y}\\ \frac{4}{x}-\frac{x}{y^2}&=\lambda.\tag2 \end{align} $$ This part is just a technical matter, you can learn here. Multiply $(1)$ by $x$ and $(2)$ by $y$, you will have $$ 6x-\frac{96}{x}-\frac{4y}{x}+\frac{x}{y}=\lambda x\tag3 $$ and $$ \frac{4y}{x}-\frac{x}{y}=\lambda y.\tag4 $$ Adding $(3)$ and $(4)$, you will obtain $$ \begin{align} 6x-\frac{96}{x}&=\lambda (x+y)\\ 6\left(x-\frac{16}{x}\right)&=\lambda (6)\\ x-\frac{16}{x}&=\lambda.\tag5 \end{align} $$ Now, using $(2)$, $(5)$, and $g(x,y)$, you can obtain the value of $x$ and $y$ and then plugging in the result $(x,y)$ to $f(x,y)$. I leave it the rest for you. I hope this helps.


$$\Large\color{blue}{\text{# }\mathbb{Q.E.D.}\text{ #}}$$


So here, our constraint is $x + y = 6$. So what we do is define a function $L(x, y, \lambda) = f(x, y) - \lambda(x + y - 6)$. This gives us the $(x, y)$ solutions that maximize $f(x,y)$.

So by our first derivative test, we need to now when $\nabla L = (0, 0, 0)$. So we take partial derivatives with respect to $x, y, \lambda$ and set them to $0$.

So: $\frac{\partial L}{\partial x}: 6 - \frac{96 - 4y}{x^{2}} + \frac{1}{y} - \lambda = 0$
$\frac{\partial L}{\partial y}: \frac{4}{x} - \frac{x}{y^{2}} - \lambda = 0$
$\frac{\partial L}{\partial \lambda}: $x + y = 6$.

So now you solve these equations. The solutions are candidates to check to maximize $L(x, y, \lambda)$. The solution(s) you find also maximize $f(x, y)$.

Edit: So if $y = x - 6$, we have:
$\frac{\partial L}{\partial x}: 6 - \frac{96 - 4x + 24}{x^{2}} + \frac{1}{x - 6} - \lambda = 0$.

$\frac{\partial L}{\partial y}: \frac{4}{x} - \frac{x}{(x-6)^{2}} - \lambda = 0$

So it's algebra from here.

  • $\begingroup$ Haha. This is where the problems start. How do I solve from here. I had done and submitted this much. I got zero. $\endgroup$ – Bhoot Apr 10 '14 at 14:35
  • $\begingroup$ Bhoot- I would do a substitution here on the third constraint and go from there. Git Gud- Thanks for the catch! Early morning mistake. $\endgroup$ – ml0105 Apr 10 '14 at 14:43
  • $\begingroup$ Can u please elaborate a little more. I did not get it. $\endgroup$ – Bhoot Apr 10 '14 at 14:49
  • $\begingroup$ By the third constraint we have $x + y - 6 = 0$. So $x + y = 6$, and we get $y = 6 - x$. Substitute this into the first two constraints. $\endgroup$ – ml0105 Apr 10 '14 at 14:57
  • $\begingroup$ Hehe. Too tricky for me. Giving up now. $\endgroup$ – Bhoot Apr 10 '14 at 15:09

enter image description here

I get a maximum at $(4,2)$ of 48 for $f(x,y)$ , and a minimum at $(-4.45181,10.45181)$ of -49.0838 for $f(x,y)$ . As you can see from the picture these are critical points, not global maxima or minima -- just local maxima and minima. The picture is easier to look at if you just grab it down from the screen. The actual problem was to minimize f, but my picture doesn't show that so well. From below the situation looks similar.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.