# Math4201 Topology I (Lecture 12)

## Metric spaces

### Basic properties and definitions

#### Definition of metric space

A metric space is a set $X$ with a function $d:X\times X\to \mathbb{R}$ that satisfies the following properties:

1. $\forall x,y\in X, d(x,y)\geq 0$ and $d(x,y)=0$ if and only if $x=y$. (positivity)
2. $\forall x,y\in X, d(x,y)=d(y,x)$. (symmetry)
3. $\forall x,y,z\in X, d(x,z)\leq d(x,y)+d(y,z)$. (triangle inequality)

<details>
<summary>Example of metric space</summary>

Let $X=\mathbb{R}$ and $d(x,y)=|x-y|$.

Check definition of metric space:

1. Positivity: $d(x,y)=|x-y|\geq 0$ and $d(x,y)=0$ if and only if $x=y$.
2. Symmetry: $d(x,y)=|x-y|=|y-x|=d(y,x)$.
3. Triangle inequality: $d(x,z)=|x-z|\leq |x-y|+|y-z|=d(x,y)+d(y,z)$ since $|a+b|\leq |a|+|b|$ for all $a,b\in \mathbb{R}$.

---

Let $X$ be arbitrary. The trivial metric is $d(x,y)=\begin{cases}
0 & \text{if } x=y \\
1 & \text{if } x\neq y
\end{cases}$

Check definition of metric space:

1. Positivity: $d(x,y)=\begin{cases}
0 & \text{if } x=y \\
1 & \text{if } x\neq y
\end{cases}\geq 0$ and $d(x,y)=0$ if and only if $x=y$.
1. Symmetry: $d(x,y)=\begin{cases}
0 & \text{if } x=y \\
1 & \text{if } x\neq y
\end{cases}=d(y,x)$.
1. Triangle inequality use case by case analysis.

</details>

#### Balls of a metric space forms a basis for a topology

Let $(X,d)$ be a metric space. $x\in X$ and $r>0, r\in \mathbb{R}$. We define the ball of radius $r$ centered at $x$ as $B_r(x)=\{y\in X:d(x,y)<r\}$.

Goal: Show that the balls of a metric space forms a basis for a topology.

$$
\{B_r(x)|x\in X,r>0,r\in \mathbb{R}\}\text{ is a basis for a topology on }X
$$

<details>
<summary>Example of balls of a metric space</summary>

Let $X=\mathbb{R}$ and $d(x,y)=\begin{cases}
0 & \text{if } x=y \\
1 & \text{if } x\neq y
\end{cases}$

The balls of this metric space are:

$$
B_r(x)=\begin{cases}
\{x\} & \text{if } r<1 \\
X & \text{if } r\geq 1
\end{cases}
$$

> [!NOTE]
>
> This basis generate the discrete topology of $X$.

---

Let $X=\mathbb{R}$ and $d(x,y)=|x-y|$.

The balls of this metric space are:

$$
B_r(x)=\{(x-r,x+r)\}
$$

This basis is the set of all open sets in $\mathbb{R}$, which generates the standard topology of $\mathbb{R}$.

</details>

<details>
<summary>Proof</summary>

Let's check the two properties of basis:

1. $\forall x\in X$, $\exists B_r(x)\in \{B_r(x)|x\in X,r>0,r\in \mathbb{R}\}$ such that $x\in B_r(x)$. (Trivial by definition of non-zero radius ball)
2. $\forall B_r(x),B_r(y)\in \{B_r(x)|x\in X,r>0,r\in \mathbb{R}\}$, $\forall z\in B_r(x)\cap B_r(y)$, $\exists B_r(z)\in \{B_r(x)|x\in X,r>0,r\in \mathbb{R}\}$ such that $z\in B_r(z)\subseteq B_r(x)\cap B_r(y)$.

Observe that for any $z\in B_r(x)$, then there exists $\delta>0$ such that $B_\delta(z)\subseteq B_r(x)$.

Let $\delta=r-d(x,z)$, then $B_\delta(z)\subseteq B_r(x)$ (by triangle inequality)

Similarly, there exists $\delta'>0$ such that $B_\delta'(z)\subseteq B_r(y)$.

Take $\lambda=min\{\delta,\delta'\}$, then $B_\lambda(z)\subseteq B_r(x)\cap B_r(y)$.

</details>

#### Definition of Metric topology

For any metric space $(X,d)$, the topology generated by the balls of the metric space is called metric topology.

#### Definition of metrizable

A topological space $(X,\mathcal{T})$ is metrizable if it is the metric topology for some metric $d$ on $X$.

> Q: When is a topological space metrizable?

#### Lemma: Every metric topology is Hausdorff

If a topology isn't Hausdorff, then it isn't metrizable.

<details>
<summary>Example of non-metrizable space</summary>

Trivial topology **with at least two points** is not Hausdorff, so it isn't metrizable.

---

Finite complement topology on infinite set is not Hausdorff.

Suppose there exists $x,y\in X$ such that $x\neq y$ and $x\in U\subseteq X$ and $y\in V\subseteq X$ such that $X-U$ and $X-V$ are finite.

Since $U\cap V=\emptyset$, we have $V\subseteq X-U$, which is finite. So $X-V$ is infinite. (contradiction that $X-V$ is finite)

So $X$ with finite complement topology is not Hausdorff, so it isn't metrizable.

</details>

<details>
<summary>Proof</summary>

Let $x,y\in (X,d)$ and $x\neq y$. To show that $X$ is Hausdorff, it is suffices to show that there exists $r,r'>0$ such that $B_r(x)\cap B_r'(y)=\emptyset$.

Take $r=r'=\frac{1}{2}d(x,y)$, then $B_r(x)\cap B_r'(y)=\emptyset$. (by triangle inequality)

We prove this by contradiction.

Suppose $\exists z\in B_r(x)\cap B_r'(y)$, then $d(x,z)<r$ and $d(y,z)<r'$.

Then $d(x,y)\leq d(x,z)+d(z,y)<r+r'=\frac{1}{2}d(x,y)+\frac{1}{2}d(x,y)=d(x,y)$. (contradiction $d(x,y)<d(x,y)$)

Therefore, $X$ is Hausdorff.

</details>

### Other metrics on $\mathbb{R}^n$

Let $\mathbb{R}^n$ be the set of all $n$-tuples of real numbers with standard topology.

Let $d: \mathbb{R}^n\times \mathbb{R}^n\to \mathbb{R}$ be defined by (the Euclidean distance)

$$
d(u,v)=\sqrt{\sum_{i=1}^n (u_i-v_i)^2}
$$

In $\mathbb{R}^2$ the ball is a circle.

Let $\rho(u,v)=\max_{i=1}^n |u_i-v_i|$. (Square metric)

In $\mathbb{R}^2$ the ball is a square.

Let $m(u,v)=\sum_{i=1}^n |u_i-v_i|$. (Manhattan metric)

In $\mathbb{R}^2$ the ball is a diamond.

#### Lemma: Square metric, Manhattan metric, and Euclidean metric are well defined metrics on $\mathbb{R}^n$

Proof ignored. Hard part is to show the triangle inequality. May use Cauchy-Schwarz inequality.
