# Computing local and global minima on Wolfram Alpha

Consider $$\sqrt{x^2+y^2}+2\sqrt{x^2+y^2-2x+1}+\sqrt{x^2+y^2-6x-8y+25}$$. I need to find global or local minima of this function, but Wolfram Alpha doesn't seem to find one; the answer is that $$1 + 2\sqrt{5}$$ is its global minimum

Am I doing something wrong? I use this input for the global minimum, and this input for local minima.

• If this might be an issue with the nuances of WolframAlpha, then perhaps the dedicated Mathematica StackExchange would be a more appropriate place for this question.
– Blue
Commented Aug 25, 2021 at 15:22
• dear BlueBirdBrown, welcome to math stackexchange! please take a moment to learn the basics of MathJax, which we use here on math.se to improve readability of posts; see here for an introductory guide. I have taken the liberty of editing your post to improve its formatting Commented Aug 25, 2021 at 15:23
• Yes indeed the minimum is $1 + 2\sqrt5$ Commented Aug 25, 2021 at 15:55
• There is a message on that page Standard computation time exceeded... Commented Aug 25, 2021 at 16:07
• @WillJagy Let $A = (0, 0)$, $B = (1, 0)$, $C = (3, 4)$. The spatial median of $\square ABBC$ is $B$ (which is not the Fermat point of $\triangle ABC$) because $|AP| + |PB| \geq |AB|$ and $|BP| + |PC| \geq |BC|$. $B$ is the only local minimum point, since the ellipses $|AP| + |PB| = a$ and $|BP| + |PC| = b$ cannot lie on the opposite sides of a common tangent. Commented Aug 25, 2021 at 23:09

Using FindMinimum[Sqrt[x^2+y^2]+2Sqrt[x^2+y^2-2x+1]+Sqrt[x^2+y^2-6x-8y+25],{x,y}] locally, I found the following minimum solutions. The output includes the already mentioned solution $$5.47214=1+2\sqrt{5}$$ and concretely looks as follows:

$$\{5.47214,\{x\to 1,y\to -7.441589669722822*10^{-10}\}\}$$

Hope it helps you to proceed. The plot is:

And here is the plot of the curve given by $$\sqrt{x^2-2 x+y^2+1}+\sqrt{x^2-6 x+y^2-8 y+25}+\sqrt{x^2+y^2}-z=0$$:

The partial derivate of $$2\sqrt{x^2-2 x+y^2+1}+\sqrt{x^2-6 x+y^2-8 y+25}+\sqrt{x^2+y^2}$$ for $$x$$ is:

$$\frac{x}{\sqrt{x^2+y^2}}+\frac{2 x-2}{\sqrt{x^2-2 x+y^2+1}}+\frac{2 x-6}{2 \sqrt{x^2-6 x+y^2-8 y+25}}$$

with the following contour plot:

and its PDE for $$y$$ is given by:

$$\frac{y}{\sqrt{x^2+y^2}}+\frac{2 y}{\sqrt{x^2-2 x+y^2+1}}+\frac{2 y-8}{2 \sqrt{x^2-6 x+y^2-8 y+25}}$$

with the following contour plot:

And finally here is the intersection plot:

followed by the intersection plot where I removed the coefficient 2 in front of the square:

• Comments are not for extended discussion; this conversation has been moved to chat. Commented Aug 29, 2021 at 16:51

Thanks to a valuable help I am using from a German math community member (Matheboard HAL 9000), we can geometrically show that there is only one minimum:

Consider $$f(x,y)=\sqrt{x^2+y^2}+2\sqrt{x^2+y^2-2x+1}+\sqrt{x^2+y^2-6x-8y+25}$$. We want to find the global or local minima of this function.

The above function $$f(x,y)$$ specifies for a point $$P(x,y)$$ and for the three given points $$A(0,0)$$, $$B(1,0)$$ and $$C(3,4)$$ the sum $$|AP|+2\cdot|BP|+|CP|$$.

It applies that

• According to the triangle inequality, we have $$|AP|+|BP|\ge|AB|$$, where the minimum $$|AB|$$ is reached exactly when $$P$$ lies on the line $$AB$$.
• Analogously, we have $$|BP|+|CP|\ge|BC|$$, where we reach the minimum $$|BC|$$ exactly when $$P$$ is on $$BC$$.

If it is possible to find a point $$P$$ which minimizes both sums at the same time, then this point is consequently also a global minimum point of the total sum (if there are several such points, then there are also several global minimum points). In the present case there is exactly one such point, namely $$P=B$$. It is therefore the only global minimum point of $$|AP|+2\cdot|BP|+|CP|$$.

However, this is only the proof that there is exactly one global minimum.

To exclude that there are other local minimum points, then this can be done with similar arguments (triangle inequality). Namely, for every assumed local minimum point $$P\ne B$$, we can prove that the point $$P'=(1-\epsilon)P+\epsilon B$$ with $$0<\epsilon<1$$ on the line $$PB$$ leads to a smaller function value. Since this is also true for $$\epsilon\rightarrow0$$, one finds such a point $$P'$$ in every neighborhood of $$P$$, which contradicts the assumed property "local minimum point".

The point $$P'$$ is located on the line $$PB$$, which means that $$|PB|=|PP'|+|P'B|$$. According to triangle inequality we obtain:

$$|AP|+2|BP|+|CP|=(|AP|+|PP'|)+2|BP'|+(|CP|+|PP'|)\ge|AP'|+2|BP'|+|CP'|$$

The equality case of this inequality is satisfied only if $$A,P,P'$$ lie in sequence on a straight line (which is equivalent to $$P$$ lies on $$AB$$) and analogously if $$C,P,P'$$ lie on a straight line (which is equivalent to $$P$$ lies on $$BC$$). Equality is thus only possible for $$P=B$$, which we had excluded here.

Hence $$|AP|+2|BP|+|CP|>|AP'|+2|BP'|+|CP'|$$ is the desired contradiction to the local minimum property of $$P$$.