Professional Documents
Culture Documents
Bith111 Mathematical Foundations
Bith111 Mathematical Foundations
Technology
Mathematical Foundations
Module BIT111
Adapted By: Nyambo Benny M
MSc (Applied Physics) (UZ)
BSc Honours (Physics) (UZ)
Mount Pleasant
Harare, ZIMBABWE
Year: 2012
You also need to be open-minded, frank, inquisitive learning package together with the sources to
and should leave no stone unturned as you analyze which you are referred. Fully-fledged lectures
ideas and seek clarification on any issues. It has can, therefore, be misleading as the tutor may
been found that those who take part in tutorials dwell on matters irrelevant to ZOU course.
actively, do better in assignments and examinations
because their ideas are streamlined. Taking part Distance education, by its nature, keeps the tutor
properly means that you prepare for the tutorial and student separate. By introducing the six hour
beforehand by putting together relevant questions tutorial, ZOU hopes to help you come in touch
and their possible answers and those areas that with the physical being, who marks your
cause you confusion. assignments, assesses them, guides you on
preparing for writing examinations and
Only in cases where the information being assignments and who runs your general academic
discussed is not found in the learning package can affairs. This helps you to settle down in your
the tutor provide extra learning materials, but this course having been advised on how to go about
should not be the dominant feature of the six hour your learning. Personal human contact is,
tutorial. As stated, it should be rare because the therefore, upheld by ZOU.
information needed for the course is found in the
Note that in all the three sessions, you identify the areas
that your tutor should give help. You also take a very
important part in finding answers to the problems posed.
You are the most important part of the solutions to your
learning challenges.
1
2.3 Inverse Relation ............................................................................................................. 31
Activity 2.2 ............................................................................................................................... 32
2.4 Composition of Relations ............................................................................................... 32
Activity 2.3 ............................................................................................................................... 34
2.5 Relation on a Set ............................................................................................................ 34
2.5.1 Reflexive Relation .......................................................................................................... 35
2.5.2 Symmetric relation ......................................................................................................... 35
2.5.3 Antisymmetric relation ................................................................................................... 35
2.5.4 Transitive relation .......................................................................................................... 35
Activity 2.4 ............................................................................................................................... 36
2.6 Digraph .......................................................................................................................... 36
Activity 2.5 ............................................................................................................................... 37
2.7 Partial Order ................................................................................................................... 37
Activity 2.6 ............................................................................................................................... 38
2.8 Equivalence Relation ...................................................................................................... 38
Activity 2.7 ............................................................................................................................... 39
Activity 2.8 ............................................................................................................................... 39
2.9 Summary ........................................................................................................................ 41
References ................................................................................................................................ 42
UNIT 3 FUNCTIONS ............................................................................................................... 43
3.0 Introduction .................................................................................................................... 43
3.1 Objectives ...................................................................................................................... 43
3.2 Concept of Function ....................................................................................................... 43
Activity 3.1 ............................................................................................................................... 44
3.3 Graph of a Function........................................................................................................ 45
3.4 Types of Functions ......................................................................................................... 46
3.4.1 Injective ......................................................................................................................... 46
3.4.2 Surjective ....................................................................................................................... 47
3.4.3 Bijective ......................................................................................................................... 48
Activity 3.2 ............................................................................................................................... 48
3.5 Inverse of a Function ...................................................................................................... 48
Activity 3.3 ............................................................................................................................... 49
3.6 Functions Composition ................................................................................................... 50
Activity 3.4 ............................................................................................................................... 51
3.7 Binary and Unary Operators ........................................................................................... 51
2
3.8 Summary ........................................................................................................................ 52
References ................................................................................................................................ 53
UNIT 4 SEQUENCES AND STRINGS .................................................................................... 54
4.0 Introduction .................................................................................................................... 54
4.1 Objectives ...................................................................................................................... 54
4.2 Sequences ...................................................................................................................... 54
4.2.1 Examples of sequences ................................................................................................... 54
4.2.2 Types of sequences......................................................................................................... 56
4.2.3 Subsequence................................................................................................................... 57
Activity 4.1 ............................................................................................................................... 57
4.3 Sequence Operation ........................................................................................................ 58
Activity 4.2 ............................................................................................................................... 59
4.4 String ............................................................................................................................. 60
4.5 Summary ........................................................................................................................ 61
References ................................................................................................................................ 62
UNIT 5 PROPOSITIONAL LOGIC.......................................................................................... 63
5.0 Introduction .................................................................................................................... 63
5.1 Objectives ...................................................................................................................... 63
5.2 Proposition ..................................................................................................................... 63
5.2.1 Conjunction and disjunction ........................................................................................... 64
5.2.2 Negation......................................................................................................................... 65
Activity 5.1 ............................................................................................................................... 66
5.3 Conditional Proposition .................................................................................................. 67
5.4 Biconditional Proposition ............................................................................................... 67
Activity 5.2 ............................................................................................................................... 68
5.5 Tautologies, Contradictions and Logical Equivalence ..................................................... 69
Activity 5.3 ............................................................................................................................... 71
5.6 Contrapositive and Converse .......................................................................................... 71
Activity 5.4 ............................................................................................................................... 72
5.7 Summary ........................................................................................................................ 72
References ................................................................................................................................ 73
UNIT 6 PREDICATE LOGIC .................................................................................................. 74
6.0 Introduction .................................................................................................................... 74
6.1 Objectives ...................................................................................................................... 74
6.2 Predicate ........................................................................................................................ 74
3
Activity 6.1 ............................................................................................................................... 75
6.3 Quantifier ....................................................................................................................... 75
6.3.1 Universal quantifier ........................................................................................................ 75
Activity 6.2 ............................................................................................................................... 77
6.3.2 Existential quantifier ...................................................................................................... 77
6.3.3 Combining Quantifiers ................................................................................................... 78
Activity 6.3 ............................................................................................................................... 78
6.4 Generalised De Morgan Laws ......................................................................................... 80
6.5 Translating Sentences into Logical Expressions .............................................................. 80
Activity 6.4 ............................................................................................................................... 81
6.6 Summary ........................................................................................................................ 82
References ................................................................................................................................ 83
UNIT 7 BOOLEAN ALGEBRA ............................................................................................... 84
7.0 Introduction .................................................................................................................... 84
7.1 Objectives ...................................................................................................................... 84
7.2 Combinatorial Circuits ................................................................................................... 84
7.2.1 Introduction .................................................................................................................... 84
7.2.2 Properties of combinatorial circuits ................................................................................ 87
7.2.3 Abstract Boolean algebras .............................................................................................. 88
7.2.4 Other properties of Boolean algebras .............................................................................. 89
7.3 Boolean Functions, Applications .................................................................................... 89
7.3.1 Introduction .................................................................................................................... 89
7.3.2 Disjunctive normal form ................................................................................................. 90
7.3.3 Conjunctive normal form ................................................................................................ 90
7.3.4 Functionally complete sets of gates................................................................................. 91
7.3.5 Minimisation of combinatorial circuits............................................................................ 93
7.3.6 Multi-output combinatorial circuits ................................................................................. 95
7.3.7 Activity 7.1 .................................................................................................................... 95
7.4 Summary ...................................................................................................................... 101
References .............................................................................................................................. 102
4
Course Guide Description
You must read this Course Guide carefully from the beginning to the end. It tells you briefly
what the course is about and how you can work your way through the course material. It also
suggests the amount of time you are likely to spend in order to complete the course
successfully. Please keep on referring to Course Guide as you go through the course material
as it will help you to clarify important study components or points that you might miss or
overlook.
Introduction
BIT111 Mathematical Foundations is one of the courses offered by the Faculty of
Information Technology and Multimedia Communication at the Zimbabwe Open University
(ZOU). This course is worth 3 credit hours and should be covered up to 15 weeks.
Course Audience
This course is offered to students undertaking the Bachelor of Information Technology
programme. This module aims to impart the importance of Mathematical Foundations in
digital electronics as well as Information Technology. This module is basically the
introductory course focusing on concepts and techniques of Mathematical Foundations
As an open and distance learner, you should be acquainted with learning independently and
being able to optimise the learning modes and environment available to you. Before you
begin this course, please confirm the course material, the course requirements and how the
course is conducted.
Study Schedule
It is a standard ZOU practice that learners accumulate 40 study hours for every credit As
such, for a three-credit hour course; you are expected to spend 120 study hours. Table 1 gives
an estimation of how the 120 study hours could be accumulated.
5
Objectives
By the end of this course, you should be able to:
Course Synopsis
This course is divided into 7 Units. The synopsis for each Unit can be listed as follows:
Unit 1 introduces the concept of sets and subsets. It also shows the theory application of sets
operations such as intersection, union, different and products.
Unit 2 discusses the concept of a relation. This Unit introduces several geometric and
algebraic methods for representing relation between objects. It also discusses some of the
properties of a relation.
Unit 3 elaborates the concept of a function which is basically a special kind of a relation that
has been discussed in Unit 2. This Unit also explains the graphical representation of
functions and the different types of functions.
Unit 4 explains the concept of sequence and strings. It also shows the operations on sequence
and strings.
Unit 5 explains the concept of propositions logic. It also explains the type of logic that deals
with proposition and how to reason about propositions.
Unit 6 explains the concept of predicate logic. This unit teaches how to write a statement
using the predicate logic concept.
Unit 7 shows the application of logic circuits in digital electronics. This unit will teach how
to design electronic circuits using Boolean Algebra.
6
Self-Check: This component of the module is inserted at strategic locations throughout the
module. It is inserted after you have gone through one subsection or sometimes a few sub-
sections. It usually comes in the form of a question that may require you to stop your reading
and start thinking. When you come across this component, try to reflect on what you have
already gone through. When you attempt to answer the question prompted, you should be
able to gauge whether you have understood what you have read (clearly, vaguely or worse
you might find out that you had not comprehended or retained the sub-section(s) that you had
just gone through). Most of the time, the answers to the questions can be found directly from
the module itself.
Activity: Like self-check, activities are also placed at various locations or junctures
throughout the module. Compared to self-check, an activity can appear in various forms such
as questions, short case studies or it may even ask you to conduct an observation or research.
An activity may also ask your opinion and evaluation on a given scenario. When you come
across an activity, you should try to widen what you have gathered from the module and
introduce it to real situations. You should engage yourself in higher order thinking where you
might be required to analyse, synthesise and evaluate instead of just having to recall and
define.
Summary: You can find this component at the end of each unit. This component helps you
to recap the whole unit. By going through the summary, you should be able to gauge your
knowledge retention level. Should you find points inside the summary that you do not fully
understand, it would be a good idea for you to revisit the details from the module.
Key Terms: This component can be found at the end of each unit. You should go through
this component to remind yourself of important terms or jargons used throughout the module.
Should you find terms here that you are not able to explain, you should look for the terms
from the module.
References: References is where a list of relevant and useful textbooks, journals, articles,
electronic contents or sources can be found. This list can appear in a few locations such as in
the Course Guide (at References section), at the end of every unit or at the back of the
module. You are encouraged to read and refer to the suggested sources to elicit the additional
information needed as well as to enhance your overall understanding of the course.
Prior Knowledge
The students would be expected to have done and passed Ordinary Level Mathematics for
them to be able to take this subject.
Assessment Method
This course will be assessed by means of assignments, tests and the final examination.
7
Blank page
UNIT 1
SET THEORY
1.0 Introduction
1.1 Objectives
For example,
(a) the collection of all students taking this course
(b) the collection of all lecturers at the university
(c) the collection of real numbers between zero and one
8
Notation
A= {elements of set A}
Where A is the name of the set. It could be any other variable name. Other Examples are,
C,D,E…..
Example 1.2a
The equation
A = {1, 2, 3, 4}
describes a set A made up of the four elements 1, 2, 3, and 4. A set is determined by its
elements and not by any particular order in which the elements might be listed. Another way
in writing the equation above is as follows:
A = {1, 3, 4, 2}
The elements comprised in a set are assumed to be distinct, and although for some reason we
may duplicate it out in a list, only one occurrence of each element is in the set. For this
reason, we may also describe the set A defined above as:
A = {1, 2, 2, 3, 4}
9
Self-Check 1.1
Example 1.2b
The set V of all vowels in the English alphabet can be written as
V = {a, e, i, o, u}
Example 1.2c
The equation
B = {x | x is a positive, even integer}
describes the set B made up of all positive, even integers; that is, B consists of the integer 2,
4, 6, 8, and so on.
The vertical bar "|" is read "such that". Equation B above can be read as "B equals the set of
all x such that x is a positive, even integer".
Symbols Description
∈ Is a member/element
∉ Is not a member/element
10
Example 1.2d
Let A = {1, 3, 5, 7}. Then 1 ∈ A, 3 ∈ A, but 2 ∉ A.
|A| = 4.
Example 1.2e
A is a set consisting of the first 5 positive integers: A = {1, 2, 3, 4, 5}
So 2 ∈ A but 6 ∉ A
Example 1.2f
Let N = {1, 2, 3,...} be a set of positive integers,
(a) A = {1, 4, 9..., 64, 81}
= {2k | k ∈ N}
A and B are called finite sets while C is an infinite set.
11
Figure 1.1: Representation of an Empty Set
Integers Z Z = {x | x is an integer}
Example: ....
-3,-2,-1,0,1,2,3,...
12
Activity 1.1
1. Let A= {1, 2, 4, a, b, c}. Identify each of the following as true or false:
(a) 2 ∈ A
(b) 3 ∈ A
(c) c ∉ A
(d) ± ∈ A
(e) { } ∉ A
(f) A ∈ A
2. Let A = {x | x is a real number and x < 6}. Identify each of the following as true or false.
(a) 3 ∈ A
(b) 6 ∈ A
(c) 5 ∉ A
(d) 8 ∉ A
(e) -8 ∈ A
(f) 3.4 ∉ A
3. Describe the following sets by listing their elements
(a) The set of all positive integers that are less than ten
A set is completely known when its members are all known. Thus, we say two sets A and B
are equal if they have the same elements and we write A = B.
13
Example 1.3a
If A = {1, 2, 3} and B = {x| x is a positive integer and x2 < 12}, then A = B.
Example 1.3b
If A = {BASIC, PASCAL, ADA} and B = {ADA, BASIC, PASCAL}, then A = B.
Example 1.3c
If A = {x | x2 + x -6 = 0},
B = {2, -3}
A = B since x2 + x- 6 = 0 can be factorised into (x - 2) (x + 3) = 0,
giving x = 2 and x = - 3.
Activity 1.2
1. Let A= {1, 2, 3, 4, 5}. Which of the following sets are equal to A?
(a) {4, 1, 2, 3, 5}
(b) {2, 3, 4}
(c) {1, 2, 3, 4, 5, 6}
(d) {x | x is an integer and x2 ≤ 25}
(e) {x | x is a positive integer and x ≤ 5}
(f) {x | x is a positive rational number and x≤ 5}
2. Which of the following sets are empty sets?
(a) {x | x is a real number and x2 - 1 = 0}
(b) {x| x is a real number and x2 + 1 = 0}
(c) {x | x is a real number and x2 = -9}
(d) {x| x is a real number and x = 2x + 1}
(e) {x | x is a real number and x = x + 1}
3. Determine whether each of the following pairs of sets is equal?
(a) {1, 3, 3, 3, 5, 5, 5, 5, 5}, {5, 3, 1}
(b) {{1}}, {1, {1}}
(c) ∅, {∅}
14
1.4 Venn Diagram
Venn diagram provides pictorial views of a set. The idea of Venn diagram was first proposed
by a mathematician by the name of John Venn.
In Venn diagrams, the universal set E will normally be denoted by a rectangle, while sets
within E will be denoted by circles as shown below:
15
1.5 Subset
Definition 1.5a: If every element of A is also an element of B, that is if whenever x
∈ A then x ∈ B, we say that A is a subset of B or A is contained in B, and we write
A ⊆ B.
The Venn diagram below represents the subset for set A and B.
Figure 1.5: Universal set E with Subset B which has Its Own Subset A
Example 1.5a
If C = {1, 3} and A = {1, 2, 3, 4}
Then C is a subset of A, or C ⊆ A
We can present it in as Venn diagram as shown below.
16
Example 1.5b
Let
A = {1, 2, 3, 4, 5, 6},
B = {2, 4, 5}, and
C = {1, 2, 3, 4, 5}.
B ⊆ A, B ⊆ C and C ⊆ A
Example 1.5c
Let
A = {1,2,3,4,5,6}
B = {3,7}
Definition 1.5b: If X is a subset of any set Y and X is not equal to Y, we say that X
is a proper subset of Y and we write X ⊂ Y.
17
Definition 1.5c: Two sets, A and B, are equal and can be written as A = B if A ⊆
B and B ⊆ A.
Activity 1.3
1. Let A = {1, 2, 5, 8, 11}. Identify each of the following statements as true or false.
(a) {5, 1} ⊆ A
(b) {8, 1} ∈ A
(d) ∅ ⊆ A
(e) {1, 6} ⊄ A
(f) {2} ⊆ A
(g) {3} ∉ A
(h) A ⊆ {11, 2, 5, 1, 8, 4}
2. In each part, find the set of the smallest cardinality that contains the given sets as subsets
(a) {a, b, c}, {a, d, e, f}, {b, c, e, g}
(a) A ⊆ B
(b) B ⊆ C
(c) C ⊆ D
18
1.6 Power Set
Definition 1.6a: If A is a set, then the set of all subsets of A is called the power set of
A and is denoted by P (A).
Example 1.6a
If A = {a, b, c}, the members of P (A) are
P (A) = { ∅, {a}, {b}, {c}, {a, b}, {a, c}, {b, c}, {a, b, c} }
All but {a, b, c} are proper subset of A. You may also write P (A) as P ({a,b,c})
The number of elements in a power set is given by the following theorem.
Example 1.6b
For set A in Example 1.5a,
| A | = 4, then | P(A) | = 24 = 16
Example 1.6c
The number of P (∅) = 1 since |∅| = 0 and
| P (∅) | = 20 = 1
Activity 1.4
1. Find the power set of each of the following sets.
(a) {a}
(b) {a, b}
(c) P (P (∅))
19
4. Determine whether each of the following sets is the power set of a set.
(a) ∅
In this section, we will discuss several operations that will combine given sets to produce
new sets.
1.7.1 Union
Definition 1.7a: If A and B are sets, their union can be defined as a set consisting of all
elements that belong to A or B and is denoted by A ∪ B. Thus A ∪ B = {x| x ∈ A or x ∈ B}.
The union of two sets can be illustrated by using a Venn diagram as follows.
Example 1.6a
Let A = {a, b, c, d, e} and B = {b, d, r, s}.
20
Figure 1.9: A ∪ B
1.7.2 Intersection
Definition 1.7b: If A and B are sets, their intersection can be defined as a set
consisting of all elements that belong to both A and B. The intersection of A and B
is denoted by A ∩ B.
21
Example 1.6b
Let
A = {a, b, c, d, e, f}
B = {b, e, f, r, s}
C = {a, t, u, v}.
A∩ B = {b, e, f} since elements b, e, and f belong to both A and B.
Figure 1.11: A ∩ B
Similarly, A ∩ C = {a}.
Figure 1.12: A ∩ C
B ∩ C = {}, since there are no elements that belong to both, B and C.
22
Figure 1.13: B ∩ C
We can illustrate the disjoint of two sets with a Venn diagram as follows:
Definition 1.7d: If A and B are sets, their difference can be defined as a set consisting of
all elements in A that are not in B. The difference between A and B is denoted by A- B.
23
Figure 1.15: B - A
Definition 1.7e: Let E be a universal set and let A be a subset of E. The set of E – A
consists of all elements of E that are not elements of A is called the complement of A
and is denoted by or A^
Activity 1.5
For questions 1 to 3, prove the following properties, first formally using the definitions and
then by drawing the Venn diagrams.
(a) A ∪ B = B ∪ A
(b) A ∩ B = B ∩ A
(c) (A ∪ B) ∪ C = A ∪ (B ∪ C)
(d) (A ∩ B) ∩ C = A ∩ (B ∩ C)
(e) A ∪∅ = A
(f) A ∩∅ = ∅
(g) A ∪ (B ∩ C) = (A ∪ B) ∩ (A ∪ C)
(h) A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C)
24
2. Let A be a subset of B. Let C be a set.
(a) A ∩ B = A
(b) A ∪ B = B
(c) A ∩ C ⊆ B ∩ C
(d) A ∪ C ⊆ B ∪ C
(a) A\B = A\ (A ∩ B)
(b) A = (A\B) ∪ (A ∩ B)
4. Let X1 be the set of all points strictly inside the circle of radius R1 and centre O1 and X2
be the set of all points strictly inside the circle of radius R2 and centre O2. Let d be the
distance between O1 and O2. Show that
X1 ∩ X2 = ∅ ⇐⇒ d ≥ R1 + R2
5. What can you say about two lines L1 and L2 in the plane if you know that they are
disjoint? Consider the same question for two lines in the space.
6. Let A={a,c,e,h,k}, B={a,b,d,e,h,i} and C={a,c,e,i,m}.
Find each of the following:
a) A∪ B
b) A∩ B ∩C
c) A – (B – C)
d) How many elements does A × B have?
e) How many elements does the power set of A have?
7. Using Venn diagrams prove or disprove that if A, B, and C are sets, then
( A − B) ∪ ( A − C ) = A − ( B ∩ C ) .
25
1.8 Summary
In this unit we dealt with the concept of sets and subsets; and operations on sets such as
intersection, union, difference and products. Before you proceed you have to make sure you
understand these concepts and operations on sets.
26
References
Fiel, T. Kroane, J. (2003). Essential Discrete Mathematics for Computer Science NJ
USA: Pearson Education, Upper Saddle River.
27
UNIT 2
RELATIONS
2.0 Introduction
In real life, relationship exists between people and other entities. For example “father of” is a
relationship between two individuals. Similarly we may have a relationship “owner of”
between people and car. In mathematics, this concept can be formalised by using relations. In
this unit, we will discuss the concept of relation. We will provide several geometric and
algebraic methods for representing relation between objects. We will also discuss some of the
properties of relation.
2.1 Objectives
Self-Check 2.1
You understand that relationships exist between people and other living entities. Can
a relationship exist between non-living objects?
Definition 2.2b: The set { x ∈ X | (x, y) ∈ R for some y ∈ Y} is called the domain of
R. The set {y ∈ Y | (x, y) ∈ R for some x ∈ X} is called the range of R.
28
Example 2.1a
If X is a set of students
X = {Jimmy, Sheila, Shami, Zurai}
and Y is a set of courses
Y = {Computer Science, Math, Art, History}
a relation R between X and Y indicating “courses taken by the students” can be written as
R = {(Jimmy, Computer Science), (Sheila, Math), (Jimmy, Art),
(Shami, History), (Shami, Computer Science), (Zurai, Math)}.
Example 2.2b
Suppose A is a set of lecturers and B is a set of cars.
A = {Anna, Johan, Raviro, Zulu}
B = {Nissan, Toyota, Mercedes}
We can define a relation R between the two sets indicating “types of cars owned by
lecturers” as
R = {(Anna, Nissan), (Johan, Toyota), (Johan, Mercedes), (Raviro, Toyota)}
The pictorial representation of this relation is as follows:
29
Figure 2.2: Relation between A and B in Pictorial Representation
Example 2.2c
1. Suppose that
A = {Mashonaland, Manicaland, Midlands}
B = {Bindura,Mutare, Gweru, Kwekwe}
Write a relation R between set A and set B which is defined by (x,y) ∈ R if “y is a town in
x”
30
2. A car manufacturer makes three different types of car frames and two types of engines.
List all possible models of cars.
Frame type: sedan (s), coupe (c), van (v)
Engine type: petrol (p), diesel (d)..1
3. Suppose that
X = {1, 2, 3, 4, 5}
Y = {3, 6, 9}
Write a relation R between set X and set Y defined by:
(a) (x,y) ∈ R if x < y
(b) (x,y) ∈ R if y = 2x
Self-Check 2.2
We hope that you have understood the basic concepts of relations. Based on your
understanding, write a relation for the following items, G = gender; and T = toys that
kids love to play. You may present your idea pictorially.
Example 2.3a
Let
X = {2, 3, 4} and Y = {3, 4, 5, 6}.
If we define a relation R from X to Y by (x, y) ∈ R if x divides y we obtain
R = {(2, 4), (2, 6), (3, 3), (3, 6), (4, 4)}
This relation can be presented pictorially as
31
The inverse of the relation R is
R-1 = {(4, 2), (6, 2), (3, 3), (6, 3), (4, 4)}.
We can represent them pictorially as below,
This relation can be described as “x is divisible by y”. Every relation R has an inverse
relation R-1.
Activity 2.2
Give the inverse for all the relations below:
(a) R = {(a, 6), (b, 2), (a, 1), (c, 1)}
(b) R = {(Susan, Music), (Emmy, History), (Adrian, Mathematics), (Emmy,
Chemistry)}
(c) R = {(2, 2), (5, 6), (1, 2), (7, 1), (9, 1)}
(d) R = {(8, 26), (21, 17), (10, a), (c, 45), (b, 3), (c, 3)}
(e) R = {(Blue, Car), (Red, Flower), (Black, Car), (White, Flower)}
32
We can represent it pictorially as shown in Figure 2.6 below,
Figure 2.6: R2 o R1
Example 2.4a
Suppose that we have two relations
R1 = {(1, 2), (1, 6), (2, 4), (3, 4), (3, 6), (3, 8)}
and
R2 ={(2, u), (4, s), (4, t), (6, t), (8, u)}
From the definition 2.3a, the relations can be presented pictorially as
Figure 2.7: R2 o R1
33
Activity 2.3
(b) R1 = {(Math, 3), (Art, 1), (Math, 1), (History, 4), (Chemistry, 2)}
R2 = {(1, Adrian), (1, Amy), (2, Amina), (3, Shamiso), (4, Amy)}
(c) R1 = {(Black, a), (Blue, a), (White, b), (Green, d), (Blue, c), (White,c)}
R2 = {(c, 2), (c, 6), (a, 4), (b, 4), (d, 6), (a, 8)}
Example 2.5a
Let R be the relation on
X = {1, 2, 3, 4, 5} defined by (x, y) ∈ R if x ≤ y, x, y ∈ X. Then
R = {(1, 1), (1, 2), (1, 3), (1, 4), (1, 5), (2, 2), (2, 3), (2, 4), (2, 5), (3, 3), (3, 4), (3, 5), (4, 4),
(4, 5), (5, 5)}
34
2.5.1 Reflexive Relation
Definition 2.5b: A relation R on a set X is called reflexive if (x, x) ∈ R for every x ∈X.
Example 2.5b
The relation R on X = {1, 2, 3, 4} for the example as shown in 2.5a above is reflexive
because for each elements x∈ X and (x, x) ∈ R.
Example 2.5c
Consider the relation R on X = {a, b, c, d} given as follows
R = {(a, d), (b, c), (c, b), (d, a)}
The relation is symmetric because for all x and y, when (x, y) ∈ R, we have (y, x) ∈ R.
In this case (d, a) and (c, b), (b, c) and (a, d) are all in R.
Example 2.5d
Consider the relation R on X = {a, b, c, d} which is given by as follows
R = {(a, b), (b, c), (c, d)}
The relation is antisymmetric because for all x, y, when (x, y) ∈ R and x ≠ y, (y, x) ∉ R.
Example 2.5e
Consider the relation R on X = {a, b, c, d} which is given as follows:
R = {(a, b), (a, d), (a, c), (b, c), (b, d),(c, d)}
35
The relation R is transitive because for all x, y, z, where (x, y) and (y, z) ∈ R, there is (x, z) ∈
R. For example, (a, b) ∈ R, (b, c) ∈ R, and (a, c) ∈ R; (a, b) ∈ R, (b, d) ∈ R, and (a, d) ∈ R;
and (a, c) ∈ R, (c, d) ∈ R and (a, d) ∈ R.
Activity 2.4
1. Write each of the relations below as sets
(a) The relation R on {1, 2, 3, 4} defined by (x, y) ∈ R if x2 ≥ y
(b) The relation R on {1, 2, 3, 4, 5} defined by (x, y) ∈ R if y = 2x
(c) Relation R on the set {1, 2, 3, 4, 5} defined by the rule (x, y) ∈ R if 3 divides x - y.
(d) Relation R on the set {1, 2, 3, 4, 5} defined by the rule (x, y) ∈ R if x + y ≤ 6.
(e) Relation R on the set {1, 2, 3, 4, 5} defined by the rule (x, y) ∈ R if x = y - 1.
2. Is the relation in questions 1(a) up to (e) reflexive, symmetric, antisymmetric, or
transitive?
2.6 Digraph
One way to picture a relation on a set is to draw its digraph. A digraph consists of vertices to
represent the elements of X and arrows or directed edges to represent the relation between
the elements.
Example 2.6a
The digraph for the relation in Example 2.5a is as follows:
Example 2.6b
The relation R on X = {a, b, c, d} given by the digraph is as follows:
R = {(a, d), (b, c), (c, b), (d, a)}
36
Figure 2.11
Symmetric Has the property that whenever there is a directed edge from v to
relation w, there is also a directed edge from w to v.
Antisymmetric Has the property that between any two vertices there is at most one
relation directed edge
Transitive Has the property that whenever there are directed edges from x to y
relation and from y to z, there is also a directed edge from x to z.
Activity 2.5
Draw the digraph of the following relations:
(a) R = {(1, 2), (2, 1), (3, 3), (1, 1), (2, 2)} on X = {1, 2, 3}
(b) R = {(1, 2), (2, 3), (3, 4), (4, 1)} on {1, 2, 3, 4}
(d) R = {(a, 3), (b, 1), (c, 4), (d, 1)} from {a, b, c, d} to {1, 3, 4}
37
Example 2.7a
Consider the relation R on the set X = {1, 2 ,3 ,4, 5} defined by (x,y) ∈ R if x divides y
So R = {(1,1), (1,2), (1,3), (1,4), (1,5), (2,2), (2,4) (3,3), (4,4), (5,5)}
R is reflexive since (1,1), (2,2), (3,3), (4,4), (5,5) are in R.
R is antisymmetric since (2,1), (3,1), (4,1), (5,1) and (4,2) are not in R.
R is transitive since (1, 2), (2,4) and (1,4) are in R.
Thus R is a partial order.
Example 2.7b
In general, a relation R on a set of positive integers defined by
(x,y) ∈ R if x divides y, is a partial order.
If R is a partial order on a set X, we can denote x ≤ y to indicate that (x, y) ∈ R.
Example 2.7c
The less than or equals relation on the positive integers is a total order since, if x and y are
integers, either x ≤ y or y ≤ x.
Activity 2.6
Determine whether each of the relations defined below on the set of positive integers is a
partial order.
(a) (x, y) ∈ R if x = y2
(b) (x, y) ∈ R if x > y
(c) (x, y) ∈ R if x ≥ y
(d) (x ,y) ∈ R if x = y
(e) (x ,y) ∈ R if 3 divides x - y
38
Example 2.8a
Consider the relation R on {1, 2, 3, 4 5} defined as
R = {(1, 1), (1, 3), (1, 5), (2, 2), (2, 4), (3, 1), (3, 3), (3, 5), (4, 2), (4, 4), (5, 1), (5, 3), (5, 5)}
R is reflexive because (1, 1), (2, 2), (3, 3), (4, 4), (5, 5) ∈ R.
R is symmetric because whenever (x, y) is in R, (y, x) is also in R.
R is transitive because whenever (x, y) and (y, z) are in, (x, z) is also in R.
Thus, R is an equivalence relation on {1, 2, 3, 4, 5}.
Example 2.8b
The relation R as shown in the example 2.6a is not an equivalence relation because R is not
symmetric.
Activity 2.7
1. Determine whether the given relation is equivalence relation on {1, 2, 3, 4, 5}.
(a) {(1,1), (2,2), (3,3), (4,4), (5,5), (1,3), (3,1)}
(b) {(1,1), (2,2), (3,3), (4,4), (5,5), (1,3), (3,1), (3,4), (4,3)}
(c) {(1,1), (2,2), (3,3), (4,4), (5,5), (1,5), (5,1), (3,5), (5,3), (1,3), (3,1)}}
Activity 2.8
1. For any set X, let P (X) denote the set of all subsets of X. Which of the following
equations are true? If the equation is not true, is one of the sides a subset of the other?
Prove your answers:
39
2. Let R be a relation on a set X. Assume that R is reflexive and transitive.
(a) reflexive?
(b) symmetric?
(c) transitive? Prove your answers.
f:X→Y
ℎ�� − 1 = � �� ∘ �
40
6. Let F : A → B and G : B → C be two functions and let H : G ◦ F : A → C. Show that
(a) If H is one-to-one, so is F.
(b) If H is onto, so is G.
(c) If H is bijective, F and G are not necessarily bijective. Give a counter example
also.
2.9 Summary
In this unit we have learnt the concept of relations between two sets and to use various
methods for representing relation. We also learnt to draw a digraph as a way to picture a
relation on a set. Relations that we met include reflexive relation, symmetric relation,
antisymmetric relation and transitive relation
41
References
42
Blank page
UNIT 3
FUNCTIONS
3.0 Introduction
In this unit we discuss that the concept of functions is very important in mathematics and it is
also important in Information Technology. For example, hashing functions are normally used
to determine to which list a particular data should be assigned. A function is basically a
special kind of relation. So, most of the terminologies that have been introduced in Unit 2
will be reused in this unit.
3.1 Objectives
By the end of this unit, you should be able to:
• describe the concept of functions
• represent functions by using graphical representations
• identify different types of functions
Self-Check 3.1
How can you relate the concept of function and apply it to your daily life? Give an
example.
Example 3.2a
The relation
f = {(1, a), (2, b), (3, a)}
from X = {1, 2, 3} to Y = {a, b, c}, is a function from X to Y.
By using an arrow diagram, this relation can be presented as:
43
Figure 3.1: The Relation f
Example 3.2b
The relation is represented as
f(x) = x2.
This relation is a function and the domain is the set of all real numbers.
The range of f is the set of all non-negative real numbers
If f is a function f: X → Y, given a value in set X, we can obtain the value in set Y.
This process is called function application.
Example 3.2c
We can apply the function given in Example 3.2b as follows:
f(2) = 4, f(8) = 64.
Activity 3.1
1. Determine whether each relation below is a function from
X = {1, 2, 3, 4} to Y = {a, b, c, d}.
If it is a function, find its domain and range, and draw the arrow diagram.
(a) {(1, a), (2, a), (3, c), (4, b)}
(b) {(1, c), (2, a), (3, b), (4, c), (4, d)}
(c) {(1, c), (2, d), (3, a), (4, b)}
(d) {(1, d), (2, d), (4, b)}
(e) {(1, b), (2, b), (3, b), (4, b)}
2. Let A = {a, b, c, d} and B = {1, 2, 3}. Determine whether the relation R from A to B is a
function. If it is a function, give its range.
(a) R = {(a,1), (b,2), (c,1), (d,2)}
(b) R = {(a,3), (b,2), (c,1)}
(c) R = {(a,1), (b,2), (a,2), (c,1), (d,2)}
(d) R = {(a, 1), (b, 1), (c, 1), (d, 1)}
44
3. Determine whether the relation R from A to B is a function.
(a) A = the set of all students at Zimbabwe Open University
B = the set of courses offered by Zimbabwe Open University
(b) A = a set of people in Harare,
B = the set of IC numbers
4. Let g = {(1,a), (2,c), (3,c)} be a function from X = {1, 2, 3} to Y = {a, b, c, d}. Apply the
function to find the value of
(a) g(1)
(b) g(2)
Self-Check 3.2
Draw a graph for the function f(x) = x2 + 1 where x ≥ 0. Do you get the parabola
shape on your graph?
Example 3.3a
The graph of the function
f(x) = x2,
is shown in the Figure 3.2 below.
Example 3.3b
The graph of the function R = {(1,1),(1,3),(2,2),(3,0)} is as shown in Figure 3.3 below.
45
Figure 3.3 Graph of the Function R
3.4.1 Injective
Definition 3.4a: A function f from X to Y is said to be one to one (or injective) if for
each y ∈ Y, there is at most one x ∈ X with f(x) = y.
The condition given in the definition above for a function to be one to one is equivalent to:
if x, x’ ∈ X and f(x) = f(x’), then x = x’.
If a function from X to Y is one to one, each element in Y in its arrow diagram will have at
most one arrow pointing to it (see figure 3.5). If a function is not one-to-one, some element in
Y in its arrow diagram will have two or more arrows pointing to it.
Example 3.4a
The function f = {(1, b), (3, a), (2, c)} from X = {1, 2, 3} to Y = {a, b, c, d} is one-to-one.
46
Figure 3.5: One-to-One Relationship
Example 3.4b
The function f(x) = x + 1 is one-to-one.
3.4.2 Surjective
Example 3.4c
The function f = {(1, b), (3, a), (2, c)} is onto on {a, b, c}.
Example 3.4d
The function f = {(1, a), (2, c), (3, b)} from X = {1, 2, 3} to Y = {a, b, c} is one-to-one and
onto Y.
The arrow diagram for this function is shown in Figure 3.6.
47
3.4.3 Bijective
Definition 3.4c: A function that is both one-to-one and onto is called a bijective function.
Example 3.4e
The function f = {(1, a), (2, b), (3, c)} from X = {1, 2, 3} to Y {a, b, c} is one-to-one and
onto. So it is bijective.
Activity 3.2
1. Show that if f is a one-to-one, onto function from X to Y, then
{(y, x) | (x, y) ∈ f}
is a one-to-one, onto function from Y to X.
Example 3.5a
For the function f in f = {(1, a), (2, c), (3, b)} from X = {1, 2, 3} to Y = {a, b, c} is one-to-
one and onto Y.
f-1 = {(a, 1), (c, 2), (b,3)}
48
The arrow diagram for f-1, where f is the function is shown in the following figure.
Example 3.5b
The function
f(x) = 2x
is one to one function from the set � of all real numbers onto the set �� of all positive real
numbers. We will derive a formula for f-1(y).
Suppose that (y,x) is in f-1, that is
f-1 (y) = x
then (x,y) ∈ f. Thus y = 2x. By definition of logarithm,
log2 y = x
Combining (f-1 (y) = x) and (log2 y = x), we have
f-1 (y) = x = log2 y
Activity 3.3
Each of the functions below is one-to-one. Find the inverse function for each of them.
Self-Check 3.3
Given f(n) = 3n + 2 and g(n) = 2n - 1. Find a composition of g o f and how do you
pronounce the answer for g o f?
49
3.6 Functions Composition
Since functions are special kinds of relations, we can form the composition of two functions.
Specifically, suppose that g is a function from X to Y and f is a function from Y to Z. The
resulting function from X to Z is called the composition of f with g and is denoted by f o g.
Example 3.6a
Given g = {(1,a), (2,a), (3,c)} a function from X = {1, 2, 3} to Y = {a, b, c}, and f = {(a,y),
(b,x), (c,z)}, a function from Y to Z = {x, y, z}.
The composition function from X to Z can be represented by an arrow diagram as follows:
So,
f o g = {(1,y), (2,y), (3,z)},
The application of f o g on x can be written as (f o g)(x) or alternatively as f(g(x)).
Example 3.6b
If f(x) = log3 x and g(x) = x4, f(g(x)) = log3 (x4 ) , g(f(x)) = (log3 x) 4 .
Composition sometimes allows us to decompose complicated functions into simpler
functions.
Example 3.6c
The function
�(� ) = √sin. 2�
can be decomposed into the functions
�(� ) = √� , ℎ(� ) = sin �, �(� ) = 2�
we can write � (�) = �(ℎ�� (� )�)
50
Activity 3.4
1. Let f and g be functions from the positive integers to the positive integers defined by the
equations
f(n) = 2n + 1
g(n) = 3n – 1
51
Example 3.7a
Let X = {1, 2,….}. If we define f(x, y) = x + y, then f is a binary operator on X.
A unary operator of a set X associates with each single element of X one element in X.
Example 3.7b
Let E be a universal set and X is a set. If we define
f(X) = X, X ⊆ E,
Then f is a unary operator on P(E).
Activity 3.5
1. A binary operator f on the set X is commutative if f(x, y) = f(y, x) for all x, y ∈ X. State
whether the given function f is a binary operator on the set X. If f is not a binary operator,
state why. State whether or not each binary operator is commutative.
(a) f(x, y) = x + y, X = {1, 2,…...}
(b) f(x, y) = x - y, X = {1, 2,…...}
(c) f(x, y) =x/y, X = {0, 1, 2,…...}
(d) f(x, y) = x2 + y2 - xy, X = {1, 2,….}
2. Give an example of a unary operator (different from f(x) = x, for all x) on the given set.
(a) {…., -2, -1, 0, 1, 2,….}
3.8 Summary
In this unit we learnt how to describe the concept of functions and to represent functions by
using graphical representations. We also learnt how to identify different types of functions,
such as injective, surjective and bijective functions. We also learnt about the inverse of a
function. We lastly dealt with binary and unary operators.
52
References
Evans, A.J. (1997). Basic Digital Electronics: Prompt Publishing.
Mano, M. and Ciletti, M.D. (2006). Digital-Design-4th-Edition: Upper Saddle River, NJ,
Prentice Hall.
53
Blank page
UNIT 4
4.0 Introduction
Sequences are used to represent ordered list of elements. A list of the letters as they appear in
a word (or normally called a string) is an example of a sequence. The words “form” and
“from” are two different words although both of them consist of the same letters. The
concept of sequences and strings will be the subject of this unit.
4.1 Objectives
By the end of this unit, you should be able to:
• describe the concept of sequence and operations on sequences
• discuss the concept of strings and operations on strings
4.2 Sequences
Self-Check 4.1
What are strings? Are strings often restricted to sequences?
A sequence is a list in which order is taken into account. It is a special type of function. The
formal definition of a sequence is as follows:
54
Figure 4.1: Ordered List Sequence
Example 4.2b
Munenzva buses charges $ 1 for the first km and 50 cents for each additional km. In general,
the cost Cn of traveling n km is 1.00 (the cost of travelling the first km) plus 0.50 times the
number (n - 1) of additional km. That is,
Cn = 1 + 0.5 (n - 1)
For example:
C1 = 1 + 0.5 (1 - 1)
= 1 + 0.5 (0)
=1
C5 = 1 + 0.5 (5 - 1)
= 1 + 0.5 (4)
=3
Example 4.2c
The ordered list a, a, b, a, b….. is a sequence. The first element of the sequence is a, the
second element of the sequence is a and so on. If we denote this sequence, we have
An alternative notation for the sequence s is 〈sn〉. Here, s or 〈sn〉 denotes the entire sequence
s1, s2, s3,…. We use the notation sn to denote the single, nth element of the sequence s.
Define a sequence 〈tn〉 by the rule tn = n2 − 1, ν ≥ 1 the first five terms of this sequence are
Example 4.1e
Define a sequence u by the rule un is the nth letter in the word digital.
Then u1 = d, u2 = u4 = i and u7 = l. This sequence is a finite sequence.
55
Table 4.1: A Finite Sequence
Example 4.2f
If x is the sequence defined by
� �
xn = ��� , -1 ≤ n ≤ 4
The elements of x are
2, 1, 1/2, 1/4, 1/8, 1/16
Example 4.2g
The sequence 2,4,6,… is increasing since sn = 2n ≤ 2(n+1) = sn+1 for all n.
Example 4.2h
The sequence s
3, 5, 5, 7, 8, 8, 13.
Is increasing since sn ≤ sn+1 for all n.
Definition 4.2c: A sequence s is decreasing if sn ≥ sn+1 for all n.
56
Example 4.2i
The sequence 2, 1, 1/2 , 1/4 ,… is decreasing since xn = 1/2n ≥ 1/2n+1 = xn+1 for all n.
4.2.3 Subsequence
One way to form a new sequence from a given sequence is to retain only certain terms of the
original sequence, maintaining the order terms in the given sequence.
Definition 4.2d: Let 〈sn〉 be a sequence defined for n = m, m + 1,.. .and let n1, n2,..
be an increasing sequence satisfying nk nk+1, for all k, whose values are in the set { m,
m + 1,…}. We call the sequence 〈snk〉 a subsequence of 〈sn〉.
Example 4.2j
The sequence
b, c
is a subsequence of the sequence
aabcq
Notice that the sequence
c, b
is not a subsequence of the sequence.
Table 4.2 illustrates the example:
Example 4.2k
The sequence
2, 4, 8, 16
is a subsequence of the sequence
2, 4, 6, 8, 10, 12, 14, 16.
Activity 4.1
1. The sequence S is defined by
c, d, d, c, d, c
(a) Find s1
(b) Find s4
57
2. The sequence k is defined by
kn = 2n - 1, n > 1
(a) Find k3
(b) Find k100
(c) Find k7
(d) Find k2077
(e) Is k increasing or decreasing?
Definition 4.3a: If 〈�� 〉���� is a subsequence, we define the sum and product
of terms in the sequence as
�
� �� = �� + ���� + � + ��
���
� �� = �� · ���� · … · ��
���
Example 4.3a
Let a sequence be defined by an = 2n, n ≥ 1. Then
58
Example 4.3b
The geometric sum
Example 4.3c
Let a sequence be defined by the rule an = 2(−1)n, where n >1. find a formula
for the sequence s defined by
�� = ∑���� �(−�)�
We find that
Sn =2(-1)1+2(-1)2+2(-1)3+………+2(-1)n
= 2-2+2-……….+(-1)n2 = 0 if n is even
= -2 if n is odd
Activity 4.2
1. The sequence g is defined by
gn= n2 - 3n + 3, n ≥ 1
���∑���� ��
59
(d) Find a formula for the sequence d defined by
�
�� = � ��
���
3. Rewrite the sum
�
� � � � ���
���
4.4 String
Activity 4.3
Let X={a,c,e,i,m,s,t}. Find the sequence if the string contains the word
“mathematics”.
Example 4.4a
Let X = {a, b, c}. If we let
q1 = b, q2 = a, q3 = a, q4 = c
We obtain a string over X. This string is written baac
Since a string is a sequence, order is taken into account. For example, the string baac is
different from the string acab.
Repetition in a string can be specified by superscripts. For example, the string bbaaac may be
written b2a3c.
60
Definition 4.4b: We let X* denotes the string of all strings over X, including the null
string, and we let X+ denotes the set of all non-null strings over X.
The string with no elements is called the null string and is denoted as λ.
Example 4.4b
Let X = {a, b}. Some elements in X* are λ, a, b, abab, b20a5 ba
Definition 4.4c: The length of a string α is the number of elements in α. The length
of α is denoted by |α|
Example 4.4c
If α = aabab and β = a3b4a32, then
|α| = 5 and |β| = 39
If α and β are two strings, the string consisting of α followed by β, written αβ, is called the
concatenation of α and β.
Example 4.4d
If t = aab and e = cabd, then
te = aabcabd, et = cabdaab, tλ = t = aab,
λt = t = aab.
Activity 4.4
4.5 Summary
In this unit we learnt how to describe the concept of sequence and operations on sequences.
We learnt about increasing and decreasing sequences and subsequences. We also learnt how
to describe the concept of strings and operations on strings.
61
References
Evans, A.J. (1997). Basic Digital Electronics: Prompt Publishing.
Mano, M. and Ciletti, M.D. (2006). Digital-Design-4th-Edition: Upper Saddle River, NJ,
Prentice Hall.
Rosen, K.H. (1998). Discrete Mathematics and its Applications: McGraw-Hill
Publications.
62
Blank page
UNIT 5
PROPOSITIONAL LOGIC
5.0 Introduction
Logic is the foundation of science and mathematics. Logical methods are used in
mathematics to prove the validity of mathematical statements. In natural and physical
sciences, logic is used to draw conclusions from experiments or observations. In Information
Technology, logic can be used to verify the correctness of computer programs.
There are a few types of logic. In this unit, we will deal with the simplest form of logic,
namely, the propositional logic. This type of logic deals with proposition and how to reason
about propositions.
5.1 Objectives
By the end of this unit, you should be able to:
• explain the concept of propositions
• apply operations on propositions by using truth tables
5.2 Proposition
Self-Check 5.1
“In order to translate a sentence from English into French two things are necessary.
First, we must understand thoroughly the English sentence. Second, we must be
familiar with the forms of expression peculiar to the French language. The situation
is very similar when we attempt to express in mathematical symbols a condition
proposed in words. First, we must understand thoroughly the condition. Second, we
must be familiar with the forms of mathematical expression.”
Adapted: George Poly_, How to Solve It. Princeton: Princeton University Press.
1945.
Definition 5.2a: A statement that is either true or false, but not both, is called a
proposition.
63
Example 5.2a
Which of the following are propositions?
(a) The earth is round
(b) Zimbabwe is a country in Southern Africa
(c) Do you speak English?
(d) 6 + 2x = 5
(e) Take two panadols
(f) The temperature in Zimbabwe is between 15 to 30 oC
Solution:
(a) and (b) are statements that happen to be true.
(c) is a question, so it is not a statement.
(d) is a declarative sentence, but not a statement, since it is true or false depending on the
value of x.
(e) is not a statement, it is a command.
(f) is a declarative sentence whose truth or falsity we do not know at this time; however,
we can in principle determine if it is true or false; so it is a statement.
We can describe the values of the conjunction of p and q by using a truth table as follows:
64
The truth table for the disjunction of p and q is:
Proposition such as p ∧ q and p ∨ q that result from combining propositions are called
compound propositions,
Example 5.2b
If
p: The Earth is round,
q: A decade is 100 years,
Then the conjunction of p and q is
p ∧ q: The Earth is round and a decade is 100 years
Since p is true and q is false, p ∧ q is false.
The disjunction of p and q is
p ∨ q: The Earth is round or a decade is 100 years.
Since p is true and q is false, p ∨ q is true.
5.2.2 Negation
Example 5.2c
If p : The Earth is round.
The negation of p is the proposition
� ̅ : The Earth is not round.
Since p is true, � ̅ is false.
65
Activity 5.1
1. Determine whether each of the statements below is a proposition. If the statement is a
proposition, write its negation.
p = F, q = T, r = T.
(a) p ∨ q
(b) �̅ ∨��
(c) �̅ ∨ (�� ∧�̅ )
(d) (p ∨ �̅ ) ∧ (q ∨ r) ∨ (r ∨ p)
3. Let p and q be the proposition
p: Tawanda is sick
q: Tawanda misses his driving test
r: Tawanda passes the test.
(a) p ∧ q
(b) q ∧ r
(c) p ∨ �� ∨ r
(d) (p ∧ �̅ ) ∨ (q ∧ r)
66
5.3 Conditional Proposition
if p then q
is called a conditional proposition and is denoted
p →q
Example 5.3a
If we define
p: The faculty is allocated another scholarship
q: Raviro can futher his studies at University of Sheffield
The conditional statement p → q means “if the faculty is allocated another scholarship,
Raviro can further his studies at University of Sheffield”.
The truth table for the conditional p → q:
Example 5.3b
Let
p: 1 > 2, q: 4 < 8.
Then p is false and q is true. Therefore, the proposition p → q, that is, “if 1 > 2 then 4 < 8” is
true.
The proposition q → p, that is “if 4 < 8 then 1 > 2” is false.
(p → q) ∧ (q → p)
is called a biconditional proposition and is denoted p↔ q
67
The truth table for the biconditional proposition p ↔ q is:
Example 5.4a
If we define
p: 1 < 5, q: 2 < 8
then the statement
1 < 5 if and only if 2 < 8
can be written symbolically as
p↔q
Since p and q are both true, the statement p ↔ q is true
An alternative way to state the statement above is:”a necessary and sufficient condition for
1 < 5 is that 2 < 8”
Activity 5.2
1. Write each of the following statements in the form “if p, then q” in English.
2. Write each of the following statements in the form “p if and only if” in English.
(a) If it is hot outside you buy an ice cream cone, and if you buy an ice cream cone it is
hot outside.
(b) You get promoted only if you have connections, and you have connections only if you
get promoted.
(c) For you to pass this course, it is necessary and sufficient that you learn how to solve
most of the problems.
68
5.5 Tautologies, Contradictions and Logical Equivalence
Example 5.5a
p ∨ � ̅ is an example of tautology
p ∧ � ̅ is an example of contradiction
Example 5.5b
Show that the negation of p →q is logically equivalent to p ∧ �
We must show that ��������
p → q ≡ p∧ �
By writing the truth table for P = ��������
p → q and Q = p∧ � , we can verify that given any truth
values of p and q, either p and q are true or p and q are both false:
Table 5.6 : � → � ≡ p∧ �
���������
69
Theorem 5.5a: The operations for propositions have the following properties:
Some of the properties of conditional propositions are given in the following theorem:
Theorem 5.5c:
1. (p → q) ≡ (~p) ∨ q
2. ~(p → q) ≡ (p ∧ ~q)
70
Activity 5.3
For each pair of the propositions below, state whether they are logically equivalent.
(a) p, p ∨ q
(b) p ∧ q, p ∨��
(c) p → q, p ∨ q
(e) p ∧ (q ∨ r), (p ∨ r) ∧ (p ∨ r)
(f) p → q, �� →�̅
(g) p → q, p ↔ q
(h) P = (p → q) → r, Q = p → (p → r)
Notice the different between the contrapositive and the converse. The converse of a
conditional proposition merely reverses the roles of p and q, whereas the contrapositive
reverses the roles of p and q and negates each of them.
Example 5.6a
If we define
p: 3 < 4,
q: 5 > 8,
Then the given proposition “if 3 < 4 then 5 > 8” may be written symbolically as
p→q
The converse is q → p, or in words “if 5 > 8, then 3 < 4”.
The contrapositive is q → p, or in words “if 5 is not greater than 8, then 3 is not less than 4”
or
“if 5 < 8, then 3 > 4”.
We see that p → q is false, q →� ̅ is true and � ̅ → p is false.
An important fact is that a conditional proposition and its contrapositive are logically
equivalent. This can be shown by using the truth table as follows
71
Table 5.9: p → q ≡ � ̅ →� ̅
Activity 5.4
State the converse and contrapositive of each of the following Implications.
(b) A positive integer is a prime only if it has no division other than 1 and itself.
5.7 Summary
In this unit we explain the concept of propositions. We look at the concept of a conjunction
and a disjunction, tautologies, contradictions and logical equivalences. We also learnt how to
apply operations on propositions by using truth tables. We also dealt with the concept of
contrapositive and the converse.
72
References
Fiel, T. Kroane, J. (2003). Essential Discrete Mathematics for Computer Science NJ
USA: Pearson Education, Upper Saddle River.
Mano, M. and Ciletti, M.D. (2006). Digital-Design-4th-Edition: Upper Saddle River, NJ,
Prentice Hall.
Rosen, K.H. (1998). Discrete Mathematics and its Applications: McGraw-Hill
Publications.
73
Blank page
UNIT 6
PREDICATE LOGIC
6.0 Introduction
In the previous unit, we discussed the concept of propositional logic. Proposition is a
statement that is either true or false. However, there are many statements in mathematics that
are not true or false, for example,
p: x is an integer greater than 2
p is true if x = 3 and it is false if x = 1. To be able to represent statements of this nature, we
need another type of logic called the predicate logic which we discuss in this unit.
Self-Check 6.1
Who is the first person to develop Predicate Logic (Calculus)?
6.1 Objectives
By the end of this unit, you should be able to:
• explain the concept of predicate logic
• use the concept in writing logical statements
6.2 Predicate
Definition 6.2a: Let p(x) be a statement involving the variable x and let D be a set. We
call p a predicate (with respect to D) if for each x in D, p(x) is a proposition. We call D
the domain of discourse of p.
Example 6.2a
The following statements are predicates:
(a) p(n): n2 + 2n is an odd number , n ∈ Z+.
(b) q(x): x scores more than 30 goals in the Zimbabwean football league, x ∈ set of
football players.
(c) r(x): the time taken to travel to destination x is 2 hours, x ∈ set of towns in
Zimbabwe.
74
A predicate p, by itself, is neither true nor false. However, for each x in its domain of
discourse, p(x) is a proposition and is, therefore, either true or false.
Example 6.2b
Let A = {x | x is an integer greater than 0 and less than 5}. Here p(x) is the sentence “x is an
integer greater than 0 less than 5.”
Since p(1) is true, 1 ∈ A.
Similarly p(2), p(3), p(4) are all true, so A = {1,2,3,4}.
Activity 6.1
1. In the following statements, state whether it is a predicate. For each of the predicates, give
a domain of discourse.
2. Let p(n) be predicate “n divides 66”. Write each of the propositions below in words and
state whether it is true or false. The domain of discourse is the set of positive integers.
(a) p(11)
(b) p(1)
(c) p(3)
6.3 Quantifier
There are two types of quantifiers: Universal quantifier (∀) and Existential quantifier (∃).
75
In most of the books, universal quantification of p(x) is denoted as
∀ x p(x)
However, we prefer to use another style for writing the statement, that is
∀ x∙ p(x)
If we wish to restrict the values of x to a certain set, we can write the statement as
∀ x ∈ N∙ p(x)
We can also restrict the values of x to certain values. This can be written as
∀ x ∈ N| x≥ 0∙ p(x)
Example 6.3a
76
A value x in the domain of discourse that makes p(x) false is called a counterexample to the
statement.
Example 6.3b
The statement
∀x∈ R| x2 ≥0
is true because, for every real number x, it is true that the square of x is positive or zero.
Activity 6.2
1. Translate the following statement into symbols.
p(x): x is an even number
q(x): x is a prime number
(a) Any number is an even number.
(b) A number plus its square is always even
Just like the universal quantifier, we can also restrict the values of x to certain values. This
can be written as, for example as
In English, ∃ x can also be read as “there is an x,” “there is some x,” “there exists an x,” or
“there is at least one x.”
77
Figure 6.4: Notation for Existential Quantifier
Example 6.3c
(a) Let q(x): x + 1 < 4. The existential quantification of q(x), ∃ x ∙ q(x), is a true
statement, because q (2) is a true statement.
(b) The statement ∃ y∙y + 2 = y is false. There is no value of y for which the propositional
function y + 2 = y produces a true statement.
Example 6.3d
The following statements are true
1. ∀ x ∃ y • x + 2 = y
2. ∀ x ∃ y • x = y ∨ x < y ∨ x > y
Example 6.3e
Let
p(x,y): x2 < y2 → x < y
The statement
∀ x ∀ y • p(x,y)
is false. A counter-example is x = 1 and y = - 2, we obtain a false proposition
(1)2 < (-2)2 → 1 < -2.
Activity 6.3
1. Determine the truth value of each of the statements below.
The domain of discourse is the set of real numbers. Justify your answers.
(a) For every x, if x > 1, then x2 > x.
(b) For some x, if x > 1, then x2 > x.
78
(c) For every x, if x > 1, then x/ ( x2+ 1 ) < 1/3.
(d) For some x, if x > 1, then x/ ( x2 + 1 ) < 1/3.
(e) For every x, for every y, x2 < y + 1.
(f) For every x, for some y, x2 < y + 1.
(g) For some x, for every y, x2 < y + 1.
(h) For some x, for some y, x2 < y + 1.
(i) For every x, for every y, if x < y, then x2 < y2.
(j) For every x, for some y, if x < y, then x2 < y2.
(k) For some x, for every y, if x < y, then x2 < y2.
(l) For some x, for some y, if x < y, then x2 < y2.
2. Let G (x, y) be the predicate “ x loves y”. The domain of discourse is the set of all living
people. Write each of the propositions below, symbolically.
(a) Someone loves everybody
(b) Everybody loves everybody
(c) Somebody loves somebody
(d) Everybody loves somebody
3. Let p(x,y) be the propositional function “x is taller than y”. The domain of discourse
consists of three students:
(a) Athur who is 5 feet 11 inches tall
(b) Erina, who is 5 feet 6 inches tall
(c) Sarah who is 6 feet tall
Write each of the propositions below in words and state whether it is true or false.
(a) ∀ x ∀ y • p(x, y)
(b) ∀ x ∃ y • p(x, y)
(c) ∃ x ∀ y • p(x, y)
(d) ∃ x ∃ y • p(x, y)
79
6.4 Generalised De Morgan Laws
An important theorem about quantifiers is Generalised De Morgan Laws, which was
introduced by Augustus De Morgan, (27 June 1806 – 18 March 1871) was a British
mathematician and logician.
(a)
(b)
Example 6.4a
Let p(x) be the predicate
1
�1
�� + 1
Since this is true, then we can conclude that the statement ∃ x • p(x) is false
Example 6.5a
Let p(x) : x has exactly one father.
So the statement “Everyone has exactly one father” can be expressed as
∀x• p(x).
Example 6.5b
Let p(x) : x is a student in the university
Let q(x) : x has grade A for all of the courses taken
80
So the statement “There is a student in a university who has managed to get grade A for all of
the courses taken” can be expressed as:
∃ x • p(x) ∧ q(x)
Example 6.5c
Let
p(x) : x has a computer q(x,y) : x and y are friends
The logical expression
∀ x • (p(x) ∨ ∃ y • p(y) ∧ q(x,y))
means that “for all person, either he has a computer or he has a friend who has a computer”.
Activity 6.4
1) Express the following arguments / statements as sentences of predicate logic:
(a) Every irreflexive and transitive binary relation is asymmetric.
(b) There is someone who is going to pay for all the breakages. Therefore, each of the
breakages is going to be paid for by someone.
(c) All the female chimpanzees can solve every problem. There exists at least one
problem. Any chimpanzee who can solve a problem will get a banana. Chica is a
female chimpanzee. Therefore, Chica will get a banana.
(d) Sultan and Chica can solve exactly the same problems. If Sultan can solve any of the
problems, then he will get a banana. Sultan will not get a banana. Therefore, Chica
cannot solve any of the problems.
(e) Everyone loves somebody and no one loves everybody, or somebody loves
everybody and someone loves nobody.
(f) Some people are witty only if they are drunk.
( )
2) Consider the formula ∀x∃yP x ,y and the following interpretation I : Let the universe of
discourse be the non-negative integers, and let P be assigned the “less than” relation <.
Show that I is a model of the formula. Explain why I is not a model of the formula
( )
∃y∀xP x ,y
81
6) Let m(x,y) be “x has sent an e-mail message to y”
Let t(x,y) be “x has telephoned y”
The domain of discourse is all students in your class.
Write the following statements in logical expressions.
a) Adam has never sent an e-mail message to Eve.
b) Jacob has never sent an e-mail message to Sarah or telephoned her.
c) There is a student in the class who has sent everyone else an e-mail message.
d) No one in the class has telephoned Susan.
e) Every student in the class has either received an e-mail message or telephone call
from another student in the class.
6.6 Summary
In this unit we learnt how to explain the concept of predicate logic using quantifiers. We also
learnt how to use the concept of predicate logic in writing logical statements. We then looked
at generalised De Morgan’s Laws in predicate logic and how to translate sentences into
logical expressions.
82
References
Mano, M. and Ciletti, M.D. (2006). Digital-Design-4th-Edition: Upper Saddle River, NJ,
Prentice Hall.
83
UNIT 7
BOOLEAN ALGEBRA
7.0 Introduction
Boolean algebra (or Boolean logic) is a logical calculus of truth values, developed by
George Boole in the 1840s. It resembles the algebra of real numbers, but with the numeric
operations of multiplication xy, addition x + y, and negation −x replaced by the respective
logical operations of conjunction x∧y, disjunction x∨y, and negation ¬x. The Boolean
operations are these and all other operations that can be built from these, such as x ∧ (y∨z).
These turn out to coincide with the set of all operations on the set {0,1} that take only finitely
many arguments; there are 22n such operations when there are n arguments.
The laws of Boolean algebra can be used in digital electronics in solving various
combinations of logic levels.
7.1 Objectives
By the end of this unit, you should be able
84
Figure 7.1 Gates
Their outputs can be expressed as a function of their inputs by the following logic tables:
x1
x1 x2 +
x2
1 1 1
1 0 1
0 1 1
0 0 0
X1 X2 X1∙X2
1 1 1
1 0 0
0 1 0
0 0 0
X �� or
(¬ X)
0 1
1 0
In this course �� is the same ¬X and we are going to use them inter-changeably.
85
� ∙ � ∙ ��������
� = ������ �+�
A B
� ∙ � ∙ ���������
Table 7.4 � = ������� � + � Truth Table
x1 x2 x3 � = ������������������
(�1 + �2) ∙ �3
1 1 1 0
1 1 0 1
1 0 1 0
1 0 0 1
0 1 1 0
0 1 0 1
0 0 1 1
0 0 0 1
However, the circuit in Figure 7.3 is not a combinatorial circuit. If x1 = 1 and x2 = 0 then y
can be 0 or 1. Assume that at a given time y = 0. If we input a signal x2 = 1, the output
becomes y = 1, and stays so even after x2 goes back to its original value 0. That way we can
store a bit. We can “delete” it by switching input x1 to 0.
86
Figure 7.3: Not a Combinatorial Circuit
1. Associative (a + b) + c = a + (b + c)
(a · b) · c = a · (b · c)
2. Commutative a+b=b+a
a·b=b·a
a +(b · c)=(a + b) · (a + c)
4. Identity a +0= a
a · 1= a
5. Complement a +¬ a =1
a · ¬ a =0
Two Boolean expressions are defined to be equal if they have the same values for all possible
assignments of values to their literals. Example: �������
� + � = � ∙ � , as shown in the following
table:
87
Table 7.5: �������
� + � = � ∙ � Truth Table
x y �������
�+� �̅ ∙ ��
1 1 0 0
1 0 0 0
0 1 0 0
0 0 1 1
A Boolean algebra B =(S, ⋁, ⋀,¬, 0, 1) is a set S containing two distinguished elements 0 and
1, two binary operators ⋁ and ⋀ on S, and a unary operator on S, satisfying the following
properties (x, y, z are elements of S):
1. Associative (x ⋁ y) ⋁ z = x ⋁ (y ⋁ z)
(x ⋀ y) ⋁ z = x ⋀ (y ⋁ z)
2. Commutative x⋁y=y⋁x
x⋀y=y⋀x
3. Distributive x ⋀ (y ⋁ z)=(x ⋀ y) ⋁ (x ⋀ z)
x ⋁ (y ⋀ z)=(x ⋁ y) ⋀ (x ⋁ z)
4. Identity x ⋁ 0= x
x ⋀ 1= x
5. Complement x ⋁ ¬x =1
x ⋀ ¬x =0
88
Example: If U is a universal set and P(U)= the power set of S (collection of subsets of S) then
(P(U), ∪, ∩,¬, ∅,U). is a Boolean algebra.
1. Idempotent x⋁x=x
x⋀x=x
2. Bound x⋁1=1
x⋀0=0
3. Absorption x ⋁ xy = x
x ⋀ (x ⋁ y)= x
4. Involution ¬(¬x) = x
5. 0 and 1 ¬0 =1
¬1 = 0
6. De Morgan’s ¬ (x ⋀ y) = ¬ x ⋁ ¬ y
For instance the first idempotent law can be proved like this:
x = x ⋁ 0= x ⋁ ¬ x ⋀ x =(x ⋁ x) ⋀ (x ⋁ ¬x)= (x ⋁ x) ⋀ 1= x ⋁ x.
The exclusive-or function can be written as a Boolean expression in the following way:
Every Boolean function can be written as a Boolean expression as we are going to see next.
89
Table 7.8 Truth Table of an Exclusive-or Function
x1 x2 x1 ⊕ x2
1 1 0
1 0 1
0 1 1
0 0 0
Given any Boolean function f : Zn that is not identically zero, it can be represented
f(x1,...,xn)= m1 + m2 + ··· + mk ,
where m1,m2,...,mk are all the minterms mi = y1 ·y2 ·····yn such that f(a1,a2,...,an) = 1,
where yj = xj if aj = 1 and yj = xj if aj = 0. That representation is called disjunctive normal
form of the Boolean function f.
Example: We have seen that the exclusive-or can be represented x1 ⊕ x2 =(x1 · x2)+(x1 ·
x2). This provides a way to implement the exclusive-or with a combinatorial circuit as shown
in Figure 7.4.
X1
X2 �1⨁�2
90
Given any Boolean function f : Zn 2 → Z2 that is not identically one, it can be represented
f(x1,...,xn)= M1 · M2 ·· ··· Mk ,
where M1,M2,...,Mk are all the maxterms Mi = y1 + y2 + ··· + yn such that f(a1,a2,...,an) = 0,
where yj = xj if aj = 0 and yj = xj if aj = 1. That representation is called conjunctive normal
form of the Boolean function f.
A set of gates {g1,g2,...,gk} is said to be functionally complete if for any integer n and any
function f : Z2 n → Z2 it is possible to construct a combinatorial circuit that computes f using
only the gates g1,g2,...,gk. Example: The result about the existence of a disjunctive normal
form for any Boolean function proves that the set of gates {AND, OR, NOT} is functionally
complete. Next we show other sets of gates that are also functionally complete.
1. The set of gates {AND, NOT} is functionally complete. Proof: Since we already know that
{AND, OR, NOT} is functionally complete, all we need to do is to show that we can
compute x + y using only AND and NOT gates. In fact:
� + � = ������
�̅ ∙ �� ,
91
2. The set of gates {OR, NOT} is functionally complete. The proof is similar:
� ⋅ � = �������
�̅ + �� ,
0 �� �1 = 1 ��� �2 = 1
�1 ↑ x2 = �
1 ��ℎ������
, is functionally complete.
� + � = �̅������
∙ �� = (� ↑ x) ↑ (y ↑ y)
Since the set {OR, NOT} is functionally complete and each of its elements can be
implemented with NAND gates, the NAND gate is functionally complete.
92
7.3.5 Minimisation of combinatorial circuits
Here we address the problems of finding a combinatorial circuit that computes a given
Boolean function with the minimum number of gates. The idea
Example: Let F (x, y, z) the Boolean function defined by the following table:
x y z f(x,y,z)
1 1 1 1
1 1 0 1
1 0 1 0
1 0 0 1
0 1 1 0
0 1 0 0
0 0 1 0
0 0 0 0
93
Its disjunctive normal form is � (�, �, �) = ��� + ���̅ + ���
��� function can be implemented
with the combinatorial circuit of Figure 7.7.
xy
= xy + x¬(yz)
= x(y + ¬z) ,
Figure 7.10: A Simpler Circuit that Computes �(�, �, �) = ��� + ���� + ���
����
94
7.3.6 Multi-output combinatorial circuits
Example: Half-Adder. A half-adder is a combinatorial circuit with two inputs x and y and
two outputs s and c, where s represents the sum of x and y and c is the carry bit. Its table is as
follows:
x y s c
1 1 0 1
1 0 1 0
0 1 1 0
0 0 0 0
So the sum is s = x ⊕ y (exclusive-or) and the carry bit is c = x · y. Figure 7.11 shows a half-
adder circuit.
1. A logic probe is used to test the pins of a 7410 IC with the following results. Is there a
problem with the chip and if so, what is the problem?
95
1A 1 14 VCC A B C /Y /Y=(ABC)^
1B 2 13 1C 0 X X 1
2A 3 12 /1Y 1 0 X 1
2B 4 11 3C 1 1 0 1
2C 5 10 3B 1 1 1 0
2Y 6 9 3A
GND 7 8 /3Y
96
2. A logic probe is again used to the pins of a 7400 IC with the following results. Is there a
problem with the circuit and if so, what is the problem?
1A 1 14 VCC A B C /Y=(AB)^
1B 2 13 4B 0 0 1
/1Y 3 12 4A 0 1 1
2A 4 11 /4Y 1 0 1
2B 5 10 3B 1 1 0
/2Y 6 9 3A
GND 7 8 /3Y
97
3*. A local systems designer has developed a system to control street lights. The street lights
can be turned on manually, or by the use of a timer, so long as a light sensing unit
indicates that it is dark.
3a). Below is an incomplete logic circuit for the control system. Redraw the logic circuit
using the correct logic gates. Note the output of the dark/light sensor is ‘1’ (true, high,
on) when it is light. The lights must be turned during the dark of night.
GATE X .................
GATE Y .................
GATE Z .................
98
Below is the logic circuit showing the logic states of inputs and outputs of all the gates
when the street lights are ON.
Below is the logic circuit showing the logic states of inputs and outputs of all the gates when
the street lights are OFF.
3c). On the logic circuit below, write the logic states of all inputs and outputs for the
following:
It is night time, the manual switch is off and the timer is ‘on’. Will the street lights be on or
off?
99
3d). Complete the truth table for the logic circuit that controls the street lighting system.
3e). Normally a logic circuit such as the one used to control the street lights cannot power
lights. In the space below name the subsystem that could be used.
100
7.4 Summary
In this unit we learnt Boolean algebra and how to apply it in digital electronics. We also
learnt about logic gates and how Boolean algebras can be used in combinational logic and
circuits.
101
References
Mano, M. and Ciletti, M.D. (2006). Digital-Design-4th-Edition, Upper Saddle River, NJ:
Prentice Hall.
102