# Closest Pair of Points

**Problem Definition:** Given a set of n points, find the closest pair of points. Points with **least distance**.

Distance between pair of points (x,y) and (z,w) are computed using euclidean distance which is given as follows: $$distance = \sqrt{(x-z)^{2} +(y-w)^{2} }$$&#x20;

![Closest pair of points](https://4230631329-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LjABCJGdQhL716TL1Tr%2F-LjkFSCsHxRG1WMC7D5Y%2F-LjkFWd6yyKE2uQkj6Qd%2FClosest_Points.jpg?alt=media\&token=80b1924f-271c-4a8c-bb2c-d7c1d1b3ccdd)

**Brute-force approach** could be finding the distance between every pair of points and identifying the pair with shortest distance.

```
```
