Download as pdf or txt
Download as pdf or txt
You are on page 1of 78

JOMO KENYATTA UNIVERSITY

OF
AGRICULTURE & TECHNOLOGY

SCHOOL OF OPEN, DISTANCE &


eLEARNING
IN COLLABORATION WITH
INSTITUTE OF COMPUTER SCIENCE AND
INFORMATION TECHNOLOGY

DEPARTMENT OF INFORMATION
TECHNOLOGY

SMA 2100: DISCRETE MATHEMATICS

LAST REVISION ON November 5, 2013

I. A OKELLO
(ireneokello@yahoo.com)

P.O. Box 62000, 00200


Nairobi, Kenya
SMA 2100: DISCRETE MATHEMATICS
Course description
1. Logic: variables, open sentences, truth sets, propositions, truth values, log-
ical equivalence, truth tables, negation of statements, conjunction, disjunc-
tion, Tautology, contradiction, implication, contra positive, converse, inverse,
Existential and Universal quantifiers, negation with quantifiers and counter
example.

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.

3. Functions: domain, co domain, images, range, pre image, specification and


composition, inverse, injection, surjection, bijections, sum, difference, prod-
uct and quotient,

4. Methods of proof: direct, contra positive, contradiction and principle of Math-


ematical induction

5. Numbers: Classification of numbers, prime numbers.

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

3. Apply the properties of functions

4. Be able to recognize the different sets of numbers

5. Apply the methods of proof

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 Text Books


1. Elias Zakon. Basic concepts of Mathematics, the Trilia group (2001)

2. Backhouse. Pure Mathematics 1 and 2, Longman (1990)

3. Stewart I., Tall D. The foundations of Mathematics, Oxford Unversity Press


(1977)

4. Booth D. J. Foundation Mathematics, Adison wesley (1991)

Course Journals
1. Journal of Applied Mathematics and Computation

2. The Mathematical Scientist Journal

3. The College Mathematics Journal

Assessment information
The module will be assessed as follows;

• 20% of marks from two (2) assignments

• 20% of marks from one written CAT to be administered at JKUAT main cam-
pus or one of the approved centres

• 60% of marks from written Examination to be administered at JKUAT main


campus 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

3 Principle of Inclusion and Exclusion 15


3.1 Examples / Applications . . . . . . . . . . . . . . . . . . . . . . . 15
3.1.1 More Revision Questions . . . . . . . . . . . . . . . . . . . 19
3.2 Cartesian product . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
3.2.1 More Revision Questions . . . . . . . . . . . . . . . . . . . 22

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

5 Necessity and Sufficiency 32


5.0.2 Propositional Equivalences . . . . . . . . . . . . . . . . . . 34
5.0.3 Contradiction . . . . . . . . . . . . . . . . . . . . . . . . . 34

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

8 Functions that involve Cartesian products 55


8.1 Sequences and Summations . . . . . . . . . . . . . . . . . . . . . . 55
8.1.1 Sequences . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
8.1.2 Summations . . . . . . . . . . . . . . . . . . . . . . . . . . 56
8.2 Methods of Proof . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
8.2.1 Direct proof . . . . . . . . . . . . . . . . . . . . . . . . . . 57

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

10.1 Classification of numbers . . . . . . . . . . . . . . . . . . . . . . . 63


Solutions to Exercises . . . . . . . . . . . . . . . . . . . . . . . . . 65

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.

1.1. Set Notation


Normally we use uppercase letters to denote sets and lowercase letters to denote
elements. The notation x ∈ A means x is an element of A and read as “ x is an
element of A ”. The notation x ∈
/ A means “ x is not an element of A ”

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

b) Set Builder Notation


In this method we use the notation {x | p(x)}, where p(x) is a property/condition
that x must satisfy for it to be in the given set.
Example 1
The set of odd positive integers can be written as
O = {x | x is an odd positive integer}
Example 2
The set of all real numbers
R = {x | x is real}
We normally use this method when it is not possible to list all the elements of a
given set.
N.B.
Two sets are equal if and only if they have the same elements. the order in which
the elements are listed does not matter i.e. the sets {1, 3, 5} and {1, 5, 3} and
{1, 1, 5, 5, 3} are equal.
The capital letters R, N, Z, Q and C will be reserved to denote the set of real num-
bers, set of natural numbers, set of integers, set of rational numbers and set of
complex numbers respectively.

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

Multiples of 4 are 4, 8, 12, 16, 20, · · ·


Therefore the set A is null

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

- For every set A, A ⊂ A, it is called the improper subset.

- For the set A, 0/ ⊂ A, it is called the trivial subset.

- A non-trivial proper subset is therefore any subset other than the empty set and
the whole set.

- We denote a proper subset by A ⊂ B and improper subset by A ⊆ B.

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


E XERCISE 1.  let A = {1, e, 3, d}


Find |A| , ρ(A), and |ρ(A)|

4
SMA 2100 DISCRETE MATHEMATICS

1.2. Set operations


1.2.1. Set Union
Let A and B be two sets. The union of the sets A and B, denoted by A ∪ B, is the set
that contains all the elements in A or B or in both
i.e. A ∪ B = {x | x ∈ A or x ∈ B}
Examples
i. A = {1, 3, 5} B = {1, 2, 3} then A ∪ B = {1, 2, 3, 5}
ii. A = {a, b, 3, c, z, f } and B = {k, t, b, 1, c, z } then
A ∪ B = {a, b, 3, c, z, f , k, t, 1 }
Defn: Universal Set U
This is a set which contains all the objects under consideration.
Defn: Vehn Diagram
Sets can be represented graphically using Vehn diagrams. In Vehn diagrams, the
universal is represented by a rectangle. Inside the rectangle, circles are used to
represent sets.

Example
The union of two sets A and B can be presented in a vehn diagram

1.2.2. Set Intersection


Let A and B be two sets. The intersection of A and B, denoted by A ∩ B is the set
containing those elements in both A and B i.e. x ∈ A ∩ B if x ∈ A and x ∈ B.
Vehn diagram representing set intersection

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

represented by a vehn diagram as follows

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

3. For any 3 sets A, B and C, (A ∪ B) ∪C = A ∪ (B ∪C), in a vehn diagram

4. For any two sets A and B, A ∪ B = B ∪ A


5. For any set A, A ∪ A = A
Set Intersection
6. For any set A, A ∩ 0/ = 0/
7. If A ⊂ B, then A ∩ B = A
8. For any 3 sets A, B and C, (A ∩ B) ∩C = A ∩ (B ∩C), 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}


1.2.3. Set Difference


Let A and B be two sets, the difference of A and B denoted by A − B, is the set
containing those elements in A but not in B i.e. A − B = {x | x ∈ A and x ∈
/ B}

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

Let U be the universal set, the complement of the set A, denoted by Ac or A0 or Ā is


the set that contains all the elements found in the universal U set but not in set A ,
the set U − A i.e. Ac = {x | x ∈ U and x ∈ / A}

Example . If U = {a, b, c, d, e, f , g, h, t, j, k, p, m, z }
and A = {a, b, c, d } B = {e, f , g, h } and C = {m, k, t, h} then
Solution: Ac = {e, f , g, h, t, j, k, p, m, z }
Bc = {a, b, c, d, t, j, k, p, m, z }
Cc = {a, b, c, d, e, f , g, j, p, z }
A ∪ B = {a, b, c, d, e, f , g, h}
A ∩ B = 0/ therefore A and B are disjoint sets
(A ∪ B)c = {t, j, k, p, m, z }
(A ∩ B)c = {a, b, c, d, e, f , g, h, t, j, k, p, m, z } = U
Ac ∪ Bc ={a, b, c, d, e, f , g, h, t, j, k, p, m, z } = U
Ac ∩ Bc = {t, j, k, p, m, z }
Compare
(A ∪ B)c and Ac ∩ Bc
(A ∩ B)c and Ac ∪ Bc

Remark
In general,
(A ∪ B)c = Ac ∩ Bc and
(A ∩ B)c = Ac ∪ Bc these two are known as De Morgan,s laws
E XERCISE 2.  Let U = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10 } and
Let A = {1, 2, 3, 4, 5 }, B = {2, 4, 6, 8, 10 } and C = {1, 3, 5, 7, 9 },
Find i. A ∩ B ii. (B ∪C) − A iii. Ac ∩ (B ∪C)
E XERCISE 3. 
A = {0, 2, 4, 6, 8, 10 }, B = {0, 1, 2, 3, 4, 5, 6 }
and C = {4, 5, 6, 7, 8, 9, 10 },
Find a) A ∩ B ∩C b) A ∪ B ∪C c) (A − B) ∪C d) (A ∪ B) ∩C
e) (A ∩ B) ∪C f) C − A

8
SMA 2100 DISCRETE MATHEMATICS

2.1. Set identities / boolean algebra


Identity Name
1. A ∪ 0/ = A
A ∩U = A Identity laws
2. A ∪U = U
A ∩ 0/ = 0/ Zero laws
3. A ∪ B = B ∪ A
A∩B = B∩A Commutative laws
4. (A ∪ B) ∪C = A ∪ (B ∪C)
(A ∩ B) ∩C = A ∩ (B ∩C) Associative laws
5. A ∪ (B ∩C) = (A ∪ B) ∩ (A ∪C)
A ∩ (B ∪C) = (A ∩ B) ∪ (A ∩C) Distributive laws
6. A ∪ A = A
A∩A = A Idempotent laws
7. A ∪ (A ∩ B) = A
A ∩ (A ∪ B) = A Adsorption laws
8. A ∪ Ac = U
A ∩ Ac = 0/ Complementation laws
c
9. (Ac ) = A Double complementation
c
10. U = 0/
0/ c = U Universal laws
c c c
11. (A ∪ B) = A ∩ B
(A ∩ B)c = Ac ∪ Bc De Morgan,s laws

Remarks

1. All the laws except the double complementation are in pairs.

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.

• Using Boolean Algebra

Justification using Vehn diagrams


We show that the sets are equal by shading the required region
a) Adsorption
A ∪ (A ∩ B) = A A ∩ (A ∪ B) = A

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

Proof Using Sets


We show that two sets A and B are equal if A ⊂ B and B ⊂ A
a) Distributive laws A ∪ (B ∩C) = (A ∪ B) ∩ (A ∪C)
i. We show that A∪(B ∩C) ⊂ (A ∪ B)∩(A ∪C) and (A ∪ B)∩(A ∪C) ⊂ A∪(B ∩C)
let x ∈ A ∪ (B ∩C)
⇒ x ∈ A or x ∈ B ∩C
if x ∈ B ∩C x ∈ B and x ∈ C
therefore x ∈ A or x ∈ B and ⇒ x ∈ A or x ∈ C
⇒ x ∈ A ∪ B and x ∈ A ∪C
⇒ x ∈ (A ∪ B)∩ (A ∪C)
⇒ A ∪ (B ∩C) ⊂ (A ∪ B) ∩ (A ∪C) i
Let y ∈ (A ∪ B) ∩ (A ∪C)

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)

ii. A ∩ (B ∪C) = (A ∩ B) ∪ (A ∩C)


We show that A ∩ (B ∪C) ⊂ (A ∩ B) ∪ (A ∩C) and (A ∩ B) ∪ (A ∩C) ⊂ A ∩ (B ∪C)
let x ∈ A ∩ (B ∪C)
⇒ x ∈ A and x ∈ B ∪C
if x ∈ B ∪C x ∈ B or x ∈ C
therefore x ∈ A and x ∈ B or ⇒ x ∈ A and x ∈ C
⇒ x ∈ A ∩ B or x ∈ A ∩C
⇒ x ∈ (A ∩ B)∪ (A ∩C)
⇒ A ∩ (B ∪C) ⊂ (A ∩ B) ∪ (A ∩C) i
Let y ∈ (A ∩ B) ∪ (A ∩C)
⇒ y ∈ A ∩ B or y ∈ A ∩C
⇒ y ∈ A and y ∈ B or ⇒ y ∈ A and y ∈ C
⇒ y ∈ A and y ∈ B or y ∈ C
⇒ y ∈ A and 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)

Example . Prove that (A ∩ B) = A ∪ B


c c c

Solution: Let x ∈ (A ∩ B)c ⇒x∈


/ A∩B
⇒x∈ / A or x ∈
/B
⇒ x ∈ A or x ∈ Bc
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


E XERCISE 4.  Prove that (A ∪ B) = A ∩ B


c c c

Example . Show that for any two sets A − B = A ∩ B c

Solution: we need to show that A − B ⊂ A ∩ Bc and A ∩ Bc ⊂ A − B


Case 1 Case 2
Let x ∈ A − B Let y ∈ A ∩ Bc
⇒ x ∈ A and x ∈/B ⇒ y ∈ A and y ∈ Bc
⇒ x ∈ A and x ∈ Bc ⇒ y ∈ A and y ∈ /B
⇒ x ∈ A ∩ Bc ⇒ y ∈ A−B
∴ A−B ⊂ A∩B c i ∴ A ∩ Bc ⊂ A − B ii
From i and ii A − B = A ∩ Bc


Example . Show that (A ∩ B) ∩C = A ∩ (B ∩C)


Solution: Let x ∈ (A ∩ B) ∩C Let x ∈ A ∩ (B ∩C)
⇒ x ∈ A ∩ B and x ∈ C ⇒ x ∈ A and x ∈ B ∩C
⇒ x ∈ A and x ∈ B and x ∈ C ⇒ x ∈ A and x ∈ B and x ∈ C
⇒ x ∈ A and x ∈ B ∩C ⇒ x ∈ A ∩ B and x ∈ C
⇒ x ∈ A ∩ (B ∩C) ⇒ x ∈ (A ∩ B) ∩C
∴ (A ∩ B) ∩C ⊂ A ∩ (B ∩C) i ∴ A ∩ (B ∩C) ⊂ (A ∩ B) ∩C ii
=⇒ (A ∩ B) ∩C = A ∩ (B ∩C)


Example . Prove that if A ⊂ C and B ⊂ D then A ∪ B ⊂ C ∪ D


Solution: Let x ∈ A ∪ B
⇒ x ∈ A or x ∈ B
if x ∈ A then x ∈ C since A ⊂ C and

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


E XERCISE 5.  Show that if Prove that if A ⊂ C and B ⊂ D then A ∩ B ⊂ C ∩ D


2.1.1. More Revision Exercise
Prove the following

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

2.1.2. Simplifying Using Boolean Algebra

Example . Simplify A ∩ (A ∪ B)
c

Solution: A ∩ (Ac ∪ B) = (A ∩ Ac ) ∪ (A ∩ B) Distributive law


= 0/ ∪ (A ∩ B) Complementaion law
= A∩B Identity law


Example . Show that A − (B ∪C) = (A − B) ∩ (A −C)


Solution: Recall A − B = A ∩ Bc
⇒ A − (B ∪C) = A ∩ (B ∪C)c
= A ∩ (Bc ∩Cc ) De Morgan’s law
= (A ∩ Bc ) ∩ (A ∩Cc ) Distributive law
= (A − B) ∩ (A −C)


Example . Simplify using Boolean Algebra (A ∪ B ) ∪ (A ∩ B)


c c

Solution: (Ac ∪ Bc ) ∪ (A ∩ B) = (A ∩ B)c ∪ (A ∩ B) De Morgan’s law

13
SMA 2100 DISCRETE MATHEMATICS

=U Complementation law


Example . Simplify A ∩ B ∩ (A ∪ B ∪C)


c c

Solution: Ac ∩ Bc ∩ (A ∪ B ∪C) = (A ∪ B)c ∩ (A ∪ B ∪C) De Morgan’s law


= [(A ∪ B)c ∩ (A ∪ B)] ∪ [(A ∪ B)c ∩C] Distributive law
= 0/ ∪ [(A ∪ B)c ∩C] Complementation law
= [(A ∪ B)c ∩C] Identity law
= Ac ∩ Bc ∩C De Morgan’s


E XERCISE 6.  Show that (A −C) − (B −C) = (A − B) −C


E XERCISE 7.  Show that [A ∪ (B ∩C)] = (C ∪ B ) ∩ A
c c c c

More Revision Exercise

E XERCISE 8.  Simplify by eliminating the minus


a) A − (B ∪C)
b) A − (B ∩C)
c) A − (B −C)
d) (A − B) −C
e) A ∩ (B −C)
E XERCISE 9.  Let A, B and C be sets, show that
i) (A ∩ B) ∪ (A ∩ Bc ) = A
ii) (B − A) ∪ (C − A) = (B ∪C) − A
iii) (A −C) ∩ (C − B) = 0/
E XERCISE 10.  Draw the vehn diagram for each of the following
a) (A ∪ B) ∩C
b) Ac ∩ Bc ∩Cc
c) (A − B) ∪ (A −C)

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|

3.1. Examples / Applications


The following information was found in a survey
120– Total number
40– Mathematics
50– English
15– Mathematics and English
Then we can find those taking;
Mathematics is only 25, English only 35.
Exactly one = 35 + 25 = 60
Neither = |U| − |M| − |E| + |M ∩ E| = 120 − 40 − 50 + 15 = 45

Example . In a survey including 60 people, 25 take milk, 26 take tea and 26 take
coffee. 9 like both milk and tea, 11 both milk and coffee, 8 like coffee and milk and
8 like non of the three drinks.
a) Find the number of people who like any of the three drinks
b) Find the number of people who like coffee, tea and milk a lone
Solution: Let M be the set of those taking milk
” T ” ” tea
” C ” ” coffee
Then |M| = 25, |T | = 26 and |C| = 26

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

A ∩C− set of all integers divisible by 3 × 7 = 21 between 1 and 100


A ∩C = {x|1 ≤ x ≤ 100, x is divisible by 21 }
= {21, 42, . . . , 84}
= {21y|1 ≤ y ≤ 4}
|A ∩C| = 4
B ∩C− set of all integers divisible by 5 × 7 = 35
B ∩C = {x|1 ≤ x ≤ 100, x is divisible by 35}
= {35, 70} ⇒ |B ∩C| = 2
A ∩ B ∩C− set of all integers divisible by 3, 5 and 7 = 3 × 5 × 7 = 105
Therefore |A ∩ B ∩C| = Ø
|A ∪ B ∪C| = |A| + |B| + |C| − |A ∩ B| − |B ∩C| − |A ∩C| + |A ∩ B ∩C| = 33 + 20 +
14 − 6 − 4 − 2 = 55


E XERCISE 11.  Out of a group of 85 people, 30 invested in the stock market, 45


had certificates of deposits (CD’s) and 44 had savings bonds.
Furthermore, 23 had both CD’s and bonds, 13 had both CD’s and stocks and 13 had
stocks and bonds. Finally 10 of the people had no
investment s use a Venn diagram to determine how many of the 60 people had:
a) All the three types of investments
b) At least two investments
c) At most two investments
d) Saving bonds only
e) CD’s only

Example . Out of a group of 92 students, every student study one, two or three
languages, 50 students study French, 40 students study English and 35 students
study German. In addition, 15 students study French and English, 10 students study
English and German while 13 study French and German. Find the number of stu-
dents studying
i. At least two languages
ii. One language only
iii. All the three languages (use vehn diagram)
Solution: Let F be the set of all who study French
Let E be the set of all who study English

18
SMA 2100 DISCRETE MATHEMATICS

Let G be the set of all who study German


|F| = 50 − 15 − 13 + x = 22 + x
|E| = 40 − 15 − 10 + x = 15 + x
|G| = 35 − 10 − 13 + x = 12 + x

|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


E XERCISE 12.  A market researcher investigating consumers preference for the


three brands of beverages namely: coffee, tea and cocoa in Machakos town found
the following information from a sample of 800 consumers, 230 took coffee, 245
took tea and 325 took cocoa. 30 took all the three beverages. 75 took coffee and
cocoa, 110 took coffee only, and 185 took cocoa only
Required
i) Present the above information in a vehn diagram
ii) The number of consumers who took tea only
iii) The number of consumers who took coffee and tea only
iv) The number of consumers who took tea and cocoa only

3.1.1. More Revision Questions


1.In a class all members study one, two or three units 11 study Biology, Chemistry
and Physics, 6 studies Biology and Chemistry only. 2
study Physics, 3 studies Biology only. In all 22 study Chemistry only. How many
are there in the class represent in a Venn diagram.

19
SMA 2100 DISCRETE MATHEMATICS

2. In a survey of 500 people 285 invested in company A , 195 invested in company


B, 115 invested in company C , 70 invested in both companies A and B, 45 invested
in both companiesB and C and 50 invested in both companies A andC . 50 have not
invested in any of these three companies.
i. How many people have invested in at most two companies?
ii. How many people have invested in at least two of the three companies.
iii. How many people have invested in exactly one of the three companies.
3. In a survey of 1000 households, 275 owned a home computer, 455 a video, 405
owned two cars and 265 households owned neither a home computer, a video nor
two cars. Given that 145 households own both a home computer and a video, 195
both video and two cars, and 110 both two cars and a home computer, find the
number of households surveyed who owns;
a) A home computer, a video and two cars
b) A video only
c) Two cars, a video but not a home computer
d) A video, a home computer but not two cars

3.2. Cartesian product


The under of the elements in a collection is often important. Since sets are un-
ordered, a different structure is needed to represent ordered
collections. This is provided by order and n−tuples. Recall (Co-ordinates Geome-
try).
The point (x, y) 6= (y, x) unless x = y. Also (x, y) = (u, v) if and only if x = u and
y = v. Let A and B be sets. The Cartesian product of A
and B denoted by A × B or A ⊗ B and read as “A cross B” is the set A × B =
{(a, b)|a ∈ A and b ∈ B}
Example 1
A = {1, 2} B = {a, b, c}
A × B = {(1, a), (1, b), (1, c), (2, a), (2, b), (2, c)}
B × A = {(b, a)|b ∈ B & a ∈ A}
= {(a, 1), (a, 2), (b, 1), (b, 2), (c, 1), (c, 2)}
⇒ A × B 6= B × A
The Cartesian product A × B 6= B × A unless A = Ø or b = Ø (so that A × B = Ø)
Example 2

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

2. If |A| = m and |B| = n then A × B = mn

/ =O
3. For any sets A, A × Ø = OA /

4. The idea can be extended to any finite number of sets A1 × A2 × . . . × An =


{a1 , a2 , . . . , an |ai ∈ A, i = 1, 2, 3, . . .}.In particular for three sets A × B × C =
{(x, y, z)|x ∈ A, y ∈ B, z ∈ C}

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.

Claim: For any 3 non empty sets A, B, C


A × (B ∩C) = (A × B) ∩ (A ×C)
Proof
Let x, y ∈ A × (B ∩C)
⇒ x ∈ A&y ∈ B∩c
⇒ x ∈ Ay ∈ B&y ∈ C
⇒ (x, y) ∈ A × B and (x, y) ∈ (A ×C)
⇒ (x, y) ∈ (A × B) ∩ (A ×C)
⇒ A × (B ∩C) ⊂ (A × B) ∩ (A ×C)..............................i
Let (p, q) ∈ (A × B) ∩ (A ×C)
⇒ (p, q) ∈ A × B & p, q ∈ (A × B)
⇒ p ∈ A & q ∈ (B ∩C)
⇒ (p, q) ∈ A × (B ∩C)
⇒ (A × B) ∩ (A ×C) ⊂ A × (B ∩C).............................ii
From i and ii A × (B ∩C) = (A × B) ∩ (A ×C)
Claim: Let A, B,C, D be sets
If A × B 6= Ø and A × B = C × D

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

3.2.1. More Revision Questions


1. a) Let A{{1, 2, 3}, {4, 5}, {6, 7, 8}}. Find the subsets B of A consists of the sets
in A with exactly
i) 3 elements B = {{1, 2, 3}, {6, 7, 8}}
ii) 4 elements B = {}
b) U = {1, 2, . . . , 9}, A = {1, 2, 3, 4, 5}, B = {4, 5, 6, 7}, C = {5, 6, 7, 8, 9}, D =
{1, 3, 5}, E = {2, 4, 6, 8}, and F = {1, 5, 9} Find
i) A ∩ (B ∪ E) = {2, 4, 5}
ii) (A − B)c = (A ∩ Bc )c = Ac ∪ B = {4, 6, 7, 8, 9, 5}
iii) (A ∩ D)|B = (A ∩ D) ∩ Bc = {1, 3}
iv) (B ∩ F) ∪ (C ∩ E); B ∩ F = {5}, C ∩ E = {6, 8}, (B ∩ F) ∪ (C ∩ E) = {5, 6, 8}
c Show that A × (B ∪C) = (A × B) ∪ (A ×C)

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

Connectives Logical operators Meaning


∼ negatition
∧ conjunction
∨ disjunction
→ logical implication/condition
↔ Double Implication/ Bicondition

If x, y ∈ R the statement is a proposition of truth value F. However if y − x ∈ {0},


then the statement is a proposition of the truth value T.
Therefore it is ambiguous.
2. Consider the statement if A2 = 0 then A = 0.
This is not a proposition since the set allowed for A is not stated. If A is an integer
then the statement is a proposition of truth value T. On
the other hand if the set allowed for A is the set of 2 × 2 matrices then the statement
are not necessarily
! true. In particular
! suppose
! !
0 k 0 k 0 k 0 0
A= A2 = =
0 0 0 0 0 0 0 0
Hence this statement is ambiguous not a proposition. Also in a proposition, we
exclude statements that are either of the following.
a) Are 7 a composite number? (question mark)
b) Exclamation
c) Possibilities / probabilities
The analysis and operation of propositions using Boolean connectives.

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

Truth table for conjunction for the three propositions p, q and r

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

Extended truth table for two propositions p and q


combining conjunction and negation

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

4.4. Logical implication/ conditional


Let p and q be propositions, the implication p → q is the proposition that is false
when p is true and q is false otherwise true. In this
implication p is called the hypothesis or premise and q is called the conclusion or
consequence
e.g. P– It is raining
q− It is wet
p → q if it is raining then it is wet.
Truth table for the logical implication

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

Consider the following compound proposition ∼ (p∧ ∼ q)


Truth table for ∼ (p∧ ∼ q)

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

4.4.1. Double implication/ biconditional


Let p, q be proposition, the double implication p ↔ q is the statement that p implies
q and q → p or if p then q then p we say
“p if and only if q” denoted “p iff q” we realize that p ↔ q is the statement p → q
and q → p
Hence (p → q) ∧ (q → p)
p q p → q q → p (p → q) ∧ (q → p)
T T T T T
T F F T F
F T T F F
F F T T T

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


E XERCISE 13.  Write the proposition using


Justification via truth value tables

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

E XERCISE 14.  Write the following sentence into a logical expression


a. “You can access internet from campus only if you are a computer science major
or you are not a freshman

Example . If you live in Nairobi then you live in Kenya
Inverse : if you don’t live in Nairobi then you don’t you don’t live in Kenya.
Converse: if you don’t live in Kenya then you live in Nairobi
Contrapositive: if you don’t live in Kenya then you don’t live in Nairobi


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.

In general from the condition p → q we say that q is a necessary condition for p.

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

Living in Kenya is a necessary condition for living in Nairobi.

Living in Nairobi is a sufficient condition for living in Kenya.

FURTHER EXAMPLES OF TRUTH TABLES

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

E XERCISE 15.  Compute p → q ∧ [(q∧ ∼ r) → (p ∨ r)]


More Revision Questions
1. Let p, q and r are the propositions
p−You get an A on the final exam
q−You do every exercise in this book
r−You get an A in this class
Express the following in English
a) p → (∼ q ∨ r)
b) ∼ p → (q → r)
c) (p ∨ q) ∨ r
d) (p ∧ q) ∨ r
e) (p ∧ q)∧ ∼ r
2. Construct a truth table for each of the following compound propositions.
a) (p ∨ q)∧ ∼ r
b) (p → q) ∨ (∼ p → q)
c) (p ↔ q) ∨ (∼ q ↔ r)
d)p → q ∧ [(p∨ ∼ r) → (q ∧ r)]

33
SMA 2100 DISCRETE MATHEMATICS

5.0.2. Propositional Equivalences


Tautology
A compound that is always true no matter what the truth values of the proposition
that occur in it is called a tautology. To check whether a
proposition is a tautology, it is sufficient to show its truth table and check whether
the final column has every entry “T ”
1. [p ∧ (p → q)] → q
p q p → q p ∧ (p → q) [p ∧ (p → q)] → q
T T T T T
T F F F T
F T T F T
F F T F T
Since the final column in the table has only truth entries “T” then the proposition is
tautology.
2. ∼ (p ∨ q) ↔ (∼ p∧ ∼ q)
∼ (p ∨ q) ↔ (∼ p ∧ ∼ q)
F T T T T F F F
F T T F T F F T
F F T T T T F F
T F F F T T T T
3 1 2 1 4 2 3 2
The classical tautology is the statement p → p
P P P→P
T T T
F F T

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

E XERCISE 16.  Shown that p ∨ (q ∧ r) and (p ∨ q) ∧ (q ∨ r) are logically equiva-


lent

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

⇐⇒∼ p∧ ∼ q Identity law




E XERCISE 17.  Shown that (p ∧ q) → (p ∨ q)


• More Revision Questions
1. Use truth tables to verify that

2. i) p ∧ (q ∨ r) ⇐⇒ (p ∧ q) ∨ (p ∧ r)

3. ii) ∼ (p ∧ q) ⇐⇒∼ p∨ ∼ q

4. Show that each of the following is tautology. Using truth tables.

• [∼ p ∧ (p ∨ q) → q]

• [(p → q) ∧ (q → r)] → (p → r)

37
SMA 2100 DISCRETE MATHEMATICS

LESSON 6
Valid Arguments

Argument is a finite collection of A1 , A2 , . . . , An of statements followed by a state-


ment A. We denote the arguments by
A1
A2
.
A1 , A2 , . . . , An or .. } premise
An
A
An argument is valid if whenever all assignments of truth value to the assignment
statement variables make the premise A1 , A2 , . . . , An true
then it also makes the conclusion true
Examples

1. Consider the argument p → q

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

p q r p→q q→r p→r


T T T T T T
T T F T F F
T F T F T T
T F F F T F
F T T T T T
F T F T F T
F F T T T T
F F F T T T
It is valid because for the rows where the premises are true, the conclusion is true.
4. (p ∧ q) → r
p
r
p q r p∧q (p ∧ q) → r
T T T T T←
T T F T F
T F T F T←
T F F F T←
F T T F T
F T F F T
F F T F T
F F F F T
Invalid argument
5. p → (q → r)
q
p→r

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

true. If this can be done then the argument is invalid.

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

2nd premise to be true we must have p true, q true, r false. Then p → (q → r) is


false.

Therefore the argument is valid.

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”

q− “Milka reads the daily nation”

r− “Milka reads the Kenya times” , express in symbols

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)]


E XERCISE 18.  Verify that p∨ ∼ (p ∧ q) is a tautology


6.1. Predicates And Quantifiers
Statements involving variables such as x > 3, x = y + 3 and x + y = z are not propo-
sitions since the value of variables are not specified.
The statement x > 3 has two parts, x which is the variable in the subject. The second
part is “is greater than 3” is the predicate – refers to
the property which the subject can have.
There are two ways of converting these statements into propositions.
i. Assigning particular values in the variable e.g. 5 > 3
ii. Quantifying the elements in the set of variables.
There are two types of quantifiers.

41
SMA 2100 DISCRETE MATHEMATICS

6.1.1. Universal quantifier:


It involves the phrase “for every x, p(x) “ “for all x, p(x) “. The universal quantifier
of p(x) is the proposition “ p(x)
is true for all values of x in the set defined. It is denoted by ∀.
e.g.
1. The square of every real number is negative. This can be written as ∀x ∈ R, x2 ≥ 0
2. All cars have wheels ∀x, p(x),where set allowed for x is the set for all cars and
p(x) predicate “has wheels”

6.1.2. Existential Quantifier:


The existential quantification of p(x) is the proposition. There exists an element x
in the universe of discourse such that p(x) is true. This
is denoted
∃x p(x)read “There exist an x such that”.
e.g.
1. Then exist a solution in the set of real numbers such that x2 + 7x = 0.
“is written as” ∃x ∈ R|x2 + 7x = 0
Normally the true quantification may occur together i.e. ∃x ∈ R, ∃y ∈ R, x + y = 0
∀x even, ∃y ∈ Z, x = 2y
Statement when true when false
∀x p(x) p(x) is true for every x There is an x for which
P(x) is false
∃x p(x) There is an x for which p(x) is false for every x
p(x) is true

• Universal Quantifiers Examples


1) Express the statement
Every student in this class have studied calculus
let p(x) denote the statement x has studied calculus.
∀x p(x)
2) ∀x, y ∈ R x + y = y + x
3) Let p(x) be the statement “x + 1 > x” what is the truth value of the quantification
∀x p(x) when the universe of discourse is the set of
real numbers.

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

• Existential Quantifiers Examples.


1. Let p(x) denote the statement ”x > 3”. What is the truth value of the quantifica-
tion
∃x ∈ R p(x)
Since x > 3 is true i.e. for x = 4 is true
2. Let Q(x) denote the statement ”x = x + 1”. What is the truth value of the quan-
tification ∃x Q(x).
Where x ∈ R
Q(x) is false for every real number.
Therefore ∃x Q(x) is false.
3. What is the truth value of ∃x p(x) when p(x) is the statement ”x2 > 10” and the
universe of discourse of the negative integers not
exceeding 4.
Universe of discourse {1, 2, 3, 4}
Therefore ∃x p(x) is the disjunction
p(1) ∨ p(2) ∨ p(3) ∨ p(4)
Since ”42 > 10” is true ⇒ ∃x p(x)is true
4. Express the statement “Everybody has exactly one Best friend “as quantification.
Let B(x, y) be → ”y is the best friend of x”
∀x ∃y ∀z (B(x, y) ∧ (z + y) →∼ B(x, z))
5. Express the statement “if somebody is a female and is a parent, then that person
is someone’s mother” as a logical expression
Let f (x) be x is a female
p(x) be x is a parent
M(x, y) be x is a mother of y
∀x((F(x) ∧ p(x)) → ∃y m(x, y)

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.


Example . ∃x ∀y ∀z ((F(x, y) ∧ F(x, z) ∧ (y + z) →∼ F(y, z)


Solution: Where F(a, b) means a and b are friends. There exist student x such that
for all students y and for all students z other than y, if x and y are
friends and x and z are friends then y and z are not friends


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)

• More Revision Questions


1. Express the negations of the following propositions using quantifiers and in
English

(a) Every student in this class likes Mathematics.


(b) There is a student in this class who has never seen a computer.
(c) There is a student in this class who has taken every mathematics unit
offered at this school.
(d) There is a student in this class who has been in at least one room of
every building on campus.

45
SMA 2100 DISCRETE MATHEMATICS

2. Use quantifiers to express the following

(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

Let A and B be non empty sets. A function from A to B is an assignment of the


elements of B to the elements of A. We write f (a) = b if b is the element of B
assigned by the function f to the element a of A.
If f is a function from A to B , we write
f : A −→ B or
f
A −→ B

Examples

X Y
x1 −→ y1
x2 −→ y2
x3 −→ y3
x4 −→ y4

X Y
x1 −→ y1
x2 −→ y2
x3 −→ y3
x4 −→ y4
x5 %

f (x) is called the image / range of f and is denoted by im f ,


im f = { y ∈ Y | ∃x ∈ X, y = f (x) }
The set X is called the domain of f and the set Y is called the co domain of f .
If f (x) = y, then y is the image of x and x is the pre image of y
Examples
Let f : Z −→ Z where f (x) = x2 then
Domain - is the set of integers
Co domain - is the set of all integers
Range - Set of all non negative integers that are perfect square i.e. {0, 1, 4, 9, · · · }

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


2. Let A = {a, b, c, d, e } and B = {1, 2, 3, 4} with f (a) = 2, f (b) = 1,


f (c) = 4, f (d) = 1 and f (e) = 2.
The image of f is the subset {1, 2, 4 }

7.1. Types of functions


7.1.1. One to one / injection
A function f is said to be one to one or injection if and only if f (x) = f (y)
implies x = y for all x and y in the domain of f .
Remark
A function f is one to one if and only if f (x) 6= f (y) whenever x 6= y i.e.
X Y
x1 −→ y1
x2 −→ y2
x3 −→ y3
x4 & y4
y5
Example
Determine if f from {a, b, c, d } to {1, 2, 3, 4, 5 } with f (a) = 4, f (b) = 5,
f (c) = 1 and f (d) = 3 is one to one
a −→ 4
b −→ 5
c −→ 1
d & 2
3

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

Given a function f in order to check whether f is one to one, we assume


or suppose f (x) = f (y). If we manage to show that x = y, then the function is
1 − 1.
Example . Let f : R −→ R be defined by f (x) = 2x + 3. Is f one to one?
Solution: Suppose f (x1 ) = f (x2 )
=⇒ 2x1 + 3 = 2x2 + 3
=⇒ 2x1 = 2x2
=⇒ x1 = x2 hence 1 − 1.


Example . Check whether f : R −→ R defined by f (x) = x2 is one to one


Solution: Suppose f (x1 ) = f (x2 )
=⇒ x12 = x22
=⇒ x1 = ±x2
=⇒ x1 = x2 or x1 = −x2 hence 1 − 1.
However g : R+ −→ R , g (x) = x2 is one to one


• ONTO / SURJECTIONS
A function f : X −→ Y is said to be onto, surjective only if

1. For every y ∈ Y there exist x ∈ X such that f (x) = y

2. Every element in the co domain has a pre image

3. If the image, im f =co domain of f

Examples

49
SMA 2100 DISCRETE MATHEMATICS

1. f : R −→ R defined by f (x) = x2 is not onto since R− do not have pre


images.However g : R+ −→ R+ , g (x) = x2 is onto.

2. Let f from {a, b, c, d, e } to {1, 2, 3 } such that f (a) = 1, f (b) = 1,


f (c) = 2 , f (d) = 3 and f (e) = 3

a −→ 1
b %
c −→ 2
d &
e −→ 3

3. f : R −→ R defined by f (x) = x3 is onto

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

Due to oneness |X| = | f (x)|,


Due to ontoness, f (x) = y =⇒ |X| = | f (x)| = |Y |

7.1.3. Computing an inverse

Example . Find the inverse of the function f (x) = 2x − 3 f : R −→ R


Solution:
Let y = f (x) = 2x − 3, then make x the subject
=⇒ y + 3 = 2x or x = y+3 2 then replace x with y
−1 and y with x.

=⇒ y−1 = x+32 but y


−1 = f −1 (x)

=⇒ f −1 (x) = x+3
2 .


7.1.4. Composite functions


Suppose two functions are such that the domain of one equals the co domain of the
other
Say f : X −→ Y
g : Y −→ Z
Then we can define a function from the domain of one to the co domain of the other
comprising of the two functions following each other e.g. in the case above, we
define a function from X to Z, which would be f followed by g. Such a function
is called a composite function.
f followed by g is denoted by g ◦ f and read as “g composition f ”

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


In general f ◦ g 6= g ◦ f . i.e. composition of functions is not commutative.



For any three functions ( f ◦ g) ◦ h = f ◦ (g ◦ h), hence associative.

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

A function is invertible only if it is a bijection

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.

2. Let f : Z −→ Z be defined by f (x) = x + 1. find the inverse of f .


Let y = x + 1 =⇒ x = y − 1 =⇒ y−1 = x − 1 or f −1 (x) = x − 1


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

i.e. −58 + 74x = 0 or 74x = 58 =⇒ x = −58/74 = 29/37


The domain is the set R − {29/37}


E XERCISE 19.  Given f (x) = 4−5x


−6x+3 and g(x) = 2−4x
−8x−4 . Find f ◦ g g ◦ f state
the domain in each case

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

1. f : Z × Z −→ Z defined by f (x, y) = x, this is onto but not one to one.

2. f : Z × Z −→ Z defined by f (x, y) = y, this is onto but not one to one.

3. f : R −→ R × R defined by f (x) = (x, y), this is onto but not one to one

More Revision Exercise


1.Determine whether f : Z −→ R is a function in each case.

• f (x) = ±x

• f (x) = x
p
• f (x) = ± (x2 + 1)

2. Determine whether each of the following functions is a bijection from R −→ R


a) f (x) = −3x + 4 b) f (x) = −3x2 + 7
c) f (x) = x+1
x+2 d) f (x) = x3 + 1
e) f (x) = x2 + 1
3. Find the inverse of the functions
a) f (x) = 5x + 7 b) f (x) = 3x+1
2x+7
3
c) 4x + 7

8.1. Sequences and Summations


8.1.1. Sequences
A sequence is a discrete structure used to represent an ordered list. The sequence is
represented by {an } where an represent an individual term in the sequence. The
variable n ∈ Z+ , the set of positive integer.
NB n will always start from 0 unless specified.
examples

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, . . .

3. Given cn = 5n =⇒ c0 , c1 , c2 , . . . which is 1, 5, 25, 125, . . .

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


. What is the value of


5
Example ∑ j2
j=1

5
Solution: ∑ j2 = 12 + 22 + 32 + 42 + 52 = 1 + 4 + 9 + 16 + 25 = 55 
j=1

 What is the value of


8
k
E XERCISE 20. ∑ (−1)
k=4

56
SMA 2100 DISCRETE MATHEMATICS

8.2. Methods of Proof


There are four methods of proving whether a mathematical statement is true or false

8.2.1. Direct proof


Definitions:

• Theorem: is a statement that can be shown to be true

• Lemma: a simple theorem that is used in the proof another

• A corollary: is a proposition that can be established directly from a theorem

• A Conjencture: A statement whose truth value is unknown. When a proof of


a conjencture is found, the conjencture becomes a theorem.

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


Example . Show that if q is even then 4 divides q 2

Solution: Suppose q is even, then q = 2m, m ∈ Z


=⇒ q2 = (2m)2 = 4m2
=⇒ 4 divides q2


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.


E XERCISE 22.  Show that x is odd if x 2 is odd

9.1. Proof by contradiction


Let p be a proposition, if ∼ p is false then p must be true
To prove, suppose ∼ p is true, then show that this leads to a contradiction
i.e. ∼ p −→ (r∧ ∼ r)
This is usually used when a contradiction can be found.
 √
Example . Prove that 2 is irrational

Solution: If p is the proposition that 2 is irrational, then ∼ p is the proposition

that 2is rational. We assume that ∼ p is true and come to a contradiction.
√ √
Assume that 2is rational, then W.L.O.G ∃ x, y ∈ Z such that 2 = xy , y 6= 0 and
gcd(x, y) = 1
2
=⇒ 2 = xy2 =⇒ 2y2 = x2
=⇒ x2 is divisible by 2 which means that x is also divisible 2 i.e x = 2k, k ∈ Z
and 2y2 = x2 but x = 2k =⇒ 2y2 = (2k)2 = 4k2
=⇒ y2 = 2k2
=⇒ y2 is divisible by 2 which means that y is also divisible 2 i.e y = 2m, m ∈ Z

58
SMA 2100 DISCRETE MATHEMATICS

∴ y is even and x is even hence gcd (x, y) 6= 1, which is a contradiction.




E XERCISE 23.  √
Prove that p is irrational for any prime number p
More Revision Exercise
√ √
1. Show that 3, 5 are irrational

2. Prove that the integer n is odd if and only if n2 is odd

3. Prove that if n is an integer and n3 + 5 is odd then n is even using i. an


indirect proof ii. Contradiction

9.1.1. Counter example (disproof)


Consider the proposition
∀ x p (x) is true, the negation is
∃ x | p (x) is false
If we can find one example which makes the proposition false, then the statement
is not true
Example . The product of any two prime numbers is odd
Solution: 2 and 3 are prime numbers but 2 × 3 = 6 not odd 

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 that any prime number p is odd


Solution: 2 is a prime which is not odd 

Example . Prove or disprove that 2 + 1 is prime for all non negative integers n.
n

Solution: For n = 3, 23 + 1 = 9 not a prime number 

9.2. Mathematical induction


This is used to prove propositions of the form ∀n p (n) is true where p (n) is a
property that n must satisfy i.e. p (n) is true for all positive integers

59
SMA 2100 DISCRETE MATHEMATICS

• The statement p (n) is called the inductive hypothesis

• 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

This lesson continues with more examlpes on proof by Mathematical induction


Example . Prove that ∀n ∈ N, n3 − n is even
Solution: NB It is not necessary to start with n = 1, we start with the least value of
n. In this case the least value is 0 therefore in the base step, we prove for n = 0
For n = 0 03 − 0 = 1 − 1 = 0 , and 2 divides 0 hence true for n = 0
Assume true for n = k, then 2 divides k3 − k or k3 − k = 2m where m ∈ Z
For n = k + 1, we have
(k + 1)3 − (k + 1) = k3 + 3k2 + 3k + 1 − k − 1
= k3 − k + 3k(k + 1)


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.


Example . Show that 1(2) + 2(3) + 3(4) + · · · + n(n + 1) = n(n+1)(n+2)


3
Solution: we prove for n = 1,
1(2) = 1(1+1)(1+2)
3 = 63 = 2, 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) + 2(3) + 3(4) + · · · + k(k + 1) = k(k+1)(k+2)
3 is true,
For n = k + 1, we have
1(2) + 2(3) + 3(4) + · · · + k(k + 1) + (k + 1) (k + 2)
but 1(2) + 2(3) + 3(4) + · · · + k(k + 1) = k(k+1)(k+2)
3 , therefore
1(2) + 2(3) + 3(4) + · · · + k(k + 1) + (k + 1) (k + 2) = k(k+1)(k+2)
3 + (k + 1) (k + 2)
k(k+1)(k+2)+3(k+1)(k+2)
= 3
(k+1)(k+2)(k+3)
= 3 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


62
SMA 2100 DISCRETE MATHEMATICS

E XERCISE 26.  Prove that for n ≥ 1, 2 2n − 1 is divisible by 3

More Revision Exercise


1. Show that 1 + 2 + 22 + · · · + 2n = 2n+1 − 1, ∀n ∈ Z+

2. Prove that 3 + 6 + 9 + · · · + 3n = 3/2n(n + 1), ∀n ∈ N


n
3. Prove that 1/1×2 + 1/2×3 + 1/3×4 + · · · + 1/n(n+1) = n+1 , ∀n ∈ N
n2 (n−1)2
4. Show that ∀n ∈ N, 13 + 23 + 33 + · · · + n3 = 4

10.1. Classification of numbers


Numbers are classified into the following sets

• The set of Natural /Basic counting numbers is N = {1, 2, 3, · · · }

• The set of Integers is the set Z = {· · · , −2, −1, 0, 1, 2, · · · }

• The set of Rational numbers is given by

– Q = x | x = ba , a, b ∈ Z, & gcd(a, b) = 1


• Numbers that are not rational are irrational and is denoted by Qc

• The set of real numbers is R = Q ∪ Qc

• The set of complex numbers is the set C = {x + yi | x, y ∈ R} i is an imagi-



nary number defined by i = −1

NB: These sets are subsets of another as follows


N⊂Z⊂Q⊂R⊂C
Definition 1
An integer n ≥ 1, is a prime number if the only positive divisors of n are 1 and n. If
n is not a prime number, then n is said to be a composite number
The first few primes are 2, 3, 5, 7, 11, · · ·
Definition 2
A number n is odd if it can be expressed in the form n = 2k + 1 or n = 2k − 1, k ∈ Z
A number n is even if it can be expressed in the form n = 2p p ∈ Z

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,

5, 4.54, 53 , 9, π, 3.14, 7.34567, 8


Solution:
i. Whole numbers −12, 0, 4, 5, 10, 60, 8
ii. Natural numbers 4, 5, 10, 60, 8
iii. Integers −12, 0, 4, 5, 10, 60, 8
iv. Rational numbers −12, 0, 4, 5, 10, 60, 227,
5

0.345, 4.54, 3 , 9, π, 3.14, 7.34567, 8

v. irrational numbers 5,
vi. Real numbers −12, 0, 4, 5, 10, 60, 22
7 , 0.345,
√ 5

5, 4.54, 3 , 9, π, 3.14, 7.34567, 8

Success

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

Then all those who take coffee is 110 + 45 + 30 + x = 230 =⇒ x = 45


Then all those who take cocoa is 185 + 45 + 30 + y = 325 =⇒ y = 65
Those taking tea only 245 − 30 − x − y =⇒ 245 − 30 − 45 − 65 = 105
ii) The number of consumers who took tea only is 105
iii) The number of consumers who took coffee and tea only is 45
iv) The number of consumers who took tea and cocoa only is 65
Exercise 12
Exercise 13. i. Implies
Today is Friday implies I have a test today.
ii. Only if,
Today is Friday only if I have a test today
iii. Sufficient.
Today is Friday is sufficient condition that I have a test today

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

i.e. 64x − 44 = 0 or 64x = 44 =⇒ x = 44/64 = 11/16


The domain is the set R − {11/16}
Exercise 19
8
k 4 5 6 7 8
Exercise 20. ∑ (−1) = (−1) + (−1) + (−1) + (−1) + (−1) = 1 − 1 + 1 −
k=4
1+1 = 1 Exercise 20
Exercise 21. Let a, b ∈ Q, then a = qp and b = r
s
where gcd(p, q) = 1 and gcd (r, s) = 1
ab = qp × rs = qs
pr
, hence rational since qs 6= 0
Exercise 21
Exercise 22. If p is the proposition that x2 is odd then ∼ p is the proposition that
x2 is even and
If q is the proposition that x is odd then ∼ q is the proposition that x is even and,
we show that if x is even then x2 is even i.e. ∼ q −→∼ p
Suppose x is even, then x = 2p , p ∈ Z
then x2 = (2p)2 = 4p2 = 2(2p2 )
∴ x2 is even.
Exercise 22

Exercise 23. If q is the proposition that p is irrational, then ∼ q is the proposition

that pis rational for any prime number p. We assume that ∼ q is true and come to
a contradiction.
√ √
Assume that pis rational, then W.L.O.G ∃ x, y ∈ Z such that p = xy , y 6= 0 and
gcd(x, y) = 1
2
=⇒ p = xy2 =⇒ py2 = x2
=⇒ x2 is divisible by p which means that x is also divisible 2 i.e x = pk, k ∈ Z since
p is prime
and py2 = x2 but x = pk =⇒ 2y2 = (pk)2 = p2 k2
=⇒ y2 = pk2
=⇒ y2 is divisible by p which means that y is also divisible p i.e y = pm, m ∈ Z
∴ hence gcd (x, y) 6= 1, since p divides both x and y and p 6= 1. This is a contradic-
tion.
Exercise 23

70
SMA 2100 DISCRETE MATHEMATICS

Exercise 24. We show that 1 + 3 + 5 + · · · + (2n − 1) = n2


i. Base step: for n = 1,
1 = 12 = 1 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
1 + 3 + 5 + · · · + (2k − 1) = k2 is true,
For n = k + 1,
1 + 3 + 5 + · · · + (2k − 1) + (2k + 1) but 1 + 2 + 3 + · · · + (2k − 1) = k2 , therefore
1 + 3 + 5 + · · · + (2k − 1) + (2k + 1) = k2 + 2k + 1
= (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
Exercise 24
Exercise 25. We show that 12 + 22 + 32 + · · · + n2 = 1/6n(n + 1)(2n + 1)
i. Base step: for n = 1,
1 = 1/61(1 + 1)(2 + 1) = 66 = 1 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
12 + 22 + 32 + · · · + k2 = 1/6k(k + 1)(2k + 1) is true,
For n = k + 1,
12 + 22 + 32 + · · · + k2 + (k + 1)2 but 12 + 22 + 32 + · · · + k2 = 1/6k(k + 1)(2k + 1),
therefore
12 + 22 + 32 + · · · + k2 + (k + 1)2 = 1/6k(k + 1)(2k + 1) + (k + 1)2
2
= k(k+1)(2k+1)+6(k+1)
6
= (k+1)/6(k(2k + 1) + 6(k + 1))
= (k+1)/6(2k2 + k + 6k + 6)
= (k+1)/6(2k2 + 4k + 3k + 6)
= (k+1)/6(2k(k + 2) + 3 (k + 2))
= (k+1)/6 (k + 2) (2k + 3)
= 1/6(k + 1) (k + 2) (2k + 3) 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
Exercise 25

71
SMA 2100 DISCRETE MATHEMATICS

Exercise 26. For n = 1, 22 − 1 = 3 and 3 is divisible by 3, therefore true for n = 1


Assume true for n = k, then 3 divides 22k − 1 or 22k − 1 = 3m where m ∈ Z
For n = k + 1, we have
22k+2 − 1 = 4.22k − 1 = 4(22k − 1) − 3 but 22k − 1 = 3m
= 4(3m) − 3 = 3(4m − 1) which is divisible by 3 since (4m − 1) ∈ Z,
thus true for n = k + 1
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.
Exercise 26

72

You might also like