# Metric space

A metric space is a mathematical concept. It is a set of points with a way to measure the distance between them. This distance is measured by a function called a metric.

Take for example a flat surface, or plane. You can measure distances on it in different ways. Like if you're walking in a city (taxicab metric), you can't walk through buildings, so the distance is how far you walk up and down the streets. This might be longer than if you could walk in a straight line from point to point (Euclidean metric), like a bird might fly. Both are useful in different situations.

The metric can measure physical distance, like on a sphere or in a 3D space. But it can also measure more abstract things. Like how many changes you need to make to turn one word into another (Hamming distance).

Many mathematical objects can be turned into metric spaces because they have a natural way to measure distance. These include things like curved surfaces, vector spaces, and graphs. Even the rational numbers can be turned into a metric space.

Metric spaces can be used in many branches of mathematics. This is because they are so general but also because the concept of distance is very intuitive and common in many contexts.

Metric spaces can also help us understand many basic ideas in mathematical analysis. These include balls, completeness, continuity, and the idea of open and closed sets.

Definition of Metric Space

To be a metric space, a set of points (M) and a metric (d) must follow these rules:

1. The distance from a point to itself is always zero.
2. The distance between two different points is always positive.
3. The distance from point x to point y is the same as the distance from y to x.
4. The distance from x to z is less than or equal to the distance from x to y plus the distance from y to z. This is like saying the fastest way to get from one place to another is by a straight line.

Examples of Metric Spaces

1. Real numbers with the distance function |y-x| form a metric space.
2. The flat plane can have different metrics. The usual distance (Euclidean) is measured by a straight line between two points. But you can also measure distance like you're walking in a city (taxicab distance). Or like how a king moves in chess (Chebyshev distance).
3. You can also have a discrete metric where all points are 1 unit apart. This treats the set just as a bunch of points, without remembering that it is a plane.

Subspaces

A subset of a metric space can also be a metric space. We just measure distances the same way as in the bigger space. For example, a sphere in a 3D space can be considered a metric space. The distance is just the straight line between two points on the sphere.