Professional Documents
Culture Documents
Sma2100 Discrete Mathematics
Sma2100 Discrete Mathematics
OF
AGRICULTURE & TECHNOLOGY
DEPARTMENT OF INFORMATION
TECHNOLOGY
I. A OKELLO
(ireneokello@yahoo.com)
2. Sets: elements, specification, finite and infinite, universal, empty and dis-
joint sets, subsets, vehn diagram, union, intersection, compliment, difference,
number of elements, logical arguments, sets of sets, the power set and the
cartesian product.
Prerequisite: None
Course aims
The purpose of this course is to enable the students to:
1. Appreciate the Algebra of Logic, including truth tables, implication and equiv-
alence
2. Appreciate the language of sets, and apply set theory in solving problems
involving vehn diagrams
ii
Learning outcomes
Upon completion of this course you should be able to;
1. Proficiently handle the basics of set theory, rules of logic, functions and math-
ematical induction required for Information Technology
Instruction methodology
Lectures and tutorials, Case studies, Review of projects, theses and Journal articles
Course Journals
1. Journal of Applied Mathematics and Computation
Assessment information
The module will be assessed as follows;
• 20% of marks from one written CAT to be administered at JKUAT main cam-
pus or one of the approved centres
iii
Contents
1 Set Theory 1
1.1 Set Notation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Set operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.2.1 Set Union . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.2.2 Set Intersection . . . . . . . . . . . . . . . . . . . . . . . . 5
1.2.3 Set Difference . . . . . . . . . . . . . . . . . . . . . . . . . 7
2 Complement of a set 8
2.1 Set identities / boolean algebra . . . . . . . . . . . . . . . . . . . . 9
2.1.1 More Revision Exercise . . . . . . . . . . . . . . . . . . . . 13
2.1.2 Simplifying Using Boolean Algebra . . . . . . . . . . . . . 13
4 Logic 23
4.1 NEGATION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
4.2 CONJUNCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
4.3 DISJUNCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
4.4 Logical implication/ conditional . . . . . . . . . . . . . . . . . . . 28
4.4.1 Double implication/ biconditional . . . . . . . . . . . . . . 30
iv
CONTENTS CONTENTS
5.0.4 Equivalences . . . . . . . . . . . . . . . . . . . . . . . . . 35
• Note/ Remarks . . . . . . . . . . . . . . . . . . . 36
• More Revision Questions . . . . . . . . . . . . . 37
6 Valid Arguments 38
6.1 Predicates And Quantifiers . . . . . . . . . . . . . . . . . . . . . . 41
6.1.1 Universal quantifier: . . . . . . . . . . . . . . . . . . . . . 42
6.1.2 Existential Quantifier: . . . . . . . . . . . . . . . . . . . . . 42
• Universal Quantifiers Examples . . . . . . . . . . 42
• Existential Quantifiers Examples. . . . . . . . . . 43
6.2 Negation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
• More Revision Questions . . . . . . . . . . . . . 45
7 Functions / Mappings 47
7.1 Types of functions . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
7.1.1 One to one / injection . . . . . . . . . . . . . . . . . . . . . 48
• ONTO / SURJECTIONS . . . . . . . . . . . . . . 49
7.1.2 Bijection . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
• Identity function . . . . . . . . . . . . . . . . . . 50
• Inverse function . . . . . . . . . . . . . . . . . . 50
7.1.3 Computing an inverse . . . . . . . . . . . . . . . . . . . . . 51
7.1.4 Composite functions . . . . . . . . . . . . . . . . . . . . . 51
9 Indirect (contra-positive) 58
9.1 Proof by contradiction . . . . . . . . . . . . . . . . . . . . . . . . . 58
9.1.1 Counter example (disproof) . . . . . . . . . . . . . . . . . . 59
9.2 Mathematical induction . . . . . . . . . . . . . . . . . . . . . . . . 59
10 Continuation 62
v
CONTENTS CONTENTS
vi
SMA 2100 DISCRETE MATHEMATICS
LESSON 1
Set Theory
A set is a collection of objects that are precisely defined i.e no two members of a
set are indistinguishable and given any object it is possible to tell whether or not it
belongs to a given set.
The objects in a set are called members or elements of a set. A set contains its
members.
Describing a Set
There are two ways in which we can describe a set
a) Listing method - This is usually used for finite sets i.e a set whose elements are
finite.
To use this method, we list all the members of this set separated by a comma and
enclosed by curly brackets
Example
If the elements a, b, c, d belongs to set A, we denote this by A = {a, b, c, d}
The method also works for infinite sets where the pattern / sequence is clear.In this
case we list the first few members and put three dots at the end
Example
Suppose A is the set of all positive whole numbers. This can be represented by
A = {1, 2, 3, 4, · · · }.
It also works in the case where the set extends infinitely on either end.
Example
B is the set of all whole numbers. Then B can be represented as
B = {· · · , −4, −3, −2, −1, 0, 1, 2, 3, 4, · · · } or
B = {0, ±1, ±2, ±3, ±4, · · · }
1
SMA 2100 DISCRETE MATHEMATICS
Order of a Set
The order of a set is the number of elements in the set. it is also called the cardinality
of a set denoted by |A| or n(A)
If a set is infinite, then it is said to be of infinite order and if a set is finite, then it is
said to be of finite order.
A set of order one is called a singleton
Example
A = {a, b, c, d}, |A| = 4
B = {a}, |B| = 1, B is a singleton
Empty Set
This is a set that has no elements. It is also called the null set, and is denoted by 0/
or {}.
Example
A = {x | x is a prime number and x is a multiple of 4}
Prime numbers are 2, 3, 5, 7, 11, · · ·
2
SMA 2100 DISCRETE MATHEMATICS
Subsets
The set A is said to be a subset of B, written as A ⊂ B if and only if every element
of A is also an element of B i.e. for every x ∈ A, x ∈ B. This is read as “A is a
subset of B” or “A is contained in B”. From the bigger set point of view, B ⊃ A, “B
is a super set of A ”
Example
Let B = {a, b, c, d, e, f , g, h}
A = {a, e, f }
Then A ⊂ B or B ⊃ A
Equal Sets
Two sets A and B are said to be equal if for every x ∈ A, x ∈ B i.e A ⊂ B and for
every y ∈ B, y ∈ A i.e B ⊂ A. Therefore A = B if A ⊂ B and B ⊂ A
Example 1
A = {1, 3, 5} , B = {1, 5, 3} and C = {1, 1, 5, 5, 3} are equal sets
Example 2
A = {a, c, e} and B = {a, c, a} are not equal sets since e ∈ A but e ∈
/B
Remarks
- A non-trivial proper subset is therefore any subset other than the empty set and
the whole set.
Equivalent Sets
Two sets A and B are said to be equivalent if there exist a one to one correspondence
between them i.e for every x ∈ A, then exist a unique y ∈ B and for every t ∈ B,
there exists a unique k ∈ A.
3
SMA 2100 DISCRETE MATHEMATICS
Power set
Given a set A, the power set of A. The power set of A is denoted by ρ(A).
Example.
A = 0, 1, 2
(A) = 0,/ 0, 1, 2, 0, 1, 0, 2, 1, 2, 0, 1, 2
If |A| = n then |ρ(A)| = 2n
Exercise
1. List the set given below
i. A = {x | x is an even number greater than 20}
A = {22, 24, 26, · · · }
ii. B = {t | t is a perfect cube}
B = · · · , −8, −1, 0, 1, 8, 27, · · ·
iii. C = {p | p is a prime less than 100}
C = 2, 3, 5, · · · , 97
iv. D = x | x2 + 1 = 0
D = {} or 0/
2. Express the following sets in set Builder notation,x | p(x)
a) 1, 2, 3, 4
A = { x | x is a whole number 1 ≤ x ≤ 4}
b) A = 2, 3, 5, 7, 11
A = {x | x is a prime number less than11}
c) A = 4, 9, 16, 25, 36
A ={x | x is a perfect square 4 ≤ x ≤ 36}
d) −2, 0, 2, 4, ...
A ={x | x is an even number ≥ −2}
Example . let A = {a, b, c}
Find |A| , ρ(A), and |ρ(A)|
Solution: |A| = 3
ρ(A) = {0,/ {a} , {b} , {c} , {a, b} , {b, c} , {a, c} , {a, b, c}}
|ρ(A)| = 8
4
SMA 2100 DISCRETE MATHEMATICS
Example
The union of two sets A and B can be presented in a vehn diagram
If the intersection of two two sets is empty (A and B do not have common elements),
A ∩ B = 0,/ then the two sets are said to be disjointed. The disjoint sets A and B are
5
SMA 2100 DISCRETE MATHEMATICS
Examples
1. A = {1, 3, 5} B = {1, 2, 3} then A ∩ B = {1, 3 }
2. A = {a, b, 3, 1, c, d } B = {1, 2, c, k, f } then A ∩ B = {1, c }
3. A = {a, b, c, d }, B = {1, 2, 3 } then A ∩ B = 0/
A and B are disjoint sets.
4. Let A =set of all ladies in the world
B =Set of all students taking Mathematics
C =Set of all men
then A ∩C = 0/
B ∩C =set of all men taking Mathematics.
Note
i. A ∩ B ⊂ A
ii. A ∩ B ⊂ B
iii. B ⊂ A ∪ B
iv. A ⊂ A ∪ B
Remarks
Set Union
1. For any set A, A ∪ 0/ = A
2. If A ⊂ B, then A ∪ B = B , in a vehn diagram
6
SMA 2100 DISCRETE MATHEMATICS
(A ∩ B) ∩C A ∩ (B ∩C)
9. For any two sets A and B, A ∩ B = B ∩ A
10. For any set A, A ∩ A = A
Example . let A = {x | 1 < x < 3} and B = {x | 2 ≤ x ≤ 7},
Find A ∪ B, , and A ∩ B
Solution:
A ∪ B = {x | 1 < x ≤ 7}
A ∩ B = {x | 2 ≤ x < 3}
A−B B−A
Examples
1. A = {1, 3, 5} B = {1, 2, 3} then A − B = {5 } and B − A = {2}
Remarks
i. In general A − B 6= B − A
ii. (A − B) ∩ (B − A) = 0/
7
SMA 2100 DISCRETE MATHEMATICS
LESSON 2
Complement of a set
8
SMA 2100 DISCRETE MATHEMATICS
Remarks
2. Any of the properties in a given pair is said to be the dual property of the
other.
3. To obtain the dual property, replace ∪ with ∩ and U with 0/ and vice versa.
4. These set identities are similar to logical equivalence we are going to see later
Proof
There are three different methods of proving the set identities
9
SMA 2100 DISCRETE MATHEMATICS
• Vehn diagram
• Showing that one of the sets is a subset of the other / set Builder notation.
b) De Morgan’s laws
(A ∪ B)c = Ac ∩ Bc and (A ∩ B)c = Ac ∪ Bc
(A ∪ B)c Ac ∩ Bc
(A ∩ B)c Ac ∪ Bc
10
SMA 2100 DISCRETE MATHEMATICS
⇒ y ∈ A ∪ B and y ∈ A ∪C
⇒ y ∈ A or y ∈ B and ⇒ y ∈ A or y ∈ C
⇒ y ∈ A or y ∈ B and y ∈ C
⇒ y ∈ A or y ∈ B ∩C
⇒ y ∈ A ∪ (B ∩C)
∴ (A ∪ B) ∩ (A ∪C) ⊂ A ∪ (B ∩C) ii
From equations i and ii,
A ∪ (B ∩C) = (A ∪ B) ∩ (A ∪C)
⇒ x ∈ Ac ∪ Bc
⇒ (A ∩ B)c ⊂ Ac ∪ Bc i
11
SMA 2100 DISCRETE MATHEMATICS
Again let y ∈ Ac ∪ Bc ⇒ y ∈ Ac or y ∈ Bc
⇒y∈ / A or y ∈
/ B, ⇒ y ∈
/ A∩B
c
⇒ y ∈ (A ∩ B)
∴ Ac ∪ Bc ⊂ (A ∩ B)c ii
From equation i and ii
(A ∩ B)c = Ac ∪ Bc
12
SMA 2100 DISCRETE MATHEMATICS
if x ∈ B then x ∈ D since B ⊂ D
⇒ x ∈ C or x ∈ D
⇒ x ∈C∪D
∴ A∪B ⊂C∪D
1. A ∪ (B ∪C) = (A ∪ B) ∪C
2. A ∪ (B ∩C)c = (Cc ∪ Bc ) ∩ Ac
3. A ∩ (A ∪ B) = A
4. A ∩ (A ∪ B) = A
Example . Simplify A ∩ (A ∪ B)
c
13
SMA 2100 DISCRETE MATHEMATICS
=U Complementation law
14
SMA 2100 DISCRETE MATHEMATICS
LESSON 3
Principle of Inclusion and Exclusion
If A and B are disjoint sets, then the number of elements in their union equals the
sum of their respective orders i.e if A ∩ B = 0, / then |A ∪ B| = |A| + |B|.
However if A ∩ B 6= 0. / Then |A ∪ B| = |A| + |B| − A ∩ B. This is called the principle
of inclusion and exclusion for two sets. It can be extended for any finite number of
sets using the following theorem.
If A1 , A2 , A3 , · · · , An are sets then,
n
∑ ∑
|A1 ∪ A2 ∪ A3 ∪ · · · ∪ An | = ∑ |Ai |− Ai ∩ A j + Ai ∩ A j ∩ Ak −
1≤i< j≤n 1≤i< j<k≤n
i=1
· · · + − (−1)n |A1 ∩ A2 ∩ A3 ∩ · · · ∩ An |
∴ |A ∪ B ∪C| = |A| + |B| + |C| − |A ∩ B| − |B ∩C| − |A ∩C| + |A ∩ B ∩C|
15
SMA 2100 DISCRETE MATHEMATICS
|M ∩ T | = 9
|M ∩C| = 11
|C ∩ T | = 8
|M ∪ T ∪C| = 60 − 8 = 52
|M ∪ T ∪C| = |M| + |T | + |C| − |M ∩C| − |M ∩ T | − |C ∩ T | + |M ∩ T ∩C|
⇒ 52 = 25 + 26 + 26 − 11 − 9 − 8 + |M ∩ T ∩C|
|M ∩ T ∩C| = 3
Milk alone= |M| − |M ∩ T | − |M ∩C| + |M ∩ T ∩C| = 25 − 9 − 11 + 3 = 8
Coffee alone = |C| − |C ∩ T | − |C ∩ M| + |M ∩ T ∩C| = 26 − 9 − 8 + 3 = 12
Tea Alone |T | − |T ∩C| − |M ∩ T | + |M ∩ T ∩C| = 26 − 11 − 8 + 3 = 10
We can use the venn diagram to solve such a problem
|C|alone 26 − 11 − 8 + x = 7 + x
|T |alone 26 − 17 + x = 9 + x
|M|alone 25 − 20 + x = 5 + x
⇒ 25 + 9 + x + 7 + x + 8 − x = 52
⇒ 49 + x = 52 or x = 52 − 49 = 3
|C| alone = 7 + 3 = 10
|T | alone = 9 + 3 = 12
|T| alone = 5 + 3 = 8
|C ∩ T ∩ M| = 3
M and T only = 9 − 3 = 6
M and C only = 11 − 3 = 8
C and T only = 8 − 3 = 5
Example . Get the number of integers between 1 and 100 inclusively that are
divisible by either 2 or 5
Solution: Let A be the set of all integers divisible by 2, between 1 and 100
A = {x|1 ≤ x ≤ 100, x is divisible by 2}
16
SMA 2100 DISCRETE MATHEMATICS
= {2, 4, 6, 8, . . . , 100}
or A = {2y|1 ≤ y ≤ 50}
⇒ |A| = 50
Let B be the set of all integers divisible by 5 between 1 and 100.
B = {x|1 ≤ x ≤ 100, x is divisible by 5}
B = {5, 10, 15, . . . , 100}
or B = {5y|1 ≤ y ≤ 20}
|B| = 20
A ∩ B− set of all integers between 1 and 100 divisible by 2 and 5.
A ∩ B = {x|x is divisible by 10, 1 ≤ x ≤ 100}
= {10, 20, . . . , 100}
= {10y|1 ≤ y ≤ 10}
|A ∩ B| = 10
|A ∩ B| = |A| + |B| − |A ∩ B| = 50 + 20 − 10 = 60
Example . Get the number of integers between 1 and 100 inclusively divisible
by 3, 5, or 7
Solution: A = {x|is divisible by 3,1 ≤ x ≤ 100}
A = {3, 6, 9, . . . , 99}
= {3y|1 ≤ y ≤ 33}
|A| = 33
B = {x| is divisible by 5 1 ≤ x ≤ 100}
= {5, 10, 15, . . . .100}
= {5y|1 ≤ y ≤ 20}
|B| = 20
C = {x|is divisible by 7 1 ≤ x ≤ 100}
= {7, 14, . . . , 98}
|C| = 14
A ∩ B− set of all integers divisible by 3 × 5 = 15 between 1 and 100
A ∩ B = {x|1 ≤ x ≤ 100, x is divisible by 15 }
= {15, 30, . . . , 90}
= {15y|1 ≤ y ≤ 6}
|A ∩ B| = 6
17
SMA 2100 DISCRETE MATHEMATICS
18
SMA 2100 DISCRETE MATHEMATICS
|F ∪ E ∪ G| = 92 = x + 22 + x + 15 + x + 12 + 15 − x + 10 − x + 13 − x + x
92 = 87 + x
x=5
i) (15 − x) + (13 − x) + (10 − x) + x = 28
ii) 22 + x + 15 + x + 12 + x = 64
iii) 5
19
SMA 2100 DISCRETE MATHEMATICS
20
SMA 2100 DISCRETE MATHEMATICS
A = {a, b, c, d} B = {1, 2, 3}
A × B = {(a, 1)(a, 2)(a, 3)(b, 1)(b, 2)(b, 3)(c, 1)(c, 2)(c, 3)(d, 1)(d, 2)(d, 3)}
B×A = {(1, a), (1, b), (1, c), (1, d), (2, a), (2, b), (2, c), (2, d), (3, a)(3, b)(3, c)(3, d)}
Remarks
1. For ant two sets A × B 6= B × A unless A = B
/ =O
3. For any sets A, A × Ø = OA /
5. If A1 = A2 = . . . = An = A then A1 × A2 × . . . × An is denoted by An . In
particular the set of all real numbers R × R = R2 is the Euclidean plane of
dimension 2. R × R × R = R3 is the Euclidean plane of dimension 3.
21
SMA 2100 DISCRETE MATHEMATICS
Then A = C and B = D
Let a ∈ A and b ∈ B
⇒ (a, b) ∈ A × B
⇒ (a, b) ∈ C × D since A × B = C × D
⇒ a ∈ C and b ∈ D
⇒ A ⊂ C and B ⊂ D..................................i
Let c ∈ C and d ∈ D
⇒ (c, d) ∈ C × D
⇒ (c, d) ∈ A × B since A × B = C × D
⇒ c ∈ A and d ∈ B
⇒ C ⊂ A and D ⊂ B................................ii
Note :The results could not necessarily hold if A × B was empty.
Example
Let A = D = Ø and let B = {x} and c = {y}
Then A × B = Ø and C × D = Ø =⇒ A × B = C × D. But B * D
22
SMA 2100 DISCRETE MATHEMATICS
LESSON 4
Logic
The rule of logic gives precise meaning to mathematical statements. They are used
to distinguish between valid and invalid mathematical arguments.
In addition, rules of logic are used to verify the correctness of programs to design
computers circuits to construct computer programs.
Definition: Proposition – a proposition is a statement that is either true or false but
not that i.e. a statement whose truth value may be determined.
For instance, Kenyatta was the 1st president of USA
Example . For x, y ∈ R, x + y = y + x
1+1 = 2
2+2 = 3
Every prime number greater than 2 is odd and 24 is not a prime number
Remarks:
Proposition 1 and 4 are false whereas 2, 3 are true.
A statement in e.g. 5 constitutes of two propositions this is known as a compound
proposition
In propositions we avoid dealing with ambiguous case i.e. statements that are both
true and false at the same time.
Example . Consider the following sentences
What time is it?
Read the this carefully
x+1 = 2
x+y = z
Sentences 1 and 2 are not propositions because they are not statements: 3 and 4 are
neither true nor false since the variables have not been assigned any value.
More examples
Example . Consider x − y = y − x
This is not a proposition because the set allowed for the variables x and y is not
stated.
23
SMA 2100 DISCRETE MATHEMATICS
We normally use the lower case letters p, q, r, s to denoted proposition. The truth
value of a proposition is true denoted by T if it is a
true statement and false denoted by F if it is a false statement.
4.1. NEGATION
Let P be a proposition. Then the negation of P denoted ∼ P is the statement “not
P”
e.g. If P is the proposition 2 + 2 = 5 then ∼ P is the proposition 2 + 2 6= 5
If P is true ∼ p is false and vice versa.
If P is the statement “today is Friday”
If ∼ p is the statement “today is not Friday”
24
SMA 2100 DISCRETE MATHEMATICS
Definition:
A truth table displays relationships between truth values. It is useful in determining
truth values of compound
compositions.
Truth table representing negation of a statement P
P ∼p
T F
F T
Note: In all the truth tables if the number of propositions are n then we have up to
2n rows.
Venn diagram representation for negation of P.
4.2. CONJUNCTION
Let p, q be propositions the conjunction of p and q denoted by p∧q is the compound
proposition “p and q” e.g. suppose
p is the statement “it is cold”
q is the statement “it is raining”
p ∧ q is the statement “it is cold and it is raining”
The conjunction of two propositions will show a truth value T when both p and q
are true and is false otherwise.
Truth table for the conjunction of two propositions p and q
p q p∧q
T T T....1
T F F....2
F T F....3
F F F....4
Vehn diagram for conjunction of two sets
25
SMA 2100 DISCRETE MATHEMATICS
p q r p∧q∧r
T T T T 1
T T F F 2
T F T F 3
T F F F 4
F T T F 5
F T F F 6
F F T F 7
F F F F 8
p q ∼ ∼ p∧ ∼ ∼ p∧ ∼ ∼ p∧q p∧ ∼
p q q (p ∧ q) q q
T T F F T F F F F
T F F T F T F F T
F T T F F T F T F
F F T T F T T F F
4.3. DISJUNCTION
Let p and q be propositions. The proposition “p or q” denoted by ”p ∨ q” is the
proposition that is false when both p and q are false
otherwise
e.g. Let p be students who take calculus,
q be students who take computer science
p ∨ q = students who take calculus or computer science
i.e. we use an inclusive or truth tale for disjunction of two propositions p and q and
Venn diagram
26
SMA 2100 DISCRETE MATHEMATICS
p∨ ∼
T
T
T
F
q
p∨q
∼
T
T
F
p∨q
T
T
T
F
∼q
T
F
F
∼p
T
T
F
F
T
T
F
F
q
T
T
p
F
F
p q p∨q
T T T
T F T
F T T
F F F
Truth table for conjunction, disjunction and negation (for two proposition p and q)
27
SMA 2100 DISCRETE MATHEMATICS
∼ p∨ ∼ q p∧q ∼ p∧ ∼ q ∼ (p ∧ q) ∼ (p ∨ q)
F T F F F
T F F T F
T F F T F
T F F T T
Remark. Remarks:
1. If in a truth table, the columns for the two expressions are identical then we say
that these expressions are logically equivalent
2. In the particular case above ∼ (p ∧ q) and ∼ p∨ ∼ q the compound propositions
∼ (p ∨ q) and ∼ p∧ ∼ q are logically equivalent
respectively. This is the De. Morgan’s law of logics.
Definition:
Let p and q be propositions, the exclusive of p and q denoted by p ⊕ q is the propo-
sition that is true when exactly one of p and q is true
and it is false otherwise.
p q p⊕q
T T F
T F T
F T T
F F T
28
SMA 2100 DISCRETE MATHEMATICS
p q p→q
T T T
T F F
F T T
F F T
p q ∼p ∼q p→q ∼ p →∼ q ∼ q →∼ p
T T F F T T T
T F F T F T F
F T T F T F T
F F T T T T T
The final column for p → q and ∼ (p∧ ∼ q) are the same hence the two compound
statement are logically equivalent it therefore follows
that the two have same Venn diagram representation.
p∧ ∼ q ∼ (p∧ ∼ q)
p→q
The implication p → q can also be expressed in the following ways
. −if p then q −p is sufficient of q
−p implies q −q if p
−if p q −q whenever p
−p only if q −q is necessary of p
p q ∼p ∼q ∼ (p∧ ∼ q)
T T F F T
T F T T F
F T F F T
F F T F T
29
SMA 2100 DISCRETE MATHEMATICS
There are some related implications that can be formed from p → q. The proposi-
tion q → p is called the converse of p → q. The
contrapositive of p → q is ∼ q →∼ p and the inverse is ∼ p →∼ q. For any given
conditional p → q the conditional is logically
equivalent to the contra positive ∼ q →∼ p and inverse is logically equivalent to
the converse.
Example . Find the converse, inverse and contra positive of if today is Friday,
then I have a test today
Solution: p−Today is Friday
q−I have a test
i. Converse q → p if I have today then today is Friday.
ii. Inverse ∼ p →∼ p
it today is not Friday then I don’t have a test today.
iii. Contrapositive ∼ q →∼ p, if I dint have a test today then today is not Friday
30
SMA 2100 DISCRETE MATHEMATICS
p q ∼p ∼q p→q ∼ p →∼ q ∼ q →∼ p
T T F F T T T
T F F T F T F
F T T F T F T
F F T T T T T
Example . If ABCD is a square then ABCD is a rectangle (T)
converse: If ABCD is a rectangle then ABCD is a square (P)
Inverse: if ABCD is not a square then ABCD is not a rectangle. (T).
Contra positive: if ABCD is not a rectangle then ABCD is not a square (T).
31
SMA 2100 DISCRETE MATHEMATICS
LESSON 5
Necessity and Sufficiency
NECESSITY
Condition A is said to be a necessary condition for B if and only if false city non
existence of A guarantees false city of B.
E.g.: Consider the following statement. “Air is necessary for life” Life → Air.
SUFFICIENCY
A is said to be sufficient for B if the truth existence for A guarantees the truth for B.
Consider
When there is life, air must exist
Life is a sufficient condition for air.
In general from the condition p → q we say that p is a sufficient condition for q.
E.g
If someone is a mother she must be a lady.
Being a lady is a necessary condition for being a mother.
Being a mother is a sufficient condition for being a lady.
If you live in Nairobi then you live in Kenya.
Nairobi →Kenya
Example . Compute (p V q) W ∼ (p → q)
Solution:
Remarks:
32
SMA 2100 DISCRETE MATHEMATICS
p→q ∼ (p → q) ∼ (p → q)
V V W
p q p q (p q)
T T T T F T
T F F F T T
F T F T F F
F F F T F F
Sometimes when computing truth tables we can reduce the number of columns by
putting truth values under the proposition as well as under the connectives. From
the above example: (p ∧ q)∨ ∼ (p → q)
p ∧ q ∨ ∼ (P → q)
T T T T F T T T
T F F T T T F F
F F T F F F T T
F F F F F F T F
1 2 1 4 3 1 2 1
33
SMA 2100 DISCRETE MATHEMATICS
5.0.3. Contradiction
This is a compound proposition that is always false. To check whether a given
proposition is a contradiction we construct the truth table and
check if the final column is “ f ”.
Note: If P is a tautology ∼ p is a contradiction. The classical contradiction is
p∧ ∼ p
34
SMA 2100 DISCRETE MATHEMATICS
p ∼p p∧ ∼ p
T F F
F T F
Definition: A contingency is a compound proposition that is neither a tautology nor
a contradiction
Logical equivalence
Propositions p and q are called logically equivalent if p ↔ q is a tautology. This is
denoted by p ⇐⇒ q.
Example . Shown that the propositions p → q and ∼ p ∨ q are logically equiva-
lent
Solution:
p → q ↔ ∼ p ∨ q
T T T T F T T T
T F F T F T F F
F T T T T F T T
F T F T T F T F
1 2 1 4 2 1 3 1
5.0.4. Equivalences
35
SMA 2100 DISCRETE MATHEMATICS
Equivalence Name
1. P ∧ T ⇐⇒ P
P ∨ F ⇐⇒ P Identity laws
2.P ∨ T ⇐⇒ T
P ∧ F ⇐⇒ F Domination laws
3.P ∨ P ⇐⇒ P
P ∧ P ⇐⇒ P Idempotent Laws
4.∼ (∼ P) ⇐⇒ P Double Laws
5.P ∨ Q ⇐⇒ Q ∨ P
P ∧ Q ⇐⇒ Q ∧ P Commutative
Laws
6.(p ∨ q) ∨ r ⇐⇒ p ∨ (q ∨ r)
(p ∧ q) ∧ r ⇐⇒ p ∧ (q ∧ r) Associative Laws
Continuation of Equivalences
Distributive Laws
• p ∨ (q ∧ r) ⇐⇒ (p ∨ q) ∧ (p ∨ r)
• p ∧ (q ∨ r) ⇐⇒ (p ∧ q) ∨ (p ∧ r)
De morgan‘s Laws
• ∼ (p ∧ q) ⇐⇒∼ p∨ ∼ q
• ∼ (p ∨ q) ⇐⇒∼ p∧ ∼ q
• Note/ Remarks
p∨ ∼ p ⇐⇒ T
p∧ ∼ p ⇐⇒ F
(p → q) ⇐⇒ (∼ p ∨ q)
∼ (p1 ∨ p2 . . . ∨ pn ) ⇐⇒∼ p1 ∧ p2 . . . ∧ ∼ pn
∼ (p1 ∧ p2 . . . ∧ pn ) ⇐⇒∼ p1 ∨ p2 . . . ∨ ∼ pn .
Example . Shown that ∼ (p ∨ (∼ p ∧ q) ⇐⇒∼ p∧ ∼ q
Solution: ∼ (p ∨ (∼ p ∧ q) ⇐⇒∼ p∧ ∼ (∼ p ∧ q) De morgan‘s Laws
⇐⇒∼ p∧ ∼ (∼ p)∨ ∼ q) De morgan‘s Laws
⇐⇒∼ p ∧ (p∨ ∼ q) Double negation
⇐⇒ (∼ p ∧ p) ∨ (∼ p∧ ∼ q)Distributive
⇐⇒ F ∨ (∼ p∧ ∼ q)
36
SMA 2100 DISCRETE MATHEMATICS
2. i) p ∧ (q ∨ r) ⇐⇒ (p ∧ q) ∨ (p ∧ r)
3. ii) ∼ (p ∧ q) ⇐⇒∼ p∨ ∼ q
• [∼ p ∧ (p ∨ q) → q]
• [(p → q) ∧ (q → r)] → (p → r)
37
SMA 2100 DISCRETE MATHEMATICS
LESSON 6
Valid Arguments
p
q
e.g. If today is Saturday then I do not have to go to school, today is Saturday
Therefore I do not have to go to school
p q p→q
T T T
T F F Any assignments of truth value to the statement variable p and q
F T T
F F T
that make both p and p → q (premises) true i.e. the
first row q is also true thus valid.
2. p → q
q e.g. if today is Saturday then I don’t have to go to school, I do not have
to go to school
p Therefore today is Saturday.
3. p → q
q→r
p→r
38
SMA 2100 DISCRETE MATHEMATICS
We can test the validity of this statement by trying to find all assignment of truth
values that makes the conclusion false but all premises are
p must be true and r false - conclusion false In order for the 2nd premise to be true,
q must be true for the conclusion to be false and the
39
SMA 2100 DISCRETE MATHEMATICS
6. p∨ ∼ s
r ←→ s
r→q
p∨q
For p ∨ q to be false, both must be false. If p is false, then p∨ ∼ s to be true, ∼ s
must be true.
i.e. s must be false. Since q is false r → q then r must be false r ↔ s, F ↔ F ↔ T .
The argument is invalid because it makes the first premise true.
7. If Mr. Johnson resigns the presidency of his company, then Mr. Smith becomes
the president. If Mr. Smith is the president, then prices
will rise or productivity will fall. Mr. Johnson has resigned and productivity in-
creased, therefore prices will rise.
P - Mr. Johnson resigns the presidency of his company
q - Mr. Smith is the president
r - Prices will rise
s - Productivity will rise
p→q for conclusion to be false, r must be false
q → (r∨ ∼ s) for 3 to be true, p and s must be true
p∧s for 1 to be true, r must be true
r for 2 to be true, r must be true
Therefore the argument is invalid
Example . Write the inverse without using connectives.
If it is cold he wears a hat and
If productivity increases, then the wages rise
Solution: If it is cold he wears a hat.
Inverse: if it is not cold, he does not wear a hat.
If productivity increases, then the wages rise.
If productivity decreases, then wages will not rise
40
SMA 2100 DISCRETE MATHEMATICS
Example . Given the following propositions
p− “Milka reads the standard”
Solution: i. Milka reads the standard or the daily Nation, but not the Kenya times.
(p ∨ q)∧ ∼ r
ii. Milka reads the standard and daily Nation or does not read the standard and
Kenya times (p ∧ q)∨ ∼ (p ∧ r)
iii. It is not true that Milka reads the standard but not the daily Nation ∼ p ∨ r ⇔∼
(p∧ ∼ r)
iv. It is not true that Milka reads the Kenya times or the daily Nation but not the
standard ∼ [(r ∨ q)∧ ∼ p] or ∼ [∼ p ∧ (q ∨ r)]
41
SMA 2100 DISCRETE MATHEMATICS
42
SMA 2100 DISCRETE MATHEMATICS
∀x p(x) is true
4) Let p(x) be the statement “x < 2”. What is he truth value of the quantification
∀x ∈ R p(x) is false.
5) What is the truth value of ∀x p(x) when p(x) is the statement x2 < 10 and the
universe of discourse Consist of elements < 4.
∀x p(x) is true
43
SMA 2100 DISCRETE MATHEMATICS
6. Let p(x) be the statement “ x can speak Russian ” and let Q(x) be the statement
“ x knows C + +” Express each of the following
sentences in terms of quantifiers and logical connectives.
a) There is a student who can speak Russian and knows C++ ∃x (p(x) ∧ Q(x)
b) There is a student who can speak Russian but doesn’t know C++ ∃x (p(x)∧ ∼
Q(x))
c) Every student can either speak Russian or knows C++ ∀x (p(x) ∨ Q(x)
d) No student can speak Russian of knows C++ ∀x ∼ (p(x) ∨ Q(x)
e) Remarks When all the elements in the universe of discourse can be listed i.e.
x1 , x2 , . . . , xn follows that the universal quantification
∀x p(x) is the same as the conjunction P(x1 ) ∧ p(x2 ) ∧ . . . ∧ p(xn ) since this conjuc-
tion is true if and only if
p(x1 ), p(x2 ), . . . , p(xn ) are true.
NB
The Existential quantification ∃x p(x) is the some as the disjunction P(x1 ) ∨ p(x2 ) ∨
. . . ∨ p(xn )
i) Every student in this class has taken at least one computer science unit.
∀x ∃y P(x, y) P(x, y)−“ x has taken y” x− Students, y− Computer science
units.
ii) There is a student in this class who has taken at least one unit in computer science
∃x ∃y P(x, y), P(x, y) “x has taken y”
iii) Every student in this class has been in every building on campus ∀x ∀y P(x, y),
P(x, y) “x has been in y”.
iv) There is a student in this class who has been in every room of at least on one
building in campus
∃x ∃y ∀z (P(z, y) → Q(x, z)), P(z, y)− “z is in y”, Q(x, z)− “x has been in z”
v) Every student in this class has been in atleast one room of every building on
campus ∀x ∀y ∃z (P(z, y) → Q(x, y))
Example . Translate the statement
∀x (C(x, y) ∀ ∃y (C(y) ∧ F(x, y)))
C(y) has a computer
F(x, y) are friends
Solution: The universe for discourse for both x and y is the set of students in your
school.
44
SMA 2100 DISCRETE MATHEMATICS
Every student in you school has a computer or has a friend who has a computer.
6.2. Negation
“Every student in the class has taken calculus”
This can be expressed as ∀x p(x) where p(x) − x has taken calculus, x set of students
in the class
Negation is “It is not the case that every student in the class has taken calculus”.
This is the same as There is a student in the class who has
not taken calculus i.e. ∃x ∼ P(x). Therefore ∼ ∀x P(x) ⇐⇒ ∃x ∼ P(x)
Examples
1. Negate the following statements if the universe of discourse is the set of integers
a) ∀n (n2 ≥ 0) and ∃n (n2 < 0)
b) ∃n (n2 = 2) and ∀n (n2 6= 2)
c)∃n ∀m (n2 + m2 = 6) and ∀n ∃m (n2 + m2 6= 6)
d)∀n ∀m ∃p (p − (m + n)/2) and ∃n ∃m ∀p(p − (m + n) 6= 2)
45
SMA 2100 DISCRETE MATHEMATICS
(a) Every computer science student needs a course in discrete math ∀x p(x), p(x)
“ x needs a course in discrete”
(b) There is a student in this class who owns a p.c ∃x P(x) P(x)− “x owns
a p.c.”
46
SMA 2100 DISCRETE MATHEMATICS
LESSON 7
Functions / Mappings
Examples
X Y
x1 −→ y1
x2 −→ y2
x3 −→ y3
x4 −→ y4
X Y
x1 −→ y1
x2 −→ y2
x3 −→ y3
x4 −→ y4
x5 %
47
SMA 2100 DISCRETE MATHEMATICS
Defn
Let f1 and f2 be functions from A to B. Then f1 + f2 and f1 f2 are also functions
from A to B defined by
( f1 + f2 ) x = f1 (x) + f2 (x) and
( f1 f2 ) x = f1 (x) f2 (x)
Examples
1. Let f1 and f2 be functions from R −→ R such that f1 (x) = x2 and f2 (x) =
x − x2 , Then
( f1 + f2 ) x = f1 (x) + f2 (x) = x2 + x − x2 = x and
( f1 f2 ) x = f1 (x) f2 (x) = x2 x − x2 = x3 − x4
48
SMA 2100 DISCRETE MATHEMATICS
∴ 1 to 1
Example
f (x) = x2 where f : Z −→ Z
the function is not one to one since f (1) = f (−1) = 1 but 1 6= −1
Example
f (x) = x3 is one to one
f (x) = x + 1 is one to one
• ONTO / SURJECTIONS
A function f : X −→ Y is said to be onto, surjective only if
Examples
49
SMA 2100 DISCRETE MATHEMATICS
a −→ 1
b %
c −→ 2
d &
e −→ 3
7.1.2. Bijection
A function f : X −→ Y is said to be a bijection if it is both one to one and onto
X Y
a −→ 1
b −→ 2
c −→ 3
d −→ 4
e.g. f : R −→ R defined by f (x) = x3 is a bijection
• Identity function
For any non empty set X, there exist a trivial mapping that maps every element of
X to itself. This is called the identity function i.e.
i : X −→ X, such that i (x) = x, for every x.
• Inverse function
Let f : X −→ Y be a bijection, then for every y ∈ Y there exist a unique x ∈ X
such that y = f (x). Hence it is possible to define a function from Y to X. Such a
function is known as the inverse function, denoted by f −1 .
CLAIM
If f : X −→ Y be a bijection then |X| = |Y |
Proof
50
SMA 2100 DISCRETE MATHEMATICS
=⇒ f −1 (x) = x+3
2 .
X Y Z
Thus (g ◦ f ) x = g( f (x)), f ◦ g is not defined
Example . Let f , g : R −→ R be defined by
f (x) = x2 + 1 and
f (x) = 2x − 5
Solution: f ◦ g = ( f ◦ g) x = f (g(x)) = f (2x − 5)
(2x − 5)2 + 1 = 4x2 − 20x + 26 and
51
SMA 2100 DISCRETE MATHEMATICS
g ◦ f = (g ◦ f ) x = g( f (x)) = g x2 + 1
2 x2 + 1 − 5 = 2x2 − 3
Theorem
If f : X −→ Y is a bijection then f ◦ f −1 = f −1 ◦ f = i
Proof
Recall that if f (x) = y then f −1 (y) = x, consider
f ◦ f −1 y = f f −1 (y) = f (x) = y = iy
=⇒ f ◦ f −1 = i
f −1 ◦ f x = f −1 ( f (x)) = f −1 (y) = x = ix
=⇒ f −1 ◦ f = i
Therefore f ◦ f −1 = f −1 ◦ f = i
More examples
1. Let f be a function from {a, b, c } to {1, 2, 3 } such that f (a) = 2, f (b) = 1
and f (c) = 3.
Then f is invertible since it is a bijection. Furthermore f −1 (2) = a, f −1 (1) = b
and f −1 (3) = c.
Example . Let f , g : Z −→ Z be defined by f (x) = 2x + 3 and g (x) = 3x + 2.
Find f og and go f
Solution: Both f og and go f are defined,
f ◦ g = ( f ◦ g) x = f (g(x)) = f (3x + 2) = 2 (3x + 2) + 3 = 6x + 7 and
g ◦ f = (g ◦ f ) x = g( f (x)) = g (2x + 3) = 3 (2x + 3) + 2 = 6x + 11
NB f og 6= go f i.e the commutative law does not hold from composition of func-
tions
52
SMA 2100 DISCRETE MATHEMATICS
Example . If f (x) = −6−7x 3+18x
and g(x) = 10−4x 5−3x , find
i. f og, go f state the domain in each case
ii. Compute ( f og)(2) and (go f )(2)
Solution: i. f ◦ g = ( f ◦ g) x = f (g(x)) = f 10−4x
5−3x
3+18( 10−4x
5−3x ) 3(5−3x)+18(10−4x) −6(5−3x)−7(10−4x) 15−9x+180−72x
=⇒ −6−7 10−4x = (5−3x) / = −30+18x−70+28x
( 5−3x ) (5−3x)
195−81x
=⇒ ( f ◦ g) x = −100+46x the domain is all x ∈ R except where the function is not
defined, and the function is not defined where the denominator is equal to zero.
i.e. −100 + 46x = 0 or 46x = 100 =⇒ x = 100/46 = 50/23
The domain is the set R − {50/23}
195−81(2)
ii. ( f og)(2) = −100+46(2) = − 33 8
3+18x
g ◦ f = (g ◦ f ) x = g( f (x)) = g −6−7x
3+18x
10−4( −6−7x ) 10(−6−7x)−4(3+18x) 5(−6−7x)−3(3+18x) −60−70x−12−72x
= 5−3 3+18x = (−6−7x) / = −30−35x−9−54x
( −6−7x ) (−6−7x)
=⇒ (g ◦ f ) x = −72−142x
−39−89x the domain is all x ∈ R except where the function is not
defined, and the function is not defined where the denominator is equal to zero.
i.e. −39 − 89x = 0 or −89x = 39 =⇒ x = −39/89
The domain is the set R − {−39/89}
−72−142(2) 356
ii. (g ◦ f ) 2 = −39−89(2) = 217
Example . If f (x) = 3−6x
14−7x and g(x) = −5+16x
−2−10x , find f og, go f , state the
domain in each case
Solution: i. f ◦ g = ( f ◦ g) x = f (g(x)) = f −5+16x
−2−10x
3−6( −5+16x
−2−10x ) 3(−2−10x)−6(−5+16x) 14(−2−10x)−7(−5+16x) −6−30x+30−96x
=⇒ −5+16x = (−2−10x) / = −28−140x+35−112x
14−7( −2−10x ) (−2−10x)
=⇒ ( f ◦ g) x = 24−126x
7−252x the domain is all x ∈ R except where the function is not
defined, and the function is not defined where the denominator is equal to zero.
i.e. 7 − 252x = 0 or 252x = 7 =⇒ x = 7/252
The domain is the set R − {7/252}
3−6x
g ◦ f = (g ◦ f ) x = g( f (x)) = g 14−7x
3−6x
−5+16( 14−7x ) −5(14−7x)+16(3−6x) −2(14−7x)−10(3−6x) −70+35x+48−96x
= 3−6x = (14−7x) / = −28+14x−30+60x
−2−10( 14−7x ) (14−7x)
=⇒ (g ◦ f ) x = −22−61x
−58+74x the domain is all x ∈ R except where the function is not
defined, and the function is not defined where the denominator is equal to zero.
53
SMA 2100 DISCRETE MATHEMATICS
54
SMA 2100 DISCRETE MATHEMATICS
LESSON 8
Functions that involve Cartesian products
Since in the definition of functions we require 2 non empty sets, either of the two
or both may be a cartesian product set.
Example
3. f : R −→ R × R defined by f (x) = (x, y), this is onto but not one to one
• f (x) = ±x
√
• f (x) = x
p
• f (x) = ± (x2 + 1)
55
SMA 2100 DISCRETE MATHEMATICS
1. Consider the sequence {an } where an = 1n , we list the terms of this sequence
beginning with a0 , a1 , a2 , . . . i.e. 1, 12 , 13 , 14 , . . .
2. Consider the sequence {bn } with bn = (−1)n . The list of the terms begin
with b0 , b1 , b2 . . . i.e. 1, −1, 1, −1, . . .
8.1.2. Summations
n
To express the sum of terms from the sequence {an }, we use the notation ∑ ai
i=1
to mean the sum a1 + a2 + a3 + . . . + an
n
To express am + am+1 + am+2 + . . . + an by the notation , we have ∑ a j , here the
j=m
variable j is called the index of summation, m is the lower limit and n is the upper
limit.
Example . Express the sum of the first 100 terms of the sequence {a } n when
an = n1
Solution: Lower limit is 1, and the upper limit is 100
100 100
1 1
=⇒ ∑ n or ∑ j
n=1 j=1
5
Solution: ∑ j2 = 12 + 22 + 32 + 42 + 52 = 1 + 4 + 9 + 16 + 25 = 55
j=1
56
SMA 2100 DISCRETE MATHEMATICS
This proof is based on the logic that if p is true, q is true so long as p −→ q is valid
To prove p −→ q, one comes up with a series of propositions p1 , p2 , . . . , pn such
that p −→ p1 −→ p2 −→ . . . , pn −→ q. This leads to a conclusion p −→ q
Sometimes when coming up with intermediate propositions, one argues from both
proposition p and q. This is called the forward backward technique.
Example . Prove that if x is odd and y is even then xy is even
Solution: If x is odd, then x = 2k + 1, k ∈ Z
and if y is even, then y = 2p, p ∈ Z
Then xy = (2k + 1) 2p = 4kp + 2p = 2 (2kp + p)
∴ xy is even since 2kp + p ∈ Z
E XERCISE 21. Prove that the product of any two rational numbers is rational
57
SMA 2100 DISCRETE MATHEMATICS
LESSON 9
Indirect (contra-positive)
Since p −→ q ≡∼ q −→∼ p, the relation can be proved by showing that its contra
positive is true.
Example . Show that if 3n + 2 is odd then, n is odd
Solution: If p is the proposition that 3n + 2 is odd then ∼ p is the proposition that
3n + 2 is not odd and
If q is the proposition that n is odd then ∼ q is the proposition that n is not odd and,
we show that if n is even then 3n + 2 is even i.e. ∼ q −→∼ p
Assume that n is even, then n = 2k, k ∈ Z
=⇒ 3n + 2 = 3(2k) + 2
=⇒ 6k + 2 = 2(3k + 1)
∴ 3n + 2 is even since it is a multiple of 2.
58
SMA 2100 DISCRETE MATHEMATICS
E XERCISE 23. √
Prove that p is irrational for any prime number p
More Revision Exercise
√ √
1. Show that 3, 5 are irrational
Example . Show that the product of any two irrational numbers need not be
irrational
√ √ √
Solution: 3 is irrational but 3 × 3 = 3 is not irrational / rational
Example . Prove or disprove that 2 + 1 is prime for all non negative integers n.
n
59
SMA 2100 DISCRETE MATHEMATICS
• Let p (n) be a property that n must satisfy for a variable natural number n,
then if p (1) is true and p(k + 1)is true whenever p(k)is true for k ≥ 0,then
p() is true for every n ∈ N.
Example . Show that the sum of the first n natural numbers is n(n+1)
2
Solution: We need to show that 1 + 2 + 3 + · · · + n = n(n+1) 2
there are two steps involved
i. Base step: At this step we prove for n = 1,
1 = 1(1+1)
2 = 1, therefore true for n = 1
ii. Inductive step: Assume true for n = k and prove for n = k + 1
For n = k , then assume that
1 + 2 + 3 + · · · + k = k(k+1)
2 is true,
For n = k + 1,
1 + 2 + 3 + · · · + k + (k + 1) but 1 + 2 + 3 + · · · + k = k(k+1)
2 , therefore
k(k+1) k(k+1)+2(k+1)
1 + 2 + 3 + · · · + k + (k + 1) = 2 + (k + 1) = 2
= (k+2)(k+1)
2 hence true for n = k+1
Since true for n = 1, and true for n = k + 1 whenever true for n = k, the it is true for
every n ≥ 1
Example . Prove that the sum of the first n even natural numbers is n(n + 1)
Solution: We need to show that 2 + 4 + 6 + · · · + 2n = n(n + 1)
i. Base step: At this step we prove for n = 1,
2 = 1(1 + 1) = 2 hence true for n = 1
ii. Inductive step: Assume true for n = k and prove for n = k + 1
For n = k , then assume that
2 + 4 + 6 + · · · + 2k = k(k + 1) is true,
For n = k + 1,
2 + 4 + 6 + · · · + 2k + 2(k + 1) but 1 + 2 + 3 + · · · + 2k = k(k + 1), therefore
2 + 4 + 6 + · · · + 2k + 2(k + 1) = k(k + 1) + 2(k + 1)
= (k + 2)(k + 1) hence true for n = k + 1
Since true for n = 1, and true for n = k + 1 whenever true for n = k, the it is true for
every n ∈ N
60
SMA 2100 DISCRETE MATHEMATICS
E XERCISE 24. Prove that the sum of the first n odd natural numbers is n 2
E XERCISE 25. Show that the sum of the square of the first n natural numbers
is 1/6n(n + 1)(2n + 1)
Example . Suppose a 6= 1, show that 1 + a + a + a + · · · + a
2 3 n = an+1 −1
a−1
2
−1
Solution: For n = 1, 1 + a = aa−1 = (a+1)(a−1)
a−1 = a + 1 = 1 + a, hence true for n = 1,
ak+1 −1
Assume for n = k, then 1 + a + a2 + a3 + · · · + ak = a−1
for n = k + 1,
k+1
1 + a + a2 + a3 + · · · + ak + ak+1 = a a−1−1 + ak+1
k+1 k+1
= (a −1)+a a−1
(a−1)
k+1 k+2 −ak+1
= a −1+a a−1
k+2
= a a−1−1 therefore true for n = k + 1
Since true for n = 1, and true for n = k + 1 whenever true for n = k, the it is true for
every n ≥ 1
61
SMA 2100 DISCRETE MATHEMATICS
LESSON 10
Continuation
The first bracket is divisible by 2 by the assumption. The second bracket is also
even, since if k is even, then the product 3k(k + 1) and if k is odd then k + 1is even
and 3k(k + 1) is even. Therefore in any case 3k(k + 1) is even, hence k3 − k +
3k(k + 1) is even. Since true for n = 1 and true for n = k + 1, whenever true for
n = k, then it is true for all values of n.
62
SMA 2100 DISCRETE MATHEMATICS
– Q = x | x = ba , a, b ∈ Z, & gcd(a, b) = 1
63
SMA 2100 DISCRETE MATHEMATICS
For two integers a and b, a divides b, written as a/b if b can be written in the form
b = am, where m ∈ Z
Example . List the elements of the given set that are
1. Whole numbers
2. Natural numbers
3. Integers
4. Rational numbers
5. irrational numbers
6. Real numbers
√
Example . −12, 0, 4, 5, 10, 60, 22
√
7 , 0.345,
64
SMA 2100 DISCRETE MATHEMATICS
Solutions to Exercises
Exercise 1. |A| = 4
ρ(A) = {0,
/ {1} , {e} , {3} , {d} , {1, e} , {1, 3} , {1, d} , {e, 3} , {e, d} , {3, d} , {1, e, 3} , {1, e, d} , {e,
|ρ(A)| = 16
Exercise 1
Exercise 2. i. A ∩ B = {2, 4 }
ii B ∪C = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }
(B ∪C) − A = {6, 7, 8, 9, 10 }
iii.Ac = { 6, 7, 8, 9, 10 }
Ac ∩ (B ∪C) = { 6, 7, 8, 9, 10 } Exercise 2
Exercise 3. a) A ∩ B ∩C = {4, 6 }
b) A ∪ B ∪C = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }
c) A − B = { 8, 10 } and (A − B) ∪C = {4, 5, 6, 7, 8, 9, 10 }
d) A ∪ B = {0, 1, 2, 3, 4, 5, 6, 8, 10 } and
(A ∪ B) ∩C = {4, 5, 6, 8, 10 }
e) A ∩ B = {0, 2, 4, 6, } and
(A ∩ B) ∪C = {0, 2, 4, 5, 6, 7, 8, 9, 10 }
f) C − A = { 5, 7, 9 } Exercise 3
Exercise 4. Let x ∈ (A ∪ B)c ⇒x∈
/ A∪B
⇒x∈ / A and x ∈/B
⇒ x ∈ Ac and x ∈ Bc
⇒ x ∈ Ac ∩ Bc
⇒ (A ∪ B)c ⊂ Ac ∩ Bc i
Again let y ∈ A ∩ B ⇒ y ∈ A and y ∈ Bc
c c c
⇒y∈ / A and y ∈/ B, ⇒ y ∈
/ A∪B
c
⇒ y ∈ (A ∪ B)
∴ Ac ∩ Bc ⊂ (A ∪ B)c ii
From equation i and ii
(A ∪ B)c = Ac ∩ Bc
Exercise 4
Exercise 5. Let x ∈ A ∩ B
⇒ x ∈ A and x ∈ B
x ∈ C since A ⊂ C and
65
SMA 2100 DISCRETE MATHEMATICS
x ∈ D since B ⊂ D
⇒ x ∈ C and x ∈ D
⇒ x ∈C∩D
∴ A∩B ⊂C∩D
Exercise 5
Exercise 6. We can show from the left hand side or from the right hand side
From the left hand side
(A −C) − (B −C) = (A −C) ∩ (B −C)c
= (A ∩Cc ) ∩ (B ∩Cc )c
= (A ∩Cc ) ∩ (Bc ∪Ccc ) De Morgan’s law
= (A ∩Cc ) ∩ (Bc ∪C) Double complementation
= (A ∩Cc ∩ Bc ) ∪ (A ∩Cc ∩C) Distributive law
= (A ∩Cc ∩ Bc ) ∪ (A ∩ 0)
/ complementation
= (A ∩Cc ∩ Bc ) ∪ 0/ zero laws
c
= A ∩C ∩ B c Identity law
c
= A ∩ B ∩C c commutative law
c
= (A ∩ B ) ∩C c Associativity
= (A − B) −C which is the right hand side
Exercise 6
Exercise 7. [A ∪ (B ∩C)]c = Ac ∩ (B ∩C)c De Morgan’s law
= (B ∩C)c ∩ Ac Commutative law for intersections
= (Bc ∪Cc ) ∩ Ac De Morgan’s law
= (Cc ∪ Bc ) ∩ Ac Commutative law for union
Exercise 7
Exercise 11. Let S be the set of all who invested in stock market
Let C be the set of all who invested in CD‘s
Let B be the set of all who invested in Savings bonds
|C| = 45 − 23 − 13 + x = x + 9 = 14
66
SMA 2100 DISCRETE MATHEMATICS
|S| = 30 − 26 + x = x + 4 = 9
|B| = 44 − 36 + x = x + 8 = 13
|S ∪C ∪ B| = 75 = x + 9 + x + 8 + x + 4 + 13 − x + 13 − x + 23 − x + x
75 = x + 70
75 − 70 = x
or x = 5
a) 5
b) 13 − x + 23 − x + 13 − x + x = 39
c) Either 2, 1 or 1⇒80
d)9
e)14
Exercise 11
Exercise 12. Let F be the set of all who take coffee
Let T be the set of all who take tea
Let C be the set of all who take cocoa
67
SMA 2100 DISCRETE MATHEMATICS
iv. If
I have test today if today is Friday
v. Whenever
I have a test today whenever today is Friday
vi. Is necessary
Having a test today is necessary condition that today is Friday.
Exercise 13
Exercise 14. Let: P− you can access internet
q− You are a computer science major
R− You are a freshman
b. You cannot ride if you are under 4 feet tall unless you are older than 16 years.
p− You can ride
q− You are under 4 feet tall.
r− You are older than 16 years
Exercise 14
Exercise 15.
p → q ∧ [(q ∧ ∼ r) → (p ∨ r)]
T T T T T F F T T T T
T T T T T T T T T T F
T F F F F F F T T T T
T F F F F F T T T T F
F T T T T F F T F T T
F T T F T T T F F F F
F T F T F F F T F T T
F T F T F F T T F F F
1 2 1 5 1 3 2 4 1 2 1
Exercise 15
Exercise 16.
68
SMA 2100 DISCRETE MATHEMATICS
p ∨ (q ∧ r) ↔ (p ∨ q) ∧ (p ∨ r)
T T T T T T T T T T T T T
T T T F F T T T T T T T F
T T F F T T T T F T T T T
T T F F F T T T F T T T F
F T T T T T F T T T F T T
F F T F F T F T T F F F F
F F F F T T F F F F F F T
F F F F F T F F F F F F F
1 3 1 2 1 4 1 2 1 3 1 2 1
Exercise 16
Exercise 17.
(p ∧ q) → (p ∨ q) ⇐⇒∼ (p ∧ q) ∨ (p ∨ q)
⇐⇒ (∼ p∨ ∼ q) ∨ (p ∨ q) De Morgans
⇐⇒ (p∨ ∼ p) ∨ (∼ q ∨ q) Associativity
⇐⇒ T ∨ T
T
Exercise 17
p ∨ ∼ (p ∧ q)
T T F T T T
T T T T F F
Exercise 18. hence a tautology. Exercise 18
F T T F F T
F T T F F F
1 4 3 1 2 1
2−4x
Exercise 19. i. f ◦ g = ( f ◦ g) x = f (g(x)) = f −8x−4
2−4x
4−5( −8x−4 )
= −32x−16−10+20x
4(−8x−4)−5(2−4x) −6(2−4x)+3(−8x−4)
=⇒ −6 2−4x = (−8x−4) / −12+24x−24x−12
( −8x−4 )+3 (−8x−4)
−12x−26
=⇒ ( f ◦ g) x = −24 = 1/2x + 13/12 the function is defined for all values of x
The domain is the set R
4−5x
g ◦ f = (g ◦ f ) x = g( f (x)) = g −6x+3
4−5x
2−4( −6x+3 ) 2(−6x+3)−4(4−5x) −8(4−5x)−4(−6x+3) −12x+6−16+20x
= 4−5x = (−6x+3) / = −32+40x+24x−12
−8( −6x+3 )−4 (−6x+3)
8x−10
=⇒ (g ◦ f ) x = 64x−44 the domain is all x ∈ R except where the function is not
defined, and the function is not defined where the denominator is equal to zero.
69
SMA 2100 DISCRETE MATHEMATICS
70
SMA 2100 DISCRETE MATHEMATICS
71
SMA 2100 DISCRETE MATHEMATICS
72