Euclidean distance

Definition
Given a number set $$E$$, the Euclidean distance is a function EuclideanDis:E^n\times E^n \longrightarrow \mathbb{R}</math< defined as

$$ EuclideanDis(u,v)=\sqrt{\sum_{i=1}^{n}(u[i]-v[i])^2}. $$

Examples

 * $$EuclideanDis((1,2,3,4),(4,3,2,1)) = \sqrt{3^2+1^2+1^2+3^2} = \sqrt{20} = 4.47$$.
 * $$EuclideanDis((1,0,1,0,1),(1,1,0,0,1)) = \sqrt{0+1+1+0+0} = 1.41$$.

Normalization
If $$E$$ is a bounded set, is possible to normalize the difference dividing by the range of $$E$$, then normalization is

$$ EuclideanSim(u,v)=1-\sqrt{\frac{\sum_{i=1}^{n}(u[i]-v[i])^2}{n}}. $$

Examples

 * If $$E=[0,10]$$, $$ManhattanSim((1,2,3,4),(4,3,2,1)) = 1-\sqrt{\frac{0.3^2+0.1^2+0.1^2+0.3^2}{4}} = 0.78$$.
 * If $$E=\{0,1\}$$, $$ManhattanSim((1,0,1,0,1),(1,1,0,0,1)) = 1-\sqrt{\frac{0+1+1+0+0}{5}} = 0.37$$.

Variations

 * Euclidean distance is a particular case of Minkowski distance when $$p=2$$.

Applications

 * Numeric vectors (codes).
 * Vectors of boolean features.