Basic Concepts

A set is a collection of elements. We can have a set called A that contains some numbers:

$A = \{1, 2, 3, 9\}$

And a set called B that contains names:

$B = \{Daniel, Alfredo, Vikas, Praveen, Bjorn\}$

We can say that an element is part of a set:

$3 \in A$

We can also say that 5 is not an element of A:

$5 \notin A$

We’ll call cardinality to the number of elements in the set. In these cases:

$|A| = 4$ and $|B| = 5$

Properties of Sets

The order of elements in a set is not important, and listing an element more than once doesn’t change the set.

The Empty Set

The empty set, denoted by $\emptyset$, is a set that contains no elements. It is unique and has a cardinality of 0.

$\emptyset = \{\}$

Intersection

The intersection of two sets A and B, denoted by $A \cap B$, is the set of elements that are common to both A and B.

For example, if $A = \{1, 2, 3, 4\}$ and $B = \{3, 4, 5, 6\}$, then:

$A \cap B = \{3, 4\}$

Union

The union of two sets A and B, denoted by $A \cup B$, is the set of elements that belong to either A or B, or both.

For example, if $A = \{1, 2, 3, 4\}$ and $B = \{3, 4, 5, 6\}$, then:

$A \cup B = \{1, 2, 3, 4, 5, 6\}$

Cardinality of the Union

The cardinality of the union of two sets A and B is given by:

$|A \cup B| = |A| + |B| - |A \cap B|$

This formula takes into account the elements that are common to both sets (the intersection) to avoid double-counting.