Euclidean distance

Let’s assume we have 2 points as x_{1} and x_{2} which are in 2-dimension, so our first dimension is feature 1(f_{1}) and our second dimension is feature 2(f_{2}). x_{1} can be represented as x_{11} and x_{22} and x_{2} can be represented as x_{21} and x_{22}. Simple understanding of the distance is, shortest distance between the points i.e represented as d in the image. Now just by using simple pythagoras theoram

When we put 2 vertical line around it, it means [length of]. **||x**_{1}– x_{2}|| this distance is called Euclidean distance. Usually euclidean distance is represented as **||x**_{1}– x_{2}||_{2} it is called L2 norm of vector.

Manhattan distance

In Euclidean distance as we used pythagoras theoram, but in manhattan distance we just use the sum of the distance (x_{21} – x_{11}) + (x_{22} – x_{12}). When we put 1 vertical line around it, it means absolute. this distance is called Manhattan distance. Usually Manhattan distance is represented as ||x_{1}– x_{2}||_{1} it is called L1 norm of vector. where ||x_{1}– x_{2}||_{1}_{ }is nothing but d= |x_{1}– x_{2}|

Minkowski distance

There is generalization to L1 norm and L2 norm known as Lp norms, and distance used for Lp norm is called Minkowski distance, formula used for this distance is d= ** (**|x_{1}– x_{2}|^{p}**)**^{1/p} where p can be any number, if you see this formula carefully, you may notice if p=2, formula becomes exact same as euclidean distance and if p=1, formula becomes same as manhattan distance