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?

thanks for your help!


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?

  • $\begingroup$ 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$. $\endgroup$ – littleO Jul 13 '13 at 10:29
  • $\begingroup$ @littleO, thanks. I added some information in this. $\endgroup$ – bonanza Jul 13 '13 at 10:49
  • $\begingroup$ Take out the square root, and minimize $(x_i-x_j)^2+(y_i-y_j)^2$ instead. $\endgroup$ – wj32 Jul 13 '13 at 10:51
  • $\begingroup$ Sorry, you need to add the $\Sigma$ $\endgroup$ – Ice sea Jul 13 '13 at 11:27
  • 1
    $\begingroup$ $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. $\endgroup$ – 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.

  • $\begingroup$ Thanks for this! And there is no way to handle e.g. with L'Hostpitals rules? $\endgroup$ – bonanza Jul 14 '13 at 11:06
  • $\begingroup$ @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. $\endgroup$ – nbubis Jul 14 '13 at 18:26
  • $\begingroup$ You're missing a $\lim$ on the last equality. $\endgroup$ – 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.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.