COMS 1016: Discrete Computational Structures
1. SETS
“A set is a well-defined collection of distinct objects.”
The ‘objects’ in a set are called its elements.
Notation:
We write x ∈ X to mean that x is an element of the set X.
We write x ∈
/ X to denote that x is not an element of X.
A set can be described by listing all of its elements:
Examples:
A = {0, 1, 2, 3}
B = {a, b, c, x, y, z}
C = {sin x, cos x, ex , x, x2 , 1}
Note: We use capital letters (A, B, C, X, Y , Z, etc.) as names for sets, we use curly brackets {, }
when listing the elements of a set, and commas to separate elements.
Sometimes we use dots . . . in our description of sets:
Examples:
A = {0, 1, 2, 3, . . . , 99, 100}
B = {a, b, c, . . . , z}
C = {−100, −99, −98, . . . , −1, 0}
When using dots like this it must be absolutely clear what is meant by them.
Some special sets:
N = {0, 1, 2, 3, . . . }, the set of all natural numbers
Z = {. . . , −2, −1, 0, 1, 2, . . . }, the set of all integers
Q is the set of all rational numbers
R is the set of all real numbers
1
2
A set can also be described using the set-builder method:
Let S be a set and P (x) any statement involving a variable x. Then we may define the set
A = {x | x ∈ S and P (x)} or, equivalently, A = {x ∈ S | P (x)}.
We say, A is the set of all x such that x ∈ S and P (x) is true.
That is, A is the set of all elements in S that make P (x) true.
Example:. Let A = {x ∈ Z | x2 ≤ 5}
(So S = Z and P (x) is: x2 ≤ 5)
For the integer 2, we have that 22 ≤ 5 is a true statement, so 2 ∈ A.
For the integer 3, we have that 32 ≤ 5 is a false statement, so 3 ∈
/ A.
It is easy to find all the elements of A. We have that A = {−2, −1, 0, 1, 2}.
Examples:
A = {x ∈ Z | x2 − 3x + 1 < 6} = {−1, 0, 1, 2, 3, 4}
B = {x ∈ R | 1 < x and x < 3}
C = {x ∈ Z | there exists y ∈ Z such that x = 2y}
D = {x ∈ R | x = 1 or x = 2 or x = 7} = {1, 2, 7}
Definition 1.1. Let X, Y be sets. We say that X is a subset of Y if every element of X is also
an element of Y . We write this as X ⊆ Y .
If X is not a subset of Y , then we write this as X 6⊆ Y . This means that there is at least one
element of X that is not an element of Y .
Example: Let X = {1, 2, 3}, Y = {0, 1, 2} and Z = {0, 1, 2, 3}.
Then X ⊆ Z and Y ⊆ Z, but X 6⊆ Y and Y 6⊆ X and Z 6⊆ X and Z 6⊆ Y .
Example: Let A = {x ∈ R | x ≤ 2} and B = {x ∈ R | x ≤ 3}. We can show that A ⊆ B as follows:
Let x ∈ A.
Then x ∈ R and x ≤ 2, by the definition of A.
But 2 ≤ 3
so x ≤ 3,
Also, x ∈ R,
∴ x ∈ B, by the definition of B.
Thus, every element of A is also an element of B, i.e., A ⊆ B.
3
Note: Suppose X and Y are sets defined using the set-builder notation, say
X = {x ∈ S | P (x)}, Y = {x ∈ S | Q(x)}
where P (x) and Q(x) are statements about a variable x.
Then X ⊆ Y is equivalent to saying that: P (x) implies Q(x).
Note: N ⊆ Z ⊆ Q ⊆ R.
Theorem 1.2.
(1) For any set X, we have X ⊆ X.
(2) For any sets X, Y and Z, if X ⊆ Y and Y ⊆ Z, then X ⊆ Z.
Proof. Exercise.
Definition 1.3. Let X, Y be sets. We say that X is equal to Y , written as X = Y , if X ⊆ Y and
Y ⊆ X. Another way to say this is that X and Y have exactly the same elements.
Definition 1.4. Let X, Y be sets. Then X is a proper subset of Y if X ⊆ Y but some element
of Y is not an element of X. This is written as X ⊂ Y . Another way to say this is that X ⊆ Y
and there exists at least one element of Y that is not an element of X.
Examples:
{1, 2, 3} ⊂ {0, 1, 2, 3} and {x ∈ R | 0 < x and x < 2} ⊂ {x ∈ R | 0 ≤ x and x ≤ 2}.
Also, N ⊂ Z ⊂ Q ⊂ R.
Definition 1.5. A set is empty if it has no elements. The empty set is written as ∅.
Note: For any set X, we have ∅ ⊆ X.
Definition 1.6. Let X be a set.
(i) If there exists n ∈ N such that X has n elements then X is called finite and we say that the
cardinality of X is n, which is written as |X| = n.
(ii) If X is not finite we say that X is infinite.
(iii) A set with with cardinality 1, i.e., with exactly one element, is called a singleton set.
(iv) The empty set has cardinality 0, i.e., |∅| = 0.
4
Note: The elements of a set can be sets themselves, for example:
X = {{a, b}, {c, d}, {a}}.
Then {a, b} ∈ X and {c, d} ∈ X and {a} ∈ X, but a ∈
/ X.
Also, {{a}} ⊆ X but {a} 6⊆ X.
Another example: Let Y = {3, {3}}.
Then 3 ∈ Y and {3} ∈ Y .
Also, {3} ⊆ Y and {{3}} ⊆ Y .
Definition 1.7. For any set X, the power set of X, written P(X), is the set of all subsets of X:
P(X) = {A | A ⊆ X}.
Example: Let X = {a, b}. Then
P(X) = {{a}, {b}, {a, b}, ∅}.
Note: We always have ∅ ∈ P(X) and X ∈ P(X).
EXERCISES
(1) List the elements of each of the following sets:
(i) {x ∈ N | x2 − 5x + 1 < 10}
(ii) {y ∈ Z | y 2 − 5y + 1 < 10}
(iii) {x ∈ R | x2 − 3x + 1 = 0}
(iv) {a ∈ R | a2 − 3a + 3 = 0}
(2) Let X = {x ∈ R | x2 − 3x + 5 ≤ 3} and Y = {x ∈ R | 0.9 < x and x < 2.1}.
Show that X ⊆ Y .
(3) Let Z = {y ∈ R | y 2 − 4y + 3 ≤ 0} and W = {y ∈ R | 2y 2 − 9y + 4 ≤ 0}.
Show that Z ⊆ W .
(4) Which of the following statements are True:
(i) {x ∈ R | x5 − 3x3 − 27x < 0} = {a ∈ R | a5 − 3a3 − 27a < 0}
(ii) {z ∈ Z | 5 < z 2 } = {z ∈ N | 5 < z 2 }
(iii) If X ⊆ Y , then |X| ≤ |Y |.
(iv) If X ⊂ Y , then |X| < |Y |.
(5) Give the power set of X in the following cases:
(i) X = {a}
(ii) X = {1, 2, 3}
(iii) X = ∅
5
(6) If |X| = n, then |P(X)| = ?
(7) Which of the following statements are True:
(i) If X = {1, 2, 3}, then {1, 2} ⊆ P(X).
(ii) If X = {1, 2, 3}, then {1, 2} ∈ P(X).
(iii) If A and B are sets, then it is possible to have both A ∈ B and A ⊆ B.
(8) Prove the following: If X ⊆ Y , then P(X) ⊆ P(Y ).
(9) Prove the statements in Theorem 1.2.
OPERATIONS ON SETS
Definition 1.8. The union of two sets X and Y , which is denoted by X ∪ Y , is defined as:
X ∪ Y = {x | x ∈ X or x ∈ Y }.
Definition 1.9. The intersection of two sets X and Y , which is denoted by X ∩ Y , is defined as:
X ∩ Y = {x | x ∈ X and x ∈ Y }.
If X and Y are sets such that X ∩ Y = ∅, then we say that X and Y are disjoint.
Examples: Let X = {1, 2, 3}, Y = {2, 3, 4} and Z = {a, b, c}. Then:
X ∪ Y = {1, 2, 3, 4}, X ∪ Z = {1, 2, 3, a, b, c}, Y ∪ Z = {2, 3, 4, a, b, c}
X ∩ Y = {2, 3}, X ∩ Z = ∅, Y ∩ Z = ∅.
Theorem 1.10. For any sets X and Y ,
(1) X ⊆ X ∪ Y and Y ⊆ X ∪ Y ,
(2) X ∩ Y ⊆ X and X ∩ Y ⊆ Y .
Theorem 1.11. Let X, Y and Z be sets. Then:
(1) If X ⊆ Y , then X ∪ Y = Y .
(2) If X ⊆ Y , then X ∩ Y = X.
(3) X ∪ ∅ = X and X ∩ ∅ = ∅ (identity laws)
(4) X ∪ Y = Y ∪ X and X ∩ Y = Y ∩ X (commutative laws)
(5) (X ∪ Y ) ∪ Z = X ∪ (Y ∪ Z) and (X ∩ Y ) ∩ Z = X ∩ (Y ∩ Z) (associative laws)
(6) X ∪ (Y ∩ Z) = (X ∪ Y ) ∩ (X ∪ Z) and X ∩ (Y ∪ Z) = (X ∩ Y ) ∪ (X ∩ Z) (distributive laws)
(7) X ∩ (X ∪ Y ) = X and X ∪ (X ∩ Y ) = X (absorptive laws)
6
Proof. (1) Assume that X ⊆ Y . To show that X ∪ Y = Y we must show that X ∪ Y ⊆ Y and that
Y ⊆ X ∪ Y . By the previous Theorem, we already know that Y ⊆ X ∪ Y , so we need only show
that X ∪ Y ⊆ Y . To do that we must show that every element of X ∪ Y is also an element of Y .
Let x ∈ X ∪ Y .
Then x ∈ X or x ∈ Y .
If x ∈ X, then, since we know X ⊆ Y , we get x ∈ Y .
In both cases, therefore, we have x ∈ Y .
Thus, X ∪ Y ⊆ Y , and so X ∪ Y = Y .
Exerxcise: Prove the remaining statements...
When working with sets, we often have some fixed set that contains all our sets; this is called the
universal set. The universal set can be any set, but is usually sets like N, Z, R or {0, 1, 2, . . . , 100}
or {a, b, c, . . . , z}, for example.
EXERCISES
(1) Let X = {a, d, e}, Y = {a, b, c} and Z = {b, c, d}.
(i) Find X ∪ Y and then (X ∪ Y ) ∪ Z.
(ii) Find Y ∪ Z and then X ∪ (Y ∪ Z) ((i) and (ii) should be the same by associative law).
(iii) Find Y ∪ Z and then X ∩ (Y ∪ Z).
(iv) Find X ∩ Y and X ∩ Z and then (X ∩ Y ) ∪ (X ∩ Z) ((iii) and (iv) should be the same
by distributive law).
(2) Let X = {x ∈ R | 1 < x and x < 4} (which we also write as the open interval (1, 4)),
let Y = {x ∈ R | 2 < x and x < 5} = (2, 5)
and Z = {x ∈ R | 3 < x and x < 6} = (3, 6).
(i) Find X ∩ Y and then (X ∩ Y ) ∩ Z.
(ii) Find Y ∩ Z and then X ∩ (Y ∩ Z) ((i) and (ii) should be the same by associative law).
(iii) Find Y ∩ Z and then X ∪ (Y ∩ Z).
(iv) Find X ∪ Y and X ∪ Z and then (X ∪ Y ) ∩ (X ∪ Z) ((iii) and (iv) should be the same
by distributive law).
(3) Let X and Y be sets defined using the set-builder notation, say
X = {x ∈ S | P (x)}, Y = {x ∈ S | Q(x)}
where P (x) and Q(x) are statements about a variable x.
(i) Show that X ∪ Y = {x ∈ S | P (x) or Q(x)}.
(ii) Show that X ∩ Y = {x ∈ S | P (x) and Q(x)}.
(4) Prove all the statements in Theorem 1.10 and Theorem 1.11.