In mathematics, in a metric space, a **ball** is a set containing all points within a specified distance of a given point. Note that with the ordinary (Euclidean) metric, if the space is the line, the ball is an interval, if the space is the plane, the ball is the inside of a circle. With other metrics the shape of a ball is different; for example, in taxicab geometry a ball is diamond-shaped.

The **open ball** of radius *r > 0* centred at point *p* is often written as B_{r}(*p*). This is defined as:

- B
_{r}(*p*) = {*x*|*d*(*x*,*p*) <*r*}

*d*is the distance function or

**metric**. In

**R**

^{n}, the usual (Euclidean) distance function is given by

.

Note in particular that an open ball always includes `p` itself, since `r` > 0.

Balls with respect to a metric `d` form a basis for the topology induced by `d`. This means, among other things, that all open sets in a metric space can be written as a union of open balls.

If the less-than symbol (<) is replaced by a less-than-or-equal-to (≤), the above definition becomes that of a **closed ball**. This is usually notated by adding an overscore to the B.

If *r* = 1, then it is called a **unit ball**.

A set is bounded if it is contained in a ball. Conversely, a set is totally bounded if given any radius, it is covered by finitely many balls of that radius.

See also: Sphere