Sets and Logic Notes
Sets and Logic Notes
Sets and Logic Notes
1 Introduction
One of the major parts of what mathematics is about is abstraction. This is a process of removing
many aspects of a thing or phenomenon that we want to study and keeping only certain ones.
For example when you learnt what the number one means, you abstracted this concept by seeing
what is common between various collections with only “one thing” in them. For instance you
might have been shown a bowl with one orange, the sky with one moon, and many other similar
situations. Abstraction allows one to see common facts about general situations. For instance
you already know how widely applicable is, say the addition of numbers. As a part of this course
you will be introduced to a certain abstraction, called sets, which arise by abstracting the idea
of collections. This abstraction has proved to be so powerful that sets are usually used as a
foundation to mathematics.
2 Sets
A set is an abstract collection of things, called elements. Usually the elements are mathematical
objects, but for the sake of the introduction we will allow any objects at all. For example, the set
containing the names of South African presidents, since 1994 is
{Nelson Mandela, Thabo Mbeki, Kgalema Motlanthe, Jacob Zuma, Cyril Ramaphosa}.
If the elements of a set can be listed one by one, we may enclose its elements between a pair of
braces (curly brackets) as in the previous example. Some other examples of sets whose elements
can be listed are:
• {1, 2} (the set containing the elements: 1 and 2);
A very important thing (that we assume) about sets is that they are determined by their elements.
This means that there is exactly one set with elements say 1, 2 and 3, and that two sets are equal
(the same) when they have identical elements. In particular this means that the sets {1, 2, 3},
{2, 1, 3}, {1, 2, 1, 3, 1, 2} are all different ways of writing the same set since they all have the same
elements: 1, 2 and 3. We can write this mathematically as:
Sometimes, it is not possible to list elements of a set one by one. Examples include Z, the set
containing all integers, and R, the set containing all real numbers. For Z we might (informally)
write
Z = {. . . , −3, −2, −1, 0, 1, 2, 3, . . .}
while for R we can’t even do that. For intervals we use round or square brackets.
Examples:
• [0, 1] is the set of all real numbers between 0 and 1 (including 0 and 1);
• [1, 2) is the set of all real numbers between 1 and 2 (including 1, but not 2);
• (2, 3) is the set of all real numbers between 2 and 3 (excluding 2 and 3);
• (−∞, 4] is the set of all real numbers less than or equal to 4 (including 4);
• (3, ∞) is the set of all real numbers greater than 3 (excluding 3).
Before giving more examples, we define the relation that connects sets with their elements. If x is
an element of a set S, we write
• 1 ∈ {1, 2}; • 3∈
/ {1, 2};
• 56 ∈ R; • 1
2 ∈
/Z
Exercises
1. Simplify the following sets:
(a) {1, 2, 3, 1, 2, 3, 1, 2, 3};
(b) {1, 3, 2, 4, 3, 5, 4, 6, 5, 7, 6, 8, 7, 9, 8, 10}.
2. How many elements do the following sets have (i.e. how many distinct (not equal) elements
do they have)? (Another way of thinking about this is, when counting the number of elements
in a set, you should always count without repetition, e.g. {2, 2} has one element.)
(a) {1, 2, 2, 3, 3, 3};
(b) {0, 1, −1, 2, −2, 3, −3, 4, −4, 5, −5, 6, −6, 7, −7, 8, −8, 9, −9, 10, −10}.
• N is the set of natural numbers (counting numbers). Note that in this course we assume
0 ̸∈ N (although not everybody follows this convention - computer scientists in particular
often define N to contain 0 as well).
• Z is the set of integers (whole numbers) that we mentioned before. This set includes both
positive and negative whole numbers.
• Q is the set of all rational numbers (whole numbers and fractions), i.e. numbers which can
be written as an integer divided by another non-zero integer. For example, 3, − 21 , 22
7 ∈ Q.
So far, all our examples of sets have contained only numbers. It will be useful to know what
other mathematical objects can be elements of sets. (In fact, as mentioned above, more formal
mathematics uses sets as a foundation and hence all mathematical objects are sets.)
• R2 , the Cartesian plane that you encountered when studying coordinate geometry, which
consists of all pairs (x, y) of real numbers. (These pairs should not be confused with open
intervals - the context should make clear which is meant.)
• {(0, 0)}, the set consisting of only one point in the Cartesian plane, namely the origin.
• {(0, 0, 0)}, the set consisting of the origin in a three-dimensional version of the Cartesian
plane. It has only one element.
2.3 Subsets
We say that a set A is a subset of a set B if every element of A is also an element of B. We write
this as
A⊆B or B ⊇ A.
It is very important to understand that x being an element of A (written x ∈ A) is completely
different to saying x is a subset of A (written x ⊆ A). The first means that x is one of the things
which is in A while the second means, firstly that x is a set and secondly that every thing which
is in x is in A.
We write A ̸⊆ B to mean A is not a subset of B. Another way of saying this is that there is
(exists) an element of A which is not an element of B.
Examples: The following are all true facts (statements):
• {1} ⊆ {1, 2}, since 1 ∈ {1, 2};
• {1, 2} ⊆ {1, 2, 3}, since 1 ∈ {1, 2, 3} and 2 ∈ {1, 2, 3};
• {1, 2} ⊆ {1, 2}, since 1 ∈ {1, 2} and 2 ∈ {1, 2};
• if A is the set with elements all positive even integers and B is the set of all positive integers,
then A ⊆ B, since each even positive integer is also a positive integer;
• Unlike for inequalities where a ≤ b or b ≤ a, it is possible that neither A ⊆ B nor B ⊆ A
hold. For example {1, 2} ̸⊆ {1, 3} and {1, 3} ̸⊆ {1, 2} (since 2 ∈
/ {1, 3} and 3 ∈
/ {1, 2}).
• [0, 1] ⊆ R, since every real number between 0 and 1 is a real number;
1 In this instance it may help to think of a set as a box containing objects. An empty box is different from a box
• [1, 2] ⊆ [0, 3], since every real number between 1 and 2 also lies between 0 and 3;
• For each set S, we always have ∅ ⊆ S. There is often philosophical debate over this. One
way to get over this is to realize that this should either be true or it should be false. This
means that either every element of the empty set should be in S or else there must be an
element in the empty set which is not in S. Since there clearly is no element in the empty
set which is not in S (since the empty set has no elements at all), it follows that the first
part is true. Another way to get over this difficulty is to take it as a convention that the
empty set is a subset of every other set.2
• [Enrichment] Given a set A, its power set P(A) is the set of all subsets of A, e.g. if
A = {1, 2, 3}, then P(A) = {∅, {1}, {2}, {3}, {1, 2}, {2, 3}, {1, 3}, {1, 2, 3}}. Power sets will
not be very important in these notes, but the example provides an interesting connection
between the fact that sets may contain other sets and the notion of a subset.
The main point that these examples should help you to realize is that to test whether A ⊆ B is
to test whether each element of A is also an element of B.
Recall that two sets A and B are equal if they contain exactly the same elements. This means
that every element of A is also an element of B (A ⊆ B) and every element of B is also an element
of A (B ⊆ A). This encodes a very common way of proving that two sets A and B are equal:
prove both that A ⊆ B and that B ⊆ A.
Warning: Some textbooks write A ⊂ B for subsets, even when A and B are possibly equal. In
that case, to emphasise that A ⊂ B and A ̸= B, they will write A ⊊ B.
Exercises
1. Determine which of the following sets are subsets of each other: (Try to illustrate this in a
2-dimensional grid with arrows from one set to another indicating inclusion.)
{1}, {1, 2}, {1, 2, 3}, {1, 3}, {2, 4}, {1, 2, 4}, {1, 2, 3, 4}.
(0, 1), [0, 1), (0, 1], [0, 1], (0, 2), (1, 3), ( 21 , 1], [0, 12 ].
3. [Enrichment]
(a) Write down the power set of {1}. How many elements does it have?
(b) Write down the power set of {1, 2}. How many elements does it have?
(c) What is the power set of ∅?
(d) How many elements do you think the power set of {1, 2, 3, . . . , 10} has?
opposing stances on whether this claim is true or not, and see where this leads you!
Sets and Logic Page 5
or as
{x ∈ Z | there is an integer m such that x = 2m}.
Note that the notation works as follows: Given a set T
{x ∈ T | conditions satisfied by x}
is the set consisting all elements x of T which satisfy the specified conditions.
Further examples:
Exercises
1. Write down the following sets as a list of elements:
(a) {x ∈ R | x ∈ Z and 0 ≤ x ≤ 5};
(b) {x ∈ R | 3x ∈ Z and 0 < x ≤ 2}.
Examples:
If A and B are sets, then the intersection of A and B is a new set, called A ∩ B, which
contains precisely those elements which lie both in A and in B. Note that this means that
A ∩ B = {x ∈ A | x ∈ B} = {x ∈ B | x ∈ A} = {x ∈ A ∪ B | x ∈ A and x ∈ B}.
Sets and Logic Page 6
Examples:
• {1, 2, 3, 4, 5, 6, 7} ∩ {2, 4, 6, 8, 10} = {2, 4, 6};
• If A is the set with elements all even numbers and B is the set with elements all prime
numbers, then A ∩ B = {2}. (Try to say what this means in words!)
• (0, 4] ∩ [1, 5) = [1, 4];
• [−1, 4) ∩ [0, 5) = [0, 4).
If you get these two notions confused, a good rule of thumb is: “unions are big, intersections are
small”.
One can also form unions and intersections Snof more than one set at a time. Suppose we have
sets A1 , A2 , . . . , An , then their union, written i=1 Ai , is the set containing
Tn all the elements which
are in at least one of A1 , A2 , . . . , An . Their intersection, written i=1 Ai , is the set with elements
that are in each of the sets A1 , A2 , . . . , An . In particular, this means that
n n−1
!
[ [
Ai = Ai ∪ An
i=1 i=1
n
\
Ai = {x ∈ A1 | x ∈ Ai for every i = 1, 2, . . . , n}.
i=1
• Let A1 = {0}, A2 = [0, 1/2], A3 = [0, 2/3], etc. in general Ai = [0, (i − 1)/i] for i in N. Then
[
Ai = [0, 1),
i∈N
since every number between 0 and 1 is eventually in one of the intervals, but 1 will never be
part of any of them.
• Let A1 = [0, 1], A2 = [0, 2], A3 = [0, 3], etc. in general Ai = [0, i] for i in N. Then the
intersection of all of these sets is \
Ai = [0, 1],
i∈N
since these are the only elements that occur in all of the sets Ai .
• Let A1 = (0, 2), A2 = (0, 3/2), A3 = (0, 4/3), etc. in general Ai = (1, (i + 1)/i) for i in N.
Then \
Ai = (0, 1],
i∈N
since 1 ∈ Ai for each i, but every number greater than 1 is eventually excluded from some
Ai .
Sets and Logic Page 7
2.5.3 Complements
The relative complement of a set B in a set A is a new set, called A \ B (“A minus B”), which
contains those elements of A which are not elements of B:
A \ B := {x ∈ A | x ∈
/ B}
Examples:
• {1, 2, 3, 4, 5} \ {2, 4} = {1, 3, 5};
• R \ (−∞, 0) = [0, ∞);
• R \ Q cannot be written in a simpler way, but has a simple verbal description. It consists of
all irrational numbers.
Examples:
• If A = {1, 2} and B = {3, 4}, then
A × B = {1, 2} × {3, 4} = {(1, 3), (1, 4), (2, 3), (2, 4)}.
• If A = R and B = R then
A × B = R × R = {(x, y) | x, y ∈ R}.
This is the set of all points in the Cartesian plane. We sometimes denote it by R2 .
Note that the elements of A × B are ordered pairs of numbers. Thus it is important in what order
their elements are listed: (a, b) ̸= (b, a) (unless a = b). It also means that B × A is usually a
different set from A × B (again unless A = B).
Exercises
1. Consider the following sets.
Determine:
question. One very important skill in mathematics is to learn to read mathematics and understand what is meant.
This is a skill that you need to develop by practising it.
Sets and Logic Page 8
(A × C) ∪ (B × C) as well as (A ∪ B) × C.
3 Mathematical Statements
Mathematical statements are claims about mathematical objects which are either true or false.
These can be written using mathematical symbols, but must be able to be rewritten in English as
full sentences, including a verb and ending with a full stop.
Examples:
• “7 is a real number.” is a true statement.
• “3 ∈ Z” is a true statement. (The verb in this statement is ∈ (“is an element of”).)
• “−3 ∈ N” is a false statement.
• “3 < 2” is a false statement. (Here the verb is < (“is less than”).)
• “{1, 2, 3} ⊆ {1, 2, 3, 4, 5}” is a true statement. (What is the verb in this statement?)
• “23 − 1” is not a statement, it’s a number. (Note that there is no verb.)
• “A ∩ B” is not a statement, it’s a set. (Is ∩ a verb?)
Many statements that mathematicians are interested in also contain variables. The truth of
the statement then depends on what value the variable takes. The distinction between a state-
ment as something which is either true or false and a statement with variables, which depends on
the value of some variables is so important that we give the latter another name: a var-statement.4
Examples:
• x2 − 1 = 0. This var-statement depends on the value of x. If x = 1 or x = −1, the statement
is true, otherwise it is false.
• n
2 ∈ Z. This var-statement depends on the value of n. If n is an even integer, it is true,
otherwise it is false.
• x < y is a var-statement that depends on two variables.
• x2 ≥ 0 is a var-statement that happens to be true for all real numbers x.
Exercises
1. Determine whether the following are statements and if they are decide whether they are true
or false.
4 This is not standard and many people don’t make this distinction. However, it is a useful distinction when first
2. For each of the following var-statements, determine the values of the variables for which it
is true.
Examples:
• “(2 is a prime) ∧ (5 is an odd integer)” is a true statement, since each of its parts (“2 is a
prime” and “5 is an odd integer”) is true;
• “(3 is an even integer) ∧ ({1, 2, 3} ⊆ N)” is a false statement, since the statement “3 is an
even integer” is false.
• The var-statement
x>0 ∧ x∈Z
is true when x is a positive integer and false otherwise.
If P and Q are statements, then P or Q (also written P ∨ Q), is true if and only if at least one of
P and Q is true. For example
• “(2 is a prime) ∨ (5 is an odd integer)” is a true statement. Each of its parts is true, and
thus their combination using “or” is also true. (This is slightly different from the usual use in
English where “or” often means either the one or the other, but not both. In mathematics,
“or” is always inclusive, i.e. if both parts are true, then the combination is true.
• “(3 is an even integer) ∨ ({1, 2, 3} ⊆ N)” is a true statement, since the second part is true;
• The var-statement
x>0 ∨ x∈Z
is true if x is positive, or if x is any integer. So the above statement is true if x = −5 or if
x = 21 or if x = 5, but false if x = − 12 . (It is a good exercise to draw on the real line the
x-values for which the var-statement is true.)
If P is a statement, then its negation, written not P (or ¬P ), is true precisely when P is false.
For example:
• “¬(2 is a prime)” is false, since “2 is a prime” is true. Note that “¬(2 is a prime)” can be
rewritten in English as “2 is not a prime”;
• “¬(3 is an even integer)” is true, since “3 is an even integer” is false;
• The var-statement ¬(x ∈ A) is true when x ∈
/ A and false if x ∈ A.
Of course, one can also combine statements using all three of these operations. In general, the order
of operations makes a difference, so we indicate with brackets the order in which the statements
are combined.
• false and (false or true) = false and true = false
• (false and false) or true = false or true = true
Sets and Logic Page 10
Exercises
1. Determine whether the following are true or false:
(a) (5 > 3) ∧ (5 > 1); (c) (−1 > 0) ∨ (−1 < 0);
(b) (4 > 8) ∧ (4 ∈ Z); (d) ((¬(1 > 0)) ∧ (¬(3 > 1))) ∨ (¬(4 > 0)).
P Q P ∧Q P ∨Q
T T T T P ¬P
T F F T T F
F T F T F T
F F F F
In the first table, the line T F F T tells us that when P is true and Q is false, then
P ∧ Q is false and P ∨ Q is true. A truth table will contain one line for each combination of
true/false values of the variables P , Q, etc.
If there are more basic statements, then there will be more combinations. For example, if
there are three basic statements P , Q and R to be combined, then there will be eight different
combinations which leads to a truth table that contains eight rows. (See the following example.)
How many rows would there be if there were five basic statements?
Example. In some cases we can compare two statements by using a truth table. For example,
we shall show that P ∨ (Q ∧ R) is equivalent to (P ∨ Q) ∧ (P ∨ R). To do this, we calculate the
intermediate columns associated to Q ∧ R, to P ∨ Q and to P ∨ R and then evaluate each of the
equivalent statements.
P Q R Q∧R P ∨Q P ∨R P ∨ (Q ∧ R) (P ∨ Q) ∧ (P ∨ R)
T T T T T T T T
T T F F T T T T
T F T F T T T T
T F F F T T T T
F T T T T T T T
F T F F T F F F
F F T F F T F F
F F F F F F F F
As you can see, the last two columns are exactly the same, no matter what the truth values
of P , Q and R were. Therefore, the two statements are always the same. We say that they
are equivalent. We indicate the fact that two statements P and Q are equivalent by writing
P ⇐⇒ Q.
Sets and Logic Page 11
Exercises
1. Set up truth tables to show the equivalence of the following pairs of statements:
(a) ¬(P ∧ Q) ⇐⇒ (¬P ) ∨ (¬Q);
(b) ¬(P ∨ Q) ⇐⇒ (¬P ) ∧ (¬Q);
(c) P ∧ (Q ∨ R) ⇐⇒ (P ∧ Q) ∨ (P ∧ R).
Now we can say what the condition must be. The second part of defining a set in this way must
consist of a var-statement. For example
x
{x ∈ N | ∈ N}
2
is the set of all positive integers x for which x/2 is also a positive integer, i.e. the set of even
positive integers. Note that “ x2 ∈ N” is a var-statement, because it depends on the value of x.
Thus, for every var-statement, we can create a set consisting of all elements that satisfy that
var-statement.
Examples:
• If P is the var-statement x > 5, then the set
{x ∈ R | x satisfies P }
consists of all real numbers that are greater than 5. (Draw this on the real line.)
• If P is the var-statement x + y = 1, then the set
consists of all points in the Cartesian plane that lie on the line defined by x + y = 1.
• If P is the var-statement x ∈ {1, 2, 3}, then the set
{x ∈ R | x satisfies P }
is exactly the set {1, 2, 3}. (Can you explain this? Does this also happen if we replace
{1, 2, 3} with another set?)
There is also a connection between the operations ∩ and ∪ between sets and the operations ∧
and ∨ between statements (or var-statements). Before reading further, can you guess what this
relationship is?
Did you come up with anything? The key is to think about the sets
{x ∈ T | P }, {x ∈ T | Q}, {x ∈ T | P ∧ Q}
where P and Q are var-statements involving x. For example if P is “x > 2” and Q is “x < 5”,
then
{x ∈ R | P } = (2, ∞)
{x ∈ R | Q} = (−∞, 5)
{x ∈ R | P ∧ Q} = (2, 5) = (2, ∞) ∩ (−∞, 5).
Sets and Logic Page 12
{x ∈ T | P ∧ Q} = {x ∈ T | P } ∩ {x ∈ T | Q}. (1)
x>0 or x ∈ Z
and asked you to draw on the real line all the values of x that satisfy this var-statement. Can you
see the connection between this drawing and the union of the sets
If you haven’t done so already, try to write down an equation that connects ∨ with ∪ similar to
equation (1) above.
Exercises
1. Write the following sets as a list of elements or as a union of intervals.
false ⇒ false
is true (since “it doesn’t rain” is false, and “we will go to the cinema” is also false). On the other
hand perhaps more subtly if the mother says the same thing and the next day it does rain but
they still go to the cinema we should also agree that what the mother said was not incorrect. This
leads to
false ⇒ true
being also a true statement. On the other hand if the mother says the same thing and the next
day it does not rain, then we see that what she said is only true if they do go to the cinema. This
means that
true ⇒ true
is true, while
true ⇒ false
is false. Convince yourself that if the mother had said “If a volcano erupts on Mars tomorrow,
then we will go to the cinema” that you would be lead to the same conclusions as we made with
respect to her previous statement (by considering all posibilities of whether a volcano on Mars
erupts or not, and whether they go to the cinema or not). Note that in this case there is no (at
least no obvious) causation between there being a volcano on Mars and going to the cinema. A
second (similar but much briefer) way of thinking about this is that we might agree that the only
way to show that the statement “P ⇒ Q” is false is to show that P is true and Q is false. From
this we are led (provided we agree that every statement is either true or false) to conclude that
the following statements are all true (since they are not false):
Sets and Logic Page 13
• true ⇒ true
• false ⇒ false
• false ⇒ false
while the following statement is false:
• true ⇒ false.
A third way to arrive to the same conclusion is think about the statements:
the first of which we think of as true because if x > 5 then certainly x > 2 also. On the other
hand, the second statement is false, since if x > 2 holds, it does not automatically imply x > 5.
For example, if x = 3, then x > 2 is true, but x > 5 is false.
Note that we will usually use conditional statements like this, to connect var-statements as
in the previous examples. We shall return to var-statements later but first we focus on how con-
ditional statements between statements behave. However, let us do so by taking x to be some
specific values in the conditional statements (2) and (3) the first of which we said was true, and
which we take to mean true for all x, while the second we take to be false (i.e. not true for every x)
Examples:
• If x = 6, then x > 5 is true and x > 2 is true, so “true ⇒ true” is a true statement;
• If x = 3, then x > 5 is false and x > 2 is true, so “false ⇒ true” is a true statement.
• If x = 0, then x > 5 is false and x > 2 is false, so “false ⇒ false” is a true statement.
• If x = 3, then equation (3) becomes “true ⇒ false,” which earlier we said to be false.5
Therefore we define the conditional statement P ⇒ Q (read “P implies Q” or “if P , then Q”)
by the following truth table:
P Q P ⇒Q
T T T
T F F
F T T
F F T
The last way we might approach understanding the statement P ⇒ Q is to simply define it to
mean (¬P ) ∨ Q. In other words we are saying that P ⇒ Q holds when P is false or Q is true.
Note that
P Q ¬P (¬P ) ∨ Q
T T F T
T F F F
F T T T
F F T T
and the final column is the same as in the truth table in our third approach.
5 The careful reader may wonder if there is some inconsistency when x = 0 or x = 6, but we will see that this is
Examples:
• “2 is prime ⇒ 5 is an odd integer” is true, since both parts of this statement are true;
(Note that these statements are unrelated, so it doesn’t agree with our usual intuition of
conditional statements. However, building up conditional statements properly means that
we have to assign a truth value to this conditional statement according to the truth table
that defines it.)
• “5 is even ⇒ 5 is odd” is a true statement, since the first statement is false and the second
is true;
• “5 is odd ⇒ 5 is even” is a false statement, since the first statement is true and the second
is false. (Note the difference between this statement and the previous one. In this case, the
premise holds, but the conclusion doesn’t. Therefore the implication can’t be right. In the
previous one, the premise didn’t hold, so the implication could not say anything about the
conclusion.)
Let us now return to conditional var-statements. As our first example let us look at
x>5 ⇒ x > 2,
again. Technically speaking we should consider this a var-statement, i.e. for each value of x this
statement can be either true or false, and a priori it may depend on the value of x. But, in fact,
it turns out that this statement is true for all x.
Precisely this is what corresponds to our usual intuition of implication. When we say x > 5
is a stronger statement than x > 2 (i.e. if x satisfies x > 5, it automatically satisfies x > 2), we
mean that for any value of x, if x > 5 is true, then x > 2 is also true. Said differently, for any
value of x, the conditional statement x > 5 ⇒ x > 2 is true.
Often when mathematicians say that a var-statement “x > 5 ⇒ x > 2” is true, they mean
that it is true for all values of x. You will encounter many statements of this kind in this course.
At the start we will be explicit about saying “For all”, but later we will drop it and expect you to
understand that there is an implicit “For all” in the statement.
Note that the opposite implication, x > 2 ⇒ x > 5 is false. That means that there is some
x-value for which the conditional statement x > 2 ⇒ x > 5 is false. For example, if x = 3, then
x > 2 is true, x > 5 is false, and hence x > 2 ⇒ x > 5 must have the same truth value as
true ⇒ false, i.e. false. Note, however, that if x = 6, then the statement becomes “true ⇒ true”
which is true! Thus
x > 2 ⇒ x > 5,
is true for some values and false for others. But mathematicians will often say this statement is
false, because it is not true for all values of x. We shall make this more precise in the section on
quantifiers.
There are two very important properties of conditional statements. The first property is that
if P is true and P ⇒ Q is true, then Q must be true as well. One way to see this is from the truth
table that defines P ⇒ Q. The only row in which P is true and P ⇒ Q is true is the row in which
Q is also true. More intuitively, if you knew that something (P ) were true and that something
else (Q) had to follow from it (P ⇒ Q), then that something else (Q) had to be true as well.
The second property is that implication is transitive. This means that, if P ⇒ Q and Q ⇒ R,
then P ⇒ R. As before, look at the following truth table and try to explain why this is the case:
Sets and Logic Page 15
P Q R P ⇒Q Q⇒R P ⇒R (P ⇒ Q) ∧ (Q ⇒ R)
T T T T T T T
T F T F T T F
F T T T T T T
F F T T T T T
T T F T F F F
T F F F T F F
F T F T F T F
F F F T T T T
Note that the last two columns are not equal. However, the sequence F–T never occurs in any
row. Therefore if we call the last column Z and the second to last column Y , then the statement
Z ⇒ Y is true, no matter what combination of P, Q, R we take.
Let us try to describe this verbally as well. Let’s say we know that Q is a direct consequence
of P and that R is a direct consequence of Q. (That is what P ⇒ Q and Q ⇒ R mean.) Then
certainly R is also a direct consequence6 of P .
These two very important properties form the basis of mathematical reasoning. A proof, or
argument, normally consists of stringing together implications. In the simplest case we string
together P ⇒ Q and Q ⇒ R to conclude P ⇒ R, but in general these strings can become quite
long, and sometimes even non-linear. We shall discuss this further when we discuss proofs.
In the previous subsection we made a connection between the operations ∪ and ∩ and the
operations ∨ and ∧. Implication of var-statements can also be linked to a set-theoretic notion —
that of being a subset.
Examples:
• The implication “x > 5 ⇒ x > 2” corresponds to the set inclusion (5, ∞) ⊆ (2, ∞).
• The implication “If n4 ∈ N then n2 ∈ N.” corresponds to inclusion of the set of positive multi-
ples of 4 in the set of positive even numbers (informally {4, 8, 12, 16, 20, . . .} ⊆ {2, 4, 6, 8, . . .}).
• The implication “If n is a prime number, then n is an odd integer.” is false. This corresponds
to the fact that the set of prime numbers is not a subset of the set of odd numbers. Why?
• The fact that the empty set is a subset of all other sets corresponds to the implication “false
⇒ Q” being true for any other statement Q. More concretely:
– ∅ ⊆ {1, 2, 3} corresponds to “false ⇒ x ∈ {1, 2, 3}” being a true statement;
– ∅ ⊆ {1, 3, 5, 7, . . .} corresponds to “false ⇒ x is odd” being a true statement;
– ∅ ⊆ {2, 4, 6, 8 . . .} corresponds to “false ⇒ x is even” being a true statement;
– generally, for any set A, ∅ ⊆ A corresponds to (x ∈ ∅ ⇒ x ∈ A); and x ∈ ∅ is false for
all x. Thus “false ⇒ Q” is always a true statement.
Closely related to conditional statements are biconditional statements: “P ⇐⇒ Q”,
meaning “P ⇒ Q and Q ⇒ P .” This behaves like the = sign for numbers. If two statements P
and Q are equivalent (essentially the same), then we write P ⇐⇒ Q. We shall dive in straight
away with biconditional var-statements.
This definition of biconditional which we have already used can be justified by the truth table:
6 Again, in common speech one might argue over whether something is a direct consequence if there is something
that happens in between, but in Mathematics the fact that if P is true, then R has no option but to be true means
that R is a direct consequence of P .
Sets and Logic Page 16
P Q P ⇒Q Q⇒P (P ⇒ Q) ∧ (Q ⇒ P ) P ⇔Q
T T T T T T
T F F T F F
F T T F F F
F F T T T T
Examples:
• “x > 2 ⇐⇒ ¬(x ≤ 2)”, since saying x is greater than 2 is equivalent to saying x is not less
than or equal to 2. Note that as sets
Exercises
1. Determine which of the following statements are true and which are false:
2. For each of the following var-statements, determine for which values of x it is true and for
which it is false:
3. Which of the following are true? (Remember, a conditional var-statement such as the fol-
lowing is true if it is true for all values of x and false if it is false for some value of x.)
4. Determine which of the following are true by first determining the set associated to each
side and then deciding whether the appropriate inclusion holds.
6. Use truth tables to show that the following statements are always true:
Sets and Logic Page 17
3.5 Quantifiers
We also have the shortcut symbols ∃ for the phrase “there exists”, and ∀ for the phrase “for all”
or “for every”. These two symbols are called quantifiers.
If P (x) is a var-statement that depends on x which is an element of S, then the statement
∀x ∈ S, P (x)
is true if P (x) is true for all possible values of x in S and false if there is one or more value of x
in S for which P (x) is false. It is therefore convenient to interpret the statement ∀x ∈ S, P (x) as
“P (x) is true for all x ∈ S”.
Examples:
• ∀x ∈ R, x
2 ∈ R is true, since every real number divided by 2 is still a real number;
• ∀x ∈ Z, x
2 ∈ Z is false, since if you divide an odd integer by 2, the answer is no longer an
integer;
∃x ∈ S, P (x)
is true if there is one or more value of x ∈ S for which it is true and false if it is false for all values
of x. It is therefore convenient to interpret the statement ∃x ∈ S, P (x) as “P (x) is true for at
least one x ∈ S”.
Examples:
• ∃x ∈ R, x < 0 is true, since there are negative real numbers. For example x = −1 is an
example for which x < 0 is true;
• ∃x ∈ R, x2 + 1 = 0 is false, since it is impossible for a real number x to satisfy this equation;
• ∃x ∈ Q, x2 ≤ 0 is true, since if x = 0, then x ≤ 0 is true.
Note that all the examples above are statements, not var-statements. Take the first one for
example. Call “ x2 ∈ R” the inside statement. The inside statement is a var-statement which
depends on the value of x. But the entire statement “∀x ∈ R, x2 ∈ R” does not give different
truth values for different values of x. Either the inside statement is true for all values of x, in
which case the entire statement is true; or it is false for some value of x, in which case the whole
statement is false. In the end, the entire statement is either true or false.
Sets and Logic Page 18
Examples:
• We show that the statement ¬(∀x ∈ S, P (x)) is equivalent to the statement ∃x ∈ S, ¬P (x).
Indeed, if the first statement is false, then ∀x ∈ S, P (x) is true, so P (x) is true for all x ∈ S.
This means that ¬P (x) is always false, so ∃x ∈ S, ¬P (x) is false.
If the first statement is true, then ∀x ∈ S, P (x) is false, i.e. P (x) is not true for all x ∈ S,
i.e. there is some x ∈ S for which P (x) is false. For that specific x the statement ¬P (x) is
true, and so ∃x ∈ S, ¬P (x) is true.
• When negating statements we can use a combination of the following (here ⇐⇒ indicates
the equivalence of the statements on either side of it):
– ¬(P ∧ Q) ⇐⇒ (¬P ) ∨ (¬Q);
– ¬(P ∨ Q) ⇐⇒ (¬P ) ∧ (¬Q);
– ¬(∀x ∈ S, P (x)) = ∃x ∈ S, ¬P (x);
– ¬(∃x ∈ S, P (x)) = ∀x ∈ S, ¬P (x). (An exercise will ask you to explain this like in the
previous bullet point.)
For example, to negate P ∧ (∃x ∈ S, Q(x)), we proceed as follows:
Sometimes two or more quantifiers are used in the same statement. For example, the (true)
statement “for every rational number x, there exists a rational number y such that x = 2y” can
be written as
∀x ∈ Q ∃y ∈ Q, x = 2y.
For it to be true, the statement
∃y ∈ Q, x = 2y
must be true for every rational number x. Well, no matter what x is, we can always divide it by
2 and get another rational number x/2. If y = x/2, then 2y = x. So the statement x = 2y is true
for the specific value y = x/2 and therefore
∃y ∈ Q, x = 2y
is true. (There is at least one y that makes x = 2y true.) It didn’t matter which x we picked, so
∃y ∈ Q, x = 2y
∀x ∈ Q ∃y ∈ Q, x = 2y
is a true statement.
Notice that the order in which quantifiers appear is important! The above statement is not
the same as
∃y ∈ Q ∀x ∈ Q, x = 2y,
which means “there exists a rational number y such that every rational number x satisfies x = 2y”.
For this statement we wish to find at least one y for which the statement
∀x ∈ Q, x = 2y
Sets and Logic Page 19
is true. But the statement x = 2y cannot be true simultaneously for x = 0 and for x = 1 (since
then 0 = 2y = 1). So, the statement
∀x ∈ Q, x = 2y
is always false, and so the statement
∃y ∈ Q ∀x ∈ Q, x = 2y
is false.
Exercises
1. Determine whether the following statements are true or false:
2. Suppose S(x) is a var-statement about the number x ∈ R. Explain the following in a way
similar to what was done in the text:
¬ ∃x ∈ R, S(x) ⇔ ∀x ∈ R, ¬S(x),
i.e. the negation of “there exists x ∈ R for which S(x) is true” is “S(x) is false for every
x ∈ R”.
3. Write down the negation of the following statements:
(a) ∃x, P (x) ∨ Q(x); (c) (P ∧ Q) ∨ R; (e) ∃x, ∀y, P (x, y).
(b) ∀x, P (x) ∧ Q(x); (d) P ∧ (Q ∨ R);
∀x ∈ Z ∃y ∈ Z, x = 2y.
Examples:
• “n is an even number.” This means, first of all, that n is an integer, but secondly that if we
divide n by two, the result is still an integer. We may thus write this statement in one of
the following ways:
n
n∈Z∧ ∈Z or ∃m ∈ Z, n = 2m.
2
(Convince yourself why each of these statements encode the fact that n is an even number.)
Note that it is not necessary to use symbols to write this statement; equally good would be:
“n is an integer and n2 is also an integer” or “there exists some integer m such that n = 2m.”
Sets and Logic Page 20
• “The set A contains exactly two elements.” This means that we can find two different
elements in A, and if we take any element of A, it must be one of those two elements.
Firstly, how do we say we can find find two different elements of A?
∃x, y ∈ A, x ̸= y.
So the two elements x and y now have the property that they are different from each other.
What other property do we need? If z is any element of A, then z must be either x or y.
∀z ∈ A, (z = x) ∨ (z = y).
Exercises
1. Express the following statements in terms of the operations ∀, ∃, ∧, ∨, ¬, ⇒, ⇐⇒ :
(a) The set A contains exactly one element.
(b) n is a composite number. (Recall that a composite number is a number greater than 1
which is not prime.)
(c) n is a perfect square (i.e. the square of an integer)
(d) x is the largest element in the set A.
(e) The element n is simultaneously the square of an integer and the third power of an
integer.