Discrete Structures
§1 Sets
13 min read
Sets and membership
A set is a collection of distinct objects. The objects inside it are called elements or members. We write the elements between braces, such as .
Example: membership
Let
The symbol is the membership symbol. Read as “ is an element of .” The symbol is the non-membership symbol and means “is not an element of.” Therefore,
The empty set
The empty set is the set with no elements. Its symbol is , and it can also be written as empty braces:
Since the empty set has no elements, for every object . In particular,
This says the empty set is not an element of itself. It is different from , which is a set containing one element—the empty set:
Subsets and set inclusion
The symbol is the subset symbol. Read
as “ is a subset of ” or “ is included in .” This relationship is called set inclusion. It means that every element of is also an element of .
Equality is allowed, so every set is a subset of itself:
A proper subset leaves out at least one element. The symbol means “is a proper subset of.” Read
as “ is a proper subset of .” It means but , so the two sets are not equal.
You may also see . The symbol always makes “subset but not equal” explicit. The symbol is sometimes used differently between books, but in these notes it means proper subset.
Example: comparing two sets
Let
Then
This is true because every element of also appears in . It is a proper subset, , because belongs to but not to .
The empty set is a subset of every set:
For this to be false, we would need an element of that is missing from . There are no elements in , so that can never happen. In particular, .
Elements and subsets are different
The symbols and describe different relationships:
| Expression | Read as | What it checks |
|---|---|---|
| is an element of | whether one object is a member of | |
| is a subset of | whether every element of the set is also an element of |
That means
is always true, while
is true only when the empty set itself appears as an element of .
Sometimes both relationships are true. If
then
because appears as one element of . We also have
because both and are elements of .
Common number sets
| Symbol | Name | Numbers it contains |
|---|---|---|
| natural numbers | ||
| positive natural numbers | ||
| integers | ||
| rational numbers | fractions such as , , and | |
| real numbers | every number on the real number line |
In these notes, is included in . Some books start at , so always check which convention is being used.
Each number set is a subset of the next one:
Viewed as points on the number line, and are discrete: their values are separated. For example, the integer after is ; there is no integer between them.
The real number line is continuous instead. Between any two different real numbers, there are always more real numbers, so the values do not come in separate steps.
Two ways to define a set
Definition by extension
A definition by extension, also called roster notation, lists the elements between braces:
Order does not matter, and writing an element more than once does not change the set:
A set only records whether an element belongs to it. It does not record the element's position or how many times it was written.
Definition by comprehension
A definition by comprehension, also called set-builder notation, describes the common property of the elements:
Here:
- represents a possible element;
- is the universe, or the set from which is chosen;
- the vertical bar is read as “such that”;
- is the property or condition that must satisfy.
Example: natural and odd numbers
The natural numbers can be defined as the nonnegative integers:
The condition means “ is greater than or equal to zero.” In other words, start with the integers, then keep the nonnegative values.
The odd natural numbers can be written by extension,
or by comprehension,
As runs through , the expression gives .
Example: rational numbers
A rational number is any number that can be written as a fraction of two integers:
The condition means the denominator cannot be zero. An integer such as is rational because .
The same rational number can have many fraction forms:
We usually write a rational number in reduced form: the denominator is positive, and the numerator and denominator share no positive factor except . In other words, their greatest common divisor (GCD) is . For example,
and the form on the right follows the positive-denominator convention.
Set equality
The principle of extensionality says that two sets are equal when they contain exactly the same elements. Their order and the way they were defined do not matter.
The double-inclusion method proves that by showing both directions:
The first direction shows that has no element missing from . The second shows that has no element missing from .
Example: two forms of the odd integers
Consider
and
Both descriptions produce all odd integers. To prove , we show both inclusions.
Take any . Then for some integer . Rewrite it as
Since is an integer, has the form used in . Therefore,
Now take any . Then for some integer . Rewrite it as
Since is an integer, has the form used in . Therefore,
Both directions are true, so .
Why not every condition defines a set
The unrestricted comprehension principle would allow any condition to create a set . Russell's paradox shows why this does not work.
Non-example: Russell's paradox
Suppose we try to define
In words, would contain every set that is not an element of itself. Under this proposed rule, would qualify because .
For comparison, some versions of set theory allow a self-containing set called a Quine atom, written . Since , it would not qualify for .
Now ask whether is an element of itself:
- If , then must satisfy its own condition, so .
- If , then satisfies the defining condition, so by definition .
Either answer gives the opposite answer. The symbol means “if and only if,” so we can write the contradiction as
This is Russell's paradox.
The safe version is restricted comprehension, called separation in formal set theory. Start with an already defined universe , then choose the elements that satisfy :
This creates a subset of instead of assuming that every condition creates a set. Here, is the universal set for the current problem—not one set containing every set that exists.
Set operations
Set operations build new sets from sets we already have. Unless stated otherwise, all complements are taken relative to a fixed universe .
Let and be subsets of . For a concrete example, take
Union
The union contains everything that belongs to at least one of the two sets:
The word “or” is inclusive here: an element may belong to , to , or to both. In the example,
Intersection
The intersection contains only the elements shared by both sets:
Therefore,
Difference
The set difference keeps the elements of that are not in :
Difference depends on the order:
Complement
The complement of contains everything in that is outside :
The universe matters. For and the convention ,
If the universe is instead , then
The notation is not universal. Depending on the course or context, the complement may be written or .
Symmetric difference
The symmetric difference contains the elements that belong to exactly one of and :
For the example,
Some sources write symmetric difference as . Neither symbol is universal, so its meaning should be stated when the context is unclear.
It has two useful equivalent forms:
Set identities and Venn diagrams
A set identity is an equality that is true for every allowed choice of its sets. Venn diagrams divide the universe into all possible membership regions. If two expressions shade exactly the same regions, then they contain exactly the same elements, so the expressions are equal.
This is the same double-inclusion idea used earlier. If expressions and shade the same regions, then every also lies in the region for , giving . The same argument in reverse gives . Therefore, .
Example: a distributive law
Let , , and be subsets of . Union distributes over intersection:
On the left, we take all of together with the part shared by and . On the right, a point must belong to both and . If it is not in , it must be in both and . Both sides therefore select the same regions.
A ∪ (B ∩ C)
(A ∪ B) ∩ (A ∪ C)
Intersection also distributes over union:
Common set identities
The following identities hold for all sets , , and inside a fixed universe .
| Law | Identities |
|---|---|
| Identity | and |
| Idempotent | and |
| Absorption | and |
| Associative | and |
| Distributive | and |
| Double complement | |
| De Morgan | and |
| Complement | and |
Example: proving an identity algebraically
Set identities can be combined like algebraic rules. To prove
start with the left-hand side:
A filled square , or QED (short for the Latin phrase meaning “which was to be demonstrated”), marks that a proof is complete.
Cartesian products
The Cartesian product is an external operation: its elements are ordered pairs rather than elements of either original set. It changes the universe of discourse.
Order matters inside each pair, so is generally different from .
For
we pair every element of with every element of :
There are pairs. The notation means the cardinality of , or the number of elements it contains. If and are finite, then
The Cartesian plane is the product of the real numbers with themselves:
Power sets
The power set of , written , is the set of every subset of :
For ,
Each element of has two choices when forming a subset: include it or leave it out. A set with elements therefore has subsets:
The empty set has one subset—itself—so
The power set of the empty set is not empty; it contains the empty set as its one element.
0 reads
Last edited