# Wolfram alpha error in global minimization?

Let us consider the function

$$f(x,y)= x + y^2 - \ln(x+y)$$

If you try to minimize it using Wolfram Alpha (http://www.wolframalpha.com/input/?i=minimize+x%2By%5E2-ln%28x%2By%29), it founds a local minimum at $(x,y)=(1/2,1/2)$, but it can't find a global minimum. But that local minimum should also be the global one, since the function is a convex one and the domain is convex.

Am I wrong or is Wolfram Alpha wrong?

Ok, thanks to everybody who answered or commented, but perhaps I was not clear when writing my question: I knew that $(1/2,1/2)$ is a local minimum, and, since the $f(x,y)=x+y^2-ln(x+y)$ is a convex function and the domain is $D=\{(x,y) \in \mathbb{R}^2 : x+y >0\}$, which is a convex subset of $\mathbb{R}^2$, then a well kwown result in convex optimization ensures that $(1/2,1/2)$ is also a global minimum. Then perhaps I should have written: "why does Wolfram Alpha says 'no global minima found' when I ask to minimize $f(x,y)$?"

As far as I can understand from your answers, that sentence from Wolfram Alpha means only that it is not able to find a global minimum, not that the global minimum does not exist, is this correct?

• Wolfram never claimed it wasn't a global minimum. Detecting local minima is generally much simpler than analyzing their global character, so Wolfram simply never bothered with the latter. – user7530 Dec 24 '14 at 2:04
• It could be thinking, "Uh-oh, if $x+y$ is negative, then the function takes complex values, and there's no order on the complex numbers... better not say anything". Computer algebra systems are kind of stupid sometimes. – Milo Brandt Dec 24 '14 at 3:04

The domain of $f$ is the set of pairs $(x,y)$ for which $r=x+y>0.$ Using $x=r-y$ our function can be expressed nicely in terms of separate functions of $r,y$ as $$(r-\ln r)+(y^2-y).$$ Using one variable calc, the min of the first bracketed term is $1$ (at $r=1$), while the min of the second is $-1/4$ (at $y=1/2$).

This shows your function satisfies $f \ge 1 -1/4=3/4.$ That this is actually the global minimum then follows since $f(1/2,1/2)=3/4.$

If Wolfram explicitly says no global minimum exists, that is incorrect. However in some cases a computer algebra system may not deal with implied domains well... [I just looked at Wolfram output you link to, and it only says there is a local min, not that there is not a global one.]

Find the partial derivatives:

$$\frac{∂}{∂x}(f(x,y))=1-\frac{1}{x+y}\:\:\:\:(1)$$ and $$\frac{∂}{∂y}(f(x,y))=2y-\frac{1}{x+y}\:\:\:\:(2)$$

Set $(1)$ equal to $0$: $$0=1-\frac{1}{x+y}$$ $$\frac{1}{x+y}=1$$ $$x+y=1\:\:\:\:(3)$$

Set $(2)$ equal to $0$:

$$0=2y-\frac{1}{x+y}\:\:\:\:(4)$$

Put $(3)$ into $(4)$:

$$0=2y-\frac{1}{1}$$ $$y=\frac{1}{2}\:\:\:\:(5)$$

Put $(5)$ back into $(3)$:

$$x+\frac{1}{2}=1$$ $$x=\frac{1}{2}$$

So $(x,y) = (\frac{1}{2},\frac{1}{2})$ is our potential extremum. Now find our second partial derivatives, and perform the second derivative test for a function of two variables:

$$f_{xx} = \frac{1}{(x+y)^2}$$ $$f_{xy} = f_{yx}=\frac{1}{(x+y)^2}$$ $$f_{yy}= \frac{1}{(x+y)^2} + 2$$

And now the test:

$$D(x,y)=f_{xx}(x,y)f_{yy}(x,y)-(f_{xy}(x,y))^2$$

$$D(\frac{1}{2},\frac{1}{2})=(\frac{1}{(\frac{1}{2}+\frac{1}{2})^2})(\frac{1}{(\frac{1}{2}+\frac{1}{2})^2} + 2)+(\frac{1}{(\frac{1}{2}+\frac{1}{2})^2})^2$$

$$D(\frac{1}{2},\frac{1}{2})=4$$

Also note that:

$$f_{xx}(\frac{1}{2},\frac{1}{2})=\frac{1}{(\frac{1}{2}+\frac{1}{2})^2}=1$$

And so, we have $D(\frac{1}{2},\frac{1}{2})>0$ and $f_{xx}(\frac{1}{2},\frac{1}{2})>0$, so by the second derivative test for a function of two variables, we conclude that $(\frac{1}{2}, \frac{1}{2})$ is a local minimum, and the only extremum. As you stated in your question, this point must be a global minimum. WolframAlpha simply said it was a local minimum, and didn't say that it wasn't a global one:

Let's look at the first order conditions:
$f_{x} = 1 - \frac{1}{x + y} = 0$
$f_{y} = 2y - \frac{1}{x + y} = 0$

So $\frac{1}{x + y} = 1$, which gives us $y = \frac{1}{2}$. It follows that $x = \frac{1}{2}$.

So Wolfram Alpha seems to be correct here. Note you should also verify that $(\frac{1}{2}, \frac{1}{2})$ is a minimum, but this is straight-forward to do.