Extrema of the $\mathbb{R}^4 \rightarrow \mathbb{R}$ function $f = \sqrt{ (x_i -x_j)^2 +(y_i-y_j)^2 }$

I have a function $f = \sqrt{ (x_i -x_j)^2 +(y_i-y_j)^2 }$ and I want to find the extremal points. Therefore, I calculated the gradient:

$g= \nabla f = \frac{1}{\sqrt{(x_i -x_j)^2 +(y_i-y_j)^2}} \begin{bmatrix} x_i - x_j \\ x_j - x_i \\ y_i -y_j \\ y_j - y_i \end{bmatrix}$.

Then in defined: $\Delta x := x_i -x_j$ and $\Delta y := y_i - y_j$. So,

$g= \frac{1}{\sqrt{ \Delta x ^2 + \Delta y^2}} \begin{bmatrix} \Delta x \\ -\Delta x \\ \Delta y \\ -\Delta y \end{bmatrix} = 0$.

How to calculate the extrema and handle the singularity?

EDIT:

I forgot to add information about the domain: $f: \mathbb{R}^4 \rightarrow \mathbb{R}$ I also know that the minimum will occur at $\Delta x =\Delta y=0$. But how to prove this mathematically, i.e. handling the singularity?

• What's the domain of your function? The minimum value of $f$ is $0$, which happens when $x_i = x_j$ and $y_i = y_j$. – littleO Jul 13 '13 at 10:29
• @littleO, thanks. I added some information in this. – bonanza Jul 13 '13 at 10:49
• Take out the square root, and minimize $(x_i-x_j)^2+(y_i-y_j)^2$ instead. – wj32 Jul 13 '13 at 10:51
• Sorry, you need to add the $\Sigma$ – Ice sea Jul 13 '13 at 11:27
• $f$ is non-negative and is unbounded from above. If you can find points for which $f=0$, these are your extremal points, that's as simple as that. – roger Jul 13 '13 at 11:51

The function $f$ is clearly monotonic increasing in $\Delta x^2$ and $\Delta y^2$. Therefore, the curve has only one minima, at $\Delta x = \Delta y = 0$.

Unfortunately, you can't get this from the gradient, since it doesn't exist at the origin. To see this, use a limit approach:

$$\lim_{\Delta x, \Delta y \to 0}\frac{\Delta x}{\sqrt{\Delta x^2 +\Delta y^2}}=\frac{1}{\sqrt{1 +\Delta y^2 / \Delta x^2}}$$ Note that this depends on the slope of the line we use of get to the origin, so that the limit doesn't exist.

• Thanks for this! And there is no way to handle e.g. with L'Hostpitals rules? – bonanza Jul 14 '13 at 11:06
• @bonanza - L'Hostpital works if the limit exists, here the limit just doesn't exist in the first place. This is a situation rarely encountered in 1D limit problems, but is quite common if you have two or more variables. – nbubis Jul 14 '13 at 18:26
• You're missing a $\lim$ on the last equality. – YoTengoUnLCD Feb 9 '17 at 5:11

This problem, if analyzed visually, describes the distance between any two points on a Cartesian $x$-$y$ plane. Since you want to find the extremas of this function, you could think of it as finding bounds to the length of the line connecting those 2 co-ordinates. Since the line can grow as large as you want it to, there are clearly no upper bounds to this. The lower bound would be at $0$ since the length cannot be a negative number. Although this isn't the proper mathematical way of solving the question, this particular technique could be used to verify the accuracy of the solution that you derive.