Sets
Sets
Sets
Justin Wyss-Gallifent
1
1 Sets and Notation
1.1 Basic Definitions
Definition 1.1.1. A set is a collection of (perhaps no) objects, or elements.
What those elements are is entirely irrelevant to the definition. Think of a set
as a box which contains (perhaps no) things.
There is no repetition in a set, meaning each element must be unique. You
could, for example, have variations on an element, such as a regular number 4
and a boldface number 4.
There is no order in a set; in other words order does not matter.
We can also explicitly list the elements in a set using {} notation.
Definition 1.2.2. The empty set is denoted by {} or ∅ and contains nothing.
It is an empty box.
Note 1.2.1. Note that {∅} is not the empty set, rater it is a set containing one
thing, that thing is the empty set! Think of it as a box containing an empty
box.
We also have notation for sets which comes from calculus using interval notation.
2
Example 1.3. The set [1, 2] contains all real number from 1 to 2 inclusive.
Note that this is very different than the set {1, 2} which contains just the
integers 1 and 2.
Lastly we can use set-builder notation to build sets:
Definition 1.2.3. A set is defined using set-builder notation using the notation:
It’s not infrequent that when the elements are taken from a set that this fact is
made clear before the vertical bar:
{x | x ∈ Z ∧ 3 | x} = {x ∈ Z | (3 | x)}
Also it’s not infrequent that an expression is used on the left.
Example 1.6. For example the odd numbers can be written as {2k + 1 | k ∈
Z}.
2 Comparison
2.1 Subsets and Proper Subsets
Definition 2.1.1. Given sets A and B we say that A is a subset of B, written
A ⊆ B, if every element in A is also in B. In other words:
A ⊆ B ←→ ∀x, (x ∈ A → x ∈ B)
3
Definition 2.1.2. Given sets A and B we say that A is a proper subset of B,
written A ⊂ B or A ( B, if every element in A is also in B but B has more. In
other words:
A ( B ←→ (∀x, (x ∈ A → x ∈ B) ∧ (∃y ∈ B, y 6∈ A))
Note 2.1.1. Observe that:
A = B ←→ (A ⊆ B ∧ B ⊆ A)
2.2 Equality
Definition 2.2.1. We say that two sets A and B are equal and write A = B
if they have exactly the same elements. More specifically A = B iff A ⊆ B and
B ⊆ A.
3 Combining
3.1 Union
Definition 3.1.1. Given sets A and B we define the union of A and B, denoted
A ∪ B to be the set of elements with are in A or in B or in both. In other words:
A ∪ B = {x | x ∈ A ∨ x ∈ B}
Thus:
x ∈ A ∪ B ←→ x ∈ A ∨ x ∈ B
4
A ∩ B = {x | x ∈ A ∧ x ∈ B}
Thus:
x ∈ A ∩ B ←→ x ∈ A ∧ x ∈ B
Definition 3.2.2. We say sets are disjoint if A ∩ B = ∅. This means they have
nothing in common!
3.3 Complements
In order to define the notion of things “not in” a set we have to have a sense of
a universal set.
Definition 3.3.1. In a given problem or situation the universal set, denoted U ,
generally denotes a large set for which everything else is taken to be a subset.
5
Example 3.4. When working with sets of integers we would take U = Z
whereas when working with sets of reals we would take U = R.
Definition 3.3.2. Suppose A ⊆ U . Then we define the complement of A,
denoted Ac or A0 , to be the set of things in U but not in A. That is:
Ac = A0 = {x ∈ U | x 6∈ A}
Thus:
x ∈ Ac ←→ x 6∈ A
3.4 Subtraction
Lastly we define set subtraction.
Definition 3.4.1. If A and B are sets then we define the set A − B to be the
set of things in A but not in B. Note that B doesn’t need to be a subset of A
for this to make sense. That is:
A − B = {x | (x ∈ A) ∧ (x 6∈ B)}
x ∈ A − B ←→ (x ∈ A) ∧ (x 6∈ B)
c 0
Note 3.4.1. Note that A = A = U − A.
6
4 Venn Diagrams
Useful for visualizing all of the above and for a good intuitive understanding of
when things are true and not true. In a Venn diagram we start with a rectangle
that indicates the universal set and typically another two sets A and B:
A B
A B
A B
7
A B
A B
A B
And lastly:
8
A B
We can do the same with three sets.
A B
5 Partitions
Definition 5.0.1. A partition of a set A is a choice of dividing the elements
of A into pairwise disjoint nonempty subsets whose union is A. This sounds
complicated but it just means we’re dividing up the elements of A in some way.
Technically speaking a partition is a set of subsets.
9
The following are not partitions of A:
• {{1, 2}, {3, 5}}
• {{1, 2, 3, 4, 5}, ∅}
• {{1, 2, 3}, {3, 4, 5}}
• {1, 2, 3, 4, 5}
Example 6.1. If A = {1, 2} then P(A) = {∅, {1}, {2}, {1, 2}}
Power sets can get pretty big.
n
Theorem 6.1.1. If A has n elements then P(A) has 2 elements.
—
Power sets can be pretty confusing.
10
• P({∅}) = {∅, {∅}}
Fun fact - power sets of the empty sets are one way that the nonnegative integers
can be constructed from scratch!
P(A) = {S | S ⊆ A}
Example 6.5. Note that in mathematics we have the cartesian plane which
is just the set of points (x, y). Formally this is R × R and is usually denoted
R2 .
11
• We have |Z| infinite
• We have |R| infinite.
However the term “infinite” is vague and we will break it down further. We’ll
start by looking at two sets: Z+ and R.
Observe that the set Z+ of positive integers may be listed one-by-one:
1, 2, 3, 4, 5, ...
It turns out that these two sets have different sizes in a meaningful way. In
order to formalize this we have the following definition:
Definition 7.0.2. We say that a set A is countable if we can match the element
in 1-1 correspondance with Z+ . Essentially this means we can choose a starting
element and list all elements in a manner which does not miss any.
Definition 7.0.3. We say that a set A is uncountable if it is not countable.
Example 7.2. The set of positive even integers is countable. Here they are:
2, 4, 6, 8, ...
Example 7.3. The set of all integers is countable. Here they are:
12
Z+ Z
1 ↔ 0
2 ↔ 1
3 ↔ -1
4 ↔ 2
5 ↔ -2
6 ↔ 3
.. .. ..
. . .
It is not clear right now whether we can or cannot do this with R but before we
try, let’s look at Q+ , the set of positive rational numbers.
Theorem 7.0.1. The positive rationals are countable.
Proof. Observe that we can put all the positive rational numbers in an infinite
table with the numerators n running across the top and the denominators d
down the left edge:
n/d 1 2 3 4 ...
1 1/1 2/1 3/1 4/1 ...
2 1/2 2/2 3/2 4/2 ...
3 1/3 2/3 3/3 4/3 ...
4 1/4 2/4 3/4 4/4 ...
5 1/5 2/5 3/5 4/5 ...
.. .. .. .. .. ..
. . . . . .
Note that there are repeats, for example 1/1 shows up as 2/2 and 1/2 shows up
as 2/4 and so on.
Here’s the fun part. We can use this table to generate a list of all of these
numbers. There are various ways to do this but here is one:
Let’s create a path through the table:
(i) Start in the top left: 1/1
(ii) Go down one: 1/1, 1/2
(iii) Go along the diagonal going up and right: 1/1, 1/2, 2/1
(iv) Go right one: 1/1, 1/2, 2/1, 3/1
(v) Go along the diagonal going down and left: 1/1, 1/2, 2/1, 3/1, 2/2, 1/3
(vi) Repeat from (ii).
This path hits everything in the table:
1/1, 1/2, 2/1, 3/1, 2/2, 1/3, 1/4, 2/3, 3/2, 4/1, 5/1, 4/2, 3/3, 2/4, 1/5, ...
13
Now then, following this path, simply skip rationals that have previously been
hit. This creates a list of all the positive rationals!
1/1, 1/2, 2/1, 3/1, 1/3, 1/4, 2/3, 3/2, 4/1, 5/1, 1/5, ...
QED
Okay, now let’s go back to R. We won’t even look at all of them, let’s just look
at the reals in the interval [0, 1].
Theorem 7.0.2. The set [0, 1] is uncountable.
Z+ Z
1 ↔ 0.a1 a2 a3 a4 a5 . . .
2 ↔ 0.b1 b2 b3 b4 b5 . . .
3 ↔ 0.c1 c2 c3 c4 c5 . . .
4 ↔ 0.d1 d2 d3 d4 d5 . . .
5 ↔ 0.e1 e2 e3 e4 e5 . . .
.. .. ..
. . .
Remember, we are assuming that every real number in [0, 1] is in this list!
Consider the new real number built as follows:
0.α1 α2 α3 α4 α5 . . .
where we insist that:
• α1 6= a1 , so this new number is not the first number in the list.
• α2 6= b2 , so this new number is not the second number in the list.
• α3 6= b3 , so this new number is not the third number in the list.
• α4 6= b4 , so this new number is not the fourth number in the list.
• α5 6= b5 , so this new number is not the fifth number in the list.
• ...etc...
Clearly this real number should be in the list by assumption, since the list is
assumed to contain all of [0, 1].
But this real number differs by the k th number at the k th digit, so it is not one
of the numbers in the list.
This is a contradiction and we are done. QED
14
8 Set Identities
Much like the logical equivalences there are set identities which arise frequently
and can be proved using the definitions. We have the following set identities.
Some of them look similar to logical equivalences!
Commutative A ∪ B = B∪ and A ∩ B = B ∩ A
Associative A ∪ (B ∪ C) = (A ∪ B) ∪ C and A ∩ (B ∩ C) = (A ∩ B) ∩ C
Distributive A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C) and A ∪ (B ∩ C) = (A ∪ B) ∩ (A ∪ C)
Identity A ∪ ∅ = A and A ∩ U = A
Complement A ∪ Ac = U and A ∩ Ac = ∅
Double Complement (Ac )c = A
Idempotent A ∪ A = A and A ∩ A = A
Universal Bound A ∪ U = U and A ∩ ∅ = ∅
DeMorgan’s (A ∩ B)c = Ac ∪ B c and (A ∪ B)c = Ac ∩ B c
Absorption A ∪ (A ∩ B) = A and A ∩ (A ∪ B) = A
Complement of ∅ and U U c = ∅ and ∅c = U
Set Difference A − B = A ∩ Bc
Later on we will discuss proving things with sets and we will be able to revisit
these and prove them.
15
Before proceeding note that we want to prove ⊆ so recall the definition. Here
I’ve abstracted using S1 and S2 for the two sets:
S1 ⊆ S2 means ∀x, x ∈ S1 → x ∈ S2
We therefore start with some arbitrary x ∈ S1 and show it is in S2 . Back to our
example:
When disproving the subset property we look for a counterexample. A Venn
diagram can help us but an explicit example is the final goal.
A B
Here is Ac ∪ B:
16
A B
Clearly we see:
A B A B
6⊆
But we should give an explicit example. We can draw another Venn Diagram
and put some numbers in the various areas:
A B
1 3 2
17
9.3 Proving or Disproving Equality
When proving set equality we use the fact that:
S1 = S2 ←→ (S1 ⊆ S2 ) ∧ (S2 ⊆ S1 )
Example 9.4. Let’s prove the absorption law. Specifically let’s prove that:
For all sets A and B, we have A ∪ (A ∩ B) = A.
Proof:
• First we prove that A ∪ (A ∩ B) ⊆ A.
To do this, start with some x ∈ A ∪ (A ∩ B).
We wish to prove that x ∈ A.
We know that either x ∈ A or x ∈ A ∩ B.
If x ∈ A then we are done.
If x ∈ A ∩ B then x ∈ A and we are done.
• Second we prove that A ⊆ A ∪ (A ∩ B).
To do this, start with some x ∈ A.
We wish to prove that x ∈ A ∪ (A ∩ B), however this is immediate
since x ∈ A.
Note 9.3.1. Note that we’re using cases in the first bullet point. Remember
cases:
p∨q
p→r
q→r
∴ r
Do you see how? Cases emerge when our hypothesis breaks into two (or more)
possibilities and we show that each of those leads to exactly the same conclusion.
Look at it this way. We proved that:
(x ∈ A) ∨ (x ∈ A ∩ B)
(x ∈ A) → (x ∈ A)
(x ∈ A ∩ B) → (x ∈ A)
∴ (x ∈ A)
18
Example 9.5. Let’s prove one of the DeMorgan’s Laws. Specifically let’s
prove that:
For all sets A and B we have (A ∩ B)c = Ac ∪ B c .
Proof:
• First we prove that (A ∩ B)c ⊆ Ac ∪ B c .
To do this, start with some x ∈ (A ∩ B)c .
We wish to prove that A ∈ Ac ∪ B c .
Since x ∈ (A ∩ B)c this means x 6∈ A ∩ B which then means either
x 6∈ A or x 6∈ B (or both).
If x 6∈ A then x ∈ Ac and then x ∈ Ac ∪ B c .
if x 6∈ B then x ∈ B c and then x ∈ Ac ∪ B c .
• Second we prove that Ac ∪ B c ⊆ (A ∩ B)c . To do this, start with some
x ∈ Ac ∪ B c .
We wish to prove that x ∈ (A ∩ B)c .
Since x ∈ Ac ∪ B c we know either x ∈ Ac or x ∈ B c (or both).
If x ∈ Ac then x 6∈ A and then x 6∈ A ∩ B and then A ∈ (A ∩ B)c .
If x ∈ B c then x 6∈ B and then x 6∈ A ∩ B and then A ∈ (A ∩ B)c .
When disproving set equality we look for a counterexample. That counterex-
ample only needs to violate one of the two subset statements! A Venn diagram
can help us but an explicit example is the final goal.
19
A B
Here is (A ∪ C) − B:
A B
Clearly we see:
A B A B
6=
C C
Specifically A ∪ (C − B) 6⊆ (A ∪ C) − B.
But we should give an explicit example. We can draw another Venn Diagram
and put some numbers in the various areas:
20
A B
4
1 2
7
5 6
C
8
9.4 Proving A = ∅
When proving A = ∅ we proceed differently because the logic above doesn’t
apply.
Instead, we prove this by contradiction - we assume that there is something in
A and find a contradiction.
21
9.5 Proving Conditionals Related to Sets
When we are proving conditionals related to sets we have to start pulling several
things together.
22