# Euclidean Distance

*noun*

say it: **“yoo-KLID-ee-un DIS-tunss”** **/juˈklɪdiən ˈdɪstəns/**

The length of the straight line between two points, found by adding the squared differences of their coordinates and taking the square root.

## What is **Euclidean distance**?

**Euclidean distance** is the straight-line distance between two examples, treating each feature as a direction:
subtract feature by feature, square the differences, add them and take the square root. k-nearest neighbors and
k-means use it to decide which examples are close.

```python
import math
apple = [150, 7]     # grams, sweetness out of 10
mystery = [154, 4]
print(math.dist(apple, mystery))   # 5.0: the square root of 4² + 3²
```

## In a sentence

- “The **Euclidean distance** between the two fruits was 5.”
- “k-nearest neighbors uses **Euclidean distance** to find the examples closest to a new one.”

Level: Journeyman · [More AI Basics terms at this level](https://www.ask-codey.com/glossary?category=ai&level=3)

Updated: November 19, 2026

Source: https://www.ask-codey.com/glossary/euclidean-distance
