Title: Metric and Topological Spaces

Q: Metric space
A: A \emph{metric space} is a pair $(X, d_X)$ where $X$ is a set (the \emph{space}) and $d_X$ is a function $d_X: X \times X \to \R$ (the \emph{metric}) such that for all $x, y, z$,
  \begin{itemize}
    \item $d_X(x, y) \geq 0$\hfill(non-negativity)
    \item $d_X(x, y) = 0$ iff $x = y$\hfill(identity of indiscernibles)
    \item $d_X(x, y) = d_X(y, x)$\hfill(symmetry)
    \item $d_X(x, z) \leq d_X(x, y) + d_X(y, z)$\hfill(triangle inequality)
  \end{itemize}

Q: Metric subspace
A: Let $(X, d_X)$ be a metric space, and $Y\subseteq X$. Then $(Y, d_Y)$ is a metric space, where $d_Y(a, b) = d_X(a, b)$, and said to be a \emph{subspace} of $X$.

Q: Discrete metric
A: Let $X$ be a set, and
      \[
        d_X(x, y) =
        \begin{cases}
          1 & x \not= y\\
          0 & x = y.
        \end{cases}
      \]

Q: Manhattan metric
A: Let $X = \R^2$, and define the metric as
  \[
    d(\mathbf{x}, \mathbf{y}) = d((x_1, x_2), (y_1, y_2)) = |x_1 - y_1| + |x_2 - y_2|.
  \]
  The first three axioms are trivial. To prove the triangle inequality, we have
  \begin{align*}
    d(\mathbf{x}, \mathbf{y}) + d(\mathbf{y}, \mathbf{z}) &= |x_1 - y_1| + |x_2 - y_2| + |y_1 - z_1| + |y_2 - z_2|\\
    &\geq |x_1 - z_1| + |x_2 - z_2|\\
    &= d(\mathbf{x}, \mathbf{z}),
  \end{align*}
  using the triangle inequality for $\R$.

Q: British railway metric
A: Let $X = \R^2$. We define
  \[
    d(\mathbf{x}, \mathbf{y}) =
    \begin{cases}
      |\mathbf{x} - \mathbf{y}|&\text{if }\mathbf{x} = k\mathbf{y}\\
      |\mathbf{x}| + |\mathbf{y}|&\text{otherwise}.
    \end{cases}
  \]

Q: $p$-adic metric
A: Let $p\in \Z$ be a prime number. We first define the norm $|n|_p$ to be $p^{-k}$, where $k$ is the highest power of $p$ that divides $n$. If $n = 0$, we let $|n|_p = 0$.
 Let $d_p (a, b) = |a - b|_p$ and then $(\Z,d_p)$ is a metric.

Q: Uniform metric
A: Let $X = C[0, 1]$ be the set of all continuous functions on $[0, 1]$. Then define
  \[
    d(f, g) = \max_{x\in [0, 1]}|f(x) - g(x)|.
  \]
  The maximum always exists since continuous functions on $[0, 1]$ are bounded and attain their bounds.

Q: Norm
A: Let $V$ is a real vector space. A \emph{norm} on $V$ is a function $\|\ph \|: V\to \R$ such that
  \begin{itemize}
    \item $\|\mathbf{v}\| \geq 0$ for all $\mathbf{v}\in V$
    \item $\|\mathbf{v}\| = 0$ if and only if $\mathbf{v} = \mathbf{0}$.
    \item $\|\lambda \mathbf{v}\| = |\lambda|\|\mathbf{v}\|$
    \item $\|\mathbf{v} + \mathbf{w}\| \leq \|\mathbf{v}\| + \|\mathbf{w}\|$.
  \end{itemize}

Q: $p-$norm
A: On $\R^n$ we define
  \[
    \|\mathbf{v}\|_p = \left(\sum_{i = 1}^n |v_i|^p\right)^{1/p}.
  \]
  for any $1 \leq p \leq \infty$, and $\|\mathbf{v}\|_\infty$ is the limit as $p\to \infty$. In particular
\begin{align*}
    \|\mathbf{v}\|_1 &= \sum_{i = 1}^n |v_i| \quad \text{(Taxicab or Manhattan norm)}\\
    \|\mathbf{v}\|_2 &= \sqrt{\sum_{i = 1}^n v_i^2}\quad\text{(Euclidean norm)}\\
    \|\mathbf{v}\|_\infty &= \max \{|v_i|: 1 \leq i \leq n\}\quad\text{(Infinity or Maximum norm)}.
  \end{align*}

Q: Norms induce metrics
A: If $\|\ph\|$ is a norm on $V$, then
  \[
    d(\mathbf{v}, \mathbf{w}) = \|\mathbf{v} - \mathbf{w}\|
  \]
  defines a metric on $V$.
\begin{proof}\leavevmode
  \begin{enumerate}
    \item $d(\mathbf{v}, \mathbf{w}) = \|\mathbf{v} - \mathbf{w}\| \geq 0$ by the definition of the norm.
    \item $d(\mathbf{v}, \mathbf{w}) = 0 \Leftrightarrow \|\mathbf{v} - \mathbf{w}\| = 0 \Leftrightarrow \mathbf{v} - \mathbf{w} = \mathbf{0} \Leftrightarrow \mathbf{v} = \mathbf{w}$.
    \item $d(\mathbf{w}, \mathbf{v}) = \|\mathbf{w} - \mathbf{v}\| = \|(-1)(\mathbf{v} - \mathbf{w})\| = |-1| \|\mathbf{v} - \mathbf{w}\| = d(\mathbf{v}, \mathbf{w})$.
    \item $d(\mathbf{u}, \mathbf{v}) + d(\mathbf{v}, \mathbf{w}) = \|\mathbf{u} - \mathbf{v}\| + \|\mathbf{v} - \mathbf{w}\| \geq \|\mathbf{u} - \mathbf{w}\| = d(\mathbf{u}, \mathbf{w})$.
  \end{enumerate}
\end{proof}

Q: $L^p$ norms
A: We have the following norms on $C[0, 1]$:
  \begin{align*}
    \|f\|_1 &= \int_0^1 |f(x)|\;\d x\\
    \|f\|_2 &= \sqrt{\int_0^1 f(x)^2 \;\d x}\\
    \|f\|_{\infty} &= \max_{x \in [0, 1]}|f(x)| \quad\text{(Uniform norm)}.
  \end{align*}

Q: Real inner product
A: Let $V$ be a real vector space. An \emph{inner product} on $V$ is a function $\bra \ph, \ph\ket: V\times V \to \R$ such that
  \begin{enumerate}
    \item $\bra \mathbf{v}, \mathbf{v}\ket \geq 0$ for all $\mathbf{v}\in V$
    \item $\bra \mathbf{v}, \mathbf{v}\ket = 0$ if and only if $\mathbf{v} = \mathbf{0}$.
    \item $\bra \mathbf{v}, \mathbf{w}\ket = \bra \mathbf{w}, \mathbf{v}\ket$.
    \item $\bra \mathbf{v}_1 + \lambda \mathbf{v}_2, \mathbf{w}) = \bra \mathbf{v}_1, \mathbf{w}\ket + \lambda\bra \mathbf{v}_2 , \mathbf{w}\ket$.
  \end{enumerate}

Q: Inner products induce norms
A: \begin{lemma}
  If $\bra \ph, \ph \ket$ is an inner product on $V$, then
  \[
    \|\mathbf{v}\| = \sqrt{\bra \mathbf{v}, \mathbf{v}\ket}
  \]
  is a norm.
\end{lemma}
\begin{proof}\leavevmode
  \begin{enumerate}
    \item $\|\mathbf{v}\| = \sqrt{\|\mathbf{v}, \mathbf{v}\|} \geq 0$.
    \item $\|\mathbf{v}\| = 0\Leftrightarrow \bra \mathbf{v}, \mathbf{v}\ket = 0 \Leftrightarrow \mathbf{v} = 0$
    \item $\|\lambda \mathbf{v}\| = \sqrt{\bra \lambda \mathbf{v}, \lambda \mathbf{v}\ket} = \sqrt{\lambda^2 \bra \mathbf{v}, \mathbf{v}\ket} = |\lambda| \|\mathbf{v}\|$.
    \item
      \begin{align*}
        (\|\mathbf{v}\| + \|\mathbf{w}\|)^2 &= \|\mathbf{v}\|^2 + 2\|\mathbf{v}\|\|\mathbf{w}\| + \|\mathbf{w}\|^2\\
        &\geq \bra \mathbf{v}, \mathbf{v}\ket + 2\bra \mathbf{v}, \mathbf{w}\ket + \bra \mathbf{w}, \mathbf{w}\ket \\
        &= \|\mathbf{v} + \mathbf{w}\|^2.
      \end{align*}
  \end{enumerate}
\end{proof}

Q: Balls
A: Let $(X, d)$ be a metric space. For any $x\in X$, $r\in \R$,
  \[
    B_r(x) = \{y\in X: d(y, x) < r\}
  \]
  is the \emph{open ball} centered at $x$.
  \[
    \bar{B}_r(x) = \{y\in X: d(y, x) \leq r\}
  \]
  is the \emph{closed ball} centered at $x$.

Q: Open and closed subsets
A: $U\subseteq X$ is an \emph{open subset} if for every $x\in U$, $\exists \delta > 0$ such that $B_\delta(x) \subseteq U$.
  $C\subseteq X$ is a \emph{closed subset} if $X\setminus C \subseteq X$ is open.

Q: Balls as subsets
A: \begin{lemma}
  The open ball $B_r(x) \subseteq X$ is an open subset, and the closed ball $\bar{B}_r(x) \subseteq X$ is a closed subset.
\end{lemma}
\begin{proof}
  Given $y\in B_r(x)$, we have $a = d(y, x) < r$. Let $\delta = r - a > 0$. Then $\forall z \in B_\delta (y)$:
  \begin{align*}
    d(z, x)&\leq d(z, y)+ d(y, x) \\
&< (r - a)+ a \\
&= r.
  \end{align*}
 Hence  $z \in B_r(x)$. So $B_\delta(y) \subseteq B_r(x)$ as desired.
 Given $y\in X\setminus \bar{B}_r(x) = \{y\in X: d(y, x) > r\}$, we have $a = d(y, x) > r$. Let $\delta = a-r > 0$. Then $\forall z \in B_\delta (y)$:
  \begin{align*}
    d(z, x)&\geq d(x, y) - d(y, z)\\
&> a -(a-r) \\
&= r.
  \end{align*}
 Hence $ z \in X\setminus \bar{B}_r(x)$. So $B_\delta(y) \subseteq X\setminus \bar{B}_r(x)$ as desired.
\end{proof}

Q: Limit point
A: Let $A\subseteq X$. Then $x\in X$ is a \emph{limit point} of $A$ if there is a sequence $x_n \to x$ such that $x_n \in A$ for all $n$.

Q: Closed subsets by limit points
A: Let $X$ be a metric space, $C\subseteq X$ and $L(C)$ be the set of limit points of $X$ in $C$.
Then $C$ is a closed subset if and only if $L(C)=C$.
\begin{proof}
  $(\Rightarrow)$ Fix a closed subset $C$ in $X$. Clearly $C\subseteq L(C)$. Now given $x_n \to x$, $x_n \in C$, suppose that $x\not\in C$. Then $x \in X\setminus C$, which is open, so there exists an open neighbourhood, $A\subseteq X \setminus C$, of $x$. Then $\exists N$ such that $\forall n\geq N: x_n \in A$. So $x_N \in X\setminus C$, contradicting $x_n\in C$. Hence $L(C)=C$.
  $(\Leftarrow)$ Suppose that $C$ is not closed. So $X\setminus C$ is not open. Hence $\exists x\in X\setminus C$ such that $\forall \delta > 0: B_\delta(x)\not\subseteq X\setminus C$. So $\forall \delta>0: B_\delta(x) \cap C \not= \emptyset$. Now pick $x_n \in B_{\frac{1}{n}}(x)\cap C$ for each $n\in\N$. Then $x_n \in C$ and $x_n\to x\in X\setminus C$. So $C\neq L(C)$.
\end{proof}
The first direction also holds for topological spaces.

Q: Limits inside an open neighbourhood
A: If $U$ is an open neighbourhood of $x$ and $x_n \to x$, then $\exists N$ such that $x_n \in U$ for all $n > N$.
\begin{proof}
  Since $U$ is open, there exists some $\delta > 0$ such that $B_\delta(x)\subseteq U$. Since $x_n \to x$, $\exists N$ such that $\forall n\geq N: d(x_n, x) < \delta$. So $\forall n\geq N: x_n \in B_\delta(x)\subseteq U$.
\end{proof}

Q: Characterization of continuity
A: Let $(X, d_x)$ and $(Y, d_y)$ be metric spaces and $f: X\to Y$. TFAE:
  \begin{enumerate}
     \item If $x_n \to x$, then $f(x_n) \to f(x)$
    \item For any closed subset $C\subseteq Y$, $f^{-1}(C)$ is closed in $X$.
    \item For any open subset $U\subseteq Y$, $f^{-1}(U)$ is open in $X$.
    \item For any $x\in X$ and $\varepsilon > 0$, $\exists \delta > 0$ such that $f(B_\delta(x)) \subseteq B_\varepsilon(f(x))$.
  \end{enumerate}
\begin{proof}\leavevmode
  \begin{itemize}
       \item $1 \Rightarrow 2$: Given $C\subseteq Y$ closed, $x_n \in f^{-1}(C)$, $x_n \to x$, then $f(x_n) \to f(x)$ and $f(x_n) \in C$. Since $C$ is closed, $f(x) \in C$. So $x\in f^{-1}(C)$. Hence $f^{-1}(C)$ is closed.
    \item $2 \Rightarrow 3$: Given $U\subseteq Y$ open, then $Y\setminus U$ is closed so $f^{-1}(Y\setminus U) = X\setminus f^{-1}(U)$ is closed. Hence $f^{-1}(U)\subseteq X$ is open.
    \item $3 \Rightarrow 4$: Given $x\in X, \varepsilon > 0$, then $B_\varepsilon(f(x))$ is open so $ f^{-1}(B_\varepsilon(f(x))) $ is open. Then $\exists \delta > 0$ such that $B_\delta (x) \subseteq f^{-1}(B_\varepsilon(f(x)))$. So $f(B_\delta(x)) \subseteq B_\varepsilon (f(x))$.
    \item $4 \Rightarrow 1$: Given $x_n \to x$, $\varepsilon > 0$, then $\exists \delta > 0$ such that $f(B_\delta(x)) \subseteq B_\varepsilon(f(x))$. Then $\exists N$ such that $\forall n\geq N: x_n \in B_\delta (x)$. So $f(x_n) \in f(B_\delta(x))\subseteq B_\varepsilon(f(x))$ for all $n > N$.
  \end{itemize}
\end{proof}

Q: Union and intersection of open subsets
A: Suppose $V_\alpha \subseteq X$ is open for all $\alpha \in A$. Then $\displaystyle U = \bigcup_{\alpha \in A}V_\alpha$ is open in $X$.
\begin{proof}
Given $x\in U$, then $x\in V_\alpha$ for some $\alpha$. Since $V_\alpha$ is open, $\exists\delta > 0$ such that $B_\delta(x) \subseteq V_\alpha$. So $\displaystyle B_\delta (x) \subseteq \bigcup_{\alpha \in A}V_\alpha = U$. So $U$ is open.
\end{proof}
If $V_1, \cdots, V_n\subseteq X$ are open, then so is $\displaystyle V = \bigcap_{i = 1}^n V_i$.
\begin{proof}\leavevmode
If $x\in V$, then $\forall i: x\in V_i$ with $V_i$ open so $\exists \delta_i > 0$ with $B_{\delta_i}(x) \subseteq V_i$. Take $\delta = \min\{\delta_1, \cdots, \delta_n\}$. So $\forall i: B_\delta(x) \subseteq V_i$. Then $B_\delta(x) \subseteq V$. So $V$ is open.
\end{proof}

Q: Topological space
A: A \emph{topological space} is a set $X$ (the space) together with a set $\cU \subseteq \P(X)$ (the topology) such that:
  \begin{enumerate}
    \item $\emptyset, X\in \cU$
    \item If $V_\alpha\in \cU$ for all $\alpha \in A$, then $\displaystyle \bigcup_{\alpha\in A}V_\alpha \in \cU$.
    \item If $V_1, \cdots, V_n \in \cU$, then $\displaystyle \bigcap_{i = 1}^n V_i \in \cU$.
  \end{enumerate}
  The elements of $X$ are the \emph{points}, and the elements of $\cU$ are the open subsets of $X$.

Q: Coarse topology
A: $\cU = \{\emptyset, X\}$ is the \emph{coarse topology} on $X$.

Q: Discrete topology
A: $\cU = \P(X)$ is the \emph{discrete topology} on $X$, since it is induced by the discrete metric.

Q: Cofinite topology
A: $\cU = \{A\subseteq X: X\setminus A\text{ is finite or } A = \emptyset\}$ is the \emph{cofinite topology} on $X$.

Q: Right order topology
A: $\cU = \{(a, \infty): a\in \R \cup \{-\infty, +\infty \} \}$ is the \emph{right order topology} on $\R$.

Q: Homeomorphism
A: $f: X\to Y$ is a \emph{homeomorphism} if
  \begin{enumerate}
    \item $f$ is a bijection
    \item Both $f$ and $f^{-1}$ are continuous (i.e. $U\subseteq X$ is open iff $f(U)\subseteq Y$ is open).
  \end{enumerate}
  Two spaces are \emph{homeomorphic} if there exists a homeomorphism between them, and we write $X\simeq Y$.

Q: Convergent sequence
A: A sequence $x_n \to x$ if for every open neighbourhood $U$ of $x$, $\exists N$ such that $x_n \in U$ for all $n > N$.

Q: Hausdorff space
A: A topological space $X$ is \emph{Hausdorff} if for all $x_1, x_2\in X$ with $x_1 \not= x_2$, there exists open neighbourhoods $U_1$ of $x_1$, $U_2$ of $x_2$ such that $U_1 \cap U_2 = \emptyset$.

Q: Uniqueness of limits in Hausdorff spaces
A: If $X$ is Hausdorff, $x_n$ is a sequence in $X$ with $x_n \to x$ and $x_n \to x'$, then $x = x'$.
\begin{proof}
  Suppose $x\not= x'$. Then, by definition of Hausdorff, there exist open neighbourhoods $U, U'$ of $x, x'$ respectively with $U \cap U' = \emptyset$.
By convergence $\exists N,N'$ such that $\forall n > N: x_n \in U$ and $\forall n > N': x_n \in U'$.
Hence $\forall n > \max(N, N')$: $x_n \in U$ and $x_n \in U'$. So $x_n \in U\cap U'$. This contradicts the fact that $U \cap U' = \emptyset$.
\end{proof}

Q: Union and intersection of closed subsets
A: \begin{enumerate}
    \item If $C_\alpha$ is a closed subset of $X$ for all $\alpha \in A$, then $\bigcap_{\alpha \in A} C_\alpha$ is closed in $X$.
    \item If $C_1, \cdots, C_n$ are closed in $X$, then so is $\bigcup_{i = 1}^n C_i$.
  \end{enumerate}
\begin{proof}\leavevmode
  \begin{enumerate}
    \item Since $C_\alpha$ is closed in $X$, $X \setminus C_\alpha$ is open in $X$. So $\bigcup_{\alpha\in A}(X\setminus C_\alpha) = X\setminus \bigcap_{\alpha\in A}C_\alpha$ is open. So $\bigcap_{\alpha \in A}C_\alpha$ is closed.
    \item If $C_i$ is closed in $X$, then $X\setminus C_i$ is open. So $\bigcap_{i = 1}^n (X\setminus C_i) = X\setminus \bigcup_{i = 1}^n C_i$ is open. So $\bigcup_{i = 1}^n C_i$ is closed.
  \end{enumerate}
\end{proof}

Q: Singleton sets in Hausdorff spaces are closed
A: If $X$ is Hausdorff and $x\in X$, then $\{x\}$ is closed in $X$.
\begin{proof}
  Given $y\in X\setminus \{ x \}$, there exist open subsets $U_x, U_y$ with $x\in U_x, y\in U_y$, $U_x \cap U_y = \emptyset$.
Hence $X\setminus \{x\} = \bigcup_{y\in X\setminus \{ x \}} U_y$ is a union of open sets so open.
\end{proof}

Q: Closure
A: Let $X$ be a topological space and $A\subseteq X$. Define
  \[
    \mathcal{C}_A = \{C\subseteq X: A\subseteq C\text{ and }C\text{ is closed in }X\}.
  \]
  Then the \emph{closure} of $A$ in $X$ is
  \[
    \bar A = \bigcap_{C\in \mathcal{C}_A} C.
  \]
\begin{prop}
  $\bar A$ is the smallest closed subset of $X$ which contains $A$.
\end{prop}
\begin{proof}
\emph{Closed}. Since $\bar A$ is an intersection of closed sets, it is closed in $X$.
\emph{Contains $A$}. $\forall C\in \mathcal{C}_A: A\subseteq C$. So $A\subseteq \bigcap_{C\in \mathcal{C}_A} C = \bar A$.
\emph{Minimal}. Given $ K\in \mathcal{C}_A$, we have $\bigcap_{C\in \mathcal{C}_A}C \subseteq K$. So $\bar A\subseteq K$.
\end{proof}

Q: Closure by limit points
A: \begin{prop}
  $L(A) \subseteq \bar A$.
\end{prop}
\begin{proof}
  Given $C\in \mathcal{C}_A$, we have $A\subseteq C$ so $L(A) \subseteq L(C) = C$. So $L(A) \subseteq \bigcap_{C\in \mathcal{C}_A}C = \bar A$.
\end{proof}
\begin{cor}
  Suppose $C\subseteq X$ is closed, $A\subseteq C$ and $C\subseteq L(A)$. Then $C = L(A) = \bar A$.
\end{cor}
\begin{proof}
  $C\subseteq L(A) \subseteq \bar A \subseteq C$, where the last step is since $\bar A$ is the smallest closed set containing $A$. So $C = L(A) = \bar A$.
\end{proof}

Q: Dense subset
A: $A\subseteq X$ is \emph{dense} in $X$ if $\bar A = X$.

Q: Interior
A: Let $A\subseteq X$, and let
  \[
    \mathcal{O}_A = \{U\subseteq X: U\subseteq A, U\text{ is open in }X\}.
  \]
  The \emph{interior} of $A$ is
  \[
    \Int(A) = \bigcup_{U\in \mathcal{O}_A} U.
  \]
\begin{prop}
  $\Int(A)$ is the largest open subset of $X$ contained in $A$.
\end{prop}
\begin{proof}
\emph{Open}. Since $\Int (A)$ is a union of open sets, it is open in $X$.
\emph{Contained in $A$}. $\forall U\in \mathcal{O}_A: U\subseteq A$. So $\Int (A)=\bigcup_{U\in \mathcal{O}_A} U \subseteq A$.
\emph{Maximal}. Given $ V\in \mathcal{O}_A$, we have $V \subseteq\bigcup_{U\in \mathcal{O}_A}U$. So $V\subseteq \Int(A)$.
\end{proof}

Q: Relationship between interior and closure
A: $X\setminus \Int(A) = \overline{X\setminus A}$
\begin{proof}
\begin{align*}
X\setminus\Int(A) &= X \setminus \bigcup \{ U\subseteq X \ | \ U \text{ open and } U\subseteq A \} \\
&= \bigcap \{ X \setminus U \ | \ U \text{ open and } U\subseteq A \} \\
&= \bigcap \{ X \setminus U \ | \ X\setminus U \text{ closed and } X\setminus U\supseteq X\setminus A \} \\
&= \bigcap \{ C \ | \ C \text{ closed and } C\supseteq X\setminus A \} \\
&= \overline{X\setminus A}.
\end{align*}
\end{proof}

Q: Subspace topology
A: Let $X$ be a topological space and $Y\subseteq X$. The \emph{subspace topology} on $Y$ is given by:
$V$ is an open subset of $Y$ $\iff\exists U$ open in $X$ such that $V = Y\cap U$.
\begin{prop}
  The subspace topology is a topology.
\end{prop}
\begin{proof}\leavevmode
  \begin{enumerate}
    \item Since $\emptyset$ is open in $X$, $\emptyset = Y\cap \emptyset$ is open in $Y$.
      Since $X$ is open in $X$, $Y = Y\cap X$ is open in $Y$.
    \item Given $V_\alpha$ open in $Y$, then $V_\alpha = Y\cap U_\alpha$ for some $U_\alpha$ open in $X$. Then
      \[
        \bigcup_{\alpha\in A}V_\alpha = \bigcup_{\alpha\in A}\left(Y\cap U_\alpha\right) = Y\cap \left(\bigcup_{\alpha\in U}U_\alpha\right)
      \]
    is open in $Y$.
    \item Given $V_i$ open in $Y$, then $V_i = Y\cap U_i$ for some open $U_i\subseteq X$. Then
      \[
        \bigcap_{i = 1}^n V_i = \bigcap_{i = a}^n \left(Y\cap U_i\right) = Y\cap \left(\bigcap_{i = a}^n U_i\right)
      \]
      is open in $Y$.
  \end{enumerate}
\end{proof}

Q: Continuity in subspace topology
A: \begin{prop}
  If $Y$ has the subspace topology, $f: Z\to Y$ is continuous iff $\iota\circ f: Z\to X$ is continuous.
\end{prop}
\begin{proof}
  $(\Rightarrow)$ Given an open set $U\subseteq X$, then $\iota^{-1}(U) = Y\cap U$ is open in $Y$. So $\iota: Y\to X$ is continuous. Then, given a continuous function $f$, we have that $\iota\circ f$ is continuous.
  $(\Leftarrow)$ Given a function $f:Z\to Y$ such that $\iota\circ f$ is continuous and an open set $V\subseteq Y$, we have that $V = Y \cap U = \iota^{-1}(U)$ for some $U$ open in $X$. So $f^{-1}(V) = f^{-1}(\iota^{-1}(U))) = (\iota\circ f)^{-1}(U)$ is open since $\iota\circ f$ is continuous. So $f$ is continuous.
\end{proof}

Q: Product Topology
A: Let $X$ and $Y$ be topological spaces. The \emph{product topology} on $X\times Y$ is given by:
  $U\subseteq X\times Y$ is open $\iff$  $\forall (x, y)\in U$, there exist open neighbourhoods $ V_x\subseteq X, W_y\subseteq Y$ of $x$ and $y$ such that $V_x\times W_y \subseteq U$.
\begin{prop}
The product topology is a topology.
\end{prop}
\begin{proof}
\begin{enumerate}
\item It is immediate that $\emptyset $ is open. $X\times Y$ is open since $X,Y$ are open.
\item Given open sets $V_\alpha$, then $\forall (x,y)\in \bigcup _\alpha V_\alpha $ we have $(x,y)\in V_{\alpha_0}$ for some $\alpha_0$ so there exist open neighbourhoods $U_x$, $U_y$ of $x$, $y$ such that $U_x\times U_y\subseteq V_{\alpha_0}\subseteq \bigcup _\alpha V_\alpha$.
\item Given open sets $(V_i)_1^n$, then $\forall (x,y)\in \bigcap _{i=1}^n V_i $ we have $\forall i: (x,y)\in V_{i}$ so there exist open neighbourhoods $U_x^{(i)},U_y^{(i)}$ of $x$ and $y$ such that $\forall i:$ $U_x^{(i)}\times U_y^{(i)}\subseteq V_i $. Hence $\bigcap _{i=1}^n U_x^{(i)}$, $\bigcap _{i=1}^n U_y^{(i)}$ are open neighbourhoods of $x$ and $y$ such that  $\bigcap _{i=1}^n U_x^{(i)} \times \bigcap _{i=1}^n U_y^{(i)}\subseteq \bigcap _{i=1}^n V_i$.
\end{enumerate}
\end{proof}

Q: Continuity in the product topology
A: $f: Z\to  X\times Y$ is continuous iff $\pi_X\circ f$ and $\pi_Y\circ f$ are continuous where $\pi_X,\pi_Y$ are the projection functions.
\begin{proof}
  $(\Rightarrow)$ Given an open set $U\subseteq X$, then $\pi_X^{-1}(U) = U\times Y$ is open in $Y$. So $\pi_X$ and similarly $\pi_Y$ are continuous. Then, given a continuous function $f$, we have that $\pi_X\circ f$ and $\pi_Y\circ f$ are continuous.
  $(\Leftarrow)$ Given a function $f:Z\to X\times Y$ such that $\pi_X\circ f$, $\pi_Y\circ f$ are continuous and an open set $V\subseteq X\times Y$, writing $V$ in terms of the basis
\begin{align*}
V&=\bigcup _{\alpha,\beta} \left( X_\alpha\times Y_\beta \right) \\
&= \bigcup _{\alpha,\beta} \left(\pi_X^{-1}(X_\alpha) \cap \pi_Y^{-1} (Y_\beta)\right) \\
f^{-1}(V)&= f^{-1} \left[ \bigcup _{\alpha,\beta} \left(\pi_X^{-1}(X_\alpha) \cap \pi_Y^{-1} (Y_\beta)\right) \right] \\
&= \bigcup _{\alpha,\beta} f^{-1}\left(\pi_X^{-1}(X_\alpha) \cap \pi_Y^{-1} (Y_\beta)\right)\\
&= \bigcup _{\alpha,\beta} \left(f^{-1}\pi_X^{-1}(X_\alpha) \cap f^{-1}\pi_Y^{-1} (Y_\beta)\right)\\
&= \bigcup _{\alpha,\beta} \left( (f\circ \pi_X)^{-1}(X_\alpha) \cap (f\circ \pi_Y)^{-1} (Y_\beta)\right)\\
\end{align*}
which is open by continuity of $\pi_X\circ f$, $\pi_Y\circ f$. So $f$ is continuous.
\end{proof}

Q: Basis
A: Let $\cU$ be a topology on $X$. A subset $\mathcal{B} \subseteq \cU$ is a \emph{basis} if
``$U\in \cU$ $\iff$ $U$ is a union of sets in $\mathcal{B}$''.

Q: Basis of the product topology
A: \begin{prop}
$\{V\times W: V\subseteq X, W\subseteq Y\text{ are open}\}$ is a basis for $X\times Y$.
\end{prop}
Given an open set $U\subseteq X\times Y$, we have that $\forall(x, y)\in U$, there exist open neighbourhoods $V_x\subseteq X, W_y\subseteq Y$ of $x$ and $y$ such that $V_x\times W_y \subseteq U$. Hence
\[
  U = \bigcup_{(x, y)\in U} V_x\times W_y.
\]
Conversely, given $U = \bigcup_{\alpha\in A, \beta\in B} V_\alpha\times W_\beta$ where $V_\alpha$, $W_\beta$ are open, we have that each $V_\alpha\times W_\beta$ is open. Hence their union is open.

Q: Quotient topology
A: If $X$ is a topological space, $\sim$ is an equivalence relation and $\pi:X\to X/{\sim}$ is the projection, then the quotient topology on $X/{\sim}$ is given by:
$U$ is open in $X/{\sim}$ $\iff$ $\pi^{-1}(U)$ is open in $X$.
\begin{prop}
The quotient topology is a topology.
\end{prop}
\begin{proof}
\begin{enumerate}
\item $\pi^{-1}(\emptyset)=\emptyset$ and $\pi^{-1}(X/{\sim})=X$ are open sets since $X$ is a topological space. So $\emptyset$ and $X/{\sim}$ are open sets.
\item Given a collection of open sets $V_\alpha$, we have \[
\pi^{-1}\left( \bigcup_\alpha V_\alpha \right)=\bigcup_\alpha \pi^{-1}(V_\alpha)
\]
is a union of open sets so open.
\item Given a collection of open sets $(V_i)_1^n$, we have \[
\pi^{-1}\left( \bigcap_{i=1}^n V_i \right)=\bigcap_{i=1}^n \pi^{-1}( V_i)
\]
is a finite intersection of open sets so open.
\end{enumerate}
\end{proof}

Q: Continuity in quotient topology
A: A function $f: X/{\sim} \to Y$ is continuous iff $f\circ \pi: X\to Y$ is continuous.
\begin{proof}
  $(\Rightarrow)$ Given an open set $U\subseteq X/{\sim}$ , then $\pi^{-1}(U)$ is open in $Y$ by definition. So $\pi: X\to X/{\sim}$ is continuous. Then, given a continuous function $f$, we have that $f \circ \pi$ is continuous.
  $(\Leftarrow)$ Given a function $f$ such that $f \circ \pi$ is continuous and an open set $V\subseteq Y$, we have that $\pi^{-1}(f^{-1}(V))) = (f \circ \pi)^{-1}(V)$ is open since $f\circ \pi $ is continuous. Hence $f^{-1}(V)$ is open by definition. So $f$ is continuous.
\end{proof}

Q: Connected space
A: A topological space $X$ is \emph{disconnected} if $X$ can be written as $A\cup B$, where $A$ and $B$ are disjoint, non-empty open subsets of $X$. We say $A$ and $B$ \emph{disconnect} $X$.
  A space is \emph{connected} if it is not disconnected.

Q: Connectivity by continuous functions
A: \begin{prop}
  $X$ is disconnected iff there exists a continuous surjective $f: X\to \{0, 1\}$ with the discrete topology.
 Conversely $X$ is connected iff any continuous map $f: X \to \{0, 1\}$ is constant.
\end{prop}
\begin{proof}
  $(\Rightarrow)$ If $A$ and $B$ disconnect $X$, define
  \[
    f(x) =
    \begin{cases}
      0 & x\in A\\
      1 & x\in B
    \end{cases}
  \]
  Then $f^{-1}(\emptyset)=\emptyset$, $f^{-1}(\{0, 1\}) = X$, $f^{-1}(\{0\}) = A$ and $f^{-1}(\{1\}) = B$ are all open. So $f$ is continuous. Also, since $A, B$ are non-empty, $f$ must be surjective.
  $(\Leftarrow)$ Given $f: X\mapsto \{0, 1\}$ surjective and continuous, define $A = f^{-1}(\{0\})$, $B = f^{-1}(\{1\})$. Then $A$ and $B$ disconnect $X$.
\end{proof}

Q: Connectivity of the closed bounded interval
A: \begin{thm}
  $[0, 1]$ is connected.
\end{thm}
\begin{proof}
  Suppose $A$ and $B$ disconnect $[0, 1]$. Wlog, assume $1\in B$. Since $A$ is non-empty, $\exists\alpha = \sup A$. Then either
  \begin{itemize}
    \item $\alpha \in A$. So $1 \in B\implies \alpha<1$. Since $A$ is open, $\exists \varepsilon > 0$ with $B_\varepsilon(\alpha) \subseteq A$. So $\alpha + \frac{\varepsilon}{2} \in A$, contradicting supremality of $\alpha$; or
    \item $\alpha \not\in A$. Note $A$ is open $\implies \alpha >0$. Then $\alpha \in B$. Since $B$ is open, $\exists \varepsilon > 0$ such that $B_\varepsilon (\alpha) \subseteq B$. Then $\forall a\in A: a \leq \alpha - \varepsilon$. So $\alpha -\varepsilon$ is a smaller upper bound. Contradiction.
  \end{itemize}
\end{proof}

Q: Continuous functions preserve connectivity
A: \begin{prop}
  If $f: X\to Y$ is continuous and $X$ is connected, then $\im f$ is also connected.
\end{prop}
\begin{proof}
  Suppose $A$ and $B$ disconnect $\im f$. We show that $f^{-1}(A)$ and $f^{-1}(B)$ disconnect $X$, contradicting connectivity.
 \textbf{Open}. Since $A, B\subseteq \im f$ are open, we have that $f^{-1}(A)$ and $f^{-1}(B)$ are open by continuity.
 \textbf{Non-empty}. Since $A, B$ are non-empty, $f^{-1}(A)$ and $f^{-1}(B)$ are non-empty.
\textbf{Disjoint}. $f^{-1}(A) \cap f^{-1}(B) = f^{-1}(A\cap B) = f^{-1}(\emptyset) = \emptyset$.
\textbf{Span}. Finally $A\cup B = \im f$. So $f^{-1}(A)\cup f^{-1}(B) = f^{-1}(A\cup B) = X$.
\end{proof}
\begin{proof}(alternative)
Suppose $\im f$ is disconnected. Then there exists a continuous surjective map $g: \im f \to \{0, 1\}$. Then $g\circ f: X \to \{0, 1\}$ is continuous surjective, contradicting connectivity of $f$.
\end{proof}

Q: Intermediate value theorem
A: Suppose $f: X\to \R$ is continuous and $X$ is connected. If $\exists x_0, x_1$ such that $f(x_0) < 0 < f(x_1)$, then $\exists x\in X$ with $f(x) = 0$.
\begin{proof}
  Suppose no such $x$ exists. Then $0\not\in \im f$ while $0 > f(x_0) \in \im f$, $0 < f(x_1) \in \im f$. So $\im f \cap (-\infty,0)$ and $\im f \cap (0,\infty)$ disconnect $\im f$, contradicting continuity of $f$.
\end{proof}
\begin{proof}(alternative)
Suppose $\forall x: f(x) \not= 0$. Then $\frac{f(x)}{|f(x)|}$ is a continuous surjection from $X$ to $\{-1, +1\}$, contradicting connectivity of $X$.
\end{proof}
Conversely, if $X$ is disconnected, then there exists a continuous surjective map $f: X\to \{0, 1\}$. Now let $g(x) = f(x) - \frac{1}{2}$. Then $g$ is continuous, non-zero and crosses the $x$-axis.

Q: Path
A: Let $X$ be a topological space, and $x_0, x_1 \in X$. Then a \emph{path} from $x_0$ to $x_1$ is a continuous function $\gamma: [0, 1] \to X$ such that $\gamma(0) = x_0$, $\gamma(1) = x_1$.

Q: Path connectivity
A: A topological space $X$ is \emph{path connected} if for all points $x_0, x_1 \in X$, there is a path from $x_0$ to $x_1$.

Q: Connectivity vs path connectivity
A: If $X$ is path connected, then $X$ is connected.
\begin{proof}
  Let $f: X \to \{0, 1\}$ be a continuous function.
  Given $x, y \in X$, by path connectedness, $\exists \gamma: [0, 1] \to X$ such that $\gamma(0) = x$ and $\gamma(1) = y$. Then $f \circ \gamma: [0, 1] \to \{0, 1\}$ is constant by connectivity of $[0, 1]$. In particular $f(\gamma(0)) = f(\gamma(1))$, ie. $f(x) = f(y)$. So $f$ is constant.
\end{proof}
  If $U\subseteq \R^n$ is open and connected, then it is path-connected.
\begin{proof}
  Let $A$ be a path component of $U$.
 \textbf{$A$ is open}. Given $a\in A$, since $U$ is open, $\exists \varepsilon > 0$ such that $B_\varepsilon(a) \subseteq U$. But $B_\varepsilon(a) \simeq \Int(D^n)$ is path-connected$^*$ so $B_\varepsilon(a) \subseteq A$.
\textbf{$U\setminus A$ is open}. Given $b\in U\setminus A$, since $U$ is open, $\exists \varepsilon > 0$ such that $B_\varepsilon(b) \subseteq U$. Now if $B_\varepsilon(b) \cap A \not= \emptyset$, then $B_\varepsilon(b)\subseteq A$ and, in particular, $b\in A$ which is a contradiction. So $B_\varepsilon(b) \cap A = \emptyset$. Then $B_\varepsilon(b) \subseteq U\setminus A$. Hence $U\setminus A$ is open.
Since $U$ is connected, we must have $U\setminus A$ empty (since $A$ is not). So $U = A$ is path-connected.
\end{proof}
($^*$) e.g. use line segments connecting the points

Q: Homeomorphisms restrict to subsets
A: Suppose $f: X\to Y$ is a homeomorphism and $A\subseteq X$, then $f|_A: A\to f(A)$ is a homeomorphism.
\begin{proof}
  Since $f$ is a bijection, $f|_A$ is a bijection.
Given an open set $U\subseteq f(A)$, then $U = f(A) \cap U'$ for some $U'$ open in $Y$. So $f|_A^{-1}(U) = f^{-1}(U')\cap A$ is open in $A$. So $f|_A$ is continuous.
Given an open set $V\subseteq A$, then $V = A \cap V'$ for some $V'$ open in $X$. So $f|_A(U) = f(V')\cap f(A)$ is open in $f(A)$. So $(f|_A)^{-1}$ is continuous.
\end{proof}

Q: Path components are equivalence classes
A: Define $x\sim y$ if there is a path from $x$ to $y$ in $X$. Then $\sim$ is an equivalence relation.
\begin{proof}\leavevmode
  \begin{enumerate}
    \item For any $x\in X$, let $\gamma_x: [0, 1] \to X$ be $\gamma(t) = x$ (the constant path). Then this is a path from $x$ to $x$. So $x\sim x$.
    \item If $\gamma: [0, 1] \to X$ is a path from $x$ to $y$, then $\bar \gamma: [0, 1] \to X$ by $t \mapsto \gamma(1 - t)$ is a path from $y$ to $x$. So $x\sim y \Rightarrow y\sim x$.
    \item If $\gamma_1$ is a path form $x$ to $y$ and $\gamma_2$ is a path from $y$ to $z$, then $\gamma_2*\gamma_1$ defined by
      \[
        t\mapsto
        \begin{cases}
          \gamma_1(2t) & t\in [0, 1/2]\\
          \gamma_2(2t - 1) & t\in [1/2, 1]
        \end{cases}
      \]
      is a path from $x$ to $z$. So $x\sim y, y\sim z \Rightarrow x\sim z$.
  \end{enumerate}
\end{proof}

Q: The union of non-disjoint connected sets is connected
A: \begin{prop}
  Suppose $Y_\alpha\subseteq X$ is connected for all $\alpha\in T$ and that $\bigcap_{\alpha\in T}Y_\alpha \not= \emptyset$. Then $Y = \bigcup_{\alpha\in T}Y_\alpha$ is connected.
\end{prop}
\begin{proof}
  Suppose that $A$ and $B$ disconnect $Y$. Then $A$ and $B$ are open in $Y$. So $A = Y\cap A'$ and $B = Y\cap B'$, where $A', B'$ are open in $X$. For any fixed $\alpha$, let
  \[
    A_\alpha = Y_\alpha \cap A = Y_\alpha \cap A',\quad B_\alpha = Y_\alpha\cap B = Y_\alpha \cap B'.
  \]
  Then $A_\alpha,B_\alpha$ are open in $Y_\alpha$. Since $Y = A\cup B$, we have
  \[
    Y_\alpha = Y\cap Y_\alpha = (A\cup B)\cap Y_\alpha = A_\alpha \cup B_\alpha.
  \]
  Since $A\cap B = \emptyset$, we have
  \[
    A_\alpha \cap B_\alpha = Y_\alpha \cap (A\cap B) = \emptyset.
  \]
  So $A_\alpha, B_\alpha$ are disjoint. So $Y_\alpha$ is connected but is the disjoint union of open subsets $A_\alpha, B_\alpha$. Hence $A_\alpha = \emptyset$ or $B_\alpha = \emptyset$.
Now, since $\bigcap_{\alpha\in T}Y_\alpha \not= \emptyset$, pick your favourite $\displaystyle y\in \bigcap_{\alpha\in T}Y_\alpha$. Wlog $y\in A$. Then $\forall\alpha\in T$: \[
y\in Y_\alpha\implies y\in A_\alpha \implies A_\alpha\neq\emptyset \implies B_\alpha=\emptyset. \]
Hence $B = \emptyset$, contradicting the fact that $A$ and $B$ disconnect $Y$.
\end{proof}

Q: Connected component
A: For $x\in X$, define
  \[
    \mathcal{C}(x) = \{A\subseteq X: x\in A\text{ and }A\text{ is connected}\}.
  \]
  Then $\displaystyle C(x) = \bigcup_{A\in \mathcal{C}(x)} A$ is the \emph{connected component} of $x$.
Since $C(x)$ is a union of non-disjoint connected sets, it follows that $C(x)$ is the largest connected subset of $X$ containing $x$.
If all connected components are singletons, then we say $X$ is totally disconnected.

Q: Connected components are equivalence classes
A: Let $X$ be a set,
 \[
    \mathcal{C}(x) = \{A\subseteq X: x\in A\text{ and }A\text{ is connected}\}.
  \]
  and $\displaystyle C(x) = \bigcup_{A\in \mathcal{C}(x)} A$ is the \emph{connected component} of $x$. Then $x\sim y$ if $x \in C(y)$ is an equivalence relation.
\begin{proof}
 \begin{enumerate}
    \item If $x\in X$, then $\forall A\in\mathcal{C}(x): x\in A$. Hence $x\in C(x)$.
    \item If $y\in C(x)$, then $C(x) \subseteq C(y)$. So $x\in C(y)$.
    \item If $x\in C(y)$ and $y\in C(z)$, then $C(y)\subseteq C(x)$ and $C(z)\subseteq C(y)$. So $C(z)\subseteq C(x)$ and in particular $z\in C(x)$.
\end{enumerate}
\end{proof}

Q: Open covers and subcovers
A: Let $\cU\subseteq \P(X)$ be a topology on $X$. An \emph{open cover} of $X$ is a subset $\mathcal{V}\subseteq \cU$ such that
  \[
    \bigcup_{V\in \mathcal{V}} V = X.
  \]
  We say $\mathcal{V}$ \emph{covers} $X$.
  If $\mathcal{V}'\subseteq \mathcal{V}$, and $\mathcal{V}'$ covers $X$, then we say $\mathcal{V}'$ is a \emph{subcover} of $V$.

Q: Compactness
A: A topological space $X$ is \emph{compact} if every open cover $\mathcal{V}$ of $X$ has a finite subcover $\mathcal{V}' = \{V_1, \cdots, V_n\} \subseteq \mathcal{V}$.

Q: Compactness of the closed bounded interval
A: $[0, 1]$ is compact.
\begin{proof}
Given an open cover $\mathcal{V}$ of $[0, 1]$, let
  \[
    A = \{a\in [0, 1]: [0, a] \text{ has a finite subcover in }\mathcal{V}\}.
  \]
We check $A$ is non-empty. Since $\mathcal{V}$ covers $[0, 1]$, $\exists V_0$ that contains $0$. So $0\in A$.
  Now suppose $s=\sup A <1$. Note $s>0$ due to the coverage of $V_0$.
  Since $\mathcal{V}$ covers $[0,1]$, let $s \in V_s$. Since $V_s$ is open, $\exists\varepsilon>0$ such that $B_\varepsilon(s) \subseteq V_s$. Wlog $\varepsilon < \min(s,1-s)$. By definition of $s$, $[0,s-\varepsilon/2]$ has a finite subcover $W$. Then $W\cup\{V_s\}$ is a finite subcover of $[0, s + \varepsilon/2]$, contradicting supremality of $s$.
  So $s  = 1$.
  Now, since $\mathcal{V}$ covers $[0,1]$, $\exists V_1 \in \mathcal{V}$ such that $(1 - \varepsilon, 1] \subseteq V_1$ for some $\varepsilon>0$. Since $1 - \varepsilon/2 \in A$, there exists a finite $\mathcal{V}' \subseteq \mathcal{V}$  which covers $[0, 1 - \varepsilon/2]$. Then $ \mathcal{V}' \cup \{V_1\}$ is a finite subcover of $[0,1]$.
\end{proof}

Q: Closed $\implies$ compact
A: If $X$ is compact and $C$ is closed subset of $X$, then $C$ is also compact.
\begin{proof}
Given an open cover $\mathcal{V}$ of $C$, lets say $\mathcal{V} = \{V_\alpha: \alpha \in T\}$. For each $\alpha$, since $V_\alpha$ is open in $C$, $V_\alpha = C\cap V_\alpha'$ for some $V_\alpha'$ open in $X$. Since $\bigcup_{\alpha \in T}V_\alpha = C$, we have $\bigcup_{\alpha\in T}V_\alpha' \supseteq C$.
  Since $C$ is closed, $U = X \setminus C$ is open in $X$. So $\mathcal{W} = \{V_\alpha': \alpha \in T\} \cup \{U\}$ is an open cover of $X$. Since $X$ is compact, $\mathcal{W}$ has a finite subcover $\mathcal{W}' = \{V_{\alpha_1}', \cdots, V_{\alpha_n}', U^*\}$. Hence $\{V_{\alpha_1}'\cap C, \cdots, V_{\alpha_n}'\cap C, U^*\cap C\}=\{V_{\alpha_1}\, \cdots, V_{\alpha_n}\}$ is a finite subcover of $C$.
\end{proof}
($^*$) May or may not be there.

Q: Compact $\implies$ closed
A: \begin{prop}
  Let $X$ be a Hausdorff space. If $C\subseteq X$ is compact, then $C$ is closed in $X$.
\end{prop}
\begin{proof}
  Let $U = X\setminus C$.
Given $x\in U$, since $X$ is Hausdorff, $\forall y\in C$, there exist open neighbourhoods $U_{xy}, W_{xy}$  of $x$, $y$  with $U_{xy}\cap W_{xy} = \emptyset$.
Then $\mathcal{W} = \{W_{xy}\cap C \ | \ y\in C\}$ is an open cover of $C$. Since $C$ is compact, there exists a finite subcover $\mathcal{W}' = \{W_{xy_1}\cap C, \cdots, W_{xy_n}\cap C\}$.
Finally we show $U_x = \bigcap_{i = 1}^n U_{xy_i}$ is an open neighbourhood of $x$ in $U$.
\textbf{Open neighbourhood}. Finite intersection of open neighbourhoods.
\textbf{Subset}. Since $C$ is a union of sets disjoint from $U_x$, $C$ is disjoint from $U_x$. So $U_x \subseteq U$.
\end{proof}

Q: Boundedness
A: A metric space $(X, d)$ is \emph{bounded} if there exists $M\in \R$ such that $d(x, y) \leq M$ for all $x, y\in X$.

Q: Compact $\implies$ bounded
A: A compact metric space $(X, d)$ is bounded.
\begin{proof}
  Pick your favourite $x\in X$. Then $V = \{B_r(x) \ | \ r>0\}$ is an open cover of $X$. Since $X$ is compact, there is a finite subcover $\{B_{r_1}(x), \cdots, B_{r_n}(x)\}$ of $X$.
  Let $R = \max\{r_1, \cdots, r_n\}$. Then $\forall y\in X: d(x, y) < R$. So $\forall y, z\in X$:
  \[
    d(y, z) \leq d(y, x) + d(x, z) < 2R.
  \]
\end{proof}

Q: Compact real spaces
A: \begin{thm}[Heine-Borel]
  $C\subseteq \R^n$ is compact iff $C$ is closed and bounded.
\end{thm}
\begin{proof}
$(\Rightarrow)$ If $C$ is compact, then $C$ is closed (since $\R^n$ is Hausdorff) and $C$ is bounded (since $\R^n$ is metric).
$(\Leftarrow)$ If $C$ is closed and bounded, then $C\subseteq [-N, N]^n$ for some $N\in \R$. Since $[-N, N]^n \simeq [0, 1]^n$ is compact and $C=C\cap [-N,N]^n$ is closed in $[-N, N]^n$, we have that $C$ is compact.
\end{proof}
\begin{cor}
  If $A\subseteq \R$ is compact, then $\exists \alpha \in A$ such that $\forall a\in A: a\leq\alpha$.
\end{cor}
\begin{proof}
  Since $A$ is real compact, it is bounded. Let $\alpha = \sup A$. Then $\forall a\in A: a\leq \alpha$.
  Suppose $\alpha \not\in A$. Then $\alpha \in \R \setminus A$ which is open. Hence $\exists \varepsilon > 0$ such that $B_\varepsilon(\alpha) \subseteq \R\setminus A$, so $\forall a\in A: a \leq \alpha - \varepsilon$ contradicting supremality of $\alpha$.
\end{proof}

Q: Continuous functions preserve compactness
A: If $f: X \to Y$ is continuous and $X$ is compact, then $\im f \subseteq Y$ is also compact.
\begin{proof}
 Given an open cover $\mathcal{V} = \{V_\alpha: \alpha \in T\}$ of $\im f$, $\forall\alpha\in T:$ $V_\alpha = \im f\cap V_\alpha'$ for some $V_\alpha'$ is open in $Y$. Then $\forall\alpha\in T:$
  \[
    W_\alpha = f^{-1}(V_\alpha) = f^{-1}(V_\alpha')
  \]
  is open in $X$.
Now $\forall x\in X: \exists \alpha\in T$ such that $f(x)\in V_\alpha$ so $x\in W_\alpha$. Hence $\mathcal{W} = \{W_\alpha: \alpha \in T\}$ is an open cover of $X$.
  Since $X$ is compact, there exists a finite subcover $\{W_{\alpha_1}, \cdots, W_{\alpha_n}\}$ of $\mathcal{W}$.
Hence $\{V_{\alpha_1}, \cdots, V_{\alpha_n}\}$ is a finite subcover of $V$.
\end{proof}

Q: Maximum value theorem
A: If $f: X \to \R$ is continuous and $X$ is compact, then $\exists x\in X$ such that $\forall y\in X: f(y) \leq f(x)$.
\begin{proof}
  Since $X$ is compact, by continuity $\im f$ is compact. So $\exists x: f(x)=\max[\im(f)]$.
\end{proof}

Q: Compactness of products
A: If $X$ and $Y$ are compact, then so is $X\times Y$.
\begin{proof}
  Given an open cover $\mathcal{V}$ of $X\times Y$, first consider the special case that $\forall U\in \mathcal{V}$:
\[
U = V\times W
\]
 where $V\subseteq X$ and $W\subseteq Y$ are open.
 Then $\forall (x, y) \in X\times Y, \exists U_{xy}\in \mathcal{V}$ such that
  \[
    U_{xy} = V_{xy}\times W_{xy},
  \]
  $V_{xy}\subseteq X$, $W_{xy}\subseteq Y$ are open, $x\in V_{xy}, y\in W_{xy}$.
  Now fix $x\in X$. Then $\mathcal{W}_x = \{W_{xy}\ | \ y\in Y\}$ is an open cover of $Y$ with finite subcover $\{W_{xy_1}, \cdots, W_{xy_n}\}$. Then $V_x = \bigcap_{i = 1}^n V_{xy_i}$ is a finite intersection of open sets such that $\mathcal{V}_x = \{U_{xy_1},\cdots , U_{xy_n}\}$ covers $V_x \times Y$. Now $ \{V_x \ | \ x\in X\}$ is an open cover of $X$ with finite subcover $\{V_{x_1}, \cdots, V_{x_m}\}$. Then $ \bigcup_{i = 1}^m \mathcal{V}_{x_i}$ is a finite subset of $\mathcal{V}$, which covers all of $X\times Y$. \\
In the general case, $\forall (x, y) \in X\times Y$, $\exists U_{xy}\in \mathcal{V}$ such that $(x, y)\in U_{xy}$. Since $U_{xy}$ is open, $\exists V_{xy}\subseteq X, W_{xy}\subseteq Y$ open with $V_{xy}\times W_{xy}\subseteq U_{xy}$ and $x\in V_{xy}$, $y\in W_{xy}$. Then $ \{V_{xy}\times W_{xy} \ | \ (x, y)\in (X, Y)\}$ is of the type above so has a finite subcover $\{V_{x_1y_1}\times W_{x_1y_1}, \cdots, V_{x_n y_n}\times W_{x_n y_n}\}$ such that $\{U_{x_1y_1},\cdots, U_{x_n y_n}\}$ is a finite subcover of $X\times Y$.
\end{proof}

Q: Compactness of quotient spaces
A: Let $X$ be compact, $\sim$ be an equivalence relation and $\pi:X\to X/{\sim} $ be the projection map. Then $X/{\sim}$ is compact.
\begin{proof}
  Given an open cover $\{ V_\alpha \ | \ \alpha\in T\}$ of $X/{\sim}$ we have that $\{ \pi^{-1}(V_\alpha) \ | \ \alpha\in T\}$ is an open cover of $X$ with finite subcover $\{ \pi^{-1}(V_1),\pi^{-1}(V_2)\cdots \pi^{-1}(V_n) \}$. So $\{ V_1,V_2,\cdots V_n \}$ is a finite subcover of $X$.
\end{proof}

Q: Homeomorphisms from compact to Hausdorff spaces
A: Suppose $f: X\to Y$ is a continuous bijection. If $X$ is compact and $Y$ is Hausdorff, then $f$ is a homeomorphism.
\begin{proof}
 Given $C$ closed in $X$, we have that $C$ is compact since $X$ is compact. Then $f(C)$ is compact by continuity. Hence $f(C)$ is closed since $Y$ is Hausdorff.
\end{proof}
\begin{cor}
  Suppose $f: X/{\sim} \to Y$ is a bijection, $X$ is compact, $Y$ is Hausdorff, and $f\circ \pi$ is continuous, then $f$ is a homeomorphism.
\end{cor}
\begin{proof}
  Since $X$ is compact and $\pi: X\mapsto X/{\sim}$ is continuous, $X/{\sim}$ is compact. Since $f\circ \pi$ is continuous, $f$ is continuous.
\end{proof}

Q: Sequential compactness
A: A topological space $X$ is \emph{sequentially compact} if every sequence $(x_n)$ in $X$ has a convergent subsequence (which converges to a point in $X$).

Q: Subsequence convergence criterion for metric spaces
A: Let $(x_n)$ be a sequence in a metric space $(X, d)$ and $x\in X$. Then $(x_n)$ has a subsequence converging to $x\iff\forall\varepsilon > 0$, $x_n \in B_\varepsilon (x)$ for infinitely many $n$.
\begin{proof}
 ($\Rightarrow$) If $(x_{k_n}) \to x$, then $\forall\varepsilon$, $\exists N\in\N$ such that $\forall n\geq N: $ $x_{k_n}\in B_\varepsilon (x)$.
($\Leftarrow$) Take $k_1 = 1$. Inductively, let $k_n$ be the smallest $m$ such that $x_m \in B_{1/n}(x)$ and $k_n>k_{n-1}$ for $n>1$. Then $d(x_{k_n}, x) < \frac{1}{n}$ so $x_{k_n} \to x$.
\end{proof}

Q: Compactness vs. sequential compactness
A: If $(X, d)$ is a compact \emph{metric space}, then $X$ is sequentially compact.
\begin{proof}
  Suppose $x_n$ is a sequence in $X$ with no convergent subsequence. Then $\forall y\in X$, there is no subsequence converging to $y$. Hence $\exists\varepsilon > 0$ such that $x_n\in B_\varepsilon (y)$ for only finitely many $n$.
  Let $U_y = B_\varepsilon (y)$. Now $\mathcal{V} = \{U_y \ | \ y\in X\}$ is an open cover of $X$ with finite subcover $\{U_{y_1}, \cdots, U_{y_m}\}$. Then $x_n \in \bigcup_{i = 1}^m U_{y_i} = X$ for only finitely many $n$. Contradiction.
\end{proof}
If $(X, d)$ is a sequentially compact \emph{metric space}, then $X$ is compact.
\begin{proof}
Given an open cover $\{ V_\alpha \ | \ \alpha\in T\}$ of $X$ with no finite subcover, we first show there exists a Lebesgue number $\varepsilon>0$ such that $\forall x\in X: \exists\alpha\in T: B_\varepsilon(x)\subseteq V_\alpha$.
Suppose not, then $\forall n\in\N: \exists x_n\in X: \forall\alpha\in T: B_{1/n}(x_n)\not\subseteq V_\alpha$. By sequential compactness, we can find a convergent subsequence $a_n \to a$ such that $\forall\alpha\in T: B_{1/n}(a_n)\not\subseteq V_\alpha$.
Using the open cover, this $a$ lies in some $V_{\alpha_0}$ such that $\exists m\in \N: B_{1/m}(a)\subseteq V_{\alpha_0}$. Since $(a_n) \to a$, $\exists N\in\N$ such that $\forall n> N:$ $d(a, a_n) < 1/(2m)$. Hence for  $n > \max(N, 2m)$:
\[
B_{1/n}(a_n) \subseteq B_{1/2m}(a_n) \subseteq B_{1/m}(a) \subseteq V_{\alpha_0}
\]
contradicting the definition of $a_n$.
Now let $x_1$ be your favourite member of $X$. Then inductively pick your favourite $x_n\in X\setminus \bigcup_{i=1}^{n-1} B_\varepsilon(x_i)$ since $\bigcup_{i=1}^{n-1} B_\varepsilon(x_i)$  does not cover $X$. Then $\forall m.n\in \N$ we have that $d(x_m,x_n)>\varepsilon$ so $(x_n)$ has no convergent subsequence, contradicting sequential compactness.
\end{proof}

Q: Complete space
A: A metric space $(X, d)$ is \emph{complete} if every Cauchy sequence in $X$ converges converges to a limit in $X$.

Q: Compact vs. complete
A: If $X$ is a compact metric space, then $X$ is complete.
\begin{proof}
 Given a Cauchy sequence $x_n$ in $X$, $\exists x_{k_n}\to x$ by sequential compactness.
  Given $\varepsilon > 0$, $\exists N_1,N_2\in \N$ such that $\forall m,n\geq N_1$:
\[
d(x_n, x_m) < \varepsilon/2
\]
and $\forall n\geq N_2:$
\[
d(x_{k_n}, x) < \varepsilon/2.
\]
Then for $n \geq \max(N_1,N_2)$
\[
d(x_n, x) \leq d(x_n, x_{k_n}) + d(x_{k_n}, x) < \varepsilon.
\]
\end{proof}

Q: Completeness of real spaces
A: $\R^n$ is complete.
\begin{proof}
  If $(x_n) \subseteq \R^n$ is Cauchy, then $\exists R>0$ such that $(x_n) \subseteq \bar B_R (0) $ where $\bar{B}_R(0)$ is compact so complete. Hence $(x_n)$ converges.
\end{proof}