# finite union of totally disconnected sets

Let $X$ be a topological space, and let $A_i$ be a totally disconnected subset for $i=1,...,n$. I am curious whether it is always true that the union $\cup_i A_i$ is totally disconnected in $X$ as well.

For some reason, I had to settle whether a finite union of Cantor sets (compact, perfect, and totally disconnected) is always a Cantor set.

Both the rationals and the irrationals are totally disconnected subspaces of their union, the connected space $\Bbb R$.
The union $K$ of finitely many Cantor sets, however, is a Cantor set. To see, this note first that it is clearly a compact set without isolated points. Its complement is the intersection of finitely many dense open sets, so its complement is dense. Finally, a subset of $\Bbb R$ with a dense complement has a countable base of clopen sets, so by Brouwer’s characterization $K$ is a Cantor set.