Definition. A metric on a set $X$ is a function: $\rho: X\times X\to[0, \infty)$ such that

1) $\rho(x, y)=0$ iff $x=y$;

2) $\rho(x, y)=\rho(y, x)$ for all $x, y\in X$;

3) $\rho(x, x)\le\rho(x, y)+\rho(y, z)$ for all $x, y, z\in X$.

A set equipped with a metric is called a metric space.

Examples. 1)  The Euclidean distance $\rho(x, y)=|x-y|$ is a metric on $\mathbb R^n$.

2) $\rho_1(x, y)=\int_0^1|f(x)-g(x)|dx$ and $\rho_\infty(f, g)=\sup_{0\le x\le 1}|f(x)-g(x)|$ are metrics on the space of continuous functions on $[0, 1]$.

3) If $\rho$ is a metric on $X$ and $A\subset X$, then $\rho|(A\times A)$ is a metric on $A$.

4) If $(X_1, \rho_1)$ and $(X_2, \rho_2)$ are metric spaces, the product metric $\rho$ on $X_1\times X_2$ is given by

$\rho((x_1, x_2),(y_1, y_2))=\max(\rho_1(x_1, y_1), \rho_2(x_2, y_2))$.

5) Some other metrics used on $X_1\times X_2$:

$\rho_1(x_1, y_1)+\rho_2(x_2, y_2)$, $[\rho_1(x_1, y_1)^2+\rho_2(x_2, y_2)^2]^{1/2}$.

Definition. Let $(X, \rho)$ be a metric space. If $x\in X$ and $r>0$, the (open) ball of radius $r$ about $x$ is $B(r, x)=\{y\in X: \rho(x, y).

A set $E\subset X$ is open if for every $x\in E$, $\exists r>0$ such that $B(r, x)\subset E$, and closed if the complement is open.

Remark. $X$ and $\emptyset$ are both open and closed. The union of any family of open sets is open, and the intersection of any family of closed sets is closed. The intersection (resp. union) of any finite family of open (resp. closed) sets is open (resp. closed). Indeed, if $U_1, U_2, ..., U_n$ are open and $x\in\cap_1^n U_j$, for each $j$, $\exists r_j>0$ such that $B(r_j, x)\subset U_j$, and then $B(r, x)\subset\cap_1^n U_j$ where $r=\min(r_1, ..., r_n)$, so $\cap_1^n U_j$ is open.

Definition. If $E\subset X$, then the interior of $E$, denoted by $E$ the union of all open sets $U\subset E$ is the largest open set contained in $E$, which is called the interior of $E$ and is denoted by $E^0$. The intersection of all closed sets $F\supset E$ is the smallest closed set containing $E$; it is called the closure of $E$ and is denoted by $\bar{E}$. $E$ is said to be dense in $X$ if $\bar{E}=X$, and nowhere dense if $\bar{E}$ has empty interior. $X$ is called separable if it has a countable dense subset. (For example, $\mathbb Q^n$ is a countable dense subset of $\mathbb R^n$.) A sequence $\{x_n\}$ in $X$ converges to $x\in X$ (symbolically: $x_n\to x$ or $\lim x_n=x$) if $\lim_{n\to\infty}\rho(x_n, x)=0$.

Proposition. If $X$ is a metric space, $E\subset X$, and $x\in X$, the following are equivalent:

1) $x\in\bar{E}$.

2) $B(r, x)\cap E\not=\emptyset$ for all $r>0$.

3) There is a sequence $\{x_n\}$ in $E$ that converges to $x$.

Proof. If $B(r, x)\cap E=\emptyset$, then $B(r, x)^c$ is a closed set containing $E$ but not $x$, so $x\not\in\bar{E}$. Conversely, if $x\not\in\bar{E}$, since $(\bar{E})^c$ is open $\exists r>0$ such that $B(r, x)\subset(\bar E)^c\subset E^c$. Thus 1) is equivalent to 2). If 2) holds, for each $n\in\mathbb N$, $\exists x_n\in B(n^{-1}, x)\cap E$, so that $x_n\to x$. On the other hand, if $B(r, x)\cap E=\emptyset$, then $\rho(y, x)\ge r$ for all $y\in E$, so no sequence of $E$ can converge to $x$. Thus 2) is equivalent to 3). $\Box$

Remark. If $(X_1, \rho_1)$ and $(X_2, \rho_2)$ are metric spaces, a map $f: X_1\to X_2$ is called continuous at $x\in X_1$ if for every $\epsilon>0$, $\exists \delta>0$ such that $\rho_2(f(y), f(x))<\epsilon$ whenever $\rho_1(x, y)<\delta$. In other words, $f^{-1}(B(\epsilon, f(x)))\supset B(\delta, x)$. The map $f$ is called continuous if it is continuous at each $x\in X_1$ and uniformly continuous if the $\delta$ in the definition of continuity can be chosen independent of $x$.

Proposition. $f: X_1\to X_2$ is continuous iff $f^{-1}(U)$ is open in $X_1$ for every open $U\subset X_2$.

Proof. If the latter condition holds, then for every $x\in X_1$ and $\epsilon>0$, the set $f^{-1}(B(\epsilon, f(x)))$ is open and contains $x$, so it contains some ball about $x$; this means that $f$ is continuous at $x$. Conversely, suppose that $f$ is continuous and $U$ is open in $X_2$. For each $y\in U$, $\exists \epsilon_y>0$ such that $B(\epsilon_y, y)\subset U$, and for each $x\in f^{-1}(\{y\})$, $\exists\delta_x$ such that $B(\delta_x, x)\subset f^{-1}(B(\epsilon_y, y))\subset f^{-1}(U)$. Thus $f^{-1}(U)=\cup_{x\in f^{-1}}B(\delta_x, x)$ is open. $\Box$

“I understand now that the vulnerability I’ve always felt is the greatest strength a person can have. You can’t experience life without feeling life. What I’ve learned is that being vulnerable to somebody you love is not a weakness, it is strength.” ~ Elisabeth Shue

References:

[1] Gerald B. Folland, Real Analysis: Modern Techniques and Their Applications, 2ed, page 13-14.

[2] Purpose Fairy’s 21-Day Happiness Challenge, http://www.jrmstart.com/wordpress/wp-content/uploads/2014/10/Free+eBook+-+PurposeFairys+21-Day+Happiness+Challenge.pdf.