MHB Minimum of function under constraint

mathmari
Gold Member
MHB
Messages
4,984
Reaction score
7
Hey! :o

We want to minimize the function $g(x_1, x_2)=2x_1+ x_2$ under the constraint $f(x_1, x_2)=x_1\cdot x_2=18$.

\begin{equation*}x_1\cdot x_2=18 \Rightarrow x_1=\frac{18}{x_2}\end{equation*}

\begin{equation*}\tilde{g}(x_2)=g\left (\frac{18}{x_2}, x_2\right )=2\cdot \frac{18}{x_2}+ x_2= \frac{36}{x_2}+ x_2\end{equation*}

\begin{equation*}\tilde{g}'(x_2)=-\frac{36}{x_2^2}+1=\frac{-36+x_2^2}{x_2^2}\end{equation*}

\begin{equation*}\tilde{g}'(x_2)=0 \Rightarrow \frac{-36+x_2^2}{x_2^2}=0 \Rightarrow -36+x_2^2=0 \Rightarrow x_2^2=36 \Rightarrow x_2=\pm 6\end{equation*}

\begin{equation*}\tilde{g}''(x_2)=-\frac{36}{x_2^2}=\frac{72}{x_2^3}\end{equation*}

For $x=6$ we get $\tilde{g}''(6)=\frac{72}{6^3}=\frac{1}{3}>0$ and for $x=-6$ we get $\tilde{g}''(-6)=\frac{72}{-6^3}=-\frac{1}{3}<0$.

So, $\tilde{g}$ has a minimum at $x_2=6$.

The fuction $g$ has theerfore the minimum at $\left (\frac{18}{x_2}, x_2\right ) =(3, 6)$.

In Wolfram it says that this is the maximum.

What have I done wrong? (Wondering)
 
Last edited by a moderator:
Physics news on Phys.org
The function:

$$f(x)=\frac{36}{x}+x$$

has 2 local extrema, but we need to also look at the range, which is $(-\infty,-6]\,\cup\,[6,\infty)$. You correctly found the local minimum for $0<x$, bur the local maximum for $x<0$ is $-6$. :D
 
MarkFL said:
The function:

$$f(x)=\frac{36}{x}+x$$

has 2 local extrema, but we need to also look at the range, which is $(-\infty,-6]\,\cup\,[6,\infty)$. You correctly found the local minimum for $0<x$, bur the local maximum for $x<0$ is $-6$. :D

So, do we not get in this case the result using the second derivative test? (Wondering)
 
You also need to check the boundaries of the function, one of which is $x=0$, at which the function is discontinuous. Another way to find the range of the function $f$ I gave is by writing:

$$fx=36+x^2$$

$$x^2-fx+36=0$$

We then know (from the discriminant) that we require:

$$f^2-12^2\ge0$$

$$(f+12)(f-12)\ge0$$

Hence, we find $f$ is on:

$$(-\infty,-12]\,\cup\,\,[12,\infty)$$

In my haste earlier, I gave the incorrect range.

So, while $f$ has a local min. of $12$ at $x=6$, this is not the global minimum, as the left branch of the function lies wholly below that value, i.e. when $x<0$, then $-\infty<f\le-12$.
 
MarkFL said:
You also need to check the boundaries of the function, one of which is $x=0$, at which the function is discontinuous.

How do we find the boundaries? (Wondering)
MarkFL said:
Another way to find the range of the function $f$ I gave is by writing:

$$fx=36+x^2$$

$$x^2-fx+36=0$$

We then know (from the discriminant) that we require:

$$f^2-12^2\ge0$$

$$(f+12)(f-12)\ge0$$

Hence, we find $f$ is on:

$$(-\infty,-12]\,\cup\,\,[12,\infty)$$

In my haste earlier, I gave the incorrect range.

So, while $f$ has a local min. of $12$ at $x=6$, this is not the global minimum, as the left branch of the function lies wholly below that value, i.e. when $x<0$, then $-\infty<f\le-12$.
Since $-\infty <f\leq -12$ the function is not bounded from below, is it? (Wondering)
 
Yes, the function as a whole is not bounded from below or from above. Let's look at this using Lagrange Multipliers...

We have the objective function:

$$f(x,y)=2x+y$$

Subject to the constraint:

$$g(x,y)=xy-18=0$$

We then obtain the system:

$$2=\lambda y$$

$$1=\lambda x$$

This implies:

$$y=2x$$

Substituting this into the constraint yields:

$$x^2=9\implies x=\pm3$$

So, this does yield the two critical points you found by using the constraint to write the objective function in one variable:

$$(\pm3,\pm6)$$

However, these two points correspond only to local extrema, not global. If we turn now to the objective function in one variable:

$$f(x)=2x+\frac{18}{x}=2\cdot\frac{x^2+9}{x}$$

And differentiate while equating the result to zero to obtain critical values:

$$f'(x)=2\left(\frac{2x^2-(1)\left(x^2+9\right)}{x^2}\right)=0$$

$$\frac{x^2-9}{x^2}=0$$

We must observe that we obtain critical values not only when the numerator is zero, but also when the denominator is zero. And we observe that:

$$\lim_{x\to0^{-}}y=-\infty$$

$$\lim_{x\to0^{+}}y=\infty$$

So we therefore may conclude that the objective function has no global extrema. :D
 
Ah ok! How could we plot this function to see the local extremas? With desmos we cannot, can we? (Wondering)
 
mathmari said:
Ah ok! How could we plot this function to see the local extremas? With desmos we cannot, can we? (Wondering)

I would use W|A:

W|A - optimize 2x+y subject to xy=18
 
  • #10
mathmari said:
Hey! :o

We want to minimize the function $g(x_1, x_2)=2x_1+ x_2$ under the constraint $f(x_1, x_2)=x_1\cdot x_2=18$.
Another way, using "Lagrange multipliers": With $g(x, y)= 2x+ y$ with $f(x, y)= xy$ then $\nabla g= 2\vec{i}+ \vec{j}$ and $\nabla f= y\vec{i}+ x\vec{j}$. At an extremum those gradient vectors must be parallel: $2\vec{i}+ \vec{j}= \lambda(y\vec{i}+ x\vec{j})$. ($\lambda$ is the "Lagrange multiplier".) So we must have $2= \lambda y$ and $1= \lambda x$. Together with the constraint, $xy= 18$, those are three equations to solve for x, y, and $\lambda$. But since a value for $\lambda$ is not necessary for a solution, a good way to start is to eliminate $\lambda$ from those equations by dividing one by the other: $\frac{2}{1}= \frac{y}{x}$ or $y= 2x$. Then $xy= x(2x)= 2x^2= 18$, $x^2= 9$, $x= 3$ or $x= -3$. Only $x= 3$ gives a point in the first quadrant. Further, $y= 2(3)= 6$. The only extremum in the first quadrant is (3, 6). To see that this gives a maximum, not that g(3, 6)= 2(3)+ 6= 12 while g(1, 1)= 2(1)+ 3= 5, a smaller value. The point is that since g(1, 1)< g(3, 6), (3, 6) cannot give a minimum so must give a maximum.
 
  • #11
HallsofIvy said:
Another way, using "Lagrange multipliers": With $g(x, y)= 2x+ y$ with $f(x, y)= xy$ then $\nabla g= 2\vec{i}+ \vec{j}$ and $\nabla f= y\vec{i}+ x\vec{j}$. At an extremum those gradient vectors must be parallel: $2\vec{i}+ \vec{j}= \lambda(y\vec{i}+ x\vec{j})$. ($\lambda$ is the "Lagrange multiplier".) So we must have $2= \lambda y$ and $1= \lambda x$. Together with the constraint, $xy= 18$, those are three equations to solve for x, y, and $\lambda$. But since a value for $\lambda$ is not necessary for a solution, a good way to start is to eliminate $\lambda$ from those equations by dividing one by the other: $\frac{2}{1}= \frac{y}{x}$ or $y= 2x$. Then $xy= x(2x)= 2x^2= 18$, $x^2= 9$, $x= 3$ or $x= -3$. Only $x= 3$ gives a point in the first quadrant. Further, $y= 2(3)= 6$. The only extremum in the first quadrant is (3, 6). To see that this gives a maximum, not that g(3, 6)= 2(3)+ 6= 12 while g(1, 1)= 2(1)+ 3= 5, a smaller value. The point is that since g(1, 1)< g(3, 6), (3, 6) cannot give a minimum so must give a maximum.

I see! Thank you very much! (Sun)
 

Similar threads

Replies
6
Views
3K
Replies
2
Views
2K
Replies
4
Views
2K
Replies
4
Views
2K
Replies
3
Views
2K
Replies
3
Views
3K
Replies
0
Views
419
Back
Top