---
title: "Topology of the Real Line"
book: "University Mathematics — Year 1"
subject: math
language: en
chapter: 12
exercises: 12
source: https://one-course.com/books/math/3/en/chapter/12-topology-of-the-real-line
---

# Chapter 12 — Topology of the Real Line

Limits keep referring to the same geometric vocabulary: points “close to” a [set](https://one-course.com/books/math/3/en/chapter/1-logic-sets-and-maps#def-b1-logic-sets), [sets](https://one-course.com/books/math/3/en/chapter/1-logic-sets-and-maps#def-b1-logic-sets) “without [boundary](#def-b1-topology-closure) leaks”, [intervals](https://one-course.com/books/math/3/en/chapter/10-real-numbers#prop-b1-reals-intervals) in which sequences cannot escape. This chapter fixes that vocabulary — [open](#def-b1-topology-open) and [closed sets](#def-b1-topology-closed), [interior](#def-b1-topology-closure) and [closure](#def-b1-topology-closure), [density](#def-b1-topology-dense) — on the real line, and proves the compactness of segments in its sequential form. The same notions, in normed vector spaces, are second-year material; on $\R$ they are within reach and immediately useful for [Chapter 13](https://one-course.com/books/math/3/en/chapter/13-limits-and-continuity#ch-b1-continuity).

## 12.1 Open sets, closed sets

**Definition 12.1 (Neighborhood, open set).**

A [set](https://one-course.com/books/math/3/en/chapter/1-logic-sets-and-maps#def-b1-logic-sets) $V \subseteq \R$ is a *neighborhood* of $x \in \R$ when it contains an [interval](https://one-course.com/books/math/3/en/chapter/10-real-numbers#prop-b1-reals-intervals) $\intoo{x - r}{x + r}$ for some $r > 0$. A [set](https://one-course.com/books/math/3/en/chapter/1-logic-sets-and-maps#def-b1-logic-sets) $U \subseteq \R$ is *open* when it is a neighborhood of each of its points:

$$
\forall x \in U,\ \exists r > 0, \quad \intoo{x - r}{x + r}
\subseteq U .
$$

**Example 12.2.**

[Open](#def-b1-topology-open) [intervals](https://one-course.com/books/math/3/en/chapter/10-real-numbers#prop-b1-reals-intervals) are [open](#def-b1-topology-open): for $x \in \intoo{a}{b}$, take $r = \min(x -
a,\, b - x) > 0$. Half-lines $\intoo{a}{+\infty}$ are [open](#def-b1-topology-open); $\R$ and $\emptyset$ are [open](#def-b1-topology-open) (the latter vacuously). $\intcc{0}{1}$ is *not* [open](#def-b1-topology-open): no [interval](https://one-course.com/books/math/3/en/chapter/10-real-numbers#prop-b1-reals-intervals) around $0$ stays inside.

**Proposition 12.3 (Stability of open sets).**

Any union of [open sets](#def-b1-topology-open) is [open](#def-b1-topology-open); a *finite* intersection of [open sets](#def-b1-topology-open) is [open](#def-b1-topology-open). Infinite intersections may fail: $\bigcap_{n \geq 1} \intoo{-\frac 1n}{\frac 1n} = \{0\}$, not [open](#def-b1-topology-open).

**Proof.** Union: if $x \in \bigcup_i U_i$, then $x \in U_{i_0}$ for some $i_0$, and the [interval](https://one-course.com/books/math/3/en/chapter/10-real-numbers#prop-b1-reals-intervals) provided by $U_{i_0}$ sits inside the union. Finite intersection: if $x \in U_1 \cap \dots \cap U_k$, take $r = \min(r_1,
\dots, r_k) > 0$ of the radii provided by each $U_j$. For the counterexample: any [interval](https://one-course.com/books/math/3/en/chapter/10-real-numbers#prop-b1-reals-intervals) around $0$ contains some $\frac{1}{n}$ (Archimedes), hence leaves the intersection. ∎

**Example 12.4 (Certifying openness with explicit radii).**

Is $U = \{x \in \R : x^2 > 2\}$ [open](#def-b1-topology-open)? Yes, and the certificate can be written down: $U = \intoo{-\infty}{-\sqrt2} \cup
\intoo{\sqrt2}{+\infty}$, a union of two [open](#def-b1-topology-open) half-lines, [open](#def-b1-topology-open) by [Proposition 12.3](#prop-b1-topology-openstable). Alternatively, argue point by point: for $x \in U$ with $x > \sqrt 2$, take $r = x -
\sqrt2 > 0$: every $y \in \intoo{x - r}{x + r}$ satisfies $y >
\sqrt 2$, hence $y^2 > 2$; symmetrically on the left. Both styles matter — the structural one (build from known [open sets](#def-b1-topology-open) by unions and finite intersections) scales better, the $\varepsilon$-style one works when no structure is visible; and [Chapter 13](https://one-course.com/books/math/3/en/chapter/13-limits-and-continuity#ch-b1-continuity) will add a third, the most powerful: $U$ is the [preimage](https://one-course.com/books/math/3/en/chapter/1-logic-sets-and-maps#def-b1-logic-map) of the [open](#def-b1-topology-open) $\intoo{2}{+\infty}$ under the continuous $x \mapsto x^2$.

**Definition 12.5 (Closed set).**

A [set](https://one-course.com/books/math/3/en/chapter/1-logic-sets-and-maps#def-b1-logic-sets) $F \subseteq \R$ is *closed* when its complement $\R \setminus F$ is [open](#def-b1-topology-open). By de Morgan and [Proposition 12.3](#prop-b1-topology-openstable): any intersection of closed [sets](https://one-course.com/books/math/3/en/chapter/1-logic-sets-and-maps#def-b1-logic-sets) is closed, finite unions of closed [sets](https://one-course.com/books/math/3/en/chapter/1-logic-sets-and-maps#def-b1-logic-sets) are closed.

**Theorem 12.6 (Sequential characterization of closed sets).**

$F$ is [closed](#def-b1-topology-closed) if and only if: for every sequence $(u_n)$ of points of $F$ converging to some $\ell \in \R$, the limit $\ell$ belongs to $F$. (“[Closed](#def-b1-topology-closed)” $=$ “stable under limits”.)

**Proof.** ($\Rightarrow$) Let $F$ be [closed](#def-b1-topology-closed), $u_n \in F$, $u_n \to \ell$, and suppose $\ell \notin F$. The complement is [open](#def-b1-topology-open): some $\intoo{\ell - r}{\ell + r}$ avoids $F$. But convergence puts $u_n$ in that [interval](https://one-course.com/books/math/3/en/chapter/10-real-numbers#prop-b1-reals-intervals) for large $n$: contradiction with $u_n \in F$.

($\Leftarrow$) Suppose $F$ is not [closed](#def-b1-topology-closed): the complement is not [open](#def-b1-topology-open), so some $x \notin F$ has no [interval](https://one-course.com/books/math/3/en/chapter/10-real-numbers#prop-b1-reals-intervals) $\intoo{x - r}{x + r}$ inside the complement; taking $r = \frac{1}{n+1}$, choose $u_n \in F$ with $\abs{u_n - x} < \frac{1}{n+1}$. Then $u_n \in F$, $u_n \to x \notin
F$: the sequential property fails. ∎

**Example 12.7 (The sequential test, both ways).**

*[Closed](#def-b1-topology-closed):* $F = \Z \cup \bigl\{n + \frac1n : n \geq 2\bigr\}$. Let $u_k \in F$ with $u_k \to \ell$. The window $\intcc{\ell -
1}{\ell + 1}$ contains only finitely many points of $F$ (finitely many integers, finitely many $n + \frac1n$), and beyond some rank all $u_k$ lie in it: the sequence then takes finitely many values, and, converging, is eventually constant (as in [Exercise 12.3](#exo-b1-topology-3)): $\ell \in F$. [Closed](#def-b1-topology-closed) — even though $F$ contains pairs of points at distance $\frac1n$, arbitrarily close.

*Not [closed](#def-b1-topology-closed):* $G = \bigl\{\frac1m + \frac1n : m, n \in
\N^*\bigr\}$. The sequence $\frac1n + \frac1n \in G$ tends to $0$, and $0 \notin G$ (a sum of two positive terms): the sequential test fails, $G$ is not [closed](#def-b1-topology-closed). Interestingly, each $\frac1m$ *does* belong to $\overline G \cap G$: indeed $\frac1m = \frac{1}{m+1} + \frac{1}{m(m+1)} \in G$. The closing insight: to prove closedness, control *all* convergent sequences at once (usually via a local finiteness or a closed-formula argument); to disprove it, one well-chosen escaping sequence suffices — the asymmetry makes the negative direction the easy one, and the counterexamples of this chapter all have this one-line shape.

**Example 12.8.**

Segments $\intcc{a}{b}$, half-lines $\intco{a}{+\infty}$, [finite sets](https://one-course.com/books/math/3/en/chapter/2-counting#def-b1-counting-card), $\Z$ (a convergent sequence of integers is eventually constant) are [closed](#def-b1-topology-closed). $\intoc{0}{1}$ is neither [open](#def-b1-topology-open) (fails at $1$) nor [closed](#def-b1-topology-closed) ($\frac 1n \to 0 \notin$ the [set](https://one-course.com/books/math/3/en/chapter/1-logic-sets-and-maps#def-b1-logic-sets)): most [sets](https://one-course.com/books/math/3/en/chapter/1-logic-sets-and-maps#def-b1-logic-sets) are neither. $\R$ and $\emptyset$ are both [open](#def-b1-topology-open) and [closed](#def-b1-topology-closed) — and they are the only such subsets of $\R$ ([Exercise 12.9](#exo-b1-topology-9)).

**Example 12.9 (An open set assembled from infinitely many pieces).**

$\R \setminus \Z = \bigcup_{n \in \Z} \intoo{n}{n+1}$: an infinite union of [open](#def-b1-topology-open) [intervals](https://one-course.com/books/math/3/en/chapter/10-real-numbers#prop-b1-reals-intervals), [open](#def-b1-topology-open) by [Proposition 12.3](#prop-b1-topology-openstable) — so $\Z$ is [closed](#def-b1-topology-closed) with no sequential argument needed. Note the division of labor in the stability rules: *unions* of [open sets](#def-b1-topology-open) may be arbitrary (each point only needs its own certificate, supplied by the one [set](https://one-course.com/books/math/3/en/chapter/1-logic-sets-and-maps#def-b1-logic-sets) containing it), while *intersections* must stay finite (certificates must be intersected, and infinitely many radii can shrink to nothing). [Exercise 12.10](#exo-b1-topology-10) will show this example is the general shape: every [open](#def-b1-topology-open) subset of $\R$ is a countable disjoint union of [open](#def-b1-topology-open) [intervals](https://one-course.com/books/math/3/en/chapter/10-real-numbers#prop-b1-reals-intervals).

## 12.2 Interior, closure, density

**Definition 12.10 (Interior, closure, boundary).**

Let $A \subseteq \R$.

- A point $x$ is *interior* to $A$ when $A$ is a [neighborhood](#def-b1-topology-open) of $x$ ; the *interior* $\mathring{A}$ is the [set](https://one-course.com/books/math/3/en/chapter/1-logic-sets-and-maps#def-b1-logic-sets) of interior points.
- A point $x$ is *adherent* to $A$ when every [neighborhood](#def-b1-topology-open) of $x$ meets $A$ ; the *closure* $\overline{A}$ is the [set](https://one-course.com/books/math/3/en/chapter/1-logic-sets-and-maps#def-b1-logic-sets) of adherent points.
- The *boundary* is $\partial A = \overline A \setminus  \mathring A$ .

Then $\mathring A \subseteq A \subseteq \overline A$.

**Proposition 12.11 (Main properties).**

1. $\mathring A$ is the largest [open set](#def-b1-topology-open) contained in $A$ ; $A$ is [open](#def-b1-topology-open) iff $A = \mathring A$ .
2. $\overline A$ is the smallest [closed set](#def-b1-topology-closed) containing $A$ ; $A$ is [closed](#def-b1-topology-closed) iff $A = \overline A$ .
3. (Sequential characterization of adherence) $x \in \overline  A$ if and only if $x$ is the limit of a sequence of points of $A$ .
4. Complementation exchanges the notions: $\R \setminus  \overline A = \bigl(\R \setminus A\bigr)^{\!\circ}$ .

**Proof.** (4) $x \notin \overline A$ $\iff$ some [neighborhood](#def-b1-topology-open) of $x$ avoids $A$ $\iff$ some [interval](https://one-course.com/books/math/3/en/chapter/10-real-numbers#prop-b1-reals-intervals) around $x$ lies in $\R \setminus A$ $\iff$ $x$ is [interior](#def-b1-topology-closure) to $\R \setminus A$.

(1) $\mathring A$ is [open](#def-b1-topology-open): if $x \in \mathring A$, some $\intoo{x-r}{x+r} \subseteq A$; every point $y$ of that [interval](https://one-course.com/books/math/3/en/chapter/10-real-numbers#prop-b1-reals-intervals) has a smaller [interval](https://one-course.com/books/math/3/en/chapter/10-real-numbers#prop-b1-reals-intervals) around it inside it, hence inside $A$: the whole [interval](https://one-course.com/books/math/3/en/chapter/10-real-numbers#prop-b1-reals-intervals) is in $\mathring A$. Any [open](#def-b1-topology-open) $U \subseteq A$ consists of [interior](#def-b1-topology-closure) points of $A$, so $U \subseteq \mathring A$: largest. The characterization of openness follows.

(2) In detail. By (4), $\R \setminus \overline A$ is the [interior](#def-b1-topology-closure) of $\R \setminus A$, an [open set](#def-b1-topology-open) by (1): so $\overline A$ is [closed](#def-b1-topology-closed), and it contains $A$. Minimality: let $F \supseteq A$ be [closed](#def-b1-topology-closed). Then $\R \setminus F$ is [open](#def-b1-topology-open) and contained in $\R
\setminus A$, so by the maximality in (1),

$$
\R \setminus F \subseteq \bigl(\R \setminus A\bigr)^{\!\circ}
= \R \setminus \overline A ,
$$

and taking complements again: $\overline A \subseteq F$. Thus $\overline A$ is the smallest [closed](#def-b1-topology-closed) superset. Characterization: if $A = \overline A$ then $A$ is [closed](#def-b1-topology-closed) (just shown); if $A$ is [closed](#def-b1-topology-closed), it is itself a [closed](#def-b1-topology-closed) superset of $A$, so minimality forces $\overline A \subseteq A$, and equality.

(3) If $u_n \in A$, $u_n \to x$: every [neighborhood](#def-b1-topology-open) of $x$ contains some $u_n \in A$, so $x \in \overline A$. Conversely, if $x \in
\overline A$: each [interval](https://one-course.com/books/math/3/en/chapter/10-real-numbers#prop-b1-reals-intervals) $\intoo{x - \frac{1}{n+1}}{x +
\frac{1}{n+1}}$ meets $A$ at some $u_n$, and $u_n \to x$. ∎

**Example 12.12.**

$\overline{\intoo{0}{1}} = \intcc{0}{1}$; $\mathring{\intcc{0}{1}} = \intoo{0}{1}$; $\partial\intoo{0}{1} =
\{0, 1\}$. For $A = \{\frac 1n : n \in \N^*\}$: $\overline A = A
\cup \{0\}$, $\mathring A = \emptyset$, $\partial A = A \cup \{0\}$. For $\Q$: by [density](#def-b1-topology-dense) ([Theorem 10.14](https://one-course.com/books/math/3/en/chapter/10-real-numbers#thm-b1-reals-density)) every real is adherent to $\Q$, so $\overline{\Q} = \R$ while $\mathring{\Q} =
\emptyset$ (every [interval](https://one-course.com/books/math/3/en/chapter/10-real-numbers#prop-b1-reals-intervals) contains irrationals): the [boundary](#def-b1-topology-closure) of $\Q$ is all of $\R$.

**Example 12.13 (A full anatomy).**

Let $A = \intoc{0}{1} \,\cup\, \bigl(\Q \cap \intoo{2}{3}\bigr)
\,\cup\, \{4\}$. We compute the three [sets](https://one-course.com/books/math/3/en/chapter/1-logic-sets-and-maps#def-b1-logic-sets) of [Definition 12.10](#def-b1-topology-closure), piece by piece.

*[Interior](#def-b1-topology-closure).* A point of $\intoo{0}{1}$ has a whole [interval](https://one-course.com/books/math/3/en/chapter/10-real-numbers#prop-b1-reals-intervals) inside $A$: [interior](#def-b1-topology-closure). The point $1$: every [interval](https://one-course.com/books/math/3/en/chapter/10-real-numbers#prop-b1-reals-intervals) around it leaks right of $1$, where $A$ has nothing until $2$: not [interior](#def-b1-topology-closure). No point of $\Q \cap \intoo{2}{3}$ is [interior](#def-b1-topology-closure) (every [interval](https://one-course.com/books/math/3/en/chapter/10-real-numbers#prop-b1-reals-intervals) contains irrationals, [Theorem 10.14](https://one-course.com/books/math/3/en/chapter/10-real-numbers#thm-b1-reals-density)); neither is the isolated $4$. So $\mathring A = \intoo{0}{1}$.

*[Closure](#def-b1-topology-closure).* Limits of points of $A$: all of $\intcc{0}{1}$ ($0 = \lim \frac1n$ with $\frac 1n \in A$); all of $\intcc{2}{3}$ (every real there is a limit of rationals of the [interval](https://one-course.com/books/math/3/en/chapter/10-real-numbers#prop-b1-reals-intervals), [density](#def-b1-topology-dense) again); and $4$. Nothing else: a point outside $\intcc{0}{1} \cup \intcc{2}{3} \cup \{4\}$ has positive distance to that [closed set](#def-b1-topology-closed). So $\overline A = \intcc{0}{1} \cup
\intcc{2}{3} \cup \{4\}$.

*[Boundary](#def-b1-topology-closure).* $\partial A = \overline A \setminus \mathring A
= \{0, 1\} \cup \intcc{2}{3} \cup \{4\}$.

The closing insight: the three operations act *locally* — each piece of $A$ contributes according to its own nature (a solid [interval](https://one-course.com/books/math/3/en/chapter/10-real-numbers#prop-b1-reals-intervals) keeps its inside, a dense-but-porous piece turns entirely into [boundary](#def-b1-topology-closure), an isolated point is pure [boundary](#def-b1-topology-closure)), and a two-line drawing of $A$ predicts every answer before any proof is written.

**Remark 12.14 (Common pitfalls in point-set reasoning).**

(i) *“Not [open](#def-b1-topology-open)” does not mean “[closed](#def-b1-topology-closed)”*: most [sets](https://one-course.com/books/math/3/en/chapter/1-logic-sets-and-maps#def-b1-logic-sets) are neither ($\intoc{0}{1}$), and two [sets](https://one-course.com/books/math/3/en/chapter/1-logic-sets-and-maps#def-b1-logic-sets) are both ($\emptyset$, $\R$) — [open](#def-b1-topology-open) and [closed](#def-b1-topology-closed) are not opposites but duals through complementation. (ii) *[Interior](#def-b1-topology-closure) and [closure](#def-b1-topology-closure) do not commute*: for $A = \Q$,

$$
\overline{\mathring A} = \overline\emptyset = \emptyset
\qquad\text{while}\qquad
\bigl(\,\overline A\,\bigr)^{\!\circ} = \mathring \R = \R :
$$

the two iterated operators differ as much as [sets](https://one-course.com/books/math/3/en/chapter/1-logic-sets-and-maps#def-b1-logic-sets) can. (iii) *Infinite unions of [closed sets](#def-b1-topology-closed) can fail to be [closed](#def-b1-topology-closed)*: $\bigcup_{n\geq1} \intcc{\frac1n}{1} = \intoc{0}{1}$ — the mirror of the intersection counterexample of [Proposition 12.3](#prop-b1-topology-openstable). (iv) *[Dense](#def-b1-topology-dense) does not mean big*: $\Q$ is [dense](#def-b1-topology-dense), countable, with empty [interior](#def-b1-topology-closure), and its complement is [dense](#def-b1-topology-dense) too; [density](#def-b1-topology-dense) says “arbitrarily close to everything”, not “almost everything” — the weekend problem’s [Cantor set](#pb-b1-topology-1) ([Problem 12.1](#pb-b1-topology-1)) makes the opposite point, a topologically small [set](https://one-course.com/books/math/3/en/chapter/1-logic-sets-and-maps#def-b1-logic-sets) that is uncountably big.

**Example 12.15 (A closure computed exactly).**

Let $G = \bigl\{\frac1m + \frac1n : m, n \in \N^*\bigr\}$ (from [Example 12.7](#ex-b1-topology-seqtest)). Claim:

$$
\overline G = G \,\cup\, \Bigl\{\frac1m : m \in \N^*\Bigr\}
\,\cup\, \{0\} .
$$

($\supseteq$) $\frac1m = \lim_n \bigl(\frac1m + \frac1n\bigr)$ and $0 = \lim_n \frac2n$: adherent by the sequential characterization. ($\subseteq$) Let $x = \lim_k \bigl(
\frac{1}{m_k} + \frac{1}{n_k}\bigr)$; order each pair so that $m_k \leq n_k$. If $(m_k)$ is unbounded, a [subsequence](https://one-course.com/books/math/3/en/chapter/11-sequences#def-b1-seq-subsequence) has $m_k
\to \infty$, hence $n_k \to \infty$ too and $x = 0$. Otherwise $(m_k)$ takes finitely many values, one of them, say $m$, infinitely often; along that [subsequence](https://one-course.com/books/math/3/en/chapter/11-sequences#def-b1-seq-subsequence) $\frac{1}{n_k} \to x -
\frac1m$: if $(n_k)$ is bounded it takes some value $n$ infinitely often and $x = \frac1m + \frac1n \in G$; if not, $x =
\frac1m$. Every case lands in the announced [set](https://one-course.com/books/math/3/en/chapter/1-logic-sets-and-maps#def-b1-logic-sets). The closing insight: computing a [closure](#def-b1-topology-closure) is a compactness-style case analysis on indices — bounded index means finitely many values (pigeonhole), unbounded index means a limit escapes — and the answer displays the typical two-layer structure of limit points: the [set](https://one-course.com/books/math/3/en/chapter/1-logic-sets-and-maps#def-b1-logic-sets), its first-generation limits, and their limit $0$.

**Definition 12.16 (Density, topological form).**

$A$ is *dense* in $\R$ when $\overline A = \R$ — equivalently, every nonempty [open](#def-b1-topology-open) [interval](https://one-course.com/books/math/3/en/chapter/10-real-numbers#prop-b1-reals-intervals) meets $A$; equivalently (by [Proposition 12.11](#prop-b1-topology-closureprops) (3)), every real is a limit of elements of $A$. Examples: $\Q$, $\R \setminus
\Q$, the dyadics ([Exercise 10.8](https://one-course.com/books/math/3/en/chapter/10-real-numbers#exo-b1-reals-8)), dense [subgroups](https://one-course.com/books/math/3/en/chapter/7-algebraic-structures#def-b1-structures-subgroup) ([Exercise 10.9](https://one-course.com/books/math/3/en/chapter/10-real-numbers#exo-b1-reals-9)).

**Example 12.17 (Density is relative).**

“[Dense](#def-b1-topology-dense)” as defined here means [dense](#def-b1-topology-dense) *in $\R$*; a [set](https://one-course.com/books/math/3/en/chapter/1-logic-sets-and-maps#def-b1-logic-sets) can instead be [dense](#def-b1-topology-dense) in a part of the line only. The dyadics of $\intcc{0}{1}$, i.e. $D \cap \intcc{0}{1}$ ([Exercise 10.8](https://one-course.com/books/math/3/en/chapter/10-real-numbers#exo-b1-reals-8)), meet every [open](#def-b1-topology-open) [interval](https://one-course.com/books/math/3/en/chapter/10-real-numbers#prop-b1-reals-intervals) included in $\intcc{0}{1}$ but of course miss $\intoo{2}{3}$ entirely: they are [dense](#def-b1-topology-dense) *in* $\intcc{0}{1}$, meaning $\overline{D \cap
\intcc{0}{1}} = \intcc{0}{1}$. The general phrase “$A$ is [dense](#def-b1-topology-dense) in $B$” abbreviates $B \subseteq \overline A$ — always name the ambient [set](https://one-course.com/books/math/3/en/chapter/1-logic-sets-and-maps#def-b1-logic-sets), since the weekend problem’s endpoints are [dense](#def-b1-topology-dense) *in the [Cantor set](#pb-b1-topology-1)* while being nowhere [dense](#def-b1-topology-dense) *in $\R$*: the same [set](https://one-course.com/books/math/3/en/chapter/1-logic-sets-and-maps#def-b1-logic-sets), two truthful and opposite-sounding descriptions.

**Example 12.18 (Handling density).**

Three quick moves that recur constantly. *Enlarging*: if $A$ is [dense](#def-b1-topology-dense) and $A \subseteq B$, then $B$ is [dense](#def-b1-topology-dense) (every [interval](https://one-course.com/books/math/3/en/chapter/10-real-numbers#prop-b1-reals-intervals) already meets $A$). *Transporting*: if $A$ is [dense](#def-b1-topology-dense), so is $\lambda A + \mu$ for $\lambda \neq 0$ — an [interval](https://one-course.com/books/math/3/en/chapter/10-real-numbers#prop-b1-reals-intervals) $I$ meets $\lambda A + \mu$ iff the [interval](https://one-course.com/books/math/3/en/chapter/10-real-numbers#prop-b1-reals-intervals) $\frac{I - \mu}{\lambda}$ meets $A$; thus the odd multiples of $10^{-9}$, say, are [dense](#def-b1-topology-dense). *Intersecting fails*: two [dense](#def-b1-topology-dense) [sets](https://one-course.com/books/math/3/en/chapter/1-logic-sets-and-maps#def-b1-logic-sets) can miss each other entirely ($\Q$ and $\R \setminus \Q$): [density](#def-b1-topology-dense) survives unions and affine [maps](https://one-course.com/books/math/3/en/chapter/1-logic-sets-and-maps#def-b1-logic-map), never intersections.

## 12.3 Compactness of segments

**Theorem 12.19 (Segments are sequentially compact).**

Let $a \leq b$. Every sequence of points of $\intcc{a}{b}$ has a [subsequence](https://one-course.com/books/math/3/en/chapter/11-sequences#def-b1-seq-subsequence) converging to a point *of* $\intcc{a}{b}$.

More generally, the subsets of $\R$ with this property (every sequence has a [subsequence](https://one-course.com/books/math/3/en/chapter/11-sequences#def-b1-seq-subsequence) converging in the [set](https://one-course.com/books/math/3/en/chapter/1-logic-sets-and-maps#def-b1-logic-sets)) are exactly the *[closed](#def-b1-topology-closed) and bounded* [sets](https://one-course.com/books/math/3/en/chapter/1-logic-sets-and-maps#def-b1-logic-sets).

**Proof.** A sequence in $\intcc{a}{b}$ is bounded, so Bolzano–Weierstrass ([Theorem 11.16](https://one-course.com/books/math/3/en/chapter/11-sequences#thm-b1-seq-bw)) extracts a convergent [subsequence](https://one-course.com/books/math/3/en/chapter/11-sequences#def-b1-seq-subsequence); its limit stays in $\intcc{a}{b}$ because segments are [closed](#def-b1-topology-closed) ([Theorem 12.6](#thm-b1-topology-seqclosed)).

General case. *([Closed](#def-b1-topology-closed) bounded $\Rightarrow$ compact)*: let $F$ be [closed](#def-b1-topology-closed) and bounded, and $(u_n)$ a sequence in $F$. Boundedness of $F$ bounds the sequence, so Bolzano–Weierstrass extracts $u_{\varphi(n)} \to \ell$; and $\ell \in F$ because $F$ is [closed](#def-b1-topology-closed) and the [subsequence](https://one-course.com/books/math/3/en/chapter/11-sequences#def-b1-seq-subsequence) is a convergent sequence of points of $F$ ([Theorem 12.6](#thm-b1-topology-seqclosed)): the two hypotheses are consumed one each, boundedness for existence of the limit, closedness for its membership. *(Compact $\Rightarrow$ [closed](#def-b1-topology-closed) and bounded)*: if $F$ is unbounded, pick $u_n \in F$ with $\abs{u_n} \geq
n$; every [subsequence](https://one-course.com/books/math/3/en/chapter/11-sequences#def-b1-seq-subsequence) is unbounded, hence divergent ([Proposition 11.4](https://one-course.com/books/math/3/en/chapter/11-sequences#prop-b1-seq-first)): no convergent [subsequence](https://one-course.com/books/math/3/en/chapter/11-sequences#def-b1-seq-subsequence) at all. If $F$ is not [closed](#def-b1-topology-closed), take $u_n \in F$ with $u_n \to \ell \notin F$ ([Theorem 12.6](#thm-b1-topology-seqclosed)): every [subsequence](https://one-course.com/books/math/3/en/chapter/11-sequences#def-b1-seq-subsequence) converges to $\ell \notin F$, so no [subsequence](https://one-course.com/books/math/3/en/chapter/11-sequences#def-b1-seq-subsequence) converges *in* $F$. ∎

**Example 12.20 (Nested compact sets).**

A first workout for the theorem. Let $K_0 \supseteq K_1 \supseteq
K_2 \supseteq \dots$ be nonempty compact ([closed](#def-b1-topology-closed) bounded) subsets of $\R$. Then $\bigcap_n K_n \neq \emptyset$. Indeed, pick $x_n
\in K_n$ for each $n$: the sequence lives in the compact $K_0$, so a [subsequence](https://one-course.com/books/math/3/en/chapter/11-sequences#def-b1-seq-subsequence) $x_{\varphi(n)}$ converges to some $x$ ([Theorem 12.19](#thm-b1-topology-compact)). For every fixed $m$, the terms $x_{\varphi(n)}$ with $\varphi(n) \geq m$ all lie in the [closed](#def-b1-topology-closed) set $K_m$, so the limit $x$ lies in $K_m$ ([Theorem 12.6](#thm-b1-topology-seqclosed)); as $m$ was arbitrary, $x \in
\bigcap_n K_n$. A useful companion: if an [open set](#def-b1-topology-open) $U$ contains $\bigcap_n K_n$, then $U \supseteq K_n$ for some $n$ — apply the same argument to points $x_n \in K_n \setminus U$; the limit $x$ would lie in $\bigcap K_n \subseteq U$, yet $U$ [open](#def-b1-topology-open) forces $x_{\varphi(n)} \in U$ eventually, a contradiction. Both [statements](https://one-course.com/books/math/3/en/chapter/1-logic-sets-and-maps#def-b1-logic-statement) fail without compactness: $\bigcap_n \intoo{0}{\frac
1n} = \emptyset$ and $\bigcap_n \intco{n}{+\infty} = \emptyset$. The closing insight: compactness converts an infinite chain of non-emptiness assertions into a single limit point — it is the tool that survives passage to the infinite intersection, and the weekend problem ([Problem 12.1](#pb-b1-topology-1)) will lean on it twice.

![The first four stages of the middle-thirds construction: each segment of C_n loses its open middle third, leaving the 2n+1 segments of C_n+1, of total length (2/3)n+1. The Cantor set C = _n C_n — the subject of the weekend problem — is the nonempty compact residue guaranteed by the nested-compacts argument above: length zero, yet uncountably many points survive.](https://one-course.com/images/onecourse/chapters/math-3/b1-topology/fig-8f10851209c3.svg)

*The first four stages of the middle-thirds construction: each segment of $C_n$ loses its [open](#def-b1-topology-open) middle third, leaving the $2^{n+1}$ segments of $C_{n+1}$, of total length $(\frac23)^{n+1}$. The [Cantor set](#pb-b1-topology-1) $C = \bigcap_n C_n$ — the subject of the weekend problem [Problem 12.1](#pb-b1-topology-1) — is the nonempty compact residue guaranteed by the nested-compacts argument above: length zero, yet uncountably many points survive.*

**Remark 12.21.**

This is the engine behind the extreme value theorem ([Chapter 13](https://one-course.com/books/math/3/en/chapter/13-limits-and-continuity#ch-b1-continuity)) and Heine’s theorem on uniform continuity. The name “compact” will acquire its general (covering) definition in the second year; on $\R$, sequential compactness is all we need, and “compact $=$ [closed](#def-b1-topology-closed) $+$ bounded” is the [statement](https://one-course.com/books/math/3/en/chapter/1-logic-sets-and-maps#def-b1-logic-statement) to remember.

**Example 12.22 (Boundaries under unions).**

Always $\partial(A \cup B) \subseteq \partial A \cup \partial
B$: a point of $\partial(A \cup B)$ has every [neighborhood](#def-b1-topology-open) meeting $A \cup B$ (hence $A$ or $B$, infinitely often one of them) and meeting the complement of $A \cup B$, which lies in both complements — a short check then places the point in $\partial A$ or $\partial B$. The inclusion can be spectacularly strict: with $A = \Q$ and $B = \R\setminus\Q$,

$$
\partial(A \cup B) = \partial \R = \emptyset ,
\qquad
\partial A \cup \partial B = \R \cup \R = \R :
$$

two ragged [sets](https://one-course.com/books/math/3/en/chapter/1-logic-sets-and-maps#def-b1-logic-sets) can glue into a seamless one, their boundaries annihilating each other. The closing insight: [interiors](#def-b1-topology-closure) and [closures](#def-b1-topology-closure) behave *monotonically* under unions and intersections, but boundaries do not — treat $\partial$ as a derived quantity ($\overline A \setminus \mathring A$), never as an operator with algebra of its own.

**Remark 12.23 (Perspectives inside this volume).**

The vocabulary built here is consumed twice more in this book. In [Chapter 13](https://one-course.com/books/math/3/en/chapter/13-limits-and-continuity#ch-b1-continuity), every theorem is a topology [statement](https://one-course.com/books/math/3/en/chapter/1-logic-sets-and-maps#def-b1-logic-statement) in disguise: the intermediate value theorem says continuous [maps](https://one-course.com/books/math/3/en/chapter/1-logic-sets-and-maps#def-b1-logic-map) preserve the [interval](https://one-course.com/books/math/3/en/chapter/10-real-numbers#prop-b1-reals-intervals) property, the extreme value theorem says they preserve compactness — and the proofs call Theorems [12.6](#thm-b1-topology-seqclosed) and [12.19](#thm-b1-topology-compact) by name. In [Chapter 25](https://one-course.com/books/math/3/en/chapter/25-functions-of-two-variables#ch-b1-multivar), the same definitions are re-read in $\R^2$ with disks in place of [intervals](https://one-course.com/books/math/3/en/chapter/10-real-numbers#prop-b1-reals-intervals): [open sets](#def-b1-topology-open), [closures](#def-b1-topology-closure) and compactness transfer word for word, and the two-variable extreme value theorem again rides on Bolzano–Weierstrass (extract on each coordinate). The one notion that does *not* generalize painlessly is the [interval](https://one-course.com/books/math/3/en/chapter/10-real-numbers#prop-b1-reals-intervals) itself — in the plane, connectedness replaces convexity, a story that begins with [Exercise 12.9](#exo-b1-topology-9)’s “only $\emptyset$ and $\R$ are [open](#def-b1-topology-open) and [closed](#def-b1-topology-closed)”.

## 12.4 Exercises

**Exercise 12.1 ★.**

For each [set](https://one-course.com/books/math/3/en/chapter/1-logic-sets-and-maps#def-b1-logic-sets), say whether it is [open](#def-b1-topology-open), [closed](#def-b1-topology-closed), both, or neither (with justification): $\intoo{0}{1} \cup \intoo{2}{3}$; $\;\intco{0}{1}$; $\;\{0\} \cup \intcc{1}{2}$; $\;\R \setminus \Z$; $\;\Q \cap
\intoo{0}{1}$.

**Solution of Exercise 12.1.**

$\intoo{0}{1} \cup \intoo{2}{3}$: [open](#def-b1-topology-open) (union of [open sets](#def-b1-topology-open)), not [closed](#def-b1-topology-closed) ($\frac 1n \to 0$ outside).

$\intco{0}{1}$: neither. Not [open](#def-b1-topology-open) (no [interval](https://one-course.com/books/math/3/en/chapter/10-real-numbers#prop-b1-reals-intervals) around $0$ inside); not [closed](#def-b1-topology-closed) ($1 - \frac1n \to 1 \notin$ [set](https://one-course.com/books/math/3/en/chapter/1-logic-sets-and-maps#def-b1-logic-sets)).

$\{0\} \cup \intcc{1}{2}$: [closed](#def-b1-topology-closed) (finite union of [closed sets](#def-b1-topology-closed)), not [open](#def-b1-topology-open) (fails at $0$).

$\R \setminus \Z$: [open](#def-b1-topology-open) ($\Z$ is [closed](#def-b1-topology-closed)), not [closed](#def-b1-topology-closed): the sequence $\bigl(\frac 1n\bigr)$ lies in it, but its limit $0$ belongs to $\Z$, i.e. escapes the [set](https://one-course.com/books/math/3/en/chapter/1-logic-sets-and-maps#def-b1-logic-sets).

$\Q \cap \intoo{0}{1}$: neither. Not [open](#def-b1-topology-open): every [interval](https://one-course.com/books/math/3/en/chapter/10-real-numbers#prop-b1-reals-intervals) around a rational contains irrationals. Not [closed](#def-b1-topology-closed): it contains sequences tending to the irrational $\frac{\sqrt 2}{2}$ ([density](#def-b1-topology-dense)).

**Exercise 12.2 ★.**

Determine $\mathring A$, $\overline A$ and $\partial A$ for: $A = \intoc{0}{1} \cup \{2\}$; $\;A = \R \setminus \Q$; $\;A = \bigl\{\frac{(-1)^n n}{n+1} : n \in \N\bigr\}$.

**Solution of Exercise 12.2.**

$A = \intoc{0}{1} \cup \{2\}$: $\mathring A = \intoo{0}{1}$, $\overline A = \intcc{0}{1} \cup \{2\}$, $\partial A = \{0, 1, 2\}$.

$A = \R \setminus \Q$: $\mathring A = \emptyset$ (every [interval](https://one-course.com/books/math/3/en/chapter/10-real-numbers#prop-b1-reals-intervals) contains rationals), $\overline A = \R$ ([density](#def-b1-topology-dense) of the irrationals), $\partial A = \R$.

$A = \bigl\{\frac{(-1)^n n}{n+1}\bigr\}$: the even terms tend to $1$, the odd terms to $-1$, neither belongs to $A$. $\mathring A =
\emptyset$ (isolated points), $\overline A = A \cup \{-1, 1\}$, $\partial A = \overline A$.

**Exercise 12.3 ★.**

Prove that a [finite set](https://one-course.com/books/math/3/en/chapter/2-counting#def-b1-counting-card) is [closed](#def-b1-topology-closed), first via complements, then via the sequential characterization.

**Solution of Exercise 12.3.**

*Complements.* $F = \{a_1 < a_2 < \dots < a_k\}$: the complement is the union of the [open](#def-b1-topology-open) [intervals](https://one-course.com/books/math/3/en/chapter/10-real-numbers#prop-b1-reals-intervals) $\intoo{-\infty}{a_1}$, $\intoo{a_i}{a_{i+1}}$, $\intoo{a_k}{+\infty}$ — [open](#def-b1-topology-open) by [Proposition 12.3](#prop-b1-topology-openstable).

*Sequences.* Let $u_n \in F$, $u_n \to \ell$. With $\varepsilon
= \min\{\abs{a_i - a_j} : i \neq j\}/2 > 0$ (or any $\varepsilon$ if $F$ is a singleton): beyond some rank, all terms are within $\varepsilon$ of $\ell$, hence within $2\varepsilon$ of each other, which forces them to be one single $a_i$ from that rank on; then $\ell = a_i \in F$.

**Exercise 12.4 ★.**

Prove that for any $A, B \subseteq \R$: $\overline{A \cup B} =
\overline A \cup \overline B$. Show by example that $\overline{A \cap B}$ can differ from $\overline A \cap \overline
B$.

**Solution of Exercise 12.4.**

$\subseteq$: $\overline A \cup \overline B$ is [closed](#def-b1-topology-closed) (finite union) and contains $A \cup B$, so it contains the *smallest* [closed](#def-b1-topology-closed) superset $\overline{A \cup B}$. $\supseteq$: $A \subseteq A \cup B$ gives $\overline A \subseteq \overline{A \cup B}$ ([closure](#def-b1-topology-closure) is monotone: adherent points of $A$ are adherent to the larger [set](https://one-course.com/books/math/3/en/chapter/1-logic-sets-and-maps#def-b1-logic-sets)), and likewise for $B$.

Counterexample for intersections: $A = \intoo{0}{1}$, $B =
\intoo{1}{2}$: $\overline{A \cap B} = \overline\emptyset = \emptyset$ but $\overline A \cap \overline B = \{1\}$.

**Exercise 12.5 ★★.**

Let $u_n \to \ell$ in $\R$. Prove that the [set](https://one-course.com/books/math/3/en/chapter/1-logic-sets-and-maps#def-b1-logic-sets) $\{u_n : n \in \N\}
\cup \{\ell\}$ is [closed](#def-b1-topology-closed) (hence compact if we add that it is bounded — which it is).

**Solution of Exercise 12.5.**

Use the sequential characterization ([Theorem 12.6](#thm-b1-topology-seqclosed)). Let $S = \{u_n\} \cup \{\ell\}$ and $(v_k)$ a sequence in $S$ with $v_k \to m$; show $m \in S$. Two cases. If some value $v \in S$ is taken by $(v_k)$ infinitely often, then a constant [subsequence](https://one-course.com/books/math/3/en/chapter/11-sequences#def-b1-seq-subsequence) gives $m = v \in S$. Otherwise every value is taken finitely often; in particular, for each $n$, the term $u_n$ appears finitely often, and $\ell$ too. Then for every $N$, the indices $k$ with $v_k \in \{u_0, \dots, u_N, \ell\}$ are finitely many: the remaining $v_k$ are terms $u_n$ with $n > N$. Given $\varepsilon > 0$, choose $N$ with $\abs{u_n - \ell} \leq
\varepsilon$ for $n > N$: all but finitely many $v_k$ satisfy $\abs{v_k - \ell} \leq \varepsilon$. Hence $v_k \to \ell$, so $m =
\ell \in S$.

**Exercise 12.6 ★★.**

Let $U$ be [open](#def-b1-topology-open) and $A$ arbitrary. Prove that $U + A = \{u + a\}$ is [open](#def-b1-topology-open). Deduce that the sum of an [open set](#def-b1-topology-open) and any [set](https://one-course.com/books/math/3/en/chapter/1-logic-sets-and-maps#def-b1-logic-sets) is [open](#def-b1-topology-open), and contrast: exhibit two *[closed](#def-b1-topology-closed)* [sets](https://one-course.com/books/math/3/en/chapter/1-logic-sets-and-maps#def-b1-logic-sets) whose sum is not [closed](#def-b1-topology-closed). *(Try $\Z$ and $\sqrt 2\,\Z$, with [Exercise 10.9](https://one-course.com/books/math/3/en/chapter/10-real-numbers#exo-b1-reals-9).)*

**Solution of Exercise 12.6.**

$U + A = \bigcup_{a \in A} (U + a)$, and each translate $U + a$ is [open](#def-b1-topology-open) (translating the [interval](https://one-course.com/books/math/3/en/chapter/10-real-numbers#prop-b1-reals-intervals) certificates). A union of [open sets](#def-b1-topology-open) is [open](#def-b1-topology-open) ([Proposition 12.3](#prop-b1-topology-openstable)).

[Closed sets](#def-b1-topology-closed): $\Z$ and $\sqrt 2\,\Z$ are [closed](#def-b1-topology-closed) (as $\alpha\Z$: convergent sequences are eventually constant, cf. [Example 12.8](#ex-b1-topology-closed)). Their sum $\Z + \sqrt 2\,\Z$ is [dense](#def-b1-topology-dense) in $\R$ ([Exercise 10.9](https://one-course.com/books/math/3/en/chapter/10-real-numbers#exo-b1-reals-9)) but is not $\R$ (it is countable, or simply: $\frac{\sqrt 2}{2} \notin \Z + \sqrt2\Z$, else $\sqrt 2$ would be rational — writing $\frac{\sqrt2}{2} = m + n\sqrt 2$ forces $(2n - 1)\sqrt 2 = -2m$, so $\sqrt 2 \in \Q$ unless $n =
\frac12$, impossible). A [dense](#def-b1-topology-dense) proper subset is not [closed](#def-b1-topology-closed): its [closure](#def-b1-topology-closure) is $\R \neq$ itself.

**Exercise 12.7 ★★.**

A point $x \in A$ is *isolated* in $A$ when some [neighborhood](#def-b1-topology-open) of $x$ meets $A$ only at $x$. Prove that every point of $\Z$ is isolated in $\Z$, that $A = \{\frac1n\}$ has all its points isolated yet $\overline A \neq A$, and that a [set](https://one-course.com/books/math/3/en/chapter/1-logic-sets-and-maps#def-b1-logic-sets) whose points are all isolated has empty [interior](#def-b1-topology-closure).

**Solution of Exercise 12.7.**

$\Z$: the [neighborhood](#def-b1-topology-open) $\intoo{n - \frac12}{n + \frac12}$ of $n$ meets $\Z$ only at $n$.

$A = \{\frac1n : n \in \N^*\}$: around $\frac 1n$, the [interval](https://one-course.com/books/math/3/en/chapter/10-real-numbers#prop-b1-reals-intervals) of radius $\frac{1}{n} - \frac{1}{n+1} = \frac{1}{n(n+1)}$ (halved, say) isolates it from its neighbors — all points isolated. Yet $0 \in
\overline A \setminus A$: isolated points do not prevent adherent outsiders.

If all points of $A$ are isolated: no point of $A$ is [interior](#def-b1-topology-closure), since an [interior](#def-b1-topology-closure) point has a whole [interval](https://one-course.com/books/math/3/en/chapter/10-real-numbers#prop-b1-reals-intervals) of $A$-neighbors around it (an [interval](https://one-course.com/books/math/3/en/chapter/10-real-numbers#prop-b1-reals-intervals) is infinite), contradicting isolation. So $\mathring A
= \emptyset$.

**Exercise 12.8 ★★.**

Prove that the [closure](#def-b1-topology-closure) of a bounded [set](https://one-course.com/books/math/3/en/chapter/1-logic-sets-and-maps#def-b1-logic-sets) is bounded, and that $\sup \overline A = \sup A$ for $A$ nonempty bounded above. Deduce that $\sup A \in \overline A$: the [supremum](https://one-course.com/books/math/3/en/chapter/10-real-numbers#def-b1-reals-bounds) is always adherent.

**Solution of Exercise 12.8.**

If $A \subseteq \intcc{-M}{M}$, the [closed set](#def-b1-topology-closed) $\intcc{-M}{M}$ contains $A$, hence contains $\overline A$ (smallest [closed](#def-b1-topology-closed) superset): $\overline A$ is bounded.

Let $s = \sup A$ (finite). Since $A \subseteq \overline A$, $\sup
\overline A \geq s$. Conversely, $\overline A \subseteq
\intoc{-\infty}{s}$: the half-line is [closed](#def-b1-topology-closed) and contains $A$; so every element of $\overline A$ is $\leq s$, giving $\sup\overline A
\leq s$. Equality.

$s \in \overline A$: by the $\varepsilon$-characterization ([Proposition 10.4](https://one-course.com/books/math/3/en/chapter/10-real-numbers#prop-b1-reals-epsilon)), every [interval](https://one-course.com/books/math/3/en/chapter/10-real-numbers#prop-b1-reals-intervals) $\intoo{s -
\varepsilon}{s + \varepsilon}$ contains an element of $A$: $s$ is adherent.

**Exercise 12.9 ★★★.**

Prove that the only subsets of $\R$ that are both [open](#def-b1-topology-open) and [closed](#def-b1-topology-closed) are $\emptyset$ and $\R$. *Hint: suppose $A$ is [open](#def-b1-topology-open), [closed](#def-b1-topology-closed), with $A \neq \emptyset$ and $\R \setminus A \neq \emptyset$; pick $a \in
A$, $b \notin A$, say $a < b$, and consider $s = \sup\,(A \cap
\intcc{a}{b})$; decide whether $s$ can belong to $A$ or to its complement.*

**Solution of Exercise 12.9.**

Suppose $A$ is [open](#def-b1-topology-open) and [closed](#def-b1-topology-closed), with $a \in A$ and $b \in \R
\setminus A$; without loss of generality $a < b$. The [set](https://one-course.com/books/math/3/en/chapter/1-logic-sets-and-maps#def-b1-logic-sets) $B = A \cap
\intcc{a}{b}$ is nonempty ($a$), bounded: let $s = \sup B$. By [Exercise 12.8](#exo-b1-topology-8), $s \in \overline B \subseteq \overline A =
A$ ($A$ [closed](#def-b1-topology-closed)). Note $s \leq b$, and since $b \notin A$: $s < b$. Now $A$ is [open](#def-b1-topology-open): some [interval](https://one-course.com/books/math/3/en/chapter/10-real-numbers#prop-b1-reals-intervals) $\intoo{s - r}{s + r}$ lies in $A$, and we may take $r < b - s$. Then $s + \frac{r}{2}$ belongs to $A
\cap \intcc{a}{b} = B$ and exceeds $s$ — contradicting $s = \sup
B$. Hence no such pair $(a, b)$ exists: one of $A$, $\R \setminus A$ is empty.

**Exercise 12.10 ★★★.**

(Structure of [open sets](#def-b1-topology-open)) Let $U \subseteq \R$ be [open](#def-b1-topology-open), nonempty. For $x \in U$, let $I_x$ be the union of all [open](#def-b1-topology-open) [intervals](https://one-course.com/books/math/3/en/chapter/10-real-numbers#prop-b1-reals-intervals) containing $x$ and contained in $U$. Prove that $I_x$ is an [open](#def-b1-topology-open) [interval](https://one-course.com/books/math/3/en/chapter/10-real-numbers#prop-b1-reals-intervals), that two [sets](https://one-course.com/books/math/3/en/chapter/1-logic-sets-and-maps#def-b1-logic-sets) $I_x$, $I_y$ are equal or disjoint, and that $U$ is a union of *countably many* pairwise disjoint [open](#def-b1-topology-open) [intervals](https://one-course.com/books/math/3/en/chapter/10-real-numbers#prop-b1-reals-intervals) *(pick a rational in each)*.

**Solution of Exercise 12.10.**

$I_x$ is a union of [open](#def-b1-topology-open) [intervals](https://one-course.com/books/math/3/en/chapter/10-real-numbers#prop-b1-reals-intervals) all containing $x$: it is [open](#def-b1-topology-open), and it is an [interval](https://one-course.com/books/math/3/en/chapter/10-real-numbers#prop-b1-reals-intervals), being convex — if $u < z < v$ with $u, v \in
I_x$, then $u$ and $v$ lie in [open](#def-b1-topology-open) subintervals $J_u \ni x$, $J_v \ni
x$ of $U$, and $J_u \cup J_v$ is an [interval](https://one-course.com/books/math/3/en/chapter/10-real-numbers#prop-b1-reals-intervals) (both contain $x$) inside $U$ containing $z$; so $z \in I_x$ ([Proposition 10.19](https://one-course.com/books/math/3/en/chapter/10-real-numbers#prop-b1-reals-intervals)).

If $I_x \cap I_y \neq \emptyset$: $I_x \cup I_y$ is then an [open](#def-b1-topology-open) [interval](https://one-course.com/books/math/3/en/chapter/10-real-numbers#prop-b1-reals-intervals) (convex: two overlapping [intervals](https://one-course.com/books/math/3/en/chapter/10-real-numbers#prop-b1-reals-intervals)) contained in $U$ containing $x$ and $y$, so $I_x \cup I_y \subseteq I_x$ and $\subseteq I_y$ by maximality of each: $I_x = I_y$.

So $U$ is the disjoint union of the distinct [sets](https://one-course.com/books/math/3/en/chapter/1-logic-sets-and-maps#def-b1-logic-sets) $I_x$ (each $x \in
U$ lies in its own $I_x$). Countability: each nonempty [open](#def-b1-topology-open) [interval](https://one-course.com/books/math/3/en/chapter/10-real-numbers#prop-b1-reals-intervals) $I$ of the family contains a rational $q_I$ ([Theorem 10.14](https://one-course.com/books/math/3/en/chapter/10-real-numbers#thm-b1-reals-density)), and distinct disjoint [intervals](https://one-course.com/books/math/3/en/chapter/10-real-numbers#prop-b1-reals-intervals) get distinct rationals: the family injects into $\Q$, which is countable (it is indexed by pairs of integers). Hence at most countably many [intervals](https://one-course.com/books/math/3/en/chapter/10-real-numbers#prop-b1-reals-intervals).

**Exercise 12.11 ★★.**

A point $x \in \R$ is an *accumulation point* of $A$ when every [neighborhood](#def-b1-topology-open) of $x$ meets $A \setminus \{x\}$; their [set](https://one-course.com/books/math/3/en/chapter/1-logic-sets-and-maps#def-b1-logic-sets) is the *derived [set](https://one-course.com/books/math/3/en/chapter/1-logic-sets-and-maps#def-b1-logic-sets)* $A'$. Prove that $\overline A = A \cup A'$, and that $A$ is [closed](#def-b1-topology-closed) if and only if $A' \subseteq A$. Determine $A'$ for $A = \{\frac 1n : n \in \N^*\}$, for $A = \Z$, and for $A = \Q$.

**Solution of Exercise 12.11.**

$\overline A = A \cup A'$. ($\supseteq$) $A \subseteq \overline
A$ always; and if $x \in A'$, every [neighborhood](#def-b1-topology-open) of $x$ meets $A
\setminus \{x\} \subseteq A$, so $x$ is adherent. ($\subseteq$) Let $x \in \overline A$. If $x \in A$, done. If $x \notin A$, every [neighborhood](#def-b1-topology-open) of $x$ meets $A = A \setminus \{x\}$: $x \in
A'$.

Consequently $A$ [closed](#def-b1-topology-closed) $\iff$ $A = \overline A = A \cup A'$ $\iff$ $A' \subseteq A$.

$A = \{\frac 1n\}$: $0$ is an accumulation point ($\frac 1n \to
0$, terms $\neq 0$); each $\frac 1n$ is isolated ([Exercise 12.7](#exo-b1-topology-7)), so not in $A'$; and a point $x
\notin A \cup \{0\}$ has a whole [interval](https://one-course.com/books/math/3/en/chapter/10-real-numbers#prop-b1-reals-intervals) avoiding $A$ (between the two neighbors of $x$ in $A \cup \{0\}$, or beyond $1$). Hence $A' = \{0\}$.

$\Z' = \emptyset$: every integer is isolated, every non-integer has a [neighborhood](#def-b1-topology-open) inside $\R \setminus \Z$.

$\Q' = \R$: every [interval](https://one-course.com/books/math/3/en/chapter/10-real-numbers#prop-b1-reals-intervals) around any real contains infinitely many rationals ([Theorem 10.14](https://one-course.com/books/math/3/en/chapter/10-real-numbers#thm-b1-reals-density)), in particular one different from the center.

**Exercise 12.12 ★★★.**

For $A \subseteq \R$ nonempty, define $d_A(x) = \inf\{\abs{x - a}
: a \in A\}$. Prove:

1. $\abs{d_A(x) - d_A(y)} \leq \abs{x - y}$ for all $x, y$ ( $d_A$ is $1$ -Lipschitz);
2. $d_A(x) = 0$ if and only if $x \in \overline A$ ; in particular, if $F$ is [closed](#def-b1-topology-closed) and $x \notin F$ , then $d_F(x) > 0$ ;
3. for every $\varepsilon > 0$ , the [set](https://one-course.com/books/math/3/en/chapter/1-logic-sets-and-maps#def-b1-logic-sets) $V_\varepsilon =  \{x : d_F(x) < \varepsilon\}$ is [open](#def-b1-topology-open) , contains $F$ , and $\bigcap_{\varepsilon > 0} V_\varepsilon = F$ for $F$ [closed](#def-b1-topology-closed) : every [closed set](#def-b1-topology-closed) is a countable intersection of [open sets](#def-b1-topology-open) .

**Solution of Exercise 12.12.**

1. For every $a \in A$ : $\abs{x - a} \leq \abs{x - y} +  \abs{y - a}$ , so $d_A(x) \leq \abs{x - y} + \abs{y - a}$ ; taking the [infimum](https://one-course.com/books/math/3/en/chapter/10-real-numbers#def-b1-reals-bounds) over $a$ : $d_A(x) \leq \abs{x - y} +  d_A(y)$ . Exchanging $x$ and $y$ gives the other inequality: $\abs{d_A(x) - d_A(y)} \leq \abs{x - y}$ .
2. $d_A(x) = 0$ $\iff$ for every $\varepsilon > 0$ there is $a \in A$ with $\abs{x - a} < \varepsilon$ $\iff$ every [interval](https://one-course.com/books/math/3/en/chapter/10-real-numbers#prop-b1-reals-intervals) around $x$ meets $A$ $\iff$ $x \in \overline A$ . If $F$ is [closed](#def-b1-topology-closed) and $x \notin F = \overline F$ , then $d_F(x) \neq 0$ , i.e. $d_F(x) > 0$ .
3. If $d_F(x) < \varepsilon$ , set $r = \varepsilon -  d_F(x) > 0$ : for $\abs{y - x} < r$ , part (1) gives $d_F(y) \leq d_F(x) + \abs{x - y} < \varepsilon$ : the [interval](https://one-course.com/books/math/3/en/chapter/10-real-numbers#prop-b1-reals-intervals) $\intoo{x - r}{x + r}$ lies in $V_\varepsilon$ , which is therefore [open](#def-b1-topology-open) ; it contains $F$ since $d_F = 0$ there. Finally $x \in \bigcap_{\varepsilon>0}  V_\varepsilon$ $\iff$ $d_F(x) < \varepsilon$ for all $\varepsilon$ $\iff$ $d_F(x) = 0$ $\iff$ $x \in \overline  F = F$ . Since $\bigcap_{\varepsilon > 0} V_\varepsilon =  \bigcap_{n \geq 1} V_{1/n}$ , every [closed set](#def-b1-topology-closed) is a countable intersection of [open sets](#def-b1-topology-open) .

## 12.5 Problem: The Cantor set, small and enormous at once

**Problem 12.1.**

Weekend problem — the Cantor middle-thirds [set](https://one-course.com/books/math/3/en/chapter/1-logic-sets-and-maps#def-b1-logic-sets): length zero, uncountable, perfect, and $C + C =
\intcc{0}{2}$

Remove from $\intcc{0}{1}$ its [open](#def-b1-topology-open) middle third, then the middle third of each remaining segment, and repeat forever: what survives is the *[Cantor set](#pb-b1-topology-1)* $C$, the fundamental counterexample factory of analysis. This problem constructs it, reads it through the base-$3$ machinery of [Problem 10.1](https://one-course.com/books/math/3/en/chapter/10-real-numbers#pb-b1-reals-1), and establishes its paradoxical portrait: total length zero, yet uncountable; empty [interior](#def-b1-topology-closure), yet no isolated point; totally disconnected, yet $C + C$ fills the whole segment $\intcc{0}{2}$. Formally: $C_0 = \intcc{0}{1}$, and $C_{n+1}$ is obtained from $C_n$ by deleting the [open](#def-b1-topology-open) middle third of each segment of $C_n$; finally $C = \bigcap_{n \geq 0}
C_n$. Throughout, a *ternary code* of $x \in \intcc{0}{1}$ is any digit string $(d_k)_{k\geq1}$ with $d_k \in \{0, 1, 2\}$ whose value $\sup_n \sum_{k=1}^n d_k 3^{-k}$ equals $x$ — improper codes (eventually $2$) are allowed; by [Problem 10.1](https://one-course.com/books/math/3/en/chapter/10-real-numbers#pb-b1-reals-1) (questions 9–11), every $x \in
\intcc{0}{1}$ has one or two codes, two exactly when $x = m/3^N
\in \intoo{0}{1}$.

**Part I — The construction.**

1. Describe $C_1$ and $C_2$ explicitly as unions of segments, and prove by induction: $C_n$ is a disjoint union of $2^n$ [closed](#def-b1-topology-closed) segments, each of length $3^{-n}$ .
2. Show that $C$ is [closed](#def-b1-topology-closed) , bounded — hence compact ( [Theorem 12.19](#thm-b1-topology-compact) ) — nonempty, and that every endpoint of every segment of every $C_n$ belongs to $C$ .
3. The total length of $C_n$ is $\bigl(\frac23\bigr)^n$ . Deduce that for every $\varepsilon > 0$ , the [set](https://one-course.com/books/math/3/en/chapter/1-logic-sets-and-maps#def-b1-logic-sets) $C$ can be covered by finitely many segments of total length $\leq \varepsilon$ : the [Cantor set](#pb-b1-topology-1) has *length zero* .
4. Show that an [interval](https://one-course.com/books/math/3/en/chapter/10-real-numbers#prop-b1-reals-intervals) contained in $C$ has length $\leq  3^{-n}$ for every $n$ , hence is a singleton or empty: $\mathring C = \emptyset$ . Being [closed](#def-b1-topology-closed) with empty [interior](#def-b1-topology-closure) , $C$ is *nowhere [dense](#def-b1-topology-dense)* .

**Part II — The ternary code.**

5. Prove the self-similarity recursion $$C_{n+1} = \tfrac13 C_n \,\cup\,  \bigl(\tfrac23 + \tfrac13 C_n\bigr),  \qquad\text{hence}\qquad  C = \tfrac13 C \,\cup\, \bigl(\tfrac23 + \tfrac13  C\bigr),$$ the two pieces being disjoint: $C$ is two copies of itself at scale $\frac13$.
6. Prove by induction on $n$ : $x \in C_n$ if and only if $x$ has a ternary code whose first $n$ digits lie in $\{0, 2\}$ . Deduce, using the fact that $x$ has at most two codes: $x \in C$ if and only if $x$ has a code with *no digit equal to $1$* (a *$1$-free* code).
7. Codes in action: give $1$ -free codes for $0$ , $1$ , $\frac13$ , $\frac23$ ; show $\frac14 = (0.\overline{02})_3$ and $\frac34 = (0.\overline{20})_3$ , so both belong to $C$ ; and check that $\frac14$ is *not* an endpoint of any $C_n$ (endpoints have the form $m/3^n$ ).
8. Show that each $x \in C$ has *exactly one* $1$ -free code *(when $x$ has two codes, prove that exactly one of the pair contains the digit $1$)* . Conclude: the value [map](https://one-course.com/books/math/3/en/chapter/1-logic-sets-and-maps#def-b1-logic-map) is a bijection from $\{0,2\}$ -strings onto $C$ .
9. (Diagonal) Let $k \mapsto x_k$ be any [map](https://one-course.com/books/math/3/en/chapter/1-logic-sets-and-maps#def-b1-logic-map) $\N^* \to C$ . Build a $\{0, 2\}$ -string differing at index $k$ from the code of $x_k$ , and conclude that $C$ is uncountable — while, by contrast, question 3 says it is metrically negligible.

**Part III — Topological portrait.**

10. Assemble the record so far: $C$ is compact, uncountable, of length zero, nowhere [dense](#def-b1-topology-dense) . Which single containment $C \subseteq C_n$ carries each property?
11. ( $C$ is perfect) Let $x \in C$ with $1$ -free code $(d_k)$ . Flipping the digit $d_n$ ( $0 \leftrightarrow  2$ ) produces $x_n \in C$ with $\abs{x_n - x} = 2 \cdot  3^{-n}$ . Conclude that $C$ has no isolated point: every point of $C$ is a limit of *other* points of $C$ .
12. Show that the endpoints of question 2 form a countable [dense](#def-b1-topology-dense) subset of $C$ *(truncate the code after $n$ digits and continue with $0$s; countability as in [Exercise 12.10](#exo-b1-topology-10))* . Conclude: the typical point of $C$ — like $\frac14$ — is *not* an endpoint: endpoints are a countable skeleton inside an uncountable body.
13. (Totally disconnected) Let $x < y$ in $C$ . Choose $n$ with $3^{-n} < y - x$ and produce a point $z \in  \intoo{x}{y}$ with $z \notin C$ . Conclude that the only nonempty [intervals](https://one-course.com/books/math/3/en/chapter/10-real-numbers#prop-b1-reals-intervals) contained in $C$ are singletons.

**Part IV — Arithmetic of $C$.**

14. Show $1 - C = C$ *(what does $x \mapsto 1 - x$ do to a $1$-free code? recall $1 = (0.\overline{2})_3$)* .
15. (Addition of codes) Show that if $x$ , $x'$ have codes $(a_k)$ , $(b_k)$ , then $x + x' = \lim_n\,(t_n + t'_n)$ where $t_n, t'_n$ are the partial sums. Deduce: every $y  \in \intcc{0}{1}$ is the *midpoint* of two points of $C$ — given a code $(e_k)$ of $y$ , choose digits $a_k, b_k \in \{0, 2\}$ with $\frac{a_k + b_k}{2} =  e_k$ .
16. Conclude $C + C = \intcc{0}{2}$ and, with question 14, $C - C = \intcc{-1}{1}$ . Concrete instance: write $1$ as a sum of the two non-endpoints found in question 7.
17. Reflect: a [set](https://one-course.com/books/math/3/en/chapter/1-logic-sets-and-maps#def-b1-logic-sets) of length zero whose difference [set](https://one-course.com/books/math/3/en/chapter/1-logic-sets-and-maps#def-b1-logic-sets) fills $\intcc{-1}{1}$ . Why is there no contradiction between “ $C$ is metrically negligible” and “ $C + C$ has full length”? (One sentence; think about what length controls and what it does not.)

**Part V — Members, rational and irrational.**

18. Combine question 8 with the periodicity criterion of [Problem 10.1](https://one-course.com/books/math/3/en/chapter/10-real-numbers#pb-b1-reals-1) : a point of $C$ is rational if and only if its $1$ -free code is eventually periodic. Run the base- $3$ long division to check $\frac1{13} =  (0.\overline{002})_3 \in C$ .
19. Produce an explicitly *irrational* member of $C$ : the value of the code with $d_k = 2$ at the triangular positions $k = \frac{j(j+1)}{2}$ and $d_k = 0$ elsewhere. Justify irrationality by the growing-gaps argument of [Problem 10.1](https://one-course.com/books/math/3/en/chapter/10-real-numbers#pb-b1-reals-1) (question 20).
20. (Onto a full segment) Consider $h$ mapping the point of $C$ with $1$ -free code $(d_k)$ to the value of the *binary* string $\bigl(\frac{d_k}2\bigr)$ , i.e. $h(x) = \sup_n \sum_{k=1}^n \frac{d_k}{2}\,2^{-k}$ . Show that $h$ [maps](https://one-course.com/books/math/3/en/chapter/1-logic-sets-and-maps#def-b1-logic-map) $C$ *onto* $\intcc{0}{1}$ . So the negligible $C$ surjects onto a segment of full length — a second proof that $C$ is uncountable.
21. (Self-similar length) Suppose some notion of length $L$ were defined for $C$ and its shrunken copies, respecting scaling ( $L(\lambda A) = \lambda L(A)$ ), translation invariance, and additivity over the disjoint decomposition of question 5. Show that then $L(C) = \frac23\,L(C)$ , forcing $L(C) = 0$ : self-similarity alone already sentences $C$ to length zero.

**Part VI — A fat cousin, and the moral.**

22. (Fat [Cantor set](#pb-b1-topology-1) ) Repeat the construction, but at stage $n$ ( $n = 0, 1, 2, \dots$ ) remove from each of the $2^n$ current segments a central [open](#def-b1-topology-open) [interval](https://one-course.com/books/math/3/en/chapter/10-real-numbers#prop-b1-reals-intervals) of length $4^{-(n+1)}$ only. Show that the segment lengths $l_n$ obey $l_{n+1} = \frac{l_n - 4^{-(n+1)}}{2}$ , $l_n =  \frac{2^n + 1}{2\cdot 4^n} > 0$ , that the resulting $K = \bigcap K_n$ is compact with empty [interior](#def-b1-topology-closure) , and that the total removed length is $\sum_{n\geq0} 2^n  4^{-(n+1)} = \frac12$ . Admitting the (intuitive, Year 3) additivity of length for finite unions of [intervals](https://one-course.com/books/math/3/en/chapter/10-real-numbers#prop-b1-reals-intervals) , and using both [statements](https://one-course.com/books/math/3/en/chapter/1-logic-sets-and-maps#def-b1-logic-statement) of [Example 12.20](#ex-b1-topology-nested) , show that any finite family of [open](#def-b1-topology-open) [intervals](https://one-course.com/books/math/3/en/chapter/10-real-numbers#prop-b1-reals-intervals) covering $K$ has total length $\geq \frac12$ : $K$ is nowhere [dense](#def-b1-topology-dense) but *not* negligible. Smallness has several inequivalent meanings.
23. (Distances) Show that for a nonempty [closed](#def-b1-topology-closed) $F \subseteq  \R$ and $x \in \R$, the [infimum](https://one-course.com/books/math/3/en/chapter/10-real-numbers#def-b1-reals-bounds) $d(x, F)$ is *attained* *(minimizing sequence plus Bolzano–Weierstrass)*. Then compute $$\max_{y \in \intcc{0}{1}} d(y, C) = \frac16 ,$$ attained exactly at the center $y = \frac12$ *(a point of a gap created at stage $n$ is within $\frac{3^{-n}}{2}$ of the gap’s endpoints, which lie in $C$)*.
24. (Every point a subsequential limit) Using questions 12 and 2, produce a single sequence in $C$ whose [set](https://one-course.com/books/math/3/en/chapter/1-logic-sets-and-maps#def-b1-logic-sets) of subsequential limits is *all* of $C$ . (Compare: for a convergent sequence that [set](https://one-course.com/books/math/3/en/chapter/1-logic-sets-and-maps#def-b1-logic-sets) is one point — $C$ realizes the opposite extreme among compacts.)
25. Synthesis, one sentence each: (i) which theorems of this chapter did the construction actually consume (stability of [closed sets](#def-b1-topology-closed) , compactness, sequential characterizations)? (ii) list the four paradoxical pairings of the portrait (length zero/uncountable, [closed](#def-b1-topology-closed) /empty [interior](#def-b1-topology-closure) , perfect/totally disconnected, negligible/ $C+C$ full); (iii) where does $C$ resurface later (the devil’s staircase built on $h$ in the theory of continuity, and the measure theory of the Year 3 volume, where $C$ separates “countable” from “negligible”)?

**Solution of Problem 12.1.**

**1.** $C_1 = \intcc{0}{\frac13} \cup \intcc{\frac23}{1}$ and

$$
C_2 = \intcc{0}{\tfrac19} \cup \intcc{\tfrac29}{\tfrac13}
\cup \intcc{\tfrac23}{\tfrac79} \cup \intcc{\tfrac89}{1} .
$$

Induction: if $C_n$ is a disjoint union of $2^n$ [closed](#def-b1-topology-closed) segments of length $3^{-n}$, deleting the [open](#def-b1-topology-open) middle third of each leaves two [closed](#def-b1-topology-closed) segments of length $3^{-n-1}$ per parent: $2^{n+1}$ segments, pairwise disjoint (children of distinct parents are separated because the parents were; children of one parent are separated by the removed gap).

**2.** Each $C_n$ is a finite union of segments, hence [closed](#def-b1-topology-closed); $C = \bigcap C_n$ is an intersection of [closed sets](#def-b1-topology-closed): [closed](#def-b1-topology-closed) ([Definition 12.5](#def-b1-topology-closed)); bounded ($\subseteq
\intcc{0}{1}$): compact by [Theorem 12.19](#thm-b1-topology-compact). Nonempty: $0$ lies in the leftmost segment of every $C_n$. Let $a$ be an endpoint of a segment $S$ of $C_n$. For $m \leq n$, $a \in C_n \subseteq C_m$. For the later stages: the middle-third deletion never removes an endpoint, and $a$ is again an endpoint of one of the two children of $S$ (the child touching $a$); by induction $a \in C_m$ for all $m \geq n$: $a \in C$.

**3.** Total length of $C_n$: $2^n \cdot 3^{-n} =
(\frac23)^n \to 0$. Given $\varepsilon > 0$, choose $n$ with $(\frac23)^n \leq \varepsilon$: then $C \subseteq C_n$, a union of finitely many segments of total length $\leq \varepsilon$.

**4.** Let $I \subseteq C$ be an [interval](https://one-course.com/books/math/3/en/chapter/10-real-numbers#prop-b1-reals-intervals) with two distinct points. For every $n$: $I \subseteq C_n$, and $I$, being convex, must lie inside a *single* segment of $C_n$ (meeting two segments would force $I$ to contain a point of the gap between them, which is outside $C_n$). Hence the length of $I$ is $\leq
3^{-n}$ for all $n$: contradiction. So the only [intervals](https://one-course.com/books/math/3/en/chapter/10-real-numbers#prop-b1-reals-intervals) inside $C$ are empty or singletons; in particular no $\intoo{x-r}{x+r}$ fits inside $C$: $\mathring C = \emptyset$. As $C$ is [closed](#def-b1-topology-closed), $\overline C = C$ has empty [interior](#def-b1-topology-closure): $C$ is nowhere [dense](#def-b1-topology-dense).

**5.** Write $\varphi_0(x) = \frac x3$ and $\varphi_2(x) =
\frac{2 + x}{3}$, increasing affine bijections of $\intcc{0}{1}$ onto $\intcc{0}{\frac13}$ and $\intcc{\frac23}{1}$. Claim: $C_{n+1} = \varphi_0(C_n) \cup \varphi_2(C_n)$. For $n = 0$ this is question 1. Induction: an increasing affine [map](https://one-course.com/books/math/3/en/chapter/1-logic-sets-and-maps#def-b1-logic-map) sends the middle third of a segment to the middle third of the image segment, so deleting middle thirds commutes with $\varphi_0$ and $\varphi_2$; applying the deletion step to $C_{n+1} =
\varphi_0(C_n) \cup \varphi_2(C_n)$ yields $C_{n+2} =
\varphi_0(C_{n+1}) \cup \varphi_2(C_{n+1})$. Intersecting over $n$: for $x \leq \frac13$, $x \in C \iff x \in \varphi_0(C_n)$ for all $n$ $\iff 3x \in \bigcap C_n = C$; likewise on $\intcc{\frac23}{1}$; and no point of $\intoo{\frac13}{\frac23}$ lies in $C_1$. Hence $C = \varphi_0(C) \cup \varphi_2(C)$, disjointly.

**6.** Induction on $n$; the case $n = 0$ says every $x \in
\intcc{0}{1}$ has a code, which is [Problem 10.1](https://one-course.com/books/math/3/en/chapter/10-real-numbers#pb-b1-reals-1) (question 9 for $x < 1$; $1 = (0.\overline 2)_3$). Suppose the equivalence at rank $n$. If $x \in C_{n+1}$: by question 5, $x =
\varphi_i(z)$ with $z \in C_n$ and $i \in \{0, 2\}$; if $(e_k)$ is a code of $z$ with first $n$ digits $1$-free, then $(i, e_1,
e_2, \dots)$ has partial sums $\frac i3 + \frac13\sum_{k\leq m}
e_k 3^{-k} \to \varphi_i(z) = x$: a code of $x$ with first $n +
1$ digits $1$-free. Conversely, if $x$ has a code $(d_k)$ with $d_1, \dots, d_{n+1} \in \{0, 2\}$: the shifted string $(d_2,
d_3, \dots)$ has some value $z \in \intcc{0}{1}$, its first $n$ digits are $1$-free, and the partial-sum computation read backwards gives $x = \varphi_{d_1}(z)$; by induction $z \in
C_n$, so $x \in C_{n+1}$ by question 5. Finally: a fully $1$-free code puts $x$ in every $C_n$, hence in $C$; conversely if $x \in C$, then for every $n$ one of the at most two codes of $x$ ([Problem 10.1](https://one-course.com/books/math/3/en/chapter/10-real-numbers#pb-b1-reals-1), question 11) has its first $n$ digits $1$-free; one fixed code must work for arbitrarily large $n$ (pigeonhole between two codes), and a code whose first $n$ digits are $1$-free for arbitrarily large $n$ is $1$-free outright.

**7.** $0 = (0.\overline 0)_3$, $1 = (0.\overline 2)_3$, $\frac13 = (0.0\overline{2})_3$ (the improper twin of $(0.1)_3$), $\frac23 = (0.2\overline{0})_3$. Geometric sums:

$$
(0.\overline{02})_3 = \sum_{j\geq1} \frac{2}{9^{\,j}}
= \frac{2/9}{1 - 1/9} = \frac14 ,
\qquad
(0.\overline{20})_3 = \sum_{j\geq1} \frac{2}{3\cdot 9^{\,j-1}}
= \frac{2/3}{1 - 1/9} = \frac34 ,
$$

both $1$-free: $\frac14, \frac34 \in C$. (The infinite sums abbreviate suprema of partial sums, as in [Problem 10.1](https://one-course.com/books/math/3/en/chapter/10-real-numbers#pb-b1-reals-1).) Endpoints of segments of $C_n$ are of the form $m/3^n$ (induction: children endpoints are parent endpoints or differ from one by a multiple of $3^{-n-1}$). If $\frac14 =
\frac{m}{3^n}$ then $3^n = 4m$, and $4 \nmid 3^n$: impossible. So $\frac14 \in C$ without ever being an endpoint.

**8.** Suppose $x$ had two distinct $1$-free codes. Having two codes at all means ([Problem 10.1](https://one-course.com/books/math/3/en/chapter/10-real-numbers#pb-b1-reals-1), question 11, base $3$) that $x = m/3^N \in \intoo{0}{1}$ and the two codes are: the terminating one, with last nonzero digit $d_N \in \{1, 2\}$ followed by $0$s, and its twin, with $d_N - 1$ at position $N$ followed by $2$s. If $d_N = 1$ the first contains a $1$; if $d_N
= 2$ the twin carries $d_N - 1 = 1$. Either way at most one of the pair is $1$-free: contradiction. So each $x \in C$ has exactly one $1$-free code (existence by question 6), and distinct $\{0,2\}$-strings have distinct values. Every $\{0,2\}$-string has value in $\intcc{0}{1}$ (partial sums $\leq
1$) with all prefixes $1$-free, hence value in every $C_n$, i.e. in $C$: the value [map](https://one-course.com/books/math/3/en/chapter/1-logic-sets-and-maps#def-b1-logic-map) is a bijection from $\{0,2\}$-strings onto $C$.

**9.** Let $(d^{(k)})$ be the $1$-free code of $x_k$ and set $e_k = 2 - d^{(k)}_k \in \{0, 2\}$: a $\{0,2\}$-string whose value $y$ lies in $C$ and has $(e_k)$ as its unique $1$-free code (question 8). For each $k$ the codes of $y$ and $x_k$ differ at position $k$, so $y \neq x_k$: no [map](https://one-course.com/books/math/3/en/chapter/1-logic-sets-and-maps#def-b1-logic-map) $\N^* \to C$ is [surjective](https://one-course.com/books/math/3/en/chapter/1-logic-sets-and-maps#def-b1-logic-inj). An uncountable [set](https://one-course.com/books/math/3/en/chapter/1-logic-sets-and-maps#def-b1-logic-sets) of length zero: bigness in [cardinality](https://one-course.com/books/math/3/en/chapter/2-counting#def-b1-counting-card), smallness in measure — simultaneously.

**10.** Compactness: closedness of the infinite intersection plus boundedness (question 2) — the one property not carried by a single containment. Length zero: $C \subseteq
C_n$ with total length $(\frac23)^n$ (question 3). Nowhere [density](#def-b1-topology-dense): $C \subseteq C_n$ forces [intervals](https://one-course.com/books/math/3/en/chapter/10-real-numbers#prop-b1-reals-intervals) inside $C$ to have length $\leq 3^{-n}$ (question 4). Uncountability rides on no containment at all: it needs the full intersection structure, encoded in the bijection of question 8.

**11.** Flip $d_n$ to $2 - d_n$: the new string is still a $\{0,2\}$-string, so its value $x_n$ lies in $C$; the partial sums beyond rank $n$ differ by exactly $2\cdot3^{-n}$, so $\abs{x_n - x} = 2\cdot3^{-n}$. Thus $x_n \neq x$ and $x_n \to
x$: every point of $C$ is a limit of other points of $C$ — $C$ is *perfect*, with no isolated point.

**12.** By the induction of question 5, the segments of $C_n$ are exactly the $\intcc{t}{t + 3^{-n}}$ where $t$ runs over the values of length-$n$ $\{0,2\}$-strings. Given $x \in C$ with code $(d_k)$, the truncation $t_n$ (digits $d_1 \dots d_n$ then $0$s) is therefore a left endpoint, and $0 \leq x - t_n
\leq 3^{-n}$: endpoints are [dense](#def-b1-topology-dense) in $C$. They form a subset of $\{m/3^n : m, n\}$, a [set](https://one-course.com/books/math/3/en/chapter/1-logic-sets-and-maps#def-b1-logic-sets) indexed by pairs of integers, hence countable (as for $\Q$ in [Exercise 12.10](#exo-b1-topology-10)). Since $C$ is uncountable (question 9), all but countably many points of $C$ are not endpoints — $\frac14$ (question 7) is the visible tip of that iceberg.

**13.** Pick $n$ with $3^{-n} < y - x$. Both $x, y \in
C_n$, and they cannot lie in the same segment (length $3^{-n} <
y - x$): the removed gap between their segments provides $z$ with $x < z < y$ and $z \notin C_n \supseteq C$. Hence any two points of $C$ are separated by the complement: the only convex subsets of $C$ are singletons — $C$ is totally disconnected.

**14.** If $(d_k)$ is the $1$-free code of $x$, the string $(2 - d_k)$ is again a $\{0,2\}$-string, with partial sums

$$
\sum_{k=1}^{n} (2 - d_k)3^{-k} = (1 - 3^{-n}) - \sum_{k=1}^n
d_k 3^{-k} \longrightarrow 1 - x :
$$

so $1 - x \in C$. Thus $1 - C \subseteq C$, and applying the [map](https://one-course.com/books/math/3/en/chapter/1-logic-sets-and-maps#def-b1-logic-map) twice gives $1 - C = C$: the [Cantor set](#pb-b1-topology-1) is symmetric about $\frac12$.

**15.** The partial sums $t_n \to x$ and $t'_n \to x'$ (increasing sequences converge to their [supremum](https://one-course.com/books/math/3/en/chapter/10-real-numbers#def-b1-reals-bounds), i.e. the value), so $t_n + t'_n \to x + x'$ by [Theorem 11.5](https://one-course.com/books/math/3/en/chapter/11-sequences#thm-b1-seq-operations). Given $y \in \intcc{0}{1}$ with code $(e_k)$, choose $(a_k, b_k) = (0,0), (0,2), (2,2)$ according as $e_k = 0, 1, 2$: then $a_k + b_k = 2e_k$, the strings $(a_k)$, $(b_k)$ are $\{0,2\}$-strings with values $x,
x' \in C$, and

$$
x + x' = \lim_n\,(t_n + t'_n) = \lim_n 2\sum_{k=1}^n e_k 3^{-k}
= 2y :
$$

every $y \in \intcc{0}{1}$ is the midpoint of two points of $C$.

**16.** Question 15 gives $\intcc{0}{2} = 2\,\intcc{0}{1}
\subseteq C + C$, and $C + C \subseteq \intcc{0}{1} +
\intcc{0}{1} = \intcc{0}{2}$: equality. Then, using $1 - C = C$:

$$
C - C = C + (C - 1) = (C + C) - 1 = \intcc{-1}{1} .
$$

Concrete instance: $1 = \frac14 + \frac34$, a sum of two non-endpoint members of $C$.

**17.** Length measures how much of the line the [set](https://one-course.com/books/math/3/en/chapter/1-logic-sets-and-maps#def-b1-logic-sets) itself occupies; it says nothing about the [set](https://one-course.com/books/math/3/en/chapter/1-logic-sets-and-maps#def-b1-logic-sets) of *sums*, which is the image of the two-parameter family $C \times C$ under $(x,
x') \mapsto x + x'$ — the two digit strings are chosen independently, and that freedom is exactly what fills $\intcc{0}{2}$. No theorem bounds the length of a sumset by the lengths of the summands, and $C$ is the proof that none can.

**18.** By [Problem 10.1](https://one-course.com/books/math/3/en/chapter/10-real-numbers#pb-b1-reals-1) (question 18), $x$ is rational iff its proper expansion is eventually periodic. The $1$-free code of $x \in C$ is either that proper expansion or the improper twin of a terminating one; a terminating string and its twin (eventually constant $2$s) are both eventually periodic, so periodicity of the $1$-free code is equivalent to rationality of $x$. Long division of $\frac1{13}$ in base $3$ ($r_0 = 1$): $3 = 13\cdot0 + 3$, $9 = 13\cdot0 + 9$, $27 =
13\cdot2 + 1$, and the remainder returns to $1$: digits $\overline{002}$, so $\frac1{13} = (0.\overline{002})_3$, $1$-free and periodic: a rational member of $C$. (Check: $\frac{2/27}{1 - 1/27} = \frac{2}{26} = \frac1{13}$.)

**19.** The string with $d_k = 2$ at the triangular positions $k = \frac{j(j+1)}{2}$ and $0$ elsewhere is a $\{0,2\}$-string, so its value $x^*$ belongs to $C$ (question 8). It has infinitely many $2$s with gaps $j + 1 \to \infty$ between consecutive ones, so it is not eventually periodic (a period $T$ would eventually force $2$s at gaps $\leq T$: the growing-gaps argument of [Problem 10.1](https://one-course.com/books/math/3/en/chapter/10-real-numbers#pb-b1-reals-1), question 20); by question 18, $x^* \notin \Q$. And by question 9 plus the countability of $\Q$, all but countably many members of $C$ are irrational: $x^*$ is the norm, not the exception.

**20.** Let $y \in \intcc{0}{1}$: it has a binary code $(c_k)$ with $c_k \in \{0, 1\}$ ([Problem 10.1](https://one-course.com/books/math/3/en/chapter/10-real-numbers#pb-b1-reals-1), question 9, base $2$; $y = 1$ takes the all-$1$s string). Then $(2c_k)$ is a $\{0,2\}$-string, its value $x$ lies in $C$, and $h(x)$ is the value of $(c_k)$, namely $y$: $h$ [maps](https://one-course.com/books/math/3/en/chapter/1-logic-sets-and-maps#def-b1-logic-map) $C$ onto $\intcc{0}{1}$. If $C$ were the image of a [map](https://one-course.com/books/math/3/en/chapter/1-logic-sets-and-maps#def-b1-logic-map) from $\N^*$, composing with $h$ would list all of $\intco{0}{1}$, contradicting the diagonal theorem of [Problem 10.1](https://one-course.com/books/math/3/en/chapter/10-real-numbers#pb-b1-reals-1) (question 22): $C$ is uncountable, again. A length-zero [set](https://one-course.com/books/math/3/en/chapter/1-logic-sets-and-maps#def-b1-logic-sets) surjecting onto a full segment.

**21.** By question 5, $C$ is the disjoint union of $\varphi_0(C)$ and $\varphi_2(C)$, each a translate of the scaled copy $\frac13 C$. Additivity, scaling and translation invariance give

$$
L(C) = L(\varphi_0(C)) + L(\varphi_2(C))
= \tfrac13 L(C) + \tfrac13 L(C) = \tfrac23\,L(C),
$$

so $\frac13 L(C) = 0$: $L(C) = 0$. Self-similarity alone sentences $C$ to length zero — question 3 merely executed the sentence.

**22.** A segment of length $l_n$ loses a central [interval](https://one-course.com/books/math/3/en/chapter/10-real-numbers#prop-b1-reals-intervals) of length $4^{-(n+1)}$, leaving two segments of length $l_{n+1}
= \frac{l_n - 4^{-(n+1)}}{2}$; from $l_0 = 1$, induction confirms $l_n = \frac{2^n + 1}{2\cdot4^n}$: indeed $\frac12\Bigl(\frac{2^n+1}{2\cdot4^n} - \frac{1}{4^{n+1}}\Bigr)
= \frac{2(2^n + 1) - 1}{2\cdot4^{n+1}} = \frac{2^{n+1} +
1}{2\cdot4^{n+1}}$, and $l_n > 0$ always: the construction never starves. $K = \bigcap K_n$ is [closed](#def-b1-topology-closed) and bounded, hence compact; an [interval](https://one-course.com/books/math/3/en/chapter/10-real-numbers#prop-b1-reals-intervals) inside $K$ lies in one segment of $K_n$, of length $l_n \to 0$: empty [interior](#def-b1-topology-closure). Removed length: $\sum_{n\geq0} 2^n
\cdot 4^{-(n+1)} = \frac14\sum_{n\geq0}\bigl(\frac12\bigr)^n =
\frac12$, and each $K_n$ has total length $2^n l_n = \frac{2^n +
1}{2^{n+1}} > \frac12$. Now let finitely many [open](#def-b1-topology-open) [intervals](https://one-course.com/books/math/3/en/chapter/10-real-numbers#prop-b1-reals-intervals) have union $U \supseteq K$. By the companion [statement](https://one-course.com/books/math/3/en/chapter/1-logic-sets-and-maps#def-b1-logic-statement) of [Example 12.20](#ex-b1-topology-nested), $U \supseteq K_n$ for some $n$; admitting additivity of length on finite unions of [intervals](https://one-course.com/books/math/3/en/chapter/10-real-numbers#prop-b1-reals-intervals), the total length of the covering [intervals](https://one-course.com/books/math/3/en/chapter/10-real-numbers#prop-b1-reals-intervals) is at least that of $K_n$, which exceeds $\frac12$. So $K$ is nowhere [dense](#def-b1-topology-dense), yet no cheap cover exists: topological smallness (nowhere [dense](#def-b1-topology-dense)) and metric smallness (length zero) are genuinely different notions, and $K$ separates them.

**23.** Attainment: let $d = d(x, F)$ and pick $a_k \in F$ with $\abs{x - a_k} \leq d + \frac1k$: the $a_k$ are bounded, so Bolzano–Weierstrass ([Theorem 11.16](https://one-course.com/books/math/3/en/chapter/11-sequences#thm-b1-seq-bw)) extracts $a_{\varphi(k)} \to a$, with $a \in F$ ($F$ [closed](#def-b1-topology-closed), [Theorem 12.6](#thm-b1-topology-seqclosed)) and $\abs{x - a} = \lim
\abs{x - a_{\varphi(k)}} = d$. Now the maximum: if $y \in C$, $d(y, C) = 0$; otherwise $y$ lies in a gap removed at some stage $n \geq 1$, an [open](#def-b1-topology-open) [interval](https://one-course.com/books/math/3/en/chapter/10-real-numbers#prop-b1-reals-intervals) of length $3^{-n}$ whose two endpoints belong to $C$ (question 2), so $d(y, C) \leq
\frac{3^{-n}}{2} \leq \frac16$, with equality requiring $n = 1$ and $y$ at the center of the gap $\intoo{\frac13}{\frac23}$, i.e. $y = \frac12$; and indeed $d\bigl(\frac12, C\bigr) =
\frac16$ since $C \cap \intoo{\frac13}{\frac23} = \emptyset$ and $\frac13, \frac23 \in C$. Hence $\max_{y\in\intcc{0}{1}} d(y, C)
= \frac16$, attained exactly at $\frac12$.

**24.** The endpoints form a countable [dense](#def-b1-topology-dense) subset of $C$ (question 12): list them as a single sequence $(e_j)_{j\geq1}$, a sequence in $C$. Its subsequential limits all lie in $C$ ($C$ [closed](#def-b1-topology-closed)). Conversely, fix $x \in C$: for each $n$, the segments of the $C_m$ containing $x$ ($m \geq n$) have their endpoints within $3^{-m} \leq 3^{-n}$ of $x$, so infinitely many distinct endpoints lie within $3^{-n}$ of $x$; choose indices $j_1 < j_2
< \dots$ with $\abs{e_{j_n} - x} \leq 3^{-n}$: a [subsequence](https://one-course.com/books/math/3/en/chapter/11-sequences#def-b1-seq-subsequence) converging to $x$. So the [set](https://one-course.com/books/math/3/en/chapter/1-logic-sets-and-maps#def-b1-logic-sets) of subsequential limits of $(e_j)$ is exactly $C$ — one sequence clustering at uncountably many points, the opposite extreme from a convergent sequence, whose cluster [set](https://one-course.com/books/math/3/en/chapter/1-logic-sets-and-maps#def-b1-logic-sets) is a singleton.

**25.** (i) The construction consumed: stability of [closed sets](#def-b1-topology-closed) under arbitrary intersection (existence of $C$ as a [closed set](#def-b1-topology-closed)), the compactness theorem [Theorem 12.19](#thm-b1-topology-compact) (questions 2, 22, 23), and the sequential characterizations of closedness and adherence (the nested-compacts argument of [Example 12.20](#ex-b1-topology-nested) and question 23). (ii) The four pairings: length zero yet uncountable (questions 3, 9); [closed](#def-b1-topology-closed) yet with empty [interior](#def-b1-topology-closure) (question 4); perfect — no isolated point — yet totally disconnected (questions 11, 13); negligible yet with $C + C = \intcc{0}{2}$ (question 16). (iii) The surjection $h$ of question 20, made continuous and nondecreasing, becomes the devil’s staircase in the theory of continuous functions; and in the Year 3 volume’s measure theory, $C$ is the standard witness that “negligible” does not mean “countable”, with its fat cousin (question 22) separating “nowhere [dense](#def-b1-topology-dense)” from “negligible”.
