What is ‘Euclidean Distance’?

<aside> 💡

Euclidean distance is a measure of the straight-line distance between two points in a multidimensional space.

</aside>

Euclidean distance is just the length of a straight line between two points - like measuring with a ruler. For example, if you have two points on a piece of paper, it's the shortest possible distance you could draw between them.

image.png

Mathematically, it is the square root of the sum of squared differences between corresponding coordinates of two points.

For points $P=(p_1,p_2,…,p_n)$ and $Q=(q_1,q_2,…,q_n)$, the formula is:

$$ d(P, Q) = \sqrt{\sum_{i=1}^n (p_i - q_i)^2} $$

This distance metric is intuitive and geometrically straightforward, which makes it a common choice in many clustering algorithms.

Application in Cluster Analysis

In cluster analysis, Euclidean distance is frequently used to quantify similarity or dissimilarity between data points. Algorithms like K-means and hierarchical clustering leverage this metric to group data points into clusters.

For example, in K-means, cluster centroids are updated iteratively by minimising the Euclidean distance between data points and their assigned centroid. Similarly, hierarchical clustering builds a tree of clusters by progressively merging or splitting groups based on pairwise Euclidean distances.

Euclidean distance is most effective when our data is scaled appropriately and follows a linear structure. Standardisation or normalisation of features is often necessary to prevent variables with larger scales from dominating the distance calculations.


Next reading:

Manhattan Distance