Why is squared Euclidean distance used for measuring similarity?



why are we looking at a squared quantity?

And is one supposed to take the square root of it at some point to get the "final result"?

  • $\begingroup$ @Munchhausen So is the idea that one takes the square root after one wants the "final result"? $\endgroup$
    – mavavilj
    Jun 26, 2018 at 12:40
  • 1
    $\begingroup$ The square/square root in $\|\cdot \|_2$ is what makes balls' boundaries actual circles. It comes from the Pythagorean theorem. But I'm not sure what exactly you are asking. $\endgroup$ Jun 26, 2018 at 12:40
  • $\begingroup$ @ArnaudMortier Why is it squared, rather than without square? Also perhaps, how is it then used in practice (does one take the square root at some point)? $\endgroup$
    – mavavilj
    Jun 26, 2018 at 12:41
  • $\begingroup$ Perhaps because the euclidean distance is invariant to rigid rotations? $\endgroup$
    – Cesareo
    Jun 26, 2018 at 12:43
  • 2
    $\begingroup$ The square of euclidean distance is differentiable, allowing for algorithms like gradient descent. Also, it is convex. $\endgroup$
    – nicomezi
    Jun 26, 2018 at 12:45

1 Answer 1


I would like to highlight the fact that the article says

Frey and Dueck suggest defining a similarity measure $$ s(x, y) = - || x - y ||_{2}^{2} $$ where $|| x - y ||_{2}^{2}$ is the squared Euclidean distance.

There are many ways to measure distance --- the article also mentions Gaussian distance as a way of measuring distance.

I would guess that the choice of which distance you use depends on what data you are analysing, and what the common conventions in that area of research are.

As for the Euclidean distance itself, as Arnaud Mortier mentioned in the comments the definition of Euclidean distance comes from Pythagoras' Theorem. By reading the link to the squared Euclidean distance, it indicates that:

The standard Euclidean distance can be squared in order to place progressively greater weight on objects that are farther apart.

This is not a metric, but is useful for comparing distances. See the comments for reasons why this is a good measure to use.


Not the answer you're looking for? Browse other questions tagged .