Connectedness is not hereditary

Statement
It is possible to have a nonempty topological space $$X$$ and a nonempty subset $$A$$ of $$X$$ such that:


 * $$X$$ is a connected space
 * $$A$$ is not a connected space under the subspace topology from $$X$$.

Related facts

 * Connectedness is not weakly hereditary

Key proof idea
The key proof idea hinges on removing points from $$X$$ that serve to connect the space.

Examples using finite topological spaces
For a counterexample, $$A$$ must have at least two points, because the unique one-point space is connected. Therefore, $$X$$ must have at least three points. We discuss two (related) examples of spaces of size three.

Space with one closed point and two open points
Consider:

$$X = \{ -1, 0, 1 \}$$

with the topology defined as follows: the open subsets are:

$$\{ \}, \{ -1 \}, \{ 1 \}, \{ -1, 1 \}, \{ -1, 0, 1 \}$$

Or equivalently, the closed subsets are:

$$\{ \}, \{ 0 \}, \{ -1, 0 \}, \{ 0, 1 \}, \{ -1, 0, 1 \}$$

Clearly, $$X$$ is connected: the only nonempty open subset containing $$0$$ is all of $$X$$, and therefore $$X$$ cannot be expressed as a union of two disjoint nonempty open subsets.

Consider $$A$$ to be the subset $$\{ -1, 1 \}$$ of $$X$$ with the subspace topology. $$A$$ has a discrete topology, and in particular, is a union of disjoint open subsets $$\{ -1 \}$$ and $$\{ 1 \}$$. Therefore, it is not connected.

Basically, the point $$0$$ serves the role of connecting the space, and removing it disconnects the space.

Space with one open point and two closed points
This is the same as the previous example, but with the roles of open and closed subsets interchanged. Explicitly:

$$X = \{ -1, 0, 1 \}$$

with the topology defined as follows: the open subsets are:

$$\{ \}, \{ 0 \}, \{ -1, 0 \}, \{ 0, 1 \}, \{ -1, 0, 1 \}$$

Or equivalently, the closed subsets are:

$$\{ \}, \{ -1 \}, \{ 1 \}, \{ -1, 1 \}, \{ -1, 0, 1 \}$$

Clearly, $$X$$ is connected: the only nonempty closed subset containing $$0$$ is all of $$X$$, and therefore $$X$$ cannot be expressed as a union of two disjoint nonempty open subsets. In fact, framed more strongly, $$X$$ is an irreducible space.

Consider $$A$$ to be the subset $$\{ -1, 1 \}$$ of $$X$$ with the subspace topology. $$A$$ has a discrete topology, and in particular, is a union of disjoint closed subsets $$\{ -1 \}$$ and $$\{ 1 \}$$. Therefore, it is not connected.

Basically, the point $$0$$ serves the role of connecting the space, and removing it disconnects the space.

Note on the interchange of roles of open and closed
For a finite space, interchanging the roles of open and closed subsets defines a new topological space. The corresponding does not hold for infinite spaces in general.

Removing one point
Consider the following example:


 * $$X = \R$$ is the set of real numbers endowed with the usual Euclidean topology.
 * $$A = \R \setminus \{ 0 \}$$ is the subset of nonzero real numbers.

$$X$$ is connected. However, $$A$$ is a union of two nonempty disjoint open subsets: the negative real numbers and the positive real numbers. In fact, these are its two connected components. Therefore, $$A$$ is not connected.

Taking a finite subset
Consider the following example:


 * $$X = \R$$ is the set of real numbers endowed with the usual Euclidean topology.
 * $$A = \{ -1, 1 \}$$ is a subset of size two.

$$X$$ is connected. $$A$$ is discrete in the subspace topology. Explicitly, for instance, $$\{-1 \}$$ is the intersection of $$A$$ with the open subset $$(-\infty, 0)$$ of $$X$$, hence is open in $$A$$, and similarly $$\{ 1 \} = A \cap (0, \infty)$$ and hence is open in $$A$$.

Taking a dense subset

 * $$X = \R$$ is the set of real numbers endowed with the usual Euclidean topology.
 * $$A = \mathbb{Q}$$ is the subset comprising rational numbers.