Two exercises about sets

title: Example 1: Prove that, for any $X$, $Y$ and $Z$, we always have $X \cap (Y \cup Z) = (X \cap Y) \cup (X \cap Z)$.
 
We need to show both:
1. $X \cap (Y \cup Z) \subseteq (X \cap Y) \cup (X \cap Z)$
1. $(X \cap Y) \cup (X \cap Z) \subseteq X \cap (Y \cup Z)$
 
We need to show both of these using no assumptions on the sets and their elements, using only properties of set properties union and intersection.
 
Hence:
1. We need to show every element of $X \cap (Y \cup Z)$ is also an element of $(X \cap Y) \cup (X \cap Z)$.
 
   Take an arbitrary element $x \in X \cap (Y \cup Z)$.
   This element is both $x \in X$ and $x \in Y \cup Z$.
   So the element can either be $x \in X \cap Y$ or $x \in X \cup Z$.
   Hence, $x \in (X \cap Y) \cup (X \cap Z)$.
 
2. We need to show every element of $(X \cap Y) \cup (X \cap Z)$ is also an element of $X \cap (Y \cup Z)$.
 
   Take an arbitrary element $x \in (X \cap Y) \cup (X \cap Z)$.
   This element can either be $x \in X \cap Y$ or $x \in X \cap Z$.
   In both cases, $x \in X$ but it can either be $x \in Y$ or $x \in Z$.
   Hence, $x \in X \cup (Y \cap Z)$.
title: Example 2: Show that there are sets $A$ and $B$ such that $A \cup \bar B \neq \bar A \cup B$.
 
We can have an infinite amount of solutions here, we just need to pick any two partially overlapping sets of numbers.
 
Let the universal set, $U = \{ 1, 2, 3 \}$.
Let $A = \{ 1 \}$ and $B = \{ 2 \}$.
 
Hence:
- $\bar A = \{ 2, 3 \}$
- $\bar B = \{ 1, 3 \}$
- $A \cup \bar B = \{ 1, 3 \}$
- $\bar A \cup B = \{ 2, 3 \}$
 
Therefore there are sets $A$ and $B$ such that $A \cup \bar B \neq \bar A \cup B$.