I'm trying to prove $(A \cup B)' = A' \cup B'$ where $S'$ denotes the derived set of some subset $S$ of a topological space $X$. A derived set $S'$ of a set $S$ is the set of $x \in X$ such that $x$ is in the closure of $S-\{x\}$. I'm having troubling showing that $(A \cup B)' \subseteq A' \cup B'$.
What I've done so far: Suppose $x \in (A \cup B)'$. Then for any neighborhood $U$ of $x$ it follows that $U$ intersects $(A \cup B)-\{x\}$ so $U$ intersects $A-\{x\}$ or $B-\{x\}$. But I don't see why we couldn't have one neighborhood of $x$, $U_{1}$, which intersects $A-\{x\}$ but not $B-\{x\}$ and another neighborhood $U_{2}$ which does the opposite. In this case $x$ would be in neither $A'$ nor $B'$. We can say that $U_{1} \cap U_{2}$ is not only $\{x\}$ because then $\{x\}$ would be open contradicting $x \in (A \cup B)'$.