You are on page 1of 118

Bachelor of Information

Technology

Mathematical Foundations

Module BIT111
Adapted By: Nyambo Benny M
MSc (Applied Physics) (UZ)
BSc Honours (Physics) (UZ)

Editor: Munongi Calisto


MSc Mathematics (UZ)
BSc Applied Mathematics (NUST)
Published by: The Zimbabwe Open University

P.O. Box MP1119

Mount Pleasant

Harare, ZIMBABWE

The Zimbabwe Open University is a distance teaching and open


learning institution.

Year: 2012

Typeset in Garamond, 12 point on auto leading

© Zimbabwe Open University. All rights reserved. No part of this publication


may be reproduced, stored in a retrieval system, or transmitted, in any form or by
any means, electronic, mechanical, photocopying, recording or otherwise, without the
prior permission of the Zimbabwe Open University.
To the student
The demand for skills and knowledge administrators of varied backgrounds,
and the requirement to adjust and training, skills, experiences and personal
change with changing technology, interests. The combination of all these
places on us a need to learn continually qualities inevitably facilitates the
throughout life. As all people need an production of learning materials that
education of one form or another, it has teach successfully any student, anywhere
been found that conventional education and far removed from the tutor in space
institutions cannot cope with the and time. We emphasize that our
demand for education of this magnitude. learning materials should enable you to
It has, however, been discovered that solve both work-related problems and
distance education and open learning, other life challenges.
now also exploiting e-learning
technology, itself an offshoot of e- To avoid stereotyping and professional
commerce, has become the most narrowness, our teams of learning
effective way of transmitting these materials producers come from different
appropriate skills and knowledge universities in and outside Zimbabwe,
required for national and international and from Commerce and Industry.
development. This openness enables ZOU to produce
materials that have a long shelf life and
Since attainment of independence in are sufficiently comprehensive to cater
1980, the Zimbabwe Government has for the needs of all of you, our learners
spearheaded the development of in different walks of life. You, the
distance education and open learning at learner, have a large number of optional
tertiary level, resulting in the courses to choose from so that the
establishment of the Zimbabwe Open knowledge and skills developed suit the
University (ZOU) on 1 March, 1999. career path that you choose. Thus, we
strive to tailor-make the learning
ZOU is the first, leading, and currently materials so that they can suit your
the only university in Zimbabwe entirely personal and professional needs. In
dedicated to teaching by distance developing the ZOU learning materials,
education and open learning. We are we are guided by the desire to provide
determined to maintain our leading you, the learner, with all the knowledge
position by both satisfying our clients and skill that will make you a better
and maintaining high academic performer all round, be this at
standards. To achieve the leading certificate, diploma, undergraduate or
position, we have adopted the course postgraduate level. We aim for products
team approach to producing the varied that will settle comfortably in the global
learning materials that will holistically village and competing successfully with
shape you, the learner to be an all-round anyone. Our target is, therefore, to
performer in the field of your own satisfy your quest for knowledge and
choice. Our course teams comprise skills through distance education and
academics, technologists and open learning.
Any course or programme launched by ZOU you may never meet in life. It is our intention
is conceived from the cross-pollination of ideas to bring the computer, email, internet chat-
from consumers of the product, chief among rooms, whiteboards and other modern methods
whom are you, the students and your employers. of delivering learning to all the doorsteps of our
We consult you and listen to your critical learners, wherever they may be. For all these
analysis of the concepts and how they are developments and for the latest information on
presented. We also consult other academics what is taking place at ZOU, visit the ZOU
from universities the world over and other website at www.zou.ac.co.zw
international bodies whose reputation in distance
education and open learning is of a very high Having worked as best we can to prepare your
calibre. We carry out pilot studies of the course learning path, hopefully like John the Baptist
outlines, the content and the programme prepared for the coming of Jesus Christ, it is
component. We are only too glad to subject my hope as your Vice Chancellor that all of you,
our learning materials to academic and will experience unimpeded success in your
professional criticism with the hope of educational endeavours. We, on our part, shall
improving them all the time. We are continually strive to improve the learning
determined to continue improving by changing materials through evaluation, transformation of
the learning materials to suit the idiosyncratic delivery methodologies, adjustments and
needs of our learners, their employers, research, sometimes complete overhauls of both the
economic circumstances, technological materials and organizational structures and
development, changing times and geographic culture that are central to providing you with
location, in order to maintain our leading the high quality education that you deserve. Note
position. We aim at giving you an education that your needs, the learner ‘s needs, occupy a
that will work for you at any time anywhere and central position within ZOU’s core activities.
in varying circumstances and that your
performance should be second to none. Best wishes and success in your studies.

As a progressive university that is forward


looking and determined to be a successful part
of the twenty-first century, ZOU has started to
introduce e-learning materials that will enable
you, our students, to access any source of
information, anywhere in the world through
internet and to communicate, converse, discuss _____________________
and collaborate synchronously and Prof. Primrose Kurasha
asynchronously, with peers and tutors whom Vice Chancellor
The Six Hour Tutorial Session At
Zimbabwe Open University
A s you embark on your studies with
Zimbabwe Open University (ZOU) by open
and distance learning, we need to advise you so
This is where the six hour tutorial comes in. For
it to work, you need to know that:
· There is insufficient time for the tutor
that you can make the best use of the learning
to lecture you
materials, your time and the tutors who are based
· Any ideas that you discuss in the
at your regional office.
tutorial, originate from your experience
as you work on the materials. All the
The most important point that you need to note is
issues raised above are a good source
that in distance education and open learning, there
of topics (as they pertain to your
are no lectures like those found in conventional
learning) for discussion during the
universities. Instead, you have learning packages
tutorial
that may comprise written modules, tapes, CDs,
· The answers come from you while the
DVDs and other referral materials for extra reading.
tutor’s task is to confirm, spur further
All these including radio, television, telephone, fax
discussion, clarify, explain, give
and email can be used to deliver learning to you.
additional information, guide the
As such, at ZOU, we do not expect the tutor to
discussion and help you put together
lecture you when you meet him/her. We believe
full answers for each question that you
that that task is accomplished by the learning
bring
package that you receive at registration. What
· You must prepare for the tutorial by
then is the purpose of the six hour tutorial for each
bringing all the questions and answers
course on offer?
that you have found out on the topics
to the discussion
At ZOU, as at any other distance and open learning
· For the tutor to help you effectively, give
university, you the student are at the centre of
him/her the topics beforehand so that
learning. After you receive the learning package,
in cases where information has to be
you study the tutorial letter and other guiding
gathered, there is sufficient time to do
documents before using the learning materials.
so. If the questions can get to the tutor
During the study, it is obvious that you will come
at least two weeks before the tutorial,
across concepts/ideas that may not be that easy
that will create enough time for
to understand or that are not so clearly explained.
thorough preparation.
You may also come across issues that you do not
agree with, that actually conflict with the practice
In the tutorial, you are expected and required to
that you are familiar with. In your discussion
take part all the time through contributing in
groups, your friends can bring ideas that are totally
every way possible. You can give your views,
different from yours and arguments may begin. You
even if they are wrong, (many students may hold
may also find that an idea is not clearly explained
the same wrong views and the discussion will
and you remain with more questions than answers.
help correct the errors), they still help you learn
You need someone to help you in such matters.
the correct thing as much as the correct ideas.
The Six Hour Tutorial Session At Zimbabwe Open University

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

The six hour tutorials should be so structured that the


tasks for each session are very clear. Work for each
session, as much as possible, follows the structure given
below.

Session I (Two Hours)


Session I should be held at the beginning of the semester. The
main aim of this session is to guide you, the student, on how
you are going to approach the course. During the session, you
will be given the overview of the course, how to tackle the
assignments, how to organize the logistics of the course and
formation of study groups that you will belong to. It is also during
this session that you will be advised on how to use your learning
materials effectively.
The Six Hour Tutorial Session At Zimbabwe Open University

Session II (Two Hours)


This session comes in the middle of the semester to respond
to the challenges, queries, experiences, uncertainties, and
ideas that you are facing as you go through the course. In this
session, difficult areas in the module are explained through the
combined effort of the students and the tutor. It should also give
direction and feedback where you have not done well in the
first assignment as well as reinforce those areas where
performance in the first assignment is good.

Session III (Two Hours)


The final session, Session III, comes towards the end of the
semester. In this session, you polish up any areas that you still
need clarification on. Your tutor gives you feedback on the
assignments so that you can use the experience for preparation
for the end of semester examination.

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.

Conclusion for this course, but also to prepare yourself to


contribute in the best way possible so that you
can maximally benefit from it. We also urge
In conclusion, we should be very clear that six you to avoid forcing the tutor to lecture you.
hours is too little for lectures and it is not
necessary, in view of the provision of fully self- BEST WISHES IN YOUR STUDIES.
contained learning materials in the package, to
turn the little time into lectures. We, therefore, ZOU
urge you not only to attend the six hour tutorials
Contents
Course Guide Description

UNIT 1 SET THEORY ............................................................................................................... 8


1.0 Introduction ...................................................................................................................... 8
1.1 Objectives ........................................................................................................................ 8
1.2 Concept of Set .................................................................................................................. 8
1.2.1 Listing the elements of sets ............................................................................................... 8
1.2.2 Specifying properties of sets ........................................................................................... 10
1.2.3 Set membership .............................................................................................................. 10
1.2.4 Empty set ....................................................................................................................... 11
1.2.5 Set of numbers ............................................................................................................... 12
Activity 1.1 ............................................................................................................................... 13
1.3 Set Equality .................................................................................................................... 13
Activity 1.2 ............................................................................................................................... 14
1.4 Venn Diagram ................................................................................................................ 15
1.5 Subset ............................................................................................................................ 16
Activity 1.3 ............................................................................................................................... 18
1.6 Power Set ....................................................................................................................... 19
Activity 1.4 ............................................................................................................................... 19
1.7 Set Operation ................................................................................................................. 20
1.7.1 Union ............................................................................................................................. 20
1.7.2 Intersection..................................................................................................................... 21
1.7.3 Disjoint sets.................................................................................................................... 23
1.7.4 Set difference ................................................................................................................. 23
1.7.5 Set complementary ......................................................................................................... 24
Activity 1.5 ............................................................................................................................... 24
1.8 Summary ........................................................................................................................ 26
References ................................................................................................................................ 27
UNIT 2 RELATIONS ............................................................................................................... 28
2.0 Introduction .................................................................................................................... 28
2.1 Objectives ...................................................................................................................... 28
2.2 Concept of a Relation ..................................................................................................... 28
Activity 2.1 ............................................................................................................................... 30

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.

Table 1: Estimation of Time Accumulation of Study Hours

Study Activities Study Hours


Briefly go through the course content and participate in 3
initial discussion
Study the module 60
Attend 3 to 5 tutorial sessions 10
Online participation 12
Revision 15
Assignment(s), Test(s) and Examination(s) 20
Total Study Hours 120

5
Objectives
By the end of this course, you should be able to:

• write statements by using mathematical language


• develop mathematical arguments by using language
• discuss the concept of integers and its role in modelling
• explain the concept of graphs and trees
• apply the concept of graph and tree models in order to solve problems

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.

Text Arrangement Guide


Before you go through this module, it is important that you note the text arrangement.
Understanding the text arrangement should help you to organise your study of this course to
be more objective and more effective. Generally, the text arrangement for each Unit is as
follows:
Objectives: This section refers to what you should achieve after you have completely gone
through a unit. As you go through each unit, you should frequently refer to these objectives.
By doing this, you can continuously gauge your progress of digesting the unit.

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

Understanding of set is very important in understanding modern mathematics. Prior to the


introduction of the set theory, the main concerns of mathematics were numbers and
geometry. The concept of set was first introduced by Cantor in the 19th Century.
There are a few types of set theory. The set theory, which will be the subject of this Unit, is
called naïve set theory. Other set theories are ZF-set theory and axiomatic set theory.

1.1 Objectives

By the end of this unit, you should be able to:

• describe the concept of sets and subsets


• apply the operations on sets such as intersection, union, difference and products

1.2 Concept of Set

Definition 1.2a: A set is any well-defined collection of objects, called elements or


members of the set.

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

1.2.1 Listing the elements of sets


There are several ways to describe sets. One way of describing a set that has a finite number
of elements is by listing the elements of the set between braces (also known as curly bracket).

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}

Table 1.1: Representation of Elements in a Set

Type of elements in a set Representation Description


Order A = {1, 2, 3, 4} A set is determined by its
elements and order in which
the elements might be listed.

Unorder A = {1, 3, 4, 2} A set is determined by its


elements and not by any
particular order in which the
elements might be listed.

Distinct A = {1, 2, 2, 3, 4} The elements making up 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.

9
Self-Check 1.1

Can you figure out how to read the set notation?

Example 1.2b
The set V of all vowels in the English alphabet can be written as
V = {a, e, i, o, u}

1.2.2 Specifying properties of sets


Sometimes it is inconvenient or impossible to describe a set by listing all of its elements.
Another useful way to define a set is by specifying a property that the elements of the set
have in common. If a set is a large finite set or an infinite set, we can describe it by listing a
property necessary for membership.

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

1.2.3 Set membership


Given a description of a set X such as
(A = {1, 2, 3, 4}) or (B = {x| x is a positive, even integer})
with element x, we can determine whether or not x belongs to X.
If x is a member in set X, we write it as x ∈ X. Otherwise, we write it as x ∉ X.
If X is a finite set, we let |X| to denote the number of elements in X also called the cardinality
of the set.

Table 1.2: Symbols Representation

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}

= {x² | x ∈ N and x² < 100}

(b) B = {1, 4, 9, 16}

= {y² | y ∈ N and y² ≤ 16}

(c) C = {2, 4, 6, 8,.....}

= {2k | k ∈ N}
A and B are called finite sets while C is an infinite set.

1.2.4 Empty set


There is a special set that has no elements. This set is called the empty set or null set, and is
denoted by ∅. The empty set can also be denoted by { } (that is, we represent the empty set
with a pair of braces that encloses all the elements in this set).
Often, a set of elements with certain properties turns out to be the null set. For example, the
set of all positive integers that are greater than their squares is the null set.

11
Figure 1.1: Representation of an Empty Set

1.2.5 Set of numbers


The following sets are normally used when dealing with numbers.

Table 1.3: Set of Numbers

Set of Numbers Notation Description

Positive Integers Z+ Z+= {x | x is a positive integer}


Example: 1,2,3..

Natural Numbers N N = {x | x is a positive integer}


Example: 1,2,3...

Integers Z Z = {x | x is an integer}
Example: ....
-3,-2,-1,0,1,2,3,...

Real Numbers R R = {x | x is a real number}

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

(b) {x | x ∈ Z and x2 < 12}


4. Write the following set in the form {x | p (x)}, where p (x) is a property that describes the
elements of the set.
(a) {2, 4, 6, 8, 10}
(b) {a, e, i, o, u}
(c) {1, 8, 27, 64, 125}
(d) {-2, -1, 0, 1, 2}

1.3 Set Equality

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:

Figure 1.2 Universal Set E with Subset A


Subsets of the universal set are drawn as circles. The inside of a circle represents the numbers
of the set. See the following figure:

Figure 1.3 Universal Set E with to Subsets A and E


To represent three sets, we use three overlapping circles as shown below:

Figure 1.4 Universal Set E with Three Subsets A, B, C

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.

Figure 1.6: C Subset of A

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

Figure 1.7: Venn Diagram Representation

Example 1.5c
Let
A = {1,2,3,4,5,6}
B = {3,7}

B is not a subset of A, so we write � � �


Any set X is a subset of itself, since any element in X is in X, so X ⊆ X. The empty set is a
subset of any set. So for any set X, ∅ ⊆ X.

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.

We can define set equality by using the concept of subset, as follows:

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

(c) {1, 8, 2, 11, 5} ⊄ 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}

(b) {1, 2}, {1, 3}, ∅


(c) {1, a}, {b, 2}
3. Suppose that A = {2, 4, 6}, B = {2, 6}, C = {4, 6} and D = {4, 6, 8}.
Determine whether

(a) A ⊆ B

(b) B ⊆ C

(c) C ⊆ D

4. Use a Venn diagram to illustrate the relationship A ⊆ B and B ⊆ C.


5. Suppose that A, B and C are sets, such that A ⊆ B and B ⊆ C. Show that A ⊆ C.

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.

Theorem 1.6a: If | X | = n, then |P(X) | = 2n

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) {∅, {∅}}


2. Can you conclude that A = B if A and B are two sets with the same power set?
3. How many elements does each of the following sets have?
(a) P({a, b, {a, b}})
(b) P({∅, {a, {a}, {{a}}})

(c) P (P (∅))

19
4. Determine whether each of the following sets is the power set of a set.

(a) ∅

(b) {∅, {a}}


(c) {∅, {a}, {∅, a}}

(d) {∅, {a}, {b}, {a, b}}

1.7 Set Operation

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.

Figure 1.8: Union of Set A and Set B

Example 1.6a
Let A = {a, b, c, d, e} and B = {b, d, r, s}.

A ∪ B consists of all the elements that belong to either A or B, so

A ∪ B = {a, b, c, d, e} ∪ {b, d, r, s} = {a, b, c, d, e, 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.

Thus A ∩ B = {x | x ∈ A and x ∈ B}.

The intersection of the two sets A and B can be illustrated as follows.

Figure 1.10: Intersection of Set A and Set 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

1.7.3 Disjoint sets


Definition 1.7c: Two sets that have no common elements are called disjoint sets.
Figure 1.13 shows two disjoint sets B and C

We can illustrate the disjoint of two sets with a Venn diagram as follows:

Figure 1.14: Disjoint of Set A and Set B

1.7.4 Set difference

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.

Thus A -B = {x | x ∈ A and x ∉ B}. We can also show it as A -B = {x| x ∈ A and x \B}.

23
Figure 1.15: B - A

1.7.5 Set complementary

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.

1. Let A, B, C be three arbitrary sets.

(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

(e) A\C ⊆ B\C

(f) C\B ⊆ C\A

3. Let A, B be two sets.

(a) A\B = A\ (A ∩ B)

(b) A = (A\B) ∪ (A ∩ B)

(c) (A\B) ∩ (B\A) = ∅


(d) (A ∪ B) \ (A ∩ B) = (A\B) ∪ (B\A)

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.

Gallier, J. (2007). Discrete Mathematics for Computer Science (Some Notes)


Philadelphia USA: University of Pennsylvania.

Haggard, G., Schilipf, J. Whitesides, S. (2006). Discrete Mathematics for Computer


Science, Belmont USA: Thomson Brooks/Cole.

Kleitz, W. (2007). Digital Electronics: A Practical Approach (8th Edition): Upper


Saddle River, NJ USA, Prentice Hall.

Rosen, K.H. (1998). Discrete Mathematics and its Applications: McGraw-Hill


Publications

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

By the end of this unit, you should be able to:


• describe the concept of relations between two sets
• use the appropriate methods for representing relation
• explain some of the properties of relations

2.2 Concept of a Relation

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.2a: Let X and Y be two sets. A (binary) relation R from X to Y is a


subset of the Cartesian product X x Y. If (x, y) ∈ R, we write x R y.

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)}.

Since (Shami, History) ∈ R, we may write Shami R History.


We can represent a relation in Example 2.1a pictorially by using an arrow diagram as
follows:

Figure 2.1: Relation between X and Y Pictorially

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

Suppose X = {2, 3, 4} and Y = {3, 4, 5, 6, 7}. If we define a relation R from X to Y by


(x, y) ∈ R, if x divides y (with zero remainder) we obtain
R = {(2, 4), (2, 6), (3, 3), (3, 6), (4, 4)}
The domain of R is the set {2, 3, 4} and the range of R is the set {3, 4, 6}.
This relation can be represented pictorially as follows:

Figure 2.3 Relation between X and Y Pictorially


Activity 2.1

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.

2.3 Inverse Relation

Definition 2.3a: Let R be a relation from X to Y. The inverse of R, denoted by R-1, is


the relation from Y to X defined by
R-1 = {(y, x) | (x, y) ∈ R}

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

Figure 2.4: Relation between X and Y Pictorially

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,

Figure 2.5: Inverse Relation, R-1 between X and Y Pictorially

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

2.4 Composition of Relations

Definition 2.4a: Let R1 be a relation from X to Y and R2 be a relation from Y to Z. The


composition of R1 and R2, denoted R2 o R1, is the relation from X to Z defined by
R2 o R1 = {(x, z) | (x, y) ∈ R1 and (y, z) ∈ R2 for some y ∈ Y}

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

The composition of these two relations is


R2 o R1 = {(1, u), (1, t), (2, s), (2, t), (3, s), (3, t), (3, u)}

Figure 2.8: Composition of the two relations

33
Activity 2.3

Write the composition relation for the given relations

(a) R1 = {(4, 10), (8, 2), (6, 6)}


R2 = {(10, w), (2, z), (6, y)}

(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)}

(d) R1 = {(4, Black), (1, Red), (2, Blue), (3, White)}

R2 = {(Blue, Car), (Red, Flower), (Black, Car), (White, Flower)}

2.5 Relation on a Set

Figure 2.9: Types of Relation on Set

Definition 2.5a: A (binary) relation R on a set X is a relation from a set X to a set X.

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

The domain and the range of R are both equal to X.

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.

2.5.2 Symmetric relation

Definition 2.4c: A relation R on a set X is called symmetric if for all x, y ∈ X, if (x,


y) ∈ R, then (y, 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.

2.5.3 Antisymmetric relation


Definition 2.5d: A relation R on a set X is called antisymmetric if for all x, y ∈ X,
when (x, y) ∈ R and x ≠ y, and (�, �) ∉ �.

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.

2.5.4 Transitive relation

Definition 2.5e: A relation R on a set X is called transitive if for all x, y, z ∈


X, when (x, y) and (y, z) ∈ R, then (x, z) ∈ 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:

Figure 2.10: Digraph for Relation

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

We can determine the characteristics of a relation by using digraph.

Table 2.1: Characteristics of a Relation and Digraph


Set Relation Digraph

Reflexive Has a loop at every vertex


relation

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}

(c) R on {1, 2, 3, 4} defined by (x, y) ∈ R if x2 ≥ y

(d) R = {(a, 3), (b, 1), (c, 4), (d, 1)} from {a, b, c, d} to {1, 3, 4}

2.7 Partial Order

Definition 2.7a: A relation R on a set X is called a partial order if R is reflexive,


antisymmetric and transitive.

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.

Definition 2.7b: Suppose that R is a partial order on a set X. If x, y ∈ X and either x ≤


y or y ≤ x, we say that x and y are comparable. Otherwise, we say that x and y are
incomparable.

Definition 2.7c: If every pair of the elements in X is comparable, we call R a total


order.

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

2.8 Equivalence Relation

Definition 2.8a: A relation that is reflexive, symmetric and transitive on a set X is


called an equivalence relation on X.

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

For the following questions, x, y ∈ {1, 2, 3, 4, 5}.


(d) {(x, y) | 1 ≤ x ≤ 5, 1≤ y ≤ 5}.
(e) {(x, y) | 4 divides x - y}.
(f) {(x, y) | 3 divides x + y}.
(g) {(x, y) | x divides 2 - y}.
2. Determine whether the given relation is equivalence relation on the set of all people.
(a) {(x, y) | x and y are the same height}.
(b) {(x, y) | x and y have, at some time, lived in the same country}.
(c) {(x, y) | x and y have the same first name}.
(d) {(x, y) | x is taller than y}.
(e) {(x, y) | x and y have the same parents}.
(f) {(x, y) | x and y have the same colour hair}.

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:

(a) P (X ∩ Y) = P (X) ∩ P (Y)

(b) P (X ∪ Y) = P (X) ∪ P (Y)


(c) P (X × Y) = P (X) × P (Y) where X and Y are arbitrary sets.

39
2. Let R be a relation on a set X. Assume that R is reflexive and transitive.

(a) Define a relation S on X by

S = {(x, y) | (x, y) ∈ R and (y, x) ∈ R } Is S an equivalence relation on X ? Prove


your answer.
(b) Define a relation T on X by

T = {(x, y) | (x, y) ∈ R or (y, x) ∈ R} Is T an equivalence relation on X? Prove


your answer.

3. Let X be a set and let R be the relation defined on P (X) as follows


(�, � ) ∈ � ⟺ � ∩ � = ∅ is R :

(a) reflexive?
(b) symmetric?
(c) transitive? Prove your answers.

4. Let f be a function between two sets:

f:X→Y

Define a relation on X by � ∼ � ⟺ � (�) = �(�)

a) Show that “∼” is an equivalence relation on X.


b) Let Z = X/ be the set of equivalence classes in X defined by the relation ∼ ,
hence Z = {[x] | [x]= equivalence class of x, for all x ∈ X}
Show that f defines a unique function F : Z → Y by the formula F ([x]) = f(x), for
all [x] ∈ Z.
c) Show that F is one-to-one and the function f and F have the same range set.

5. Let f : X → Y and g : Y → Z be two functions. Let ℎ = � ∘ f: X → Z Show that

(a) If f and g are one-to-one, so is h.


(b) If f and g are onto, so is h.
(c) If f and g are bijective, so is h.
(d) Let f and g be bijective. Show that the inverse functions f−1,g−1,h−1 verify:

ℎ�� − 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.

7. Show that a transitive, symmetric relation R on a set X is not necessarily reflective.

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

Fiel, T. Kroane, J. (2003). Essential Discrete Mathematics for Computer Science NJ


USA: Pearson Education, Upper Saddle River.

Gallier, J. (2007). Discrete Mathematics for Computer Science (Some Notes):


Philadelphia USA, University of Pennsylvania.

Haggard, G., Schilipf, J. Whitesides, S. (2006). Discrete Mathematics for Computer


Science, Belmont USA: Thomson Brooks/Cole.

Kleitz, W. (2007). Digital Electronics: A Practical Approach (8th Edition): Upper


Saddle River, NJ USA, Prentice Hall.

Rosen, K.H. (1998). Discrete Mathematics and its Applications: McGraw-Hill


Publications

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

3.2 Concept of Function

Self-Check 3.1
How can you relate the concept of function and apply it to your daily life? Give an
example.

Definition 3.2a: A function f from X to Y is a relation from X to Y having the


following properties:
1. the domain of f is X
2. if (x, y), (x, y’) ∈ f, then y = y’
A function from X to Y is sometimes denoted by f: X → Y

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

The domain of f is X and the range of f is {a, b}.


The range of a relation R is the set {y ∈ Y | (x, y) ∈ R for some x ∈ X}

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)

3.3 Graph of a Function

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?

Another way to visualise a function is to draw its graph.

Example 3.3a
The graph of the function
f(x) = x2,
is shown in the Figure 3.2 below.

Figure 3.2 Graph of the Function f(x) = x2

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 Types of Functions


There are three types of function and they are injective, surjective and bijective.

Figure 3.4: Types of Function

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

Definition 3.4b: If f is a function from X to Y and the range of f is Y, f is said to


be onto Y (or an onto function or a surjective function). The function from X to
Y is onto, each element in Y in its arrow diagram will have at least one arrow
pointing to it.

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.

Figure 3.6: One-to-One and Onto Y

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.

2. In each part, sets A and B and a function from A to B are given.


Determine whether the function is one-to-one or onto (or both or neither).
(a) A = {1, 2, 3, 4} = B;
f = {(1,1), (2,3), (3,4), (4,2)}
(b) A = {1, 2, 3, 4}; B = {a, b, c, d};
f = {(1, a), (2, b), (3, c)}
(c) A = B = Z ; f (a) = a -1
(d) A = {1.1, 7, 0.06}; B = {p, q};
f = {(1.1, p), (7, q), (0.06, p)}

3. Let f be a function from A to B. Determine whether each function f is one-to-one and


whether it is onto.
(a) A = R, B = {x | x is a real and x ≥ 0}; f(a) = | a |
(b) A = R x R, B = R; f ((a, b)) = a
(c) A = B = R x R; f((a, b)) = (a + b, a - b)
(d) A = R, B = {x | x is a real and x ≥ 0}; f(a) = a2.

3.5 Inverse of a Function


Suppose that f is one to one, onto function from X to Y. It can be shown that the inverse
relation
{(y, x) | (x, y) ∈ f}
is a function from Y to X. This new function, denoted f-1 is called f inverse.
Given the arrow diagrams of a one-to-one, onto function f from X to Y, we can obtain the
arrow diagram for f-1 simply by reversing the direction of each the arrows.

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.

Figure 3.7: Arrow Diagram for f-1

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.

(a) f(x) = 4x + 2 (f) f(x) = 6+27x−1


(b) f(x) = 3x (g) f(x) = 6x−9
(c) f(x) = 3 log2 x (h) f(x) = 3x−2
(d) f(x) = 3 + 1/x (i) f(x) = 2x3−4
(e) f(x) = 4x3−5

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:

Figure 3.8: Composition Function from X to Z

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

Find the following function compositions:


(a) f o f
(b) g o g
(c) f o g
(d) g o f

2. Let f and g be functions from the positive integers to the positive


integers defined by the equations
f(n) = n2
g(n) = 3n

Find the following function compositions:


(a) f o f
(b) g o g
(c) f o g
(d) g o f

3. Let f and g be functions from the positive integers to the positive


integers defined by the equations
f(x) = 2x
g(x) = x2

Find the following function compositions:


(a) f o f
(b) g o g
(c) f o g
(d) g o f

4. Decompose the following functions into simpler functions.


(a) f(x) = log2 (x2 + 2)
(b) f(x) = 1/2x2
(c) f(x) = sin 2x
(d) f(x) = 2 sin x
(e) f(x) = (3 + sin x)4

3.7 Binary and Unary Operators

Definition 3.7a: A function from X x X into X is called a binary operator on X.

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.

Definition 3.7b: A function X into X is called a unary operator on 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.

Fiel, T. Kroane, J. (2003). Essential Discrete Mathematics for Computer Science NJ


USA: Pearson Education, Upper Saddle River.

Gallier, J. (2007). Discrete Mathematics for Computer Science (Some Notes):


Philadelphia USA, University of Pennsylvania.

Haggard, G., Schilipf, J. Whitesides, S. (2006). Discrete Mathematics for Computer


Scienc: Belmont USA, Thomson Brooks/Cole.

Kleitz, W. (2007). Digital Electronics: A Practical Approach (8th Edition): Upper


Saddle River, NJ USA, Prentice Hall.

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.

53
Blank page
UNIT 4

SEQUENCES AND STRINGS

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:

Definition 4.2a: A sequence whose smallest index is 1 is a function whose domain is


either the set of all positive integers or a set of the form {1…. n}.
If s is a sequence, we denote the first element as s1, the second element as s2, and so
on. In general, sn denotes the nth element.

4.2.1 Examples of sequences


Example 4.2a
The ordered list 2, 4, 6… 2n….. is a sequence. The first element is 2; the second element is 4
and so on. The nth element is 2n. If we let s denote this sequence, we have

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

The list of fares in the example above is in sequence.


A sequence can have repetitions.

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

Figure 4.2: Ordered List

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

Figure 4.3: Sequence of tn by the rule tn = n - 1

The 55th term is


T55 = 552 - 1 = 3024

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

4.2.2 Types of sequences


Two important types of sequences are increasing sequence and decreasing sequence.

Figure 4.4: Types of Sequences

Definition 4.2b: A sequence s is increasing if sn ≤ sn+1 for all n.

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.

The resulting sequence is called a subsequence of the original 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:

Table 4.2: Example 4.2j

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?

3. The sequence r defined by


rn = 3.2n 4.5n, n≥1
(a) Find r0
(b) Find r1
(c) Find r2
(d) Find r3
(e) Find a formula for rp
(f) Find a formula for rn-2
(g) Is r in increasing or decreasing?

4. Define 〈tn 〉 by the rule


sn = 2n − 1, n > 1
The Subsequence of s obtained by taking first, third, fifth, terms
(a) List the first seven terms of s
(b) List the first seven terms of the subsequence
(c) Find a formula for the expression nk of definition 4.1d
(d) Find a formula for the kth term of the subsequence

4.3 Sequence Operation

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

can be rewritten compactly using the sum notation as

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

(a) Find ∑���� g �

(b) Find ∑���� g �

(c) Find ∑���� g�

(d) Find ∏���� g �

(e) Find ∏���� g �

2. The sequence v is defined by vn = n(−1)n


(a) Find ∑���� v�

(b) Find ∑��


��� v�

(c) Find a formula for the sequence c defined by

���∑���� ��

59
(d) Find a formula for the sequence d defined by

�� = � ��
���
3. Rewrite the sum

� � � � ���
���

Replacing the index i by k, where i = k+1

4.4 String

Definition 4.4a: A string over X is a finite sequence of elements from X.

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

Figure 4.5: Sequence with Order

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

Suppose we have three strings as follows


α = baab, β = caaba, γ = bbab
(a) Write the string αβ, αα, βα, β3α2γ, γ2β, αβγ, β2γα
(b) Compute the value of |αβ|, |βα|, |αα|, |ββ|

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.

Fiel, T. Kroane, J. (2003). Essential Discrete Mathematics for Computer Science: NJ


USA, Pearson Education, Upper Saddle River.

Gallier, J. (2007). Discrete Mathematics for Computer Science (Some Notes)


Philadelphia USA: University of Pennsylvania.

Haggard, G., Schilipf, J. Whitesides, S. (2006). Discrete Mathematics for Computer


Science, Belmont USA: Thomson Brooks/Cole.

Kleitz, W. (2007). Digital Electronics: A Practical Approach (8th Edition): Upper


Saddle River, NJ USA, Prentice Hall.

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.

In propositional logic, a proposition is represented by using a lower case letter, such as p, q


or r. For example, we can use the notation
p: The Earth is round - to define p as a proposition “The Earth is round”

5.2.1 Conjunction and disjunction

Definition 5.2b: Let p and q be propositions. The conjunction of p and q, denoted


p∧q, is the proposition that is true (T) if both p and q are true, otherwise the
proposition is false (F).

We can describe the values of the conjunction of p and q by using a truth table as follows:

Table 5.1: Conjunction of p and q

Definition 5.2c: Let p and q be propositions. The disjunction of p and q, denoted p ∨ q,


is the proposition (p or q). The value of this proposition is true (T) if p or q are true (T).
It is false if both p and q are false (F).

64
The truth table for the disjunction of p and q is:

Table 5.2: Disjunction of p and q

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

Definition 5.2d: The negation of p, denoted �̅ , is the proposition not p.

The truth table for the negation p:

Table 5.3: Negation p

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.

(a) Give me a cup of tea


(b) 2 + 5 = 19
(c) For some positive integer n, 19340 = n . 17
(d) The difference of two primes is always greater than 1

2. Write the truth value for each of the propositions below:

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: The temperature is more than 40 degrees


q: It is raining

Write the following propositions using p and q and logical connectives.

(a) The temperature is more than 40 degrees but it is raining


(b) The temperature is less than 40 degrees and it is raining.
(c) Either the temperature is more than 40 degrees or it is raining.

4. Let p, q and r be the propositions

p: Tawanda is sick
q: Tawanda misses his driving test
r: Tawanda passes the test.

Express each of the following propositions as an English sentence:

(a) p ∧ q
(b) q ∧ r
(c) p ∨ �� ∨ r
(d) (p ∧ �̅ ) ∨ (q ∧ r)

66
5.3 Conditional Proposition

Definition 5.3a: If p and q are proposition, the compound 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:

Table 5.4: Conditional p → q

The converse for p → q is q → p.

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.

5.4 Biconditional Proposition

Definition 5.4a: If p and q are proposition, the compound proposition

(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:

Table 5.5: Proposition p ↔ q

The biconditional proposition p ↔ q is normally read as “p if and only if q” or “p iff q”. An


alternative way to state this proposition is “p is a necessary and sufficient condition for q.”

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.

(a) It rains whenever the wind blows from the north-east.


(b) That the Dynamos win the championship implies that they beat the Highlanders.
(c) It is necessary to walk a few kilometres to get to the top of the mountain.
(d) To get accepted into ZOU, you must have at least three O-levels.
(e) If you drive more than 110 km/h, you will get a ticket.
(f) I will remember to send you the address only if you send me an email message.
(g) To be a citizen of this country (Zimbabwe), it is sufficient that you were born in this
country.
(h) That you get the job implies that you had the best credentials.

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

Definition 5.5a: A proposition p that is always true is called a tautology. A


proposition p that is always false is called a contradiction.

Example 5.5a
p ∨ � ̅ is an example of tautology
p ∧ � ̅ is an example of contradiction

Definition 5.5b: Suppose that the compound proposition p is made up of


propositions p1…….. pn and compound proposition q is made up of propositions
q1….. qn, we say that p and q are logically equivalent and write
p≡q
provided that given any truth values of p1…... pn and truth values of q1……... qn,
either p and q are both true or p and q are both false.

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∧ �
���������

p → q is logically equivalent to p ∧ �. We can write ��������


Thus �������� p → q ≡ p ∧ �. Some of the
properties of ∧, ∨ and negation are given in the following theorems.

69
Theorem 5.5a: The operations for propositions have the following properties:

Table 5.7: Theorem 5.5a

Theorem 5.5b (De Morgan’s Law):

1. ~(p ∨ q) ≡ (~p) ∧ (~q)


2. ~(p ∧ q) ≡ (~p) ∨ (~q)

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

(d) p ∧ (�̅ ∨ r), 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)

5.6 Contrapositive and Converse

Definition 5.6a: The contrapositive for a conditional proposition p → q is the


proposition q → p

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.

(a) I go to town whenever there is a need to buy a new cloth.

(b) A positive integer is a prime only if it has no division other than 1 and itself.

(c) If it rains tonight, then I will stay at home.

(d) I go to the beach whenever it is a holiday.

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.

Gallier, J. (2007). Discrete Mathematics for Computer Science (Some Notes)


Philadelphia USA: University of Pennsylvania.

Haggard, G., Schilipf, J. Whitesides, S. (2006). Discrete Mathematics for Computer


Science: Belmont USA, Thomson Brooks/Cole.

Kleitz, W. (2007). Digital Electronics: A Practical Approach (8th Edition): Upper


Saddle River, NJ USA, Prentice Hall.

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.

(a) (2n + 1)2 is an odd number


(b) Choose an integer between 1 and 10
(c) Let x be a real number
(d) 1 + 3 = 4
(e) There exists x such that x < 10 (x real number)

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 (∃).

Figure 6.1: Types of Quantifier

6.3.1 Universal quantifier


Definition 6.3a: Universal quantification of a predicate p(x) is a proposition “p(x) is
true for all values of x in the domain of discourse”.

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

Figure 6.2: Notation for Universal Quantifier

Figure 6.3: Notation for Universal Quantifier with Restriction

(a) The predicate


p(x): -(- x) = x, x∈ R
is true for all real numbers x. So the statement
∀ x ∙p(x)
is true.
(b) Let
q(x) : x + 1 < 4
The predicate
∀ x ≥ 0 .q(x)
is a false statement, because q(5) is not true.

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

6.3.2 Existential quantifier


Definition 6.3b: The existential quantification of a predicate p(x) is the proposition
“There exists a value of x in the domain of discourse for which p(x) is true”.

Existential quantification is denoted as

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.

6.3.3 Combining Quantifiers


Two or more quantifiers may be used in a 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.

Theorem 6.4a: If p(x) is a predicate

(a)

(b)

Example 6.4a
Let p(x) be the predicate
1
�1
�� + 1

We want to show that ∃ x • p(x) is false.

Theorem 6.4a states that this statement is equivalent to ∀x • ������


p(x) is true, that is, we have to
prove that

∀� · � � 1 is true.
� ��

Since this is true, then we can conclude that the statement ∃ x • p(x) is false

6.5 Translating Sentences into Logical Expressions


The following examples show how to translate some of the natural language sentences into
logical expressions.

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

3) Let T = {∀x(P( x ) → P( f ( x )))}. Find a model of T. Show that T is not valid.

4) Let T = {∀xP( x, x ), ∀x∀y (P( x, y ) → P( y, x )), ∀x∀y∀z (P( x, y ) ∧ P( y, z ) → P( x, z ))} . Give


two distinct models of T. Briefly explain any connection between the models.
5) Represent the following statements in predicate logic:
(i) If a brick is on another brick, it is not on the table.
(ii) Every brick is on the table or on another brick.
(iii)No brick is on a brick which is also on a brick.

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

Gallier, J. (2007). Discrete Mathematics for Computer Science (Some Notes)


Philadelphia USA: University of Pennsylvania.

Kleitz, W. (2007). Digital Electronics: A Practical Approach (8th Edition): Upper


Saddle River, NJ USA, Prentice Hall.

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.

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

• minimise logic combinations using Boolean algebra rules


• design digital circuits from Boolean algebra

7.2 Combinatorial Circuits


7.2.1 Introduction
At their lowest level digital computers handle only binary signals, represented with the
symbols 0 and 1. The most elementary circuits that combine those signals are called gates.
Figure 7.1 shows three gates: OR, AND and NOT.

84
Figure 7.1 Gates

Their outputs can be expressed as a function of their inputs by the following logic tables:

Table 7.1 OR GATE Truth Table

x1
x1 x2 +
x2

1 1 1

1 0 1

0 1 1

0 0 0

Table 7.2 AND GATE Truth Table

X1 X2 X1∙X2
1 1 1
1 0 0
0 1 0
0 0 0

Table 7.3 NOT GATE Truth Table

X �� or
(¬ X)
0 1
1 0

In this course �� is the same ¬X and we are going to use them inter-changeably.

These are examples of combinatorial circuits. A combinatorial circuit is a circuit whose


output is uniquely defined by its inputs. They do not have memory, previous inputs do not
affect their outputs. Some combinations of gates can be used to make more complicated
combinatorial circuits. For instance figure 7.2 is combinatorial circuit with the logic table
shown below, representing the values of the Boolean expression

85
� ∙ � ∙ ��������
� = ������ �+�
A B

Figure 7.2: A Combinatorial Circuit

� ∙ � ∙ ���������
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

7.2.2 Properties of combinatorial circuits


Here Z2 = {0, 1} represents the set of signals handled by combinatorial circuits, and the
operations performed on those signals by AND, OR and NOT gates are represented by the
symbols ·, + and ¬ respectively. Then their properties are the following (a, b, c are elements
of Z2, that is, each represents either 0 or 1):

1. Associative (a + b) + c = a + (b + c)

(a · b) · c = a · (b · c)

2. Commutative a+b=b+a

a·b=b·a

3. Distributive a · (b + c)=(a · b)+(a · c)

a +(b · c)=(a + b) · (a + c)

4. Identity a +0= a

a · 1= a

5. Complement a +¬ a =1

a · ¬ a =0

A system satisfying those properties is called a Boolean algebra.

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

7.2.3 Abstract Boolean algebras


Here we deal with general Boolean algebras; combinatorial circuits are an example, but there
are others.

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

Table.7.6 Boolean Algebra Rules

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

Example: (Z2, +, ·,¬, 0, 1) is a Boolean algebra.

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.

7.2.4 Other properties of Boolean algebras


The properties mentioned above define a Boolean algebra, but Boolean algebras also have
other properties:

Table 7.7 Boolean Algebra Properties

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.

7.3 Boolean Functions, Applications


7.3.1 Introduction
A Boolean function is a function from Zn to Z. For instance, consider the exclusive-or
function, defined by the following table:

The exclusive-or function can be written as a Boolean expression in the following way:

x1 ⊕ x2 =(x1 · x2)+(x1 · x2)

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

7.3.2 Disjunctive normal form


We start with a definition. A minterm in the symbols x1,x2,...,xn is a Boolean expression of
the form y1 · y2 ·· ··· yn, where each yi is either xi or xi.

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.

7.3.3 Conjunctive normal form


A maxterm in the symbols x1,x2,...,xn is a Boolean expression of the form y1 + y2 + ··· + yn,
where each yi is either xi or xi.

X1

X2 �1⨁�2

Figure 7.4: Exclusive-Or

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.

Example: The conjunctive normal form of the exclusive-or is

x1 ⊕ x2 =(x1 + x2) · (x1 + x2).

7.3.4 Functionally complete sets of gates


We have seen how to design combinatorial circuits using AND, OR and NOT gates. Here we
will see how to do the same with other kinds of gates. In the following gates will be
considered as functions from Zn 2 into Z2 intended to serve as building blocks of arbitrary
Boolean functions.

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:

� + � = ������
�̅ ∙ �� ,

hence the combinatorial circuit of Figure 7.5 computes x + y.

Figure 7.5: OR with AND and NOT

91
2. The set of gates {OR, NOT} is functionally complete. The proof is similar:

� ⋅ � = �������
�̅ + �� ,

hence the combinatorial circuit of Figure 7.6 computes x+ y.

Figure 7.6: AND using OR and NOT

3. The gate NAND, denoted ↑ and defined as

0 �� �1 = 1 ��� �2 = 1
�1 ↑ x2 = �
1 ��ℎ������

, is functionally complete.

Figure 7.7: NAND Gate

Proof: Note that x ∙ y . Hence �̅ = �


� ↑ y = ����� ∙ � = � ↑ x, so the NOT gate can be
������
implemented with a NAND gate. Also the OR gate can be implemented with NAND gates:

� + � = �̅������
∙ �� = (� ↑ 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

Figure 7.8: NOT and OR Functions Implemented with NAND Gates

is to simplify the corresponding Boolean expression by using algebraic properties such as (E


· a)+(E ·¬ a)= E and E +(E · a)= E, where E is any Boolean expression. For simplicity in the
following we will represent a · b as ab, so for instance the expressions above will look like
this: Ea + E ¬a = E and E + Ea = E.

Example: Let F (x, y, z) the Boolean function defined by the following table:

Table 7.9 Truth Table f(x,y,z)

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.

Figure 7.9: A Circuit that Computes �(�, �, �) = ��� + ���� + ���


����

But we can do better if we simplify the expression in the following way:

xy

f(x, y, z)= xyz + xy¬z +x¬(yz)

= xy + x¬(yz)

= x(y +¬( yz))

= x(y + ¬y)(y + ¬z)

= x(y + ¬z) ,

which corresponds to the circuit of Figure 7.10.

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:

Table 7.10 Half Adder Circuit Truth Table

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.

Figure 7.11 Half Adder Circuit


7.3.7 Activity 7.1

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?

Triple 3-input NAND gates.

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

Positive Logic ___


Y = ABC

pin indicator pin indicator


1 ON 14 ON
2 PULSING 13 ON
3 PULSING 12 PULSING
4 ON 11 ON
5 ON 10 OFF
6 OFF 9 ON
7 OFF 8 OFF

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

pin indicator pin indicator


1 on 8 on
2 on 9 off
3 on 10 off
4 off 11 off
5 on 12 on
6 off 13 on
7 off 14 on

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.

3b). Name the logic gates you have used:

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.

*Adopted from V Ryan 2000-2009 The World Association of Technology Teachers

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

Evans, A.J. (1997). Basic Digital Electronics: Prompt Publishing.

Fiel, T. Kroane, J. (2003). Essential Discrete Mathematics for Computer Science NJ


USA: Pearson Education, Upper Saddle River.

Gallier, J. (2007). Discrete Mathematics for Computer Science (Some Notes)


Philadelphia USA: University of Pennsylvania.

Haggard, G., Schilipf, J. Whitesides, S. (2006). Discrete Mathematics for Computer


Science, Belmont USA: Thomson Brooks/Cole.

Kleitz, W. (2007). Digital Electronics: A Practical Approach (8th Edition): Upper


Saddle River, NJ USA: Prentice Hall.

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.

102

You might also like