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:
Examples of Metric Spaces
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.