Connected and compact are properties of a whole space. This page asks a smaller question: what does the space look like if you only ever stand at one point and look at what's right next to you? A space can be one piece and still be a mess up close. It can be infinitely long and still be perfectly tidy up close. The word for "up close" is locally.
Local compactness is the one that pays off. It's exactly what you need to add a single point $\infty$ to a space and make it compact, the way the circle is a line with its two ends tied together at one point. Practice sits right after each idea, and the Mixed Practice at the bottom takes that hint away.
Here's the pattern for every "local" property. Pick a point $x$ and any neighborhood $U$ of it, as small as you like. Inside $U$ there should be a smaller neighborhood of $x$ that has the property. So it's not enough for $x$ to have one nice neighborhood: there have to be nice ones inside every neighborhood, no matter how small.
A topological space $X$ is locally connected at $x \in X$ if for every neighborhood $U$ of $x$, there is a connected neighborhood $V$ of $x$ such that $V \subseteq U$. If $X$ is locally connected at every $x \in X$, we say that $X$ is locally connected.
Swap "connected" for "path connected" and you get the version with paths. Same pattern, stronger pieces.
A topological space $X$ is locally path connected at $x \in X$ if for every neighborhood $U$ of $x$, there is a path connected neighborhood $V$ of $x$ such that $V \subseteq U$. $X$ is locally path connected if it is locally path connected at each of its points.
The point of the word "locally" is that it has nothing to do with being in one piece. Every combination happens, and the four spaces below are the ones to keep in your head.
On Connected Spaces: the closure of a connected set is connected. That's the whole reason the closed sine curve below is connected, even though its segment and its wiggles never touch.
Let $S = \{(x, \sin(1/x)) : 0 < x \le 1\}$ and let $\overline{S} = S \cup (\{0\} \times [-1, 1])$ be its closure in $\mathbb{R}^2$, the closed topologist's sine curve. Decide which of these are connected and which are locally connected: $(a, b)$; $[-1, 0) \cup (0, 1]$; $\overline{S}$; $\mathbb{Q}$.
The sine curve is the one that surprises people, so watch it up close. The ball around $(0, \tfrac12)$ keeps shrinking, and what's inside it never becomes one piece.
$\sin(1/x)$ near $0$ is a toddler after a whole bag of candy. Up, down, up, down, faster and faster, and it never settles.
Every ball centered on the segment catches infinitely many arcs, because $\sin(1/x)$ crosses every height between $-1$ and $1$ infinitely often as $x \to 0$. The segment piece and the arcs never join up inside the ball. Here's the argument written out.
Show that $\overline{S}$ is not locally connected at $(0, 0)$: the neighborhood $U = \overline{S} \cap B\big((0, 0), \tfrac12\big)$ contains no connected neighborhood of $(0, 0)$.
Proof. Suppose $V$ is a connected neighborhood of $(0, 0)$ in $\overline{S}$ with $V \subseteq U$. The points $\big(\frac{1}{k\pi}, 0\big)$ of $S$ converge to $(0, 0)$, so the open set $V$ contains one of them; call it $p$, with first coordinate $x_0 > 0$.
Choose $k$ so large that $a = \frac{1}{\pi/2 + k\pi}$ is less than $x_0$. The only point of $\overline{S}$ with first coordinate $a$ is $(a, \sin(1/a)) = (a, \pm 1)$, which is at distance at least $1$ from the origin, so it is not in $U$, and not in $V$. Hence $V$ is the union of $V \cap \{x < a\}$ and $V \cap \{x > a\}$. These are disjoint and open in $V$, the first contains $(0, 0)$, and the second contains $p$. That's a separation of $V$, which contradicts $V$ being connected. $\blacksquare$
Notice what did the damage: a single bad point. The rest of $\overline{S}$, every point of $S$ itself, is perfectly locally connected, since $S$ is homeomorphic to $(0, 1]$ by $x \mapsto (x, \sin(1/x))$.
Now for what local connectedness buys. The clean way to say it uses components, the largest connected pieces of a space. In a general space components can be tiny and badly behaved (in $\mathbb{Q}$ they're single points). Local connectedness is exactly what makes them open.
A space $X$ is locally connected if and only if for every open set $U \subseteq X$, each component of $U$ is open in $X$.
Proof. ($\implies$) Let $U$ be open, $C$ a component of $U$, and $x \in C$. Since $U$ is a neighborhood of $x$, there is a connected neighborhood $V$ of $x$ with $V \subseteq U$. Then $V$ is a connected subset of $U$ containing $x$, and $C$ is the union of all of those, so $V \subseteq C$. So $C$ contains a neighborhood of each of its points, and $C$ is open.
($\impliedby$) Let $x \in X$ and $U$ a neighborhood of $x$. The component $V$ of $U$ containing $x$ is connected, and it is open by hypothesis. So $V$ is a connected neighborhood of $x$ with $V \subseteq U$. $\blacksquare$
Watch it happen in the plane, which is locally connected (open disks are connected). An open set breaks into components, and every point gets a little disk that stays inside its own component.
In the sine curve, the theorem fails exactly at the segment. Try it yourself: pick a space, drag the point, and shrink the ball. The piece of the ball that's connected to your point turns green when it's still a neighborhood, and red when it isn't.
The comb and the sine curve fail along a whole segment of bad points, and nowhere else. For paths there's a matching theorem, and it explains why open subsets of $\mathbb{R}^n$ never have this problem.
Let $X$ be a topological space.
Proof. (1) Path connected sets are connected, so a path connected neighborhood $V \subseteq U$ is a connected one.
(2) Fix $x \in X$ and let $P$ be the path component of $x$. If $y \in P$, then $y$ has a path connected neighborhood $V$. Every point of $V$ is joined to $y$ by a path in $V$, and $y$ is joined to $x$, so $V \subseteq P$. Hence $P$ is open. The same argument shows every path component is open, so $X \setminus P$, the union of the other path components, is open, and $P$ is closed. Since $X$ is connected and $P$ is nonempty, open, and closed, $P = X$. $\blacksquare$
The first part is why "locally path connected" is the stronger condition. The second part is the payoff, and here's the most useful instance of it.
Show that every connected open subset $W$ of $\mathbb{R}^n$ is path connected.
Let $x \in W$ and let $U$ be a neighborhood of $x$ in $W$. Since $U$ is open in $\mathbb{R}^n$, some open ball $B(x, r)$ lies inside $U$. A ball is convex, so any two of its points are joined by a straight segment inside it, and $B(x, r)$ is path connected. So $W$ is locally path connected, and since $W$ is connected, part (2) says $W$ is path connected.
That's why you can always "draw a path" in a connected open region, but not in the sine curve, which is connected without being locally path connected. Try both.
One more of the four spaces deserves a proof, because it's the extreme case: not a single point is locally connected.
Show that $\mathbb{Q}$ is not locally connected at any point.
Proof. Let $q \in \mathbb{Q}$, and let $V$ be any neighborhood of $q$ in $\mathbb{Q}$. Then $V$ contains $(q - r, q + r) \cap \mathbb{Q}$ for some $r > 0$, so it contains a second rational $q'$. Pick an irrational $s$ between $q$ and $q'$. Then $V \cap \{x < s\}$ and $V \cap \{x > s\}$ are disjoint, nonempty, open in $V$, and cover $V$, so $V$ is not connected. So no neighborhood of $q$ at all is connected, let alone one inside a given $U$. $\blacksquare$
Your turn. Each question names a corner of the connected / locally connected grid; find the space that lives there.
Loading practice engine...
Now the same idea with compactness. The line $\mathbb{R}$ isn't compact: the cover by the intervals $(-n, n)$ has no finite subcover. But stand at any point and the closed interval $[x - 1, x + 1]$ around you is compact. Compact up close, not compact overall.
The topological space $X$ is said to be locally compact if for every $x \in X$, there exists a compact subspace $C$ of $X$ that contains a neighborhood of $x$.
Notice this definition breaks the pattern of the last section: it asks for one compact set around each point, not one inside every neighborhood. We'll see shortly that for Hausdorff spaces the two versions agree, which is why nobody bothers to define "locally compact at every scale".
Show that each of these is locally compact: $\mathbb{R}^n$; any discrete space; any compact space.
The Measure Theory page Locally Compact Spaces proves that $\mathbb{Q}$ is not locally compact: any neighborhood's closure would contain rationals marching toward an irrational, with nowhere to land.
So $\mathbb{R}$ is locally compact, and $\mathbb{R}^2$, and $\mathbb{R}^{100}$. Here's where it stops: infinitely many coordinates.
Let $\mathbb{R}^\omega = \prod_{n \in \mathbb{N}} \mathbb{R}$, the product of countably many copies of $\mathbb{R}$, with the product topology. Show that $\mathbb{R}^\omega$ is not locally compact.
We show that no compact set contains a neighborhood of $0 = (0, 0, \ldots)$. Suppose $C$ is compact and contains a neighborhood of $0$. Then it contains a basis element of the product topology around $0$, which has the form $$B = U_1 \times U_2 \times \cdots \times U_N \times \mathbb{R} \times \mathbb{R} \times \cdots,$$ with each $U_n$ open in $\mathbb{R}$: only finitely many coordinates are restricted.
The projection $\pi_{N+1}$ is continuous, so $\pi_{N+1}(C)$ is a compact subset of $\mathbb{R}$. But it contains $\pi_{N+1}(B) = \mathbb{R}$, so $\pi_{N+1}(C) = \mathbb{R}$, which is not compact. Contradiction.
Infinitely many coordinates, and every box pins down only finitely many of them. Most of $\mathbb{R}^\omega$'s coordinates are permanently on vacation.
The problem is the first free coordinate: whatever box you draw, there's a direction in which it runs off forever. Here are the coordinates drawn side by side, as vertical lines, with a point escaping up the first one you didn't restrict.
Now you pick the box. Restrict as many coordinates as you like, as tightly as you like, and see where the escape goes.
Restricting more coordinates never helps; the escape just moves one coordinate over. A different topology on $\mathbb{R}$ itself can fail too, even with one coordinate.
Show that $\mathbb{R}_l$, the real line with the lower limit topology, is not locally compact.
Proof. Suppose $C$ is compact and contains a neighborhood of $x$. That neighborhood contains a basis element, so $C \supseteq A = [x, x + \varepsilon)$ for some $\varepsilon > 0$. The set $A$ is closed in $\mathbb{R}_l$, since its complement $(-\infty, x) \cup [x + \varepsilon, \infty)$ is a union of basis elements. A closed subset of a compact space is compact, and $A = A \cap C$ is closed in $C$, so $A$ is compact.
But the sets $$A_n = \Big[x + \varepsilon - \tfrac{\varepsilon}{n}, \ x + \varepsilon - \tfrac{\varepsilon}{n + 1}\Big), \qquad n \in \mathbb{N},$$ are open in $\mathbb{R}_l$, pairwise disjoint, nonempty, and their union is $A$. Removing any one of them uncovers its points, so no finite subcollection covers $A$. Contradiction. $\blacksquare$
Now the promised comparison. Many books (the Measure Theory pages here among them) define local compactness as "every point has a neighborhood whose closure is compact". For Hausdorff spaces that's the same thing, and it comes in the "inside every neighborhood" form too. First a lemma you've half seen before.
On Compact Spaces: every compact subspace of a Hausdorff space is closed. The lemma below is the heart of that proof, pulled out so we can use it on its own.
Let $X$ be a Hausdorff space, $K \subseteq X$ compact, and $x \in X \setminus K$. Then there are disjoint open sets $U$ and $V$ with $x \in U$ and $K \subseteq V$.
Proof. If $K = \emptyset$, take $U = X$ and $V = \emptyset$. Otherwise, for each $y \in K$ choose disjoint open sets $U_y \ni x$ and $V_y \ni y$. The sets $V_y$ cover $K$, so finitely many of them, $V_{y_1}, \ldots, V_{y_n}$, do. Put $U = U_{y_1} \cap \cdots \cap U_{y_n}$ and $V = V_{y_1} \cup \cdots \cup V_{y_n}$. Then $U$ is open and contains $x$, $V$ is open and contains $K$, and a point of $V$ lies in some $V_{y_i}$, which misses $U_{y_i} \supseteq U$. So $U \cap V = \emptyset$. $\blacksquare$
With the lemma in hand, the comparison is a short argument. Statement (2) is the "every scale" version, and (3) is the other books' definition.
Let $X$ be a Hausdorff space. The following are equivalent:
Proof. (1) $\implies$ (2). Let $C$ be compact and contain a neighborhood $W$ of $x$, and let $A = C \setminus U = C \cap (X \setminus U)$. Then $A$ is closed in $C$, so $A$ is compact, and $x \notin A$. By the lemma there are disjoint open sets $V_0 \ni x$ and $V' \supseteq A$. Let $V = V_0 \cap W$, a neighborhood of $x$.
Since $X$ is Hausdorff, the compact set $C$ is closed, so $V \subseteq C$ gives $\overline{V} \subseteq C$, and $\overline{V}$ is compact as a closed subset of $C$. Also $V \subseteq X \setminus V'$, which is closed, so $\overline{V} \subseteq X \setminus V'$, and $\overline{V}$ misses $A$. Hence $\overline{V} \subseteq C \setminus A \subseteq U$.
(2) $\implies$ (3). Apply (2) with $U = X$.
(3) $\implies$ (1). Take $C = \overline{V}$: it is compact and contains the neighborhood $V$ of $x$. $\blacksquare$
Here's (1) $\implies$ (2) as a picture: carve the bad part $A$ out of $C$, separate it from $x$, and the closure of what's left near $x$ lands inside $U$.
Hausdorff got used twice: once in the lemma, and once to know that $C$ is closed. Drop it, and (1) no longer gives (3).
Every nonempty open set has to contain $1$. The point $1$ is the friend who invites themselves to every party.
Give $\mathbb{N}$ the particular point topology at $1$: the open sets are $\emptyset$ and every subset of $\mathbb{N}$ that contains $1$. Show that $\mathbb{N}$ is locally compact, but no point has a neighborhood whose closure is compact.
This is a topology: unions and finite intersections of sets containing $1$ still contain $1$, and $\emptyset$ and $\mathbb{N}$ are on the list.
Locally compact. For $x \in \mathbb{N}$, the set $\{1, x\}$ is open (it contains $1$) and finite, so compact. It contains the neighborhood $\{1, x\}$ of $x$.
No compact closures. Let $V$ be any neighborhood of any point, so $1 \in V$. Every point $y$ has only neighborhoods containing $1$, and each of them meets $V$ at $1$. So $y \in \overline{V}$, and $\overline{V} = \mathbb{N}$. But $\mathbb{N}$ is not compact: the open cover $\{\{1, n\} : n \in \mathbb{N}\}$ has no finite subcover. (And $\mathbb{N}$ isn't Hausdorff here: any two nonempty open sets share the point $1$.)
Here's the same example as a movie: each neighborhood is tiny, and each closure balloons out to swallow the whole space.
Compare it with $\mathbb{R}$ side by side. Pick a neighborhood in each and look at its closure: in the Hausdorff space it hugs the neighborhood, and in the other it takes everything.
Non-Hausdorff spaces like this one are the only place the definitions part ways, and different books pick different ones, so it's worth a warning.
When a book says "locally compact", check its definition. This page and Munkres ask for a compact set containing a neighborhood; Rudin and Folland ask for a neighborhood with compact closure; some authors build Hausdorff into the definition. For Hausdorff spaces, the only kind most theorems care about, all of them agree by the theorem above.
Your turn. All of these spaces are Hausdorff, so use whichever version of the definition is quicker.
Loading practice engine...
Which constructions keep local compactness? Subspaces, products, and images each get a yes with a hypothesis, and each hypothesis is there because the plain version fails. The first one shows why $\mathbb{Q}$ fails: it isn't closed in $\mathbb{R}$.
Show that every closed subspace $A$ of a locally compact space $X$ is locally compact.
Proof. Let $x \in A$, and let $C$ be compact and contain a neighborhood $U$ of $x$ in $X$. Then $C \cap A$ is closed in $C$, so it is compact. It contains $U \cap A$, which is a neighborhood of $x$ in the subspace $A$. Compactness doesn't depend on the surrounding space, so $C \cap A$ is a compact subspace of $A$. $\blacksquare$
Products are next. Finitely many factors are fine, and $\mathbb{R}^\omega$ already showed that infinitely many can break it.
Show that if $X$ and $Y$ are locally compact, then so is $X \times Y$. Conclude that a product of finitely many locally compact spaces is locally compact.
Proof. Let $(x, y) \in X \times Y$. Choose compact $C \subseteq X$ containing a neighborhood $U$ of $x$, and compact $D \subseteq Y$ containing a neighborhood $V$ of $y$. Then $U \times V$ is open in the product and contains $(x, y)$, and it lies inside $C \times D$, which is compact as a product of two compact spaces. The finite case follows by induction, since $X_1 \times \cdots \times X_n$ is homeomorphic to $(X_1 \times \cdots \times X_{n-1}) \times X_n$. $\blacksquare$
Last, images. Continuous images of compact spaces are compact, so you might hope continuous images of locally compact spaces are locally compact. They're not; you need the map to be open too.
(a) Let $f\colon X \to Y$ be continuous, open, and onto, with $X$ locally compact. Show that $Y$ is locally compact. (b) Show that (a) fails without "open": give a continuous map from a locally compact space onto a space that is not locally compact.
(a) Let $y \in Y$. Since $f$ is onto, $y = f(x)$ for some $x$. Choose compact $C$ containing a neighborhood $U$ of $x$. Then $f(C)$ is compact, $f(U)$ is open because $f$ is open, $y \in f(U)$, and $f(U) \subseteq f(C)$. $\blacksquare$
(b) Let $\mathbb{Q}_d$ be $\mathbb{Q}$ with the discrete topology, which is locally compact, and let $f\colon \mathbb{Q}_d \to \mathbb{Q}$ be the identity, where $\mathbb{Q}$ has its usual topology. Every map out of a discrete space is continuous, and $f$ is onto, but $\mathbb{Q}$ is not locally compact. (Here $f$ isn't open: $\{0\}$ is open in $\mathbb{Q}_d$ but not in $\mathbb{Q}$.)
Two traps. "Every subspace of a locally compact space is locally compact" is false ($\mathbb{Q} \subseteq \mathbb{R}$); closed subspaces are fine, and the next section shows open subspaces of locally compact Hausdorff spaces are too. And "every product of locally compact spaces is locally compact" is false ($\mathbb{R}^\omega$). The true infinite version: $\prod X_\alpha$ is locally compact exactly when every $X_\alpha$ is locally compact and all but finitely many are compact.
Here's the payoff. Take the line $\mathbb{R}$ and add one new point, called $\infty$, sitting "at both ends at once". Tie the two ends of the line to it and you get a circle, which is compact. Local compactness is exactly what makes this trick work for any space.
The only question is which sets around $\infty$ should count as open. On the circle, a small arc around $\infty$ is everything outside some big interval $[-M, M]$, and $[-M, M]$ is compact. So: a neighborhood of $\infty$ is what's left after removing a compact set.
Let $X$ be a locally compact Hausdorff space and let $\infty$ be a point not in $X$. The one-point compactification of $X$ is $X^+ = X \cup \{\infty\}$, where a set is declared open in $X^+$ if it is either an open set in $X$, or a set of the form $X^+ \setminus C$, where $C \subseteq X$ is compact.
The definition makes promises that need checking: that these sets really form a topology, that the result is compact Hausdorff, and that $X$ sits inside unchanged. That's the theorem.
Let $X$ be a locally compact Hausdorff space. Then:
Proof. Compact subsets of the Hausdorff space $X$ are closed, and we use that throughout.
(1) $\emptyset$ is open in $X$, and $X^+ = X^+ \setminus \emptyset$. Unions: a union of open sets of $X$ is open in $X$. A union of sets $X^+ \setminus C_\alpha$ is $X^+ \setminus \bigcap_\alpha C_\alpha$, and $\bigcap_\alpha C_\alpha$ is closed and lies in the compact set $C_\beta$ (any $\beta$), so it is compact. Finally, for $U$ open in $X$ and $C$ compact, $U \cup (X^+ \setminus C) = X^+ \setminus (C \setminus U)$, and $C \setminus U = C \cap (X \setminus U)$ is closed in $C$, so compact. Any union splits into a union of the first kind and one of the second, so it is open. Intersections (two at a time is enough): two open sets of $X$ meet in an open set of $X$; $(X^+ \setminus C_1) \cap (X^+ \setminus C_2) = X^+ \setminus (C_1 \cup C_2)$, and $C_1 \cup C_2$ is compact; and $U \cap (X^+ \setminus C) = U \cap (X \setminus C)$, which is open in $X$ because $C$ is closed.
(2) The subspace topology on $X$ consists of the sets $W \cap X$. For $W = U$ open in $X$ that is $U$; for $W = X^+ \setminus C$ it is $X \setminus C$, which is open in $X$. So the subspace topology is the topology of $X$. And $X$ itself is an open set of $X$, so it is open in $X^+$.
(3) Compact: let $\mathcal{A}$ be an open cover of $X^+$. Some member contains $\infty$, so it is $X^+ \setminus C$ with $C$ compact. The other members meet $X$ in open sets of $X$ that cover $C$, so finitely many of them cover $C$; together with $X^+ \setminus C$ they cover $X^+$. Hausdorff: two points of $X$ have disjoint neighborhoods in $X$, which are open in $X^+$. For $x \in X$ and $\infty$: since $X$ is locally compact, some compact $C$ contains a neighborhood $U$ of $x$, and then $U$ and $X^+ \setminus C$ are disjoint open sets containing $x$ and $\infty$.
(4) Let $\mathcal{T}$ be any topology making $X^+$ compact Hausdorff with $X$ as a subspace. One-point sets are closed in a Hausdorff space, so $X = X^+ \setminus \{\infty\}$ is in $\mathcal{T}$. If $W \in \mathcal{T}$ and $\infty \notin W$, then $W = W \cap X$ is open in the subspace $X$. Conversely, an open set $U$ of $X$ is $W \cap X$ for some $W \in \mathcal{T}$, an intersection of two members of $\mathcal{T}$, so $U \in \mathcal{T}$. If $W \in \mathcal{T}$ and $\infty \in W$, then $C = X^+ \setminus W \subseteq X$ is closed in the compact space $X^+$, so compact, and $W = X^+ \setminus C$. Conversely, if $C \subseteq X$ is compact, it is compact in the Hausdorff space $(X^+, \mathcal{T})$, so closed, and $X^+ \setminus C \in \mathcal{T}$. So $\mathcal{T}$ has exactly the open sets of the definition.
(5) If $X$ is not compact, every open set containing $\infty$ is $X^+ \setminus C$ with $C \neq X$, so it meets $X$, and $\infty \in \overline{X}$. If $X$ is compact, $\{\infty\} = X^+ \setminus X$ is open, so $\infty \notin \overline{X}$. $\blacksquare$
On the Stone–Čech page, a compactification of $X$ must have $X$ dense in it. By (5), $X^+$ qualifies exactly when $X$ is not compact. When $X$ is already compact, the recipe still runs, but $\infty$ comes out as an isolated point.
Notice where each hypothesis went. Hausdorff made compact sets closed, which is what made the recipe a topology at all. Local compactness made $X^+$ Hausdorff, by separating each point from $\infty$. Here's what the neighborhoods of $\infty$ look like for the line: drag the ends of $C$ and watch $\mathbb{R}^+ \setminus C$ wrap around $\infty$ on the circle.
A closed half-line is closed but not compact, and the widget shows what goes wrong: removing it leaves $\infty$ hanging off the end of an arc with no room on one side. Your turn to sort the open sets from the impostors.
Loading practice engine...
Now, what is $X^+$ for familiar spaces? Part (4) of the theorem does the work: if you can spot a compact Hausdorff space that is "$X$ plus one point", it has to be $X^+$.
Let $X$ be locally compact Hausdorff, $Y$ a compact Hausdorff space, $p \in Y$, and $h\colon X \to Y \setminus \{p\}$ a homeomorphism. Then $h$ extends to a homeomorphism $h^+\colon X^+ \to Y$ with $h^+(\infty) = p$.
Proof. The map $h^+$ is a bijection. Give $X^+$ the topology $\mathcal{T} = \{(h^+)^{-1}(O) : O \text{ open in } Y\}$, so that $h^+$ is a homeomorphism onto $Y$ by construction. Then $(X^+, \mathcal{T})$ is compact Hausdorff, because $Y$ is. Its subspace topology on $X$ is pulled back from the subspace topology on $Y \setminus \{p\}$ by $h$, which is a homeomorphism, so it is the topology of $X$. By part (4) of the theorem, $\mathcal{T}$ is the topology of the one-point compactification. So $h^+$ is a homeomorphism from $X^+$ onto $Y$. $\blacksquare$
So naming $X^+$ comes down to finding the right $Y$ and the right missing point. For the line, the classic choice is stereographic projection: put the circle on top of the line, and draw a straight line from the top point through each point of the circle down to $\mathbb{R}$.
One point to cap off both ends of $\mathbb{R}$? So $+\infty$ and $-\infty$ have to share a room.
Far out in either direction is close to the top point, so the top point plays $\infty$. Here are the formulas.
Let $N = (0, 1)$ be the top of the unit circle $S^1$. Show that $$h(x) = \left(\frac{2x}{1 + x^2}, \ \frac{x^2 - 1}{x^2 + 1}\right)$$ is a homeomorphism from $\mathbb{R}$ onto $S^1 \setminus \{N\}$, and conclude that $\mathbb{R}^+$ is homeomorphic to $S^1$.
Proof. Onto the circle. $(2x)^2 + (x^2 - 1)^2 = x^4 + 2x^2 + 1 = (x^2 + 1)^2$, so $h(x) \in S^1$. Its second coordinate is $1 - \frac{2}{x^2 + 1} < 1$, so $h(x) \neq N$.
The inverse. Let $g(u, v) = \frac{u}{1 - v}$ on $S^1 \setminus \{N\}$, which is continuous since $v \neq 1$ there. First, $g(h(x)) = \frac{2x/(1 + x^2)}{2/(1 + x^2)} = x$. Second, let $(u, v) \in S^1 \setminus \{N\}$ and $x = g(u, v)$. Using $u^2 = 1 - v^2$, $$x^2 = \frac{1 - v^2}{(1 - v)^2} = \frac{1 + v}{1 - v}, \qquad \frac{x^2 - 1}{x^2 + 1} = \frac{(1 + v) - (1 - v)}{(1 + v) + (1 - v)} = v,$$ and $\frac{2x}{1 + x^2} = \frac{2u/(1 - v)}{2/(1 - v)} = u$. So $h(g(u, v)) = (u, v)$. Both maps are continuous and they are inverse to each other, so $h$ is a homeomorphism.
Conclusion. $S^1$ is compact Hausdorff, so by the corollary, $h$ extends to a homeomorphism $\mathbb{R}^+ \to S^1$ sending $\infty$ to $N$. $\blacksquare$
The same projection works one dimension up: put a sphere on the plane and project from the north pole. The outside of a huge disk in the plane becomes a tiny cap around the pole.
So $(\mathbb{R}^2)^+ \cong S^2$, and in general $(\mathbb{R}^n)^+ \cong S^n$, the unit sphere in $\mathbb{R}^{n+1}$. The corollary also handles spaces that aren't whole Euclidean spaces.
Identify $(0, 1)^+$, $[0, 1)^+$, and $\mathbb{N}^+$, where $\mathbb{N}$ has the discrete topology.
The general picture: every way of running off to infinity in $X$, and every missing edge, gets gathered into the single point $\infty$. Pick a space and watch it happen.
Your turn: name the one-point compactification. The trap is giving each end its own point (that's a different construction), or giving each piece its own $\infty$.
Loading practice engine...
Why insist on local compactness? Run the same recipe on $\mathbb{Q}$, and the new point can't be pulled away from anything.
Define $\mathbb{Q}^+ = \mathbb{Q} \cup \{\infty\}$ by the same recipe: the open sets are the open sets of $\mathbb{Q}$ and the sets $\mathbb{Q}^+ \setminus C$ with $C \subseteq \mathbb{Q}$ compact. (Part (1) of the theorem used only that $\mathbb{Q}$ is Hausdorff, so this is a topology.) Show that $\mathbb{Q}^+$ is not Hausdorff.
Proof. We show $0$ and $\infty$ have no disjoint neighborhoods. Suppose $W_1 \ni 0$ and $W_2 \ni \infty$ are disjoint and open. Since $\infty \notin W_1$, the set $W_1$ is open in $\mathbb{Q}$, so it contains $(-r, r) \cap \mathbb{Q}$ for some $r > 0$. And $W_2 = \mathbb{Q}^+ \setminus C$ with $C$ compact. Disjointness means $W_1 \subseteq C$, so $(-r, r) \cap \mathbb{Q} \subseteq C$.
But $C$ is a compact subset of $\mathbb{R}$, so it is closed in $\mathbb{R}$, and it contains the closure of $(-r, r) \cap \mathbb{Q}$ in $\mathbb{R}$, which is $[-r, r]$. That includes irrationals, which are not in $C \subseteq \mathbb{Q}$. Contradiction. $\blacksquare$
So a space with a one-point compactification has to be locally compact Hausdorff. The converse direction of that sentence is the theorem, and together they say exactly which spaces live inside compact Hausdorff spaces as open sets.
A space $X$ is locally compact Hausdorff if and only if $X$ is homeomorphic to an open subspace of a compact Hausdorff space.
Proof. ($\implies$) By the theorem, $X$ is an open subspace of the compact Hausdorff space $X^+$.
($\impliedby$) Suppose $X$ is an open subspace of a compact Hausdorff space $Y$ (a homeomorphic copy changes nothing). $X$ is Hausdorff, as a subspace of a Hausdorff space. Let $x \in X$. The compact space $Y$ is locally compact Hausdorff, and $X$ is a neighborhood of $x$ in $Y$, so by part (2) of the comparison theorem there is a neighborhood $V$ of $x$ in $Y$ whose closure $\overline{V}$ in $Y$ is compact and lies inside $X$. Then $V$ is open in $X$, and $\overline{V}$ is a compact subspace of $X$ containing it. $\blacksquare$
That settles the subspace question from the last section, too.
Every open subspace of a locally compact Hausdorff space is locally compact Hausdorff.
Proof. Let $Z$ be locally compact Hausdorff and $X \subseteq Z$ open. Then $Z$ is open in $Z^+$, so $X$ is open in the compact Hausdorff space $Z^+$, and the theorem applies. $\blacksquare$
Open subsets of $\mathbb{R}^n$, open subsets of spheres, the plane minus a Cantor set: all locally compact Hausdorff, no work needed.
For a locally compact Hausdorff space $X$ that isn't compact, every compactification of $X$ can be squashed onto $X^+$ by sending everything new to $\infty$. So $X^+$ is the smallest compactification, and the Stone–Čech compactification $\beta X$ is the largest. (We won't prove the first claim here.)
"Locally compact Hausdorff" is the standing setting of the Measure Theory course from Urysohn's Lemma on: it's exactly enough room to build continuous functions with compact support, and those are what the Riesz Representation Theorem turns into measures.
Every question so far came right after its idea, which is a hint. Down here the hint is gone. First, true or false: a claim about anything on this page, some of them the kind that sounds right and isn't. Decide, then read why.
Loading practice engine...
Then a proof from this page with one line to fill in. Every wrong line is false or doesn't follow.
Loading practice engine...
Next, the mixed set. Every question type on this page except true or false goes into one hat, and each click draws a new one at random. All of them need their answer choices, so the switch stays on Choices.
Loading practice engine...
Last, the Spicy Bonus. Which continuous maps survive the trip to the one-point compactification? Exactly the ones that never send something huge to something small.
Let $X$ and $Y$ be locally compact Hausdorff spaces and $f\colon X \to Y$ continuous. Call $f$ proper if $f^{-1}(K)$ is compact for every compact $K \subseteq Y$. Define $f^+\colon X^+ \to Y^+$ by $f^+(x) = f(x)$ for $x \in X$ and $f^+(\infty) = \infty$.
Proof. (1) There are two kinds of open sets in $Y^+$, so we compute both kinds of preimage. For $V$ open in $Y$, $\infty \notin V$, so $(f^+)^{-1}(V) = f^{-1}(V)$, which is open in $X$ (since $f$ is continuous) and hence open in $X^+$. For $K \subseteq Y$ compact, $$(f^+)^{-1}(Y^+ \setminus K) = X^+ \setminus f^{-1}(K),$$ since $\infty$ belongs to both sides, and $x \in X$ belongs to the left side exactly when $f(x) \notin K$.
($\implies$) If $f$ is proper, $f^{-1}(K)$ is compact, so $X^+ \setminus f^{-1}(K)$ is open. So every preimage of an open set is open, and $f^+$ is continuous.
($\impliedby$) If $f^+$ is continuous and $K \subseteq Y$ is compact, then $X^+ \setminus f^{-1}(K)$ is open in $X^+$. Its complement $f^{-1}(K)$ is closed in the compact space $X^+$, so it is compact (in $X^+$, hence as a subspace of $X$). So $f$ is proper.
(2) Let $p$ have degree $d \ge 1$. Then $|p(x)| \to \infty$ as $|x| \to \infty$, so for a compact $K \subseteq [-M, M]$ there is an $R$ with $|p(x)| > M$ whenever $|x| > R$. Hence $p^{-1}(K) \subseteq [-R, R]$ is bounded, and it is closed because $p$ is continuous and $K$ is closed. By Heine–Borel, $p^{-1}(K)$ is compact. For $\sin$, the compact set $[-1, 1]$ has preimage $\mathbb{R}$, which is not compact. (By (1), $\sin^+$ is not continuous at $\infty$: points $x_n = n\pi$ head to $\infty$ while $\sin(x_n) = 0$ stays put.) $\blacksquare$