Fundamentals Of Set Theory
Tags: database, computerscience, programming, machinelearning
Published: 2024-06-04 14:18:15

## Definitions and Examples

- **Sets**

**Definition**: A set is a collection of distinct objects, known as elements of the set. Sets are typically denoted using curly braces.

**Example**: Consider "A = {2, 4, 6, 8, 10}". This represents a set of the first five even numbers. Another example might be "C = {apple, banana, cherry}", a set of fruits.

- **Subsets**

**Definition**: A subset is a set where every element is also contained in another set. This relationship is denoted as "B is a subset of A", indicating that "B" is a subset of "A".

**Example**: If "A = {1, 2, 3, 4}", then "B = {1, 2}" and "C = {3, 4}" are both subsets of "A". Importantly, every set is a subset of itself, so "A is a subset of A" is also true.

- **Unions**

**Definition**: The union of two sets "A" and "B", includes all elements from both "A" and "B", without any duplicates.

**Example**: If "A = {1, 2, 3}" and "B = {3, 4, 5}", the union "A union B = {1, 2, 3, 4, 5}" combines all elements from both sets, with the overlap only listed once.

- **Intersections**

**Definition**: The intersection of two sets "A" and "B", contains only the elements that are common to both sets.

**Example**: For the same sets "A" and "B" as above, "A intersect B = {3}" includes only the number 3, which is present in both sets.

- **Complements**

**Definition**: The complement of a set "A", includes all elements that are not in "A", relative to a defined universal set "U".

**Example**: If "U = {1, 2, 3, 4, 5, 6}" is the universal set and "A = {1, 2, 3}", then "A' = {4, 5, 6}" includes every element of "U" that is not in "A".

## Introduction to Venn Diagrams

```
     A = {1, 2, 3}              B = {3, 4, 5}
      _______                      _______
     /       \                    /       \
    /    1    \                  /    4    \
   /           \                /           \
  /_______2_____\              /_______5_____\
 /      3      \              /      3      \
 \             /              \             /
  \_______    /                \_______    /
          \  /                        \  /
           \/                          \/
            \                          /
             \________C = {2, 3, 6}___/
```

Venn diagrams provide a visual way to represent set relationships, which can be particularly helpful in understanding complex interactions between multiple sets.

**Basic Example**: Drawing two overlapping circles for sets "A" and "B" helps visualize their union and intersection. If "A = {1, 2, 3}" and "B = {3, 4, 5}", the overlap contains "{3}", representing "A intersect B", while the total area covered by both circles represents "A union B".

**Complex Example**: Introduce a third set, "C = {2, 3, 6}", and add another circle to the diagram. The points where all three circles intersect can represent the intersection of all three sets, "A intersect B intersect C = {3}", highlighting the shared element. Each pair of overlaps shows the pairwise intersections, and the areas not overlapping with any other represent the unique elements of each set.

_Some dreams might start from nowhere so never give up_. Author [𝕏](https://x.com/niladrridas)