# Cardinality of union of two different sets

Let $A_1$, $A_2$, $B_1$, $B_2$ be non-empty sets such that $|A_i| = |B_i|$ for $i = 1, 2$. Prove that: If $A_1 ∩ A_2 = B_1 ∩ B_2 = ∅$, then $|A_1 ∪ A_2| = |B_1 ∪ B_2|$. Would really appreciate on some help with solving this.

Let $f_i:A_i \to B_i$ be a bijection. It seems reasonable to conjecture that the function $$f(a)=\begin{cases} f_1(a) \text{ if } a \in A_1\\ f_2(a) \text{ if } a\in A_2\end{cases}$$ is going to be the desired bijection between $A_1 \cup A_2$ and $B_1 \cup B_2$.

The function $f$ is well defined because $a$ is either in $A_1$ or $A_2$, but never both. It remains to show that it is injective and surjective.

Injective

Suppose that $f(a_1)=f(a_2)$ and $a_1 \not=a_2$. We know that $a_1$ and $a_2$ cannot both be in the same $A_i$, because if they were, then $f_i$ would not be a bijection. WLOG assume $a_1 \in A_1$ and $a_2 \in A_2$. Then $f(a_1) \in B_1$ and $f(a_2) \in B_2$, which contradicts that $f(a_1)=f(a_2)$ by $B_1 \cap B_2 =\emptyset$

Surjective

Consider any $b \in B_1 \cup B_2$. If $b \in B_1$, then $f_1^{-1}(b) \in A_1$, and $f(f_1^{-1}(b))=f_1(f_1^{-1}(b))=b$, so for any $b \in B_1$ there is an $a \in A_1 \cup A_2$ that maps to it. Similar logic holds for $b \in B_2$.

Try stating $\lvert A_1 \cup A_2\rvert$ in terms of $\lvert A_1 \rvert$, $\lvert A_2 \rvert$, and $\lvert A_1 \cap A_2 \rvert$. Do the same for $B_1$ and $B_2$, then use the given equalities to prove the result.