Distance metrics

L-p metrics

Manhattan distance (L1)

Given two vectors \(p\) and \(q\), such that

\[ \begin{aligned} p &= \left(p_1, p_2, \dots,p_n\right) \\ q &= \left(q_1, q_2, \dots,q_n\right) \end{aligned} \]

we define the Manhattan distance as:

\[ d_1(p, q) = \|p - q\|_1 = \sum_{i=1}^n |p_i-q_i| \]