# Max/min problem

#### Archimedess

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:
Related Calculus and Beyond Homework News on Phys.org

#### Ray Vickson

Homework Helper
Dearly Missed
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).$

#### Archimedess

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.

#### PeroK

Homework Helper
Gold Member
2018 Award
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:

#### Ray Vickson

Homework Helper
Dearly Missed
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:

#### ehild

Homework Helper
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

#### Archimedess

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..

#### PeroK

Homework Helper
Gold Member
2018 Award
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 = ?$

#### Archimedess

$\ln u = -1 \ \Rightarrow \ u = ?$
$1/e$... yeah, change of variables definitely helps.. thanks

#### Archimedess

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

#### PeroK

Homework Helper
Gold Member
2018 Award
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:

#### Archimedess

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

#### PeroK

Homework Helper
Gold Member
2018 Award
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.

#### Archimedess

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

#### Ray Vickson

Homework Helper
Dearly Missed
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:

"Max/min problem"

### Physics Forums Values

We Value Quality
• Topics based on mainstream science
• Proper English grammar and spelling
We Value Civility
• Positive and compassionate attitudes
• Patience while debating
We Value Productivity
• Disciplined to remain on-topic
• Recognition of own weaknesses
• Solo and co-op problem solving