Finding the Local Max/Min of f(x,y) on C

Archimedess
Messages
23
Reaction score
0
Hi everyone, I'm struggling with this problem:

Let ##f(x,y) =
\begin{cases}
(x-y)\ln(y-x) & \text{if } y>x \\
0 & \text{if } y\leq x
\end{cases}## and let ##C=\{(x,y)\in \mathbb{R}^2|x^2+y^2=1\}##

Then proof that ##max_Cf=1/e## and ##min_Cf=-(\ln2)/\sqrt2##

My solution:

I used Lagrange multiplier, so I have ##(x-y)\ln(y-x)-\lambda(x^2+y^2-1)=0##, then i have:

##
\begin{cases}
\ln(y-x)+1-2\lambda x=0\\
-\ln(y-x)-1-2\lambda y=0 \\
x^2+y^2-1=0
\end{cases}##

By solving the system (I also checked it with compiler) I only get the local minima which is ##-(ln2)/\sqrt2##, but by solving the system of equation I don't find the local maxima, I don't understand why. Any suggestions?
 
Last edited:
Physics news on Phys.org
Archimedess said:
Hi everyone, I'm struggling with this problem:

Let ##f(x,y) =
\begin{cases}
(x-y)ln(y-x) & \text{if } y>x \\
0 & \text{if } y\leq x
\end{cases}## and let ##C=\{(x,y)\in \mathbb{R}^2|x^2+y^2=1\}##

Then proof that ##max_Cf=1/e## and ##min_Cf=-(ln2)/\sqrt2##

My solution:

I used Lagrange multiplier, so I have ##(x-y)ln(y-x)-\lambda(x^2+y^2-1)=0##, then i have:

##
\begin{cases}
ln(y-x)+1-2\lambda x=0\\
-ln(y-x)-1-2\lambda y=0 \\
x^2+y^2-1=0
\end{cases}##

By solving the system (I also checked it with compiler) I only get the local minima which is ##-(ln2)/\sqrt2##, but by solving the system of equation I don't find the local maxima, I don't understand why. Any suggestions?

Your lagrangian expressions are valid only when ##x < y##. In fact, there is some doubt that the Lagrangian method is even valid at all near the "boundary" ##x = y##, because the objective ##f## has discontinuous first-derivatives along that boundary.

BT: please type "\ln" instead of "ln", because the results are more readable: you would get the properly-typeset form ##\ln(y-x)## instead of ##ln(y-x).##
 
Ray Vickson said:
Your lagrangian expressions are valid only when ##x < y##. In fact, there is some doubt that the Lagrangian method is even valid at all near the "boundary" ##x = y##, because the objective ##f## has discontinuous first-derivatives along that boundary.

BT: please type "\ln" instead of "ln", because the results are more readable: you would get the properly-typeset form ##\ln(y-x)## instead of ##ln(y-x).##

Thanks for your answer, so the theorem is not valid here. The problem is that I don't know any other method to solve this when Lagrange's theorem is not valid.
 
Archimedess said:
Thanks for your answer, so the theorem is not valid here. The problem is that I don't know any other method to solve this when Lagrange's theorem is not valid.

Convert to polar coordinates?

And/or, try ##u = x-y##.
 
Last edited:
  • Like
Likes Archimedess
Archimedess said:
Thanks for your answer, so the theorem is not valid here. The problem is that I don't know any other method to solve this when Lagrange's theorem is not valid.

I did not claim the method was definitely not valid; I just said it might be invalid. In some problems it will still be valid, in other problems it will definitely not be valid. The problem is that there are theorems about validity of the method that posit certain hypotheses about the objective ##f(x,y)## and the constraint function ##g(x,y)##; typically, we assume that ##f(x,y)## is continuously once-differentiable, at least in a neighbourhood of the solution.

Anyway, if I were tackling the problem I would avoid the Lagrange-multiplier method. First, I would change variables to ##u=y-x## and ##v = y+x,## so the objective would be ##f(u) = -u \ln(u)## if ##u > 0## and ##f(u) = 0## if ##u \leq 0##. This ##f## is continuous everywhere, but is not differentiable at ##u=0.## The constraint would be ##u^2 + v^2 = 2.## Now the nature of the solution possibilities would be easy to see from a graph of the function ##f(u), u > 0.##

However, if you want to you can get both the maximum and the minimum using Lagrange multipliers applied to the ##u,v## problem. That means that the Lagrange-multiplier method is actually valid for this problem, but for some reason is not easy to deal with in the original ##x,y## variables.

Note added in edit: your original three equations in the three variables ##x,y, \lambda## do, indeed, give both the max and the min solution (plus some extraneous, complex solutions). Maple solves the system completely. However, using the ##u,v## representation is much, much easier, being solvable almost "by inspection" (meaning that hardly any work need be done).
 
Last edited:
Archimedess said:
My solution:

I used Lagrange multiplier, so I have ##(x-y)\ln(y-x)-\lambda(x^2+y^2-1)=0##, then i have:

##
\begin{cases}
\ln(y-x)+1-2\lambda x=0\\
-\ln(y-x)-1-2\lambda y=0 \\
x^2+y^2-1=0
\end{cases}##

By solving the system (I also checked it with compiler) I only get the local minima which is ##-(ln2)/\sqrt2##, but by solving the system of equation I don't find the local maxima, I don't understand why. Any suggestions?
I think you did not consider the case λ=0
 
  • Like
Likes PeroK
ehild said:
I think you did not consider the case λ=0

I did but,

##\begin{cases}
\ln(y-x)=-1\\
\lambda=0\\
x^2+y^2=1
\end{cases}##

Then I'm stuck here..
 
Archimedess said:
I did but,

##\begin{cases}
\ln(y-x)=-1\\
\lambda=0\\
x^2+y^2=1
\end{cases}##

Then I'm stuck here..

##\ln u = -1 \ \Rightarrow \ u = ?##
 
PeroK said:
##\ln u = -1 \ \Rightarrow \ u = ?##
##1/e##... yeah, change of variables definitely helps.. thanks
 
  • #10
Ok, here's what I got

##u\ln u+\lambda(u^2+v^2-2)=0##

##\begin{cases}
\ln u+1+2\lambda u=0\\
2\lambda v=0\\
u^2+v^2-2=0
\end{cases}##

The solutions are: ##(1/e,\pm\sqrt{2-1/e^2},0)## and ##(\pm\sqrt{2},0,\frac{\ln\pm\sqrt{2}+1}{\pm2\sqrt{2}})##

By substitution I get ##-1/e## and ##\sqrt{2}\ln\sqrt{2}## but these are not the solution
 
  • #11
Archimedess said:
Ok, here's what I got

##u\ln u+\lambda(u^2+v^2-2)=0##

##\begin{cases}
\ln u+1+2\lambda u=0\\
2\lambda v=0\\
u^2+v^2-2=0
\end{cases}##

The solutions are: ##(1/e,\pm\sqrt{2-1/e^2},0)## and ##(\pm\sqrt{2},0,\frac{\ln\pm\sqrt{2}+1}{\pm2\sqrt{2}})##

By substitution I get ##-1/e## and ##\sqrt{2}\ln\sqrt{2}## but these are not the solution

That was my fault! Note that you have ##u = y - x##.

PS and ##y-x## can only have positive values.
 
Last edited:
  • #12
PeroK said:
That was my fault! Note that you have ##u = y - x##.
The thing is..
if i substitute in ##-u\ln u-\lambda(u^2+v^2-2)=0## the results are correct
else if i substitute in ##u\ln u+\lambda(u^2+v^2-2)=0## the results are not correct..
I don't understand what I'm doing wrong
 
  • #13
Archimedess said:
The thing is..
if i substitute in ##-u\ln u-\lambda(u^2+v^2-2)=0## the results are correct
else if i substitute in ##u\ln u+\lambda(u^2+v^2-2)=0## the results are not correct..
I don't understand what I'm doing wrong

You need ##y-x > 0##. And your function is:

##-(y-x)\ln(y-x)##

You found a maximum at ##y -x = 1/e##. So, you just plug that in. The values of ##x, y## aren't important.

And, you already found the minimum.

If you want to use ##u = y-x##, then ##u## must be positive.
 
  • #14
PeroK said:
You need ##y-x > 0##. And your function is:

##-(y-x)\ln(y-x)##

You found a maximum at ##y -x = 1/e##. So, you just plug that in. The values of ##x, y## aren't important.

And, you already found the minimum.

If you want to use ##u = y-x##, then ##u## must be positive.
Ok, I got it thank you so much everyone
 
  • #15
Archimedess said:
Hi everyone, I'm struggling with this problem:

Let ##f(x,y) =
\begin{cases}
(x-y)\ln(y-x) & \text{if } y>x \\
0 & \text{if } y\leq x
\end{cases}## and let ##C=\{(x,y)\in \mathbb{R}^2|x^2+y^2=1\}##

Then proof that ##max_Cf=1/e## and ##min_Cf=-(\ln2)/\sqrt2##

My solution:

I used Lagrange multiplier, so I have ##(x-y)\ln(y-x)-\lambda(x^2+y^2-1)=0##, then i have:

##
\begin{cases}
\ln(y-x)+1-2\lambda x=0\\
-\ln(y-x)-1-2\lambda y=0 \\
x^2+y^2-1=0
\end{cases}##

By solving the system (I also checked it with compiler) I only get the local minima which is ##-(ln2)/\sqrt2##, but by solving the system of equation I don't find the local maxima, I don't understand why. Any suggestions?

Now that you have the solution, here is another method: adding your two equations above gives ##-2*\lambda*(x+y) = 0,## so you need to solve
$$\begin{array}
(1) \; \ln (y-x) + 1 - 2 \lambda x = 0\\
(2) \; \lambda (x+y) = 0 \\
(3) \; x^2 + y^2 = 1
\end{array}$$
Eq. (2) implies that either ##\lambda = 0## or ##x+y = 0.##

If we set ##\lambda = 0## we have ## \ln(y-x) + 1 = 0## and ##x^2+y^2 = 1##. These are two equations in ##x,y##, so are fairly easily solvable. Instead, if we set ##x+y=0##, then ##y = -x## and so ##f = 2x \ln(-2x)## and ##2 x^2 = 1.##

All that come out automatically in the ##u,v## representation I suggested in #5:
$$ \begin{array}
{}-\ln(u) - 1 - 2 \lambda u = 0\\
\lambda v = 0\\
u^2+v^2=2
\end{array}$$
 
Last edited:
Back
Top