Tutorial: Sets and set operations
This tutorial: Part A: Basics, unions, intersections, and complements
(This topic is also in Section 7.1 in Finite Mathematics and Applied Calculus)
Basics: sets, elements
Briefly, a set is a collection of distinct objects, called elements, which are allowed to be anything we can conceive of: real objects, numbers, letters, words, or even sets themselves. The theory of sets is extremely important in all of mathematics, and was invented by Georg Cantor.
Sets and elements
As we mentioned above, a set is a collection of distinct objects, called the elements of the set. We usually use a capital letter to name a set, and braces {} to enclose the elements of a set. For instance,
As we mentioned above, a set is a collection of distinct objects, called the elements of the set. We usually use a capital letter to name a set, and braces {} to enclose the elements of a set. For instance,
 $A = \{1, 3, 5, 7\}$
$A = \{n \mid n \text{is a positive odd integer} \leq 7 \} \qquad$ \t $A$ is the set of all $n$ such that $n$ is a positive odd integer $\leq 7.$
Here, the vertical line means "such that", and we read  "$\{n \mid \text{ blah blah blah} \}$"
Examples
1. \t %%Let $P = \{x, y, z, t\}$. \gap[20] \t $P$ is the (finite) set consisting of $x, y, z$, and $t$.
\\ \t Then $z \in P$ but $w \notin P$. \t $z$ is an element of $P$, but $w$ is not an element of $P$.
\\
\\ \t #[Venn diagram representation][Representación diagrama de Venn]#:
\t In a Venn diagram, sets are represented by regions (often discs) and the elements of the set are inside the region. \\ \\ 2. \t %%Let $Q = \{x \mid x \text{ is a negative integer} \}$. \gap[20] \t $Q$ is the (infinite) set of all $x$ such that $x$ is a negative integer \\ \t So $Q = \{ 1, 2, 3, 4, ...\}$. \\ \t Then $378 \in Q$ but $2 \notin Q$. \t $378$ is an element of $Q$, but $2$ is not an element of $Q$. \\ \\ \t #[Venn diagram representation][Representación diagrama de Venn]#:
Some for you
\t In a Venn diagram, sets are represented by regions (often discs) and the elements of the set are inside the region. \\ \\ 2. \t %%Let $Q = \{x \mid x \text{ is a negative integer} \}$. \gap[20] \t $Q$ is the (infinite) set of all $x$ such that $x$ is a negative integer \\ \t So $Q = \{ 1, 2, 3, 4, ...\}$. \\ \t Then $378 \in Q$ but $2 \notin Q$. \t $378$ is an element of $Q$, but $2$ is not an element of $Q$. \\ \\ \t #[Venn diagram representation][Representación diagrama de Venn]#:
Order unimportant
The order in which we write the elements of a set is unimportant, so the set $A$ above can also be written as
 $A = \{3, 1, 7, 5 \}$ This is the same set as $\{1, 3, 5, 7 \}$.
%%A #[There is a set with no elements called the empty set or null set. This set is denoted by $\emptyset$. Thus,][Hay un conjunto con ninguos elementos al que se llama el conjunto vacio o el conjunto nula. Este conjunto se denota por $\emptyset$. Por lo tanto,]#

$\emptyset = \{\} \qquad \qquad$ $\emptyset$ has no elements.
Relations between sets
As with numbers, two sets may be related to each other in various ways:
Set relations
Equality: As a set is nothing more than a collection of elements, two sets are equal if and only if they have the same elements.
Examples
1. \t $\{3, 1, 7, 5\} = \{1, 3, 5, 7\}$ \t Order unimportant
\\ 2. \t $\{3, 1, 7, 5\} \neq \{3, 1, 7\}$ \t They do not have the same elements.
\\ 3. \t $\{3, 1, 7, 5\} = \{n \mid n \ \text{is a positive odd integer} \leq 7 \} \}$ \gap[20] \t They have the same elements.
Subset: $B \subseteq A$ means that $B$ is a subset of $A$; every element of $B$ is also an element of $A$. So, in a Venn diagram representation, the region representing $A$ includes the region represented by $B$:
As with inequalities, can also write the relation $B \subseteq A$ backwards as $A \supseteq B$.
Note If $A$ is any set, then $A \subseteq A$ because every element of $A$ is an element of $A$!
$B \subseteq A$
Examples
1. \t $\{3, 5, 7\} \subseteq \{1, 3, 5, 7\}$
\\ 2. \t $\{3, 5, 7\} \subseteq \{3, 5, 7\}$ \t %%If $A = B$, %%then $A \subseteq B$.
\\ 3. \t $\emptyset \subseteq A$ for every set $A$. \gap[20] \t The empty set is a subset of every set.
Proper subset:
$B \subset A$ means that $B$ is a proper subset of $A$: $B \subseteq A$ but $B \neq A$.
As with inequalities, can also write the relation $B \subset A$ backwards as $A \supset B$.
Note If $A$ is any set, then $A \subseteq A$ because every element of $A$ is an element of $A$!
Examples
1. \t $\{3, 5, 7\} \subset \{1, 3, 5, 7\}$
\\ 2. \t $\{3, 5, 7\} \cancel{\subset} \{3, 5, 7\}$ \gap[40] \t Because they are equal
Set Operations: Union, intersection, complement, and Cartesian product
We are already familiar with the idea that operations on numbers, like addition, multiplication, division and taking reciprocals, produce new numbers from old. In the same way, there are also operations on sets that produce new sets from old ones. Here are some important ones:
Unions and intersections
Unions and intersections of sets
Union: To take the union of two sets $A$ and $B$ means to combine the elements of both in a single, possibly larger, set which we write as $A \cup B$. Specifically,
 $A \cup B$ is the union of $A$ and $B,$ the set of all elements that are either in $A$ or in $B$ (or in both). In symbols:
 $A \cup B = \{x \mid x \in A \text{ or } x \in B\}$
Examples
1. \t $\{1, 3, 5\} \cup \{1, 2, 3\} = \{1, 2, 3, 5\}$ \t No repetitions are allowed in a set.
\\ \t
$A \cup B = \{1, 2, 3, 5\}$ \\ 2. \t $A \cup A = A$ \t No new elements introduced \\ 3. \t $A \cup \emptyset = A$ \t No new elements introduced
Some for you
#[Venn diagram representation][Representación diagrama de Venn]#:
\t $A = \{1, 3, 5\}, B = \{1, 2, 3\}$$A \cup B = \{1, 2, 3, 5\}$ \\ 2. \t $A \cup A = A$ \t No new elements introduced \\ 3. \t $A \cup \emptyset = A$ \t No new elements introduced
Intersection: The intersection of two sets $A$ and $B$ is the single set of all elements common to both (if any). We write the intersection of $A$ and $B$ as $A \cap B$. So,
 $A \cap B$ is the intersection of $A$ and $B,$ the set of all elements that are simultaneously in $A$ and $B$. In symbols:
 $A \cap B = \{x \mid x \in A \text{ and } x \in B\}$
Examples
1. \t $\{1, 3, 5\} \cap \{1, 2, 3\} = \{1, 3\}$ \t Only the elements common to both
\\ \t
$A \cap B = \{1, 3\}$ \\ 2. \t $A \cap A = A$ \t All elements in common \\ 3. \t $A \cap \emptyset = \emptyset$ \t No elements in common
Some for you
#[Venn diagram representation][Representación diagrama de Venn]#:
\t $A = \{1, 3, 5\}, B = \{1, 2, 3\}$$A \cap B = \{1, 3\}$ \\ 2. \t $A \cap A = A$ \t All elements in common \\ 3. \t $A \cap \emptyset = \emptyset$ \t No elements in common
Logical equivalents
For an element to be in $A \cup B$, it must be in $A$ or in $B$.
For an element to be in $A \cap B$, it must be in $A$ and in $B$.
For an element to be in $A \cup B$, it must be in $A$ or in $B$.
For an element to be in $A \cap B$, it must be in $A$ and in $B$.
Complements
There is another operation we frequently use: taking the complement of a set $A$,
which, roughly speaking, is the set of elements not in $A$. To be more precise, we first need to specify a universal set $S$ consisting of all the elements in the sets under discussion:
 If the sets under discussion are sets of Web sites, we can specify $S$ to be the set of all Web sites.
 If the sets under discussion are sets of real numbers, we can specify $S$ to be the set of all real numbers.
 If the sets under discussion are sets of integers, we can specify $S$ to be the set $\{0, 1, 1, 2, 2, 3, 3 ... \}$ of all integers.
Complements of sets
If $S$ is a universal set for the sets under discussion, then $A\prime$, the complement of $A$ (in $S$), is the set of all elements of $S$ not in $A$.
If $S$ is a universal set for the sets under discussion, then $A\prime$, the complement of $A$ (in $S$), is the set of all elements of $S$ not in $A$.
 $A\prime = \{x \in S \mid x \notin A\}$
#[Venn diagram representation][Representación diagrama de Venn]#:
$S$ 
$\overbrace{\qquad \qquad \qquad \qquad \qquad \qquad}$ 
Examples
1. \t %%Let $S = \{a, b, c, d, e, f, g\},\ A = \{a, b, c, d\}$.
\\ \t Then $A\prime = \{e, f, g \}$ \gap[20] \t Elements of $S$ not in $A$
\\
\\ \t #[Venn diagram representation][Representación diagrama de Venn]#:
\t $S = \{a, b, c, d, e, f, g\},\ A = \{a, b, c, d\}$
$A\prime=\{e,f,g\}$ \\ 2. \t %%Let $S = \{x \mid x $ is a nonnegative integer$ \}$, \gap[20] \t $S = \{ 0, 1, 2, 3, 4, ...\}$ \\ \t %%and %%let $A = \{x \mid x $ is a nonnegative even integer$ \}$. \gap[20] \t $A = \{ 0, 2, 4, 6, ...\}$ \\ \t Then $A' = \{ 1, 3, 5, 7, ...\}$. \t Elements of $S$ not in $A$
Some for you
$S$ 
$\overbrace{\qquad \qquad \qquad \qquad \qquad \qquad}$ 
\t $S = \{a, b, c, d, e, f, g\},\ A = \{a, b, c, d\}$
$A\prime=\{e,f,g\}$ \\ 2. \t %%Let $S = \{x \mid x $ is a nonnegative integer$ \}$, \gap[20] \t $S = \{ 0, 1, 2, 3, 4, ...\}$ \\ \t %%and %%let $A = \{x \mid x $ is a nonnegative even integer$ \}$. \gap[20] \t $A = \{ 0, 2, 4, 6, ...\}$ \\ \t Then $A' = \{ 1, 3, 5, 7, ...\}$. \t Elements of $S$ not in $A$
Logical equivalent
For an element to be in $A'$, it must be in $S$ but not in $A$.
For an element to be in $A'$, it must be in $S$ but not in $A$.
Now go on to Part B of this tutorial or try some of the exercises in Section 7.1 in Finite Mathematics and Applied Calculus.
Copyright © 2018 Stefan Waner and Steven R. Costenoble