# Manhattan, Euclidean and Minkowski: three complete comparisons

Subject: Natural Language Processing

Exam: TEE

Reader: https://deep-learning-study-room.vercel.app/nlp/#tee/formulas/f-vectors/u2-distances

Canonical: https://deep-learning-study-room.vercel.app/read/nlp/tee/formulas/f-vectors--u2-distances/

Formulas explained through full worked examples

**Distance measures separation; smaller means closer.** Absolute values prevent positive and negative differences from cancelling.



$$
d_1=\sum_i|x_i-y_i|\quad\text{Manhattan}
$$





$$
d_2=\sqrt{\sum_i(x_i-y_i)^2}\quad\text{Euclidean}
$$





$$
d_p=\left(\sum_i|x_i-y_i|^p\right)^{1/p},\quad p\ge1\quad\text{Minkowski}.
$$



Manhattan is p=1; Euclidean is p=2. For p=3, cube absolute differences, add, then take a cube root.

**Question. Find Manhattan, Euclidean and Minkowski p=3 distances for x=[1,2], y=[4,6].**

#### Given

Vectors share coordinate order; negative inputs are allowed.

#### To find

Find Manhattan, Euclidean and Minkowski p=3 distances for x=[1,2], y=[4,6].

#### Formula and why it applies

Use 

$$
d_1=\sum|\Delta_i|
$$

, 

$$
d_2=\sqrt{\sum|\Delta_i|^2}
$$

, 

$$
d_3=\sqrt[3]{\sum|\Delta_i|^3}
$$

.

#### Step 1. Absolute differences

|1 − (4)| = 3; |2 − (6)| = 4.

#### Step 2. Manhattan

3 + 4 = 7.

#### Step 3. Square and add

3²=9; 4²=16. Sum=25.

#### Step 4. Euclidean root



$$
\sqrt{25}\approx 5.000000.
$$



#### Step 5. Cube and add

3³=27; 4³=64. Sum=91.

#### Step 6. Minkowski root



$$
\sqrt[3]{91}\approx 4.497941.
$$



**Answer.** Manhattan=7; Euclidean≈5.000000; p=3≈4.497941.

**Question. Find Manhattan, Euclidean and Minkowski p=3 distances for x=[0,1,2], y=[2,1,0].**

#### Given

Vectors share coordinate order; negative inputs are allowed.

#### To find

Find Manhattan, Euclidean and Minkowski p=3 distances for x=[0,1,2], y=[2,1,0].

#### Formula and why it applies

Use 

$$
d_1=\sum|\Delta_i|
$$

, 

$$
d_2=\sqrt{\sum|\Delta_i|^2}
$$

, 

$$
d_3=\sqrt[3]{\sum|\Delta_i|^3}
$$

.

#### Step 1. Absolute differences

|0 − (2)| = 2; |1 − (1)| = 0; |2 − (0)| = 2.

#### Step 2. Manhattan

2 + 0 + 2 = 4.

#### Step 3. Square and add

2²=4; 0²=0; 2²=4. Sum=8.

#### Step 4. Euclidean root



$$
\sqrt{8}\approx 2.828427.
$$



#### Step 5. Cube and add

2³=8; 0³=0; 2³=8. Sum=16.

#### Step 6. Minkowski root



$$
\sqrt[3]{16}\approx 2.519842.
$$



**Answer.** Manhattan=4; Euclidean≈2.828427; p=3≈2.519842.

**Question. Find Manhattan, Euclidean and Minkowski p=3 distances for x=[-1,3], y=[2,-1].**

#### Given

Vectors share coordinate order; negative inputs are allowed.

#### To find

Find Manhattan, Euclidean and Minkowski p=3 distances for x=[-1,3], y=[2,-1].

#### Formula and why it applies

Use 

$$
d_1=\sum|\Delta_i|
$$

, 

$$
d_2=\sqrt{\sum|\Delta_i|^2}
$$

, 

$$
d_3=\sqrt[3]{\sum|\Delta_i|^3}
$$

.

#### Step 1. Absolute differences

|-1 − (2)| = 3; |3 − (-1)| = 4.

#### Step 2. Manhattan

3 + 4 = 7.

#### Step 3. Square and add

3²=9; 4²=16. Sum=25.

#### Step 4. Euclidean root



$$
\sqrt{25}\approx 5.000000.
$$



#### Step 5. Cube and add

3³=27; 4³=64. Sum=91.

#### Step 6. Minkowski root



$$
\sqrt[3]{91}\approx 4.497941.
$$



**Answer.** Manhattan=7; Euclidean≈5.000000; p=3≈4.497941.

Manhattan: absolute-add. Euclidean: square-add-root. Minkowski: p-power-add-p-root.
