Union of Boundaries

Theorem
Let $T = \left({S, \tau}\right)$ be a topological space.

Let $A, B$ be subsets of $S$.

Then:
 * $\partial A \cup \partial B = \partial \left({A \cup B}\right) \cup \partial \left({A \cap B}\right) \cup \left({\partial A \cap \partial B}\right)$

where $\partial A$ denotes the boundary of $A$.

Proof
First we will prove that
 * $\partial A \subseteq \partial \left({A \cup B}\right) \cup \partial \left({A \cap B}\right) \cup \left({\partial A \cap \partial B}\right)$

Let $x \in \partial A$.

Aiming for a contradiction suppose that
 * $x \notin \partial \left({A \cup B}\right) \cup \partial \left({A \cap B}\right) \cup \left({\partial A \cap \partial B}\right)$

Then by definition of union:
 * $x \notin \partial \left({A \cup B}\right) \land x \notin \partial \left({A \cap B}\right) \land x \notin \left({\partial A \cap \partial B}\right)$

By Characterization of Boundary by Open Sets:
 * $\exists Q \in \tau: x \in Q \land \left({\left({A \cup B}\right) \cap Q = \varnothing \lor \complement_S \left({A \cup B}\right) \cap Q = \varnothing}\right)$

By Intersection Distributes over Union. Complement of Union:
 * $\left({A \cap Q}\right) \cup \left({B \cap Q}\right) = \varnothing \lor \complement_S \left({ A }\right) \cap \complement_S \left({B}\right) \cap Q = \varnothing$

Because $x \notin \left({\partial A \cap \partial B}\right)$ therefore by definition of intersection:
 * $x \notin \partial B$

By Characterization of Boundary by Open Sets:
 * $\exists U \in \tau: x \in U \land \left({B \cap U = \varnothing \lor \complement_S \left({B}\right) \cap U = \varnothing}\right)$

As $x \in \partial A$ by Characterization of Boundary by Open Sets:
 * $A \cap Q \ne \varnothing$

Then by Union is Empty iff Sets are Empty:
 * $\left({A \cap Q}\right) \cup \left({B \cap Q}\right) \ne \varnothing$

Hence
 * $\complement_S \left({ A }\right) \cap \complement_S \left({B}\right) \cap Q = \varnothing$

We will show that
 * $B \cap U = \varnothing \implies \complement_S \left({ A }\right) \cap Q \cap U = \varnothing$

Assume
 * $B \cap U = \varnothing$

Then:
 * $U \subseteq \complement_S \left({B}\right)$

By Intersection with Empty Set:
 * $\complement_S \left({ A }\right) \cap Q \cap \complement_S \left({B}\right) \cap U = \varnothing \cap U = \varnothing$

Thus by Intersection with Subset is Subset:
 * $\complement_S \left({ A }\right) \cap Q \cap U = \varnothing$

By definition of intersection:
 * $x \in Q \cap U$

By definition of topological space:
 * $Q \cap U$ is open.

Then by Characterization of Boundary by Open Sets:
 * $\complement_S \left({A}\right) \cap Q \cap U \ne \varnothing$

Hence:
 * $B \cap U \ne \varnothing$

Then:
 * $\complement_S \left({B}\right) \cap U = \varnothing$

Therefore:
 * $U \subseteq B$

Because $x \notin \partial \left({A \cap B}\right)$ by Characterization of Boundary by Open Sets:
 * $\exists V \in \tau: x \in V \land \left({A \cap B \cap V = \varnothing \lor \complement_S \left({A \cap B}\right) \cap V = \varnothing}\right)$

By Complement of Intersection:
 * $A \cap B \cap V = \varnothing \lor \left({\complement_S \left({A}\right) \cup \complement_S \left({B}\right)}\right) \cap V = \varnothing$

By Intersection Distributes over Union:
 * $A \cap V \cap B = \varnothing \lor \left({\complement_S \left({A}\right) \cap V}\right) \cup \left({\complement_S \left({B}\right) \cap V}\right) = \varnothing$

Because $x \in \partial A$ therefore by Characterization of Boundary by Open Sets:
 * $\complement_S \left({A}\right) \cap V \ne \varnothing$

Then by Union is Empty iff Sets are Empty:
 * $\left({\complement_S \left({A}\right) \cap V}\right) \cup \left({\complement_S \left({B}\right) \cap V}\right) \ne \varnothing$

Hence:
 * $A \cap V \cap B = \varnothing$

By Intersection with Empty Set:
 * $A \cap V \cap B \cap U = \varnothing \cap U = \varnothing$

By Intersection with Subset is Subset:
 * $A \cap V \cap U = \varnothing$

By definition of intersection:
 * $x \in V \cap U$

By definition of topological space:
 * $V \cap U$ is open.

Then by Characterization of Boundary by Open Sets:
 * $A \cap Q \cap V \ne \varnothing$

This contradicts with $A \cap V \cap U = \varnothing$

Thus the inclusion is proved.

Analogically
 * $\partial B \subseteq \partial \left({A \cup B}\right) \cup \partial \left({A \cap B}\right) \cup \left({\partial A \cap \partial B}\right)$

By Union of Subsets is Subset:
 * $\partial A \cup \partial B \subseteq \partial \left({A \cup B}\right) \cup \partial \left({A \cap B}\right) \cup \left({\partial A \cap \partial B}\right)$

By Boundary of Union is Subset of Union of Boundaries:
 * $\partial \left({A \cup B}\right) \subseteq \partial A \cup \partial B$

By Boundary of Intersection is Subset of Union of Boundaries:
 * $\partial \left({A \cap B}\right) \subseteq \partial A \cup \partial B$

By Intersection is Subset of Union:
 * $\partial A \cap \partial B \subseteq \partial A \cup \partial B$

Hence by Union of Subsets is Subset
 * $\partial \left({A \cup B}\right) \cup \partial \left({A \cap B}\right) \cup \left({\partial A \cap \partial B}\right) \subseteq \partial A \cup \partial B$

Thus by definition of set equality the result follows:
 * $\partial A \cup \partial B = \partial \left({A \cup B}\right) \cup \partial \left({A \cap B}\right) \cup \left({\partial A \cap \partial B}\right)$