Introduction to Discrete Mathematics
Set Theory
What is a Set?
In mathematics, a set is simply a collection of distinct objects. These objects, called elements or members, can be anything: numbers, letters, people, or even other sets. The key is that each element is unique, and the order of elements doesn't matter.
Think of it like a grocery list. The set of items you need to buy is {milk, eggs, bread}. The order you write them in doesn't change what's in the set. And you wouldn't write "eggs" twice; each item is distinct.
We usually write sets by listing their elements inside curly braces {}. For example, if we have a set containing the first five positive integers, we would write it like this:
To say that 3 is an element of set , we use the symbol . So, we can write . To say that 6 is not an element of , we write .
Types of Sets
Sets can be big or small. A finite set is one where you can count all the elements, even if the number is very large. The set of students in a classroom is a finite set. An infinite set, as you might guess, has an unlimited number of elements. The set of all integers is infinite because you can keep counting forever.
Sometimes, one set is completely contained within another. This is called a subset. If every element of set is also an element of set , then is a subset of . We use the symbol to show this relationship.
For example, if and , then is a subset of because both 2 and 4 are in .
There's also a special set called the empty set, which contains no elements at all. It's represented by the symbol or just {}. The empty set is a subset of every set.
Set Operations
Just like we can add or subtract numbers, we can perform operations on sets to combine them or find out what they have in common. These operations are fundamental in fields like database queries and computer logic.
Union
noun
The union of two sets contains all the elements that are in either set (or both).
The symbol for union is . If we have set and set , their union is:
Notice that the element 3, which is in both sets, appears only once in the union. Remember, sets only contain distinct elements.
Intersection
noun
The intersection of two sets contains only the elements that are in both sets.
The symbol for intersection is . Using the same sets and from before:
The only element they share is 3.
Next up is the difference. The difference of set and set , written , is the set of elements that are in but not in . Think of it as taking everything in and removing whatever is also in .
The order matters here! The difference would be the elements in but not in :
Finally, we have the complement. The complement of a set , written as , contains everything that is not in . To define this, we need to know the universal set (), which is the set of all possible elements for the context we are considering. For example, if we're talking about numbers, the universal set might be all integers.
If our universal set is and , then the complement of is:
Cartesian Products
The last concept we'll cover is the Cartesian product. This operation creates a new set from two existing sets by forming all possible ordered pairs. The first element of the pair comes from the first set, and the second element comes from the second set.
Imagine a restaurant menu. Set has main courses: {Steak, Pasta}. Set has side dishes: {Fries, Salad}. The Cartesian product gives you all possible meal combinations.
The symbol for the Cartesian product is . Let's take set and set . Their Cartesian product is:
The result is a set of ordered pairs. Unlike elements within a set, the order inside these pairs matters. The pair is different from . This concept is crucial for understanding relationships and functions in mathematics and computer science.
| Set A | Set B | A × B (Cartesian Product) |
|---|---|---|
| 1 | a | (1, a) |
| b | (1, b) | |
| c | (1, c) | |
| 2 | a | (2, a) |
| b | (2, b) | |
| c | (2, c) |
Now that you have the basics of sets, let's test your knowledge.
What is the defining characteristic of a mathematical set?
Let and . What is the intersection of A and B, denoted ?
These building blocks, from simple collections to complex operations, form a language that helps describe the logical structures at the heart of computer science and mathematics.
