Solution (source code)

= Solution

A <subset> $A$ is <connected> when it is a <connected space> in its <subspace topology>: there is no <separation of a topological space>
$$
A=P\sqcup Q
$$
into two nonempty <disjoint> <open subsets> of $A$. Equivalently, the only <clopen sets> of $A$ are $\varnothing$ and $A$.

Since the given $A$ is not <connected>, choose such $P,Q$. Each is the <complement> of the other in $A$, so both are also <closed subsets> of $A$. They are <compact> by the <closed subset of a compact space> result. We now separate these two <compact subsets> by ambient <open sets>.

For each $p\in P$, part (b), applied to $Q$ and $p$, gives <disjoint> ambient <open sets> $G_p,H_p$ with $p\in G_p$ and $Q\subseteq H_p$. Choose $p_1,\ldots,p_m$ such that the $G_{p_j}$ cover $P$, using its <compactness>. Define
$$
U=\bigcup_{j=1}^mG_{p_j},\qquad
V=\bigcap_{j=1}^mH_{p_j}.
$$
Then $P\subseteq U$, $Q\subseteq V$, and $U,V$ are <disjoint> <open sets>. Indeed a point of $U$ lies in some $G_{p_j}$, whereas every point of $V$ lies in the corresponding $H_{p_j}$. Consequently
$$
\boxed{A\subseteq U\cup V,\qquad A\cap U=P\ne\varnothing,\qquad A\cap V=Q\ne\varnothing.}
$$
This proves the requested ambient separation, using the more general <separation of disjoint compact subsets>. The initially given relatively <open sets> $P,Q$ need not themselves be <open> in $X$; the finite construction supplies ambient <open neighbourhoods>.