# Calculus

## Set Theory # Set Operations and Venn Diagrams

Sets are treated as mathematical objects. Similarly to numbers, we can perform certain mathematical operations on sets. Below we consider the principal operations involving the intersection, union, difference, symmetric difference, and the complement of sets.

To visualize set operations, we will use Venn diagrams. In a Venn diagram, a rectangle shows the universal set, and all other sets are usually represented by circles within the rectangle. The shaded region represents the result of the operation.

## Intersection of Sets

The intersection of two sets $$A$$ and $$B$$ is the set of elements which are in both sets $$A$$ and $$B.$$ The intersection of the two sets is written as $$A \cap B.$$

Two sets are called disjoint if they have no elements in common.

#### Examples:

1. $$A = \left\{ {a,b,c} \right\},$$ $$B = \left\{ {k,\ell,m} \right\}.$$ These two sets are disjoint as they have no common elements. Their intersection is the empty set.
$A \cap B = \left\{ {a,b,c} \right\} \cap \left\{ {k,l,m} \right\} = \varnothing.$
2. $$C = \left\{ {1,2,3,4} \right\},$$ $$D = \left\{ {2,4,6,7} \right\}.$$ The intersection of these sets is
$C \cap D = \left\{ {1,2,3,4} \right\} \cap \left\{ {2,4,6,7} \right\} = \left\{ {2,4} \right\}.$

## Union of Sets

The union of two sets $$A$$ and $$B$$ is defined as the set of elements which are either in set $$A$$ or set $$B$$ or in both $$A$$ and $$B.$$ This operation is denoted by the $$\cup$$ symbol.

#### Examples:

1. $$A = \left\{ {a,b,c} \right\},$$ $$B = \left\{ {k,\ell,m} \right\}.$$ The union of the two sets is given by
$A \cup B = \left\{ {a,b,c} \right\} \cup \left\{ {k,l,m} \right\} = \left\{ {a,b,c,k,l,m} \right\}.$
2. $$C = \left\{ {1,2,3,4} \right\},$$ $$D = \left\{ {2,4,6,7} \right\}.$$ The union of the sets is given by
$C \cup D = \left\{ {1,2,3,4} \right\} \cup \left\{ {2,4,6,7} \right\} = \left\{ {1,2,3,4,6,7} \right\}.$

### Principle of Inclusion-Exclusion

The cardinality of a finite set $$A,$$ denoted by $$\left| A \right|,$$ is equal to the number of elements in it. The cardinality of the union of two finite sets $$A$$ and $$B$$ is given by the following relationship:

$\left| {A \cup B} \right| = \left| A \right| + \left| B \right| - \left| {A \cap B} \right|,$

where $$\left| {A \cap B} \right|$$ is the cardinality of the intersection of $$A$$ and $$B.$$

The similar formula exists for the union of $$3$$ finite sets:

$\left| {A \cup B \cup C} \right| = \left| A \right| + \left| B \right| + \left| C \right| - \left| {A \cap B} \right| - \left| {A \cap C} \right| - \left| {B \cap C} \right| + \left| {A \cap B \cap C} \right|.$

## Difference of Two Sets

The difference of two sets $$A$$ and $$B$$ is the set that contains exactly all elements in $$A$$ but not in $$B.$$ The difference of two sets $$A$$ and $$B$$ is denoted by $$A \backslash B$$ or $$A - B.$$

#### Examples:

1. $$A = \left\{ {a,b,c} \right\},$$ $$B = \left\{ {k,\ell,m} \right\}.$$ The difference between two disjoint sets is equal to the initial set. So, we have
$A \backslash B = A \backslash \left( {A \cap B} \right) = A \backslash \varnothing = A = \left\{ {a,b,c} \right\}.$
2. $$C = \left\{ {1,2,3,4} \right\},$$ $$D = \left\{ {2,4,6,7} \right\}.$$ The difference of two sets $$C$$ and $$D$$ is given by
$C \backslash D = \left\{ {1,2,3,4} \right\} - \left\{ {2,4,6,7} \right\} = \left\{ {1,3} \right\}.$

## Symmetric Difference

The symmetric difference of two sets $$A$$ and $$B$$ is the set of all elements which belong to exactly one of the two original sets. This operation is written as $$A \,\triangle\, B$$ or $$A \oplus B.$$

In terms of unions and intersections, the symmetric difference of two sets $$A$$ and $$B$$ can be expressed as

$A \,\triangle\, B = \left( {A \cup B} \right) \backslash \left( {A \cap B} \right).$

#### Examples:

1. $$A = \left\{ {a,b,c} \right\},$$ $$B = \left\{ {k,\ell,m} \right\}.$$ The symmetric difference of two disjoint sets is equal to their union:
$A \,\triangle\, B = \left( {A \cup B} \right) \backslash \left( {A \cap B} \right) = \left( {A \cup B} \right) \backslash \varnothing = A \cup B = \left\{ {a,b,c,k,\ell,m} \right\}.$
2. $$C = \left\{ {1,2,3,4} \right\},$$ $$D = \left\{ {2,4,6,7} \right\}.$$ The symmetric difference of the sets $$C$$ and $$D$$ is given by
$C \,\triangle\, D = \left( {C \cup D} \right) \backslash \left( {C \cap D} \right) = \left\{ {1,2,3,4,6,7} \right\} - \left\{ {2,4} \right\} = \left\{ {1,3,6,7} \right\}.$

## Complement of a Set

The complement of a set $$A$$ is the set of elements in the given universal set $$U$$ that are not elements of $$A.$$ The complement of $$A$$ is denoted by $${A^c}$$ or $$A^\prime,$$ or sometimes $$\bar A.$$

$A^c = U \backslash A.$
1. Let the universal set be $$U = \left\{ {a,b,c,d,e,f} \right\}.$$ If $$A = \left\{ {a,b,d,f} \right\},$$ then the complement of $$A$$ is given by
${A^c} = U \backslash A = \left\{ {c,e} \right\}.$
2. Suppose the universal set is $$U = \{ x \in \mathbb{Z} \mid {x^2} \lt 20\}$$ and the set $$A$$ is given by $$A = \{ x \in \mathbb{Z} \mid -3 \le x \lt 3\}.$$ Find the complement of $$A.$$
$U = \{- 4,- 3,- 2,- 1,0,1,2,3,4\},\;\;A = \{- 3,- 2,- 1,0,1,2\},\;\;\Rightarrow {A^c} = \{- 4,3,4\} .$