Professional Documents
Culture Documents
Study Guide PDF
Study Guide PDF
COS1501
Author
T HÖRNE
Co-author
D BECKER
Critical reader
A E DU PREEZ
Editor
Carina Potgieter
Graphic designer
Ella Viljoen
Photographs
IlzeBotha (082 772 2482)
Shutterstock
SCHOOL OF COMPUTING
UNIVERSITY OF SOUTH AFRICA
PRETORIA
i
Introduction COS1501/1
COS1501/1/2014-2020
ACKNOWLEDGEMENTS
In previous years many lecturers played a role in the development of the COS1501
(previously COS101S) study material. Our sincere thanks go to Willem Labuschagne,
Martha Pistorius, Biffie Viljoen, Ruth de Villiers and Louise Leenen – some of whom
are no longer lecturers in the School of Computing. We also thank Jeanetta du Preez
for creating the mind map in study unit 1, the diagram for the worked example in
section 1.2.2, and figures 5.1, 5.2 and 5.3 in study unit 5.
This study guide for COS1501 was reviewed and approved by the following team:
ROLE NAME
Director, School of Computing Sheryl Buckley
Educational advice Hentie Wilson
Chair of Committee Hentie Wilson
Academic field specialists Sihem Belabbes
Biffie Viljoen (study units 9 and 10)
Layout format Hentie Wilson
Page layout School of Computing
Printed and published by the University of South Africa, Muckleneuk, Pretoria
ii
Introduction COS1501/1
CONTENTS
Introduction v
1. What is Discrete Mathematics? v
2. The purpose of the module vi
3. Outcomes of the module vi
4. Syllabus vi
5. How to study this module vii
6. Acknowledgements xiv
Glossary of symbols xv
iii
Introduction COS1501/1
Appendix A: Index
Appendix B: Bibliography
iv
Introduction COS1501/1
Introduction
1. What is discrete mathematics?
“Many problems of science deal with quantities so large that it is natural to assume
that they are dense, continuously distributed, and that all real numbers can be used
to measure them; centuries of development of “continuous mathematics” have given
us extremely powerful tools for handling problems of this kind. Other problems are
so small that we can deal with all the possible cases by hand. These are truly “finite”
and defined problems. Some of the most important problems, however, fall in
between: not big enough to assume density, continuity, etc., but not small enough to
allow us to consider all cases. These intermediate problems are, for the most part,
the problems with which discrete mathematics deals.” (Roberts, 2001: 3743).
Discrete mathematics became one of the fastest growing fields of modern
mathematics because many of the physical and biology sciences problems such as
time, mass, velocity, involve very large quantities. However, many problems fall in
the middle ground and for these the tools of DISCRETE MATHEMATICS are
especially relevant (according to Roberts, 2001: 3743, referring to the work by the
mathematician and philosopher, Kemeny) With the help of powerful computers we
are now able to replace computations done manually with computations done by
computer.
This module deals with the sub-field of the domain of discrete (not continuous)
mathematics which is relevant to computing. In the module we shall be using tools
such as
• set theory,
• relations and functions,
• vector and matrix manipulations,
• mathematical proofs, and
• propositional logic.
(a) From a practical perspective, our ability to deal effectively with rational number
concepts vastly improves our understanding and our ability to handle
situations and problems in the real world.
(b) From a psychological perspective, rational numbers provide a rich space within
which we can develop and expand the mental structures necessary for our
continued intellectual development.
(c) From a mathematical perspective, our understanding of rational numbers
provides the foundation upon which our ability to do elementary algebraic
operations can later be based.
v
Introduction COS1501/1
* Eeny-meeny-miney-moe
* One potato, 2 potato, 3 potato, four, 5 potato, 6 potato, 7 potato, MORE (on “MORE”
the person is OUT)
* Draw an outline of an envelope (a square) with a cross over it without lifting your
pen
What other games such as these did you play as a child? Describe them in a
paragraph. This is great knowledge from your childhood and, if you wish, you can
share it with others in the module’s online discussion forum.
On completing this module, you will be able to critically apply the fundamental
knowledge and skills of discrete mathematics. The module forms part of the
theoretical foundation of a Computer Science major. This background is relevant to
computing fields such as relational databases, the development of provably correct
programs, and the analysis of algorithms that will contribute to the development of
computing in Southern Africa, Africa, or globally. The module will support further
studies and applications in the computing discipline.
4. Syllabus
• Number sets
• Set theory
• Relations and functions
• Binary operations
• The fundamentals of logic
vi
Introduction COS1501/1
Many textbooks or study guides provide us with detailed text that we have to read
with comprehension and insight to make our own sense of the concepts and to
practise the skills and internalise the values. Sometimes we may find science
textbooks or study guides hard to read, until we start to apply the following three
techniques, which often help at the start of a new study journey (you might find
others elsewhere).
Train your brain to think maths at a certain time and in a certain place.
Eventually it will take you no longer than 10 minutes per day to get in a
maths mood. Not only will you save the time and emotional energy you once
needed to psych yourself up to do maths, it will also help you remember
more of what you are studying.
(ii) Get help early if there is something in the study material that you do not
understand. Lagging or losing time is similar to committing academic
suicide. Maths requires a sequential learning process, so if you fall behind, it
will be difficult to catch up. Each topic builds on the previous one. It would
be like going to a Spanish class without learning the current set of
vii
Introduction COS1501/1
vocabulary words – the lecturer/tutor would be talking to you using the new
vocabulary, but you would not understand what is being said.
(iii) After studying, reinforce the pleasure of studying by doing something fun,
such as watching television or going to a party. Experts have established that
the positive reinforcement of behaviour (such as studying) will increase its
frequency and duration.
Where you only need the shallowest knowledge of the subject, you can scan
material: read only the headings, introductions and summaries (like when you page
through a magazine). If you need a moderate level of information on a subject, then
you can skim the text: read the introductions and summaries in detail. You may also
speed-read the contents, picking out and understanding key words and concepts,
and paying attention to diagrams and graphs. Only when you need detailed
knowledge of a subject is it worth studying the text. So, skim the material to get an
overview of the subject and to get an understanding of its structure, so that you can
fit the detail gained from a full, receptive reading of the material into that structure.
We look at each of these reading methods in more detail in the activities that follow.
The way one should read a maths textbook or study guide is different from the
traditional way students are taught to read textbooks in high school or college.
Often, students are taught to read quickly or skim the material and, if they do not
understand a word, they are supposed to keep on reading. Instructors of other
courses want students to continue to read, so that they can pick up the unknown
words and their meanings from the context. NOTE: This reading technique may
work with your other modules, but using it in your maths course will probably leave
you totally confused. If you skip some of the major concepts or words printed in bold
or italics, you will not understand the concepts and will not be able to do the
activities. In a mathematical subject, it might take you half an hour to read and
understand just one page. If you do not understand everything in a section, you
should go back, so make a note in the margin.
viii
Introduction COS1501/1
considered study goals – understanding the answers can help you to structure
the information in your own mind.
• (Study) Read the document while taking notes. Read through individual
sections in detail, taking care to understand all the points that are relevant. In
the case of some texts this reading may be very slow. This will particularly be
the case if there is a lot of dense and complicated information. While you are
reading, it can help to take notes in a mind map or concept map format. A
concept map is a drawing that shows key ideas and relevant relationships (see
activity 1 of each study unit).
• Recall after you have read appropriate sections of the document. Run through it
in your mind several times. Isolate the core facts or the essential processes
behind the subject, and then see how other information fits around them.
• Review the detail once you have run through the whole exercise above. This
review can be done by rereading the document, by expanding your notes, or by
discussing the material with your fellow students (peers) or with your tutor. A
particularly effective method of reviewing information is to have to explain it to
someone else in a group.
(From the webpage, Mindtools, for more details
http://www.mindtools.com/pages/article/newISS_02.htm).
READ the contents page, and then go back and forth. Ask QUESTIONS such as:
• Which sections are important?
• Which sections are relevant to the different assignments you are given in this
module?
Scanning is a technique you often use when looking up a word in the telephone book
or dictionary, or when looking for the answer to an assignment question, where you
search for key words or ideas. In most cases, you know what you’re looking for, so
you’re concentrating on finding a particular answer. Scanning involves moving your
eyes quickly down the page, seeking specific words and phrases. Scanning is also
used when you first find a resource, to determine whether it will answer your
questions. Once you’ve scanned a document, you might go back and skim-read it.
When scanning, look for the author’s use of organisers (such as numbers, letters,
steps, or the words “first”, “second”, or "next"). Look for words that are bold-faced,
in italics, or in a different font size, style, or colour.
ix
Introduction COS1501/1
Research shows that people have more difficulty when reading off a computer
screen than when reading off paper. Although they can read and comprehend at the
same rate as when reading from paper, skimming on the computer is much slower
than on paper.
If you are reading large amounts of difficult mathematics or technical words, it may
be useful to compile a GLOSSARY (a word list) during this skimming exercise. Keep
this beside you as you read. It could also be useful to note down further explanations
of the key concepts in your own words, and refer to them when necessary. (To help
you, we have included the beginnings of a glossary as activity 2 in each study unit, to
which you can add your own words.)
Research has shown that it is not how much time you study that is important; all
that counts is how well you study during a given time. In fact, in at least one survey,
students who studied more than 35 hours a week came out with poorer grades than
those who studied less. Still, you will have to study at least 2 hours every day of the
week to be successful in this module. Do not underestimate the volume of the
module – it is a 120 study-hour module, and you will earn 12 credits when
completing it.
There are many strategies that can be used when skimming. Some people read the
first and last paragraphs using headings and summaries when they proceed through
a document. You might only read the title, subtitles, subheadings, and illustrations.
As a start, consider reading the first sentence of each paragraph. This technique is
useful when you’re seeking specific information, rather than reading for
comprehension. Skimming works well to find specific information. It can also be
used to get an overview of the information contained within graphs, tables, and
charts. Take care not to skip these, but to find out what these graphics say and note
down what you think they say.
Skim the section or chapter with the aim of starting a mind map. Look for items and
concepts while reading the information in the section or unit in a more evaluative
way.
Visualisation is important and you are certainly going to start writing down key
concepts. When you are reading a document in detail, it often helps if you highlight
and underline important points/concepts and annotate as you go along. This
emphasises information, and helps you to review important points later. Doing this
x
Introduction COS1501/1
also helps to keep your mind focused on the material and stops it from wandering. It
is best to make notes as you go along. Creating concept maps or using the study
system suggested here are effective ways of studying.
Study-reading is done carefully, thoroughly and thoughtfully. The key terms and
concepts you have pinpointed have to be linked up, and for this the mind map and
summaries are important. Summaries and mind maps also fix the knowledge more
firmly in your mind. Pause while reading, consolidate what you remember, and
consider how new information fits in with what you already know. We want to
broaden your perspective and outlook, help you to identify problems and help you
to resolve them in a new way in the context of teaching and learning.
Deeper reflection is where you expand the structure of the mind map, working
towards a holistic picture. (Later, as you work through the prescribed activities of
the section or chapter, keep returning to the mind map to fill in the detail.) Reflect
on the value and meaning or categories, concepts, reasons, variables, formulas, and
key terms.
Concentrate on including text in bold and italic type, boxes, tables and illustrations,
summaries, and introductions. The objectives (or a bold introduction to a chapter)
are very important for this overview, so use it to ensure you have all the key items in
your map.
Read in such a manner that you will be able to make a summary of the contents of
the chapter. Take care to look for the linking paragraphs that precede sub-sections,
such as another definition that might extend the argument or indicate further
exclusions or unique applications. The map will give you an overview of the story-
line which you are going to study in detail.
Make up a colour and sign system for highlighting text and notes, such as
Start your own glossary of the words and concepts you do not know, and use a
scientific dictionary to find the meanings of the words in a scientific context.
Watch for linking words such as “therefore” and “in essence”, which tell you what is
being summarised.
xi
Introduction COS1501/1
Take your time now to make a mind map of the whole guide (just the outline). Look
out for these main ideas:
Now, consult your tutorial letter 101, and indicate on your mind map how the
assignments will cover the sections above.
Write out the example question in your notebook, and make sure that you
understand the underlying concepts. Then write out your arguments, without
looking at the solution. When you’re done, compare your solution to the model
solution. At this point, take care to understand that messy is good and that the
authors of the guide have taken out the messy thinking to give you neat solutions –
which is not necessarily how mathematicians work. If you cannot follow some
argument, make a note of what you think and what your question is, and go on.
Sometimes insight comes later when you come back.
Whenever you get to an activity, complete the activity in full, either in your notebook
or on loose pages inserted and grouped together in the plastic folders of your file.
Supplement this with your own notes.
Doing activities can be frustrating, or rewarding. Many students jump right into the
activities, become frustrated, and stop studying. These students usually go directly
to the maths problems and start working on them, without any preparation. When
they get stuck on a problem, they read the solution. Then, they either try to work the
problem backward to understand the steps in the problem, or they just copy down
the answer. Other students go to the solutions and simply copy the steps. After
getting stuck several times, these students will inevitably quit doing the activities.
Doing the activities becomes a frustrating experience, and they may even quit
working on the module altogether.
When doing activities, write down every step of the problem. Even if you can do the
step in your head, write it down anyway. This will increase the amount of activity
xii
Introduction COS1501/1
time, but will be worthwhile. Doing every step is an easy way to memorise and
understand the material. Another advantage is that when you rework the problems
you did incorrectly, it is easy to review each step to find the mistake. In the long run,
doing every step of the activity will save you time and frustration.
Understand the reasons for each step of the problem and check your answers. Do
not get into the bad habit of memorising how to do problems without knowing the
reasons for each step. Many students are smart enough to memorise the procedures
required to complete a set of problems. However, when similar problems are
presented in an exam, the student cannot solve them. To avoid this dilemma, keep
reminding yourself about the rules, laws, or properties used to solve any given
problem.
You should check the answers to your activities and to your assignments. Make a
point of checking the answers to the self-assessment exercises in this study guide.
• First, check your answer by estimating the correct answer. Example: If you are
multiplying 2.234 by 5.102 the answer should by a little over 10. Remember to
estimate that 2 times 5 is 10.
• You can sometimes check your answers by substituting the answer back into the
equation. The more you hone a skill, the faster you will become. This is very
important, because increasing your reading and answer checking speed can help
you to do quick checks to avoid careless errors in your assignments.
• review the material in this study guide that relates to the problem
• review the notes in the study unit text that relate to the problem
• review any similar problems, diagrams, examples or rules that explain the
misunderstood material
• refer to a maths textbook, solutions guide, math computer program or DVD, or
the internet to obtain a better understanding of the material
• call a friend
• skip the problem and contact your tutor or lecturer for help
Always finish your activity by successfully completing problems. Even if you get
stuck, go back and successfully complete previous problems before quitting. You
should end your activity assignment with feelings of success.
After finishing your activity, recall or write down the most important concepts you
have learned. Recalling this information makes it easier to master these new
concepts.
Once you know the correct reason for going from one step to another in solving a
maths problem, you can answer any problem which requires a specific technique.
Students who simply memorise how to solve problems instead of understanding the
reasons for correctly working the steps will eventually fail their maths course.
xiii
Introduction COS1501/1
• assess the progress you have made towards the chapter objectives – allowing
you to determine your own level of competence and what you still have to do to
reach the requisite standard
• reinforce and expand the knowledge and insights you have derived from the
chapter
Note: The solutions to the self-assessment exercises in this study guide are
provided in tutorial letter 102. Evaluate your own solutions against these solutions.
You can also participate in the discussion forum for this module on myUnisa.
These feelings cannot be avoided, so welcome them – they are symptoms of brain
activity, which indicate that new connections between neurons are being made.
After all, everything worthwhile takes effort. Studying mathematics is much like
learning to play a new musical instrument or a sport: practice makes perfect. There
is no royal road, just the hard road.
Do some maths activity every day. Work frequently and regularly. Make notes of
your feelings as you go along. You can be successful!
6. Acknowledgements
Our sincere thanks go to Willem Labuschagne and Martha Pistorius for the valuable
work they have done on the study material this study guide is based on.
Thank you as well to Ms Hentie Wilson, who assisted us with the design and layout
of the guide and compiled the introduction.
We also thank Ms Jeanetta du Preez for compiling the mind map in study unit 1, and
for providing the diagrams in sections 1.2.2 and 5.1.
xiv
Introduction COS1501/1
Glossary of symbols
You have to thoroughly understand and be able to recognise at first sight the
following “mathematical vocabulary”. This takes time and focus. You can include
the “vocabulary” in your mind maps and lists, with the equivalent term.
- If A is a set, A′ denotes the complement of A (the set that contains those elements of some
universal set U that are not in A, i.e. U – A = A′).
- If A and B are sets, A + B denotes the symmetric difference between A and B (the set that
contains those elements in either A or B, but not in both).
- If A is a set, |A| or n(A) denotes the number of elements in A.
- (a, b) denotes the ordered pair with a as first and b as second co-ordinate.
- If A and B are sets, A × B denotes the Cartesian product of A and B.
- (x1, x2, ..., xn) denotes the ordered n-tuple with first co-ordinate x1, second co-ordinate x2, and so
on.
xvi
Study unit 1 The development of numbers systems: Z +, Z ≥ and Z COS1501/1
• What are the differences amongst the three number systems Z +, Z ≥ (also
referred to as N) and Z ?
• Why did the invention of zero advance our understanding and ability regarding
number systems?
• Why is a minus (− ) times a minus a plus (+)? − × − = +
• Why is a plus times a minus a minus? + × − = −
• What is the usefulness of properties such as commutativity?
• What is meant by the concepts “multiplicative and additive identities”;
“additive inverse”; “absolute value”; “prime number”; and
“ n factorial (n!)”?
In this study unit we review very briefly what the different classifications of
the types of number we use are, and how these numbers can be re-written by
scientists to make difficult and advanced mathematics possible. We also
discuss the characteristics of numbers, which tell us what make them useful.
In this first study unit we are going to help you acquire three different
skills/study habits which we think might help you in the future and might help
you to master material in a shorter space of time.
These skills are
- getting an overview,
- the deep remembering of terms (linking it to your home language), and
- pronouncing these new terms correctly.
Check your map against ours for concepts. It should include integers, positive
integers and non-negative integers (natural numbers). It should also include
the properties “commutativity”, “associativity”, “distributivity”, and so on, the
concepts “absolute value”, “prime number” and “n factorial”, and the
multiplication rules.
Did you add colour to your map? Your map is your own drawing and should
not look like those of other people; in fact, yours should be unique. Still, a
mind map should contain key concepts that can be checked or correlated for
correctness.
1
Study unit 1 The development of numbers systems: Z +, Z ≥ and Z COS1501/1
The concepts in the sections focus on the knowledge we expect you to have as
underpinning (“building blocks”) for this module and further modules.
Without a clear understanding of these concepts you will find it difficult to
identify and correctly complete tasks. Please take some time to ensure that
you understand these concepts.
A mind map for the number systems Z, Z≥, and Z+ (or N):
You can compare your mind map with the above map and then fill in possible
missing concepts in your map if needed. After studying the next study unit you
can also include the concepts “rational numbers” and “irrational numbers”
with their properties in an extended mind map.
2
Study unit 1 The development of numbers systems: Z +, Z ≥ and Z COS1501/1
In this section we look at the number system Z+ by which we mean the set of
all positive integers namely the numbers 1, 2, 3, … and so on. We can indicate a
set by writing down curly brackets and then writing the members belonging to
the set inside the brackets. The members (or elements) of a set are separated
by commas. We can denote the set of positive integers as follows:
Z+ = {1, 2, 3, …}. (In study unit 3 we will learn more about sets.)
These are the numbers we would use to count sheep, for example. Historically,
before discovering numbers such as zero and the negative integers, people
worked with these numbers. A child, for example, learns to use these numbers
before learning to use zero or fractions.
You all know how to add together or multiply positive integers. In this section
we look at a number of properties of the addition and multiplication of positive
integers. The principles (“commutativity”, “associativity” and “distributivity”)
will be familiar to you; we will only add some terminology that you will often
encounter in your Computing modules.
3
Study unit 1 The development of numbers systems: Z +, Z ≥ and Z COS1501/1
Property: Commutativity
For all positive integers m and n, addition and multiplication is commutative.
This means that
(a) m+n =n+m (i.e. addition is commutative)
(b) (m)(n) = (n)(m) (i.e. multiplication is commutative)
How do we know that addition and multiplication are commutative? Can I (as
a student) trust and believe you (the lecturer)?
I would reply “As your lecturer, I cannot at this stage prove my claim that addition and
multiplication are commutative, because this is outside the scope of this fundamental
module. The proof is usually discussed at Honours level in any good set theory course, so
you have to trust me at this stage when I say that these properties hold. But my claim is
reasonable, because we can substitute specific values for m and n, and through examples
show that it is a truthful statement.”
Example
Let’s take m = 3 and n = 6, for instance,
then m + n = 3 + 6 and
n + m = 6 + 3,
i.e. 3 + 6 = 9 and
also 6 + 3 = 9.
So for m = 3 and n = 6 we get 3 + 6 = 6 + 3 = 9.
You might also ask, “Why do you write the product of m times n as (m)(n)?
Can’t we write m × n or mn or m⋅n?”
We can write (m)(n) or mn or m⋅n. I would tend to avoid m× n, since the × symbol is
sometimes mistaken for the letter x, and also because we later use × for a very specific
sort of product, namely the Cartesian product of sets.
In stating the commutative properties, we used the letters “m” and “n”. These
symbols are variables; they are not the names of specific things. The idea is
that for every positive integer whose name is substituted by m and every
positive integer whose name is substituted by n, we will get a true statement
of the form
or of the form
Note that we wrote mn and not (m)(n) in the discussion. We do not need to
use the brackets, because it is clear what mn means. However, the moment we
substitute the variables with numbers such as 113 and 25, the brackets are
essential. We cannot write 11325 when we actually mean (113)(25).
When you come across a statement involving variables, it‘s a good idea to mentally
substitute specific values for the variables, just to keep the feeling of being in control.
Property: Associativity
For all positive integers m, n and k, addition and multiplication are associative.
This means that
(a) m+(n+k) = (m+n)+k (i.e. addition is associative)
(b) (m)(nk) = (mn)(k) (i.e. multiplication is associative)
Bookkeepers often have to add up long lists of numbers. Some like to start at
the top of the list and work downwards. Others like to start at the bottom of
the list and work upwards. Do you know why they get the same answers?
WORKED EXAMPLE
Bookkeepers use the principles of the commutativity and associativity of
addition. Let’s illustrate with an example of what they often need to do.
Consider the list of numbers that have to be added: 7, 13, 5, 9.
Working downwards we get: ((7 + 13) + 5) + 9, where the brackets show that
we added 7 and 13 first, then added 5 to the result, and then 9 to that result:
5
Study unit 1 The development of numbers systems: Z +, Z ≥ and Z COS1501/1
Working upwards we would have: ((9 + 5) + 13) + 7, where the brackets show
that we first added 9 and 5, then 13 to the result, and then 7 to that result:
((7 + 13) + 5) + 9
= 9 + ((7 + 13) + 5) by commutativity
= 9 + (5 + (7 + 13)) by commutativity
= 9 + (5 + (13 + 7) ) by commutativity
= 9 + ((5 + 13) + 7) by associativity
= (9 + (5 + 13)) + 7 by associativity
= ((9 + 5) + 13) + 7 by associativity
Property: Distributivity
For all positive integers m, n and k, we say that multiplication is distributive
over addition. This means that
m(n + k) = mn + mk, and since multiplication is commutative,
(n + k)m = m(n + k)
= mn + mk by distributivity
= nm + km by commutativity
Examples
Let x be a variable representing some positive integer.
6
Study unit 1 The development of numbers systems: Z +, Z ≥ and Z COS1501/1
One can read (3x + 2) as playing the role of m, x playing the role of n, and 4
playing the role of k:
(3x + 2)(x + 4)
= (3x + 2)x + (3x + 2)4 by distributivity
= 3x2 + 2x + 12x + 8 by distributivity
= 3x2 + 14x + 8 by distributivity
Activity 1-4:
Do you think that addition is distributive over multiplication, i.e. that
m + (nk) = (m+n)(m+k)? Substitute a few values for m, n and k to see whether
you get the same answer for the left-hand side and the right-hand side of the
equation.
“Isn’t this a very useless property?” one might ask. “Everyone knows it, after
all.” Well, this property is used very often as a trick to simplify some
complicated expression or to get it into some required form.
At this stage it is a bit difficult to give you convincing examples of this trick,
since it requires further mathematical skills. For instance, in a calculus course,
one uses this trick to show that the root of x, i.e. , is differentiable. But you
cannot at this stage be expected to follow examples like that, so let’s make a
deal. You keep your eyes open from now on for situations in which the trick is
used. We’ll do the same and try to draw your attention to them.
Different notation: It is important that you should be aware of the fact that you will find
a variety of notations (or names) for the same concept (such as the positive integers) in
the literature. We call the positive integers Z +, but some books call it P. So remember,
whenever you pick up a mathematical textbook, you will have to make an effort to figure
out exactly what notation it uses.
With Z≥ (or N) we mean the set of all non-negative integers (natural numbers),
namely the numbers 0, 1, 2, 3, 4, ... and so on. We can write Z≥ = {0, 1, 2, 3, …}.
7
Study unit 1 The development of numbers systems: Z +, Z ≥ and Z COS1501/1
Note: In some books the letter N (the set of natural numbers) is reserved for
the positive integers {1, 2, 3, …}. However, in this study guide we stick to the
convention of using N for the set of natural numbers {0, 1, 2, 3, …}.
Strange as it might seem, it took thousands of years before mankind conceived the idea of
having a number such as zero. Of what use is it?
Scenario
Suppose we want to buy sheep, but farmer Mokoena has lost all his sheep in
the drought. If we don’t know about zero, we could write:
Farmer Mokoena has no sheep.
It was not obvious that zero was necessary while people were mainly
interested in counting the number of sheep. It is only when we want to rate
things according to a scale that we begin to get the idea that there is a
difference between “zero” and “nothing”.
Example
Suppose we think of the marks a lecturer awards for an exam. One particular
student, let’s call him Mr Jones, decided to do no work at all. This might result
in Mr Jones being awarded a mark of zero! But Mr Singh, who is not enrolled
for the module, would get nothing. In other words, he will have no mark for
the module at all, so we would just delete his name off our class list in reality.
Mathematically these situations are not the same; 0 is not the same as
“nothing”.
The invention of zero by the Hindus in the seventh or eighth century AD in India made the
first successful form of positional notation possible. This means that the position of a digit
within a number is important. This concept is worth spending a little time on, since it
may well be the most powerful justification for the extension of Z + to Z ≥. So, let’s think
about notation for numbers. Strictly speaking, in ordinary language one could get away
with names for numbers: names such as “one thousand eight hundred and sixty”,
“thirteen” and “seventy-two”. But this makes arithmetic difficult. If the ordinary man in
the street is to learn to add and multiply easily, what we need are abbreviated names for
numbers which, in some way or other, make arithmetic easy.
8
Study unit 1 The development of numbers systems: Z +, Z ≥ and Z COS1501/1
Those of you who are familiar with binary numbers will realise that these vertical strokes
do not represent binary notation.
Addition becomes very easy with this notation. To add three and four, for
example, one just takes the bunch of strokes representing three, i.e. 111, and
puts it with the bunch representing four, i.e. 1111, to get 1111111, which then
represents the sum of three and four. When it comes to bigger numbers
though, it is not only tedious to write down all the strokes, but it is also very
easy to make a mistake and put in one extra stroke, or one stroke too few.
Also, there is no way to indicate zero in this system, except by the absence of a
stroke. This tends to result in the idea that zero is nothing, and we have
discussed the weakness of this idea in our example of Mr Jones and Mr Singh.
The early civilizations of Sumer and Babylonia started to get a handle on the problem of
representing large numbers by devising a positional system of notation in which the
place (position) occupied by a symbol determined its value. Hence we talk about a place-
value system.
First, you can choose any positive integer greater than 1. Call whichever
number you choose the base of your system (or radix, meaning root).
The Arabs chose ten, which we still use today. In contrast, some ancient tribes in South
America chose four, while the Mayan tribe chose twenty, and the Babylonians sixty.
Next you need symbols for the numbers smaller than your base. Call these
symbols digits. Now you can represent a number as a row of digits, in which
the rightmost digit represents a number of units, the next digit to its left
represents a number of groups which each has as many things in it as your
base, and so on. The further to the left you go, the greater the value of the digit.
We will get back to this a little later.
Following the invention of zero by the Hindus and the Arabs, we ended up with several
excellent systems of notation. Nowadays the man in the street uses the decimal system.
Let’s see how it works in the familiar decimal system (of which the base is 10).
(a) This is easy for us, since we simply write 113. When we look at this
closely, and say the number out loud, we see that the position of each
digit within the number indicates the place value of each digit, so 113
can be regarded as
(1 times 102 = 100) plus (1 times 101) plus 3, or (1)(102) + (1)(101) + 3.
9
Study unit 1 The development of numbers systems: Z +, Z ≥ and Z COS1501/1
Now, if one doesn’t have the number zero represented by some digit, then the following
problem arises. How does one indicate the difference between numbers such as 300, 30
and 3? The symbol 0 pushes the digit 3 to the left in 30 and in 300 and so increases its
value. Also how would you write the number “three hundred and five” in the decimal
system? This can be written as (3)(102) + (0)(101) + 5.
(b) The decimal system has made it simple to multiply a hundred and
eighty-six by ten, i.e. (186)(10): you just put a zero to the right of 186,
to get 1860.
Addition and multiplication are not made more difficult by the inclusion of 0.
We call 0 the identity with respect to addition because, when adding zero, the
number we start with is identical to the end result.
0 + 2 = 2 + 0 = 2.
10
Study unit 1 The development of numbers systems: Z +, Z ≥ and Z COS1501/1
We can use (b) above when we use factorisation to solve some quadratic
equation such as x2 + 2x + 1 = 0. An example illustrating how this definition is
applied is provided later in this study unit. If you have trouble remembering
how factorisation works, we have included a number of self-assessment
exercises at the end of this study unit. Try to do the exercises by yourself then
evaluate your answers by studying the solutions to the self-assessment
exercises as provided in tutorial letter 102.
1.4 Integers: Z
In this section we look at the symbol, Z, that we use to represent the set of all
integers in both directions (negative and non-negative), namely the numbers
... , −3, −2, −1, 0, 1, 2, … . We can write Z = {... , −3, −2, −1, 0, 1, 2, …}.
Just as it took a long time for zero to be invented, so the invention of the
negative integers had to wait until it became a necessity within the society of
the day.
In bookkeeping, scribes found it easier to keep track of debits and credits if, instead of
entering figures into two different columns, the debits were indicated by putting a little
hyphen in front of the number representing the size of the debit. So, for instance, a debit
of 113 Δ (where Δ represents some currency) could be written as −113. Apart from
making things convenient for scribes, the invention of negative numbers was necessary to
clear up some other mathematical difficulties.
Let x be 5 and y be 3.
Then x + y = 2z. (where z is 4)
The important thing to remember here is that usually when we talk about
taking “the square root”, we take the positive root. The symbol in fact
means “the positive square root”.
So from (x − z)2 = (y − z)2 we should get a positive object on each side. But
recall from our “silly argument” that y was 3 and z was 4. Clearly y − z is not
positive.
This helps us to see the flaw in the argument given above: you have to realise that there
are things such as negative numbers and that in our reasoning we have gone to a
negative number when in fact the symbol required a non-negative number. A modern
mathematician will not have any trouble fixing the argument by using absolute values (a
topic we will deal with soon).
Many uses were found for the expanded system of integers. Just think again of
rating things according to a scale.
Some scales, such as marks for an exam, can conveniently contain a range
from some minimum to some maximum. Other scales have, rather than a
minimum or a maximum, some point in the middle which is of importance.
Think for instance of temperature measured in centigrade, with a mid-point
indicating the temperature at which water freezes.
°C . . . .−50 . . . . 0 . . . . 50 . . . . 100
From such a point in the middle one can move in two directions, one of which
could be called the positive direction and the other the negative direction.
For example, a business might choose as mid-point its break-even point at
which it has covered its expenses but not made any profit, and then choose
increasing net profit as the positive direction and increasing net cost as the
negative direction.
Addition and multiplication were not made much more complicated by the
inclusion of negative integers. Addition can be performed quite mechanically
by drawing a number line on which the names of integers are written at some
fixed unit of distance apart. A number line can be represented as follows:
-3 -2 -1 0 1 2 3 4
You might now want to know whether the concept of a number line has any
use at all. Let’s use an example to illustrate that it is, in fact, a very useful
concept.
12
Study unit 1 The development of numbers systems: Z +, Z ≥ and Z COS1501/1
Example: Addition
Let zero be the starting point. To find the sum x + y, one moves x steps in the
positive or negative direction (depending, of course, on whether x is positive
or negative) and then, from where you stop, y steps in the appropriate
direction (again depending on whether y is positive or negative). The place
where you stop gives the sum x + y.
-3 -2 -1 0 1 2 3 4 5 6 7 8 9 10
Example: Multiplication
Firstly, the simplest case is when both x and y are non-negative. Then, of
course, we know that the product is non-negative, because both x and y are
also members of Z≥.
Thirdly, remember that a product (x)(y) can also be written as xy. Now
suppose we need to find xy when y is negative but x is not. Can we say “xy = yx
by commutativity, and so xy = y + y + ... + y (x times)”?
No, we can’t. If we don’t yet know what xy is, then we can’t be sure that the
multiplication of integers is commutative.
One has to be careful not to use a more advanced fact to prove one of the simpler facts on
which it rests; doing so would create a vicious circle.
What happens when we have to find the product xy, when both x and y are
negative?
The usual way to calculate the product in tricky cases is given by the general
rule:
RULES:
A plus times a minus is a minus, a minus times a plus is a minus, and
a minus times a minus is a plus.
Worked example
Suppose you deposit money into, or withdraw money from your bank account
every day. Let’s denote an increase of, say, R110 in your account by the
positive integer 110, and a decrease of R110 by the negative integer −110.
Let‘s indicate days in the future by a positive number, and days in the past by a
negative number (e.g. three days from now is indicated by 3, while three days
ago is indicated by −3).
The following four cases all fit our general rule for multiplication:
* If you increase the amount in your account by R5 every day for the next 3
days, your balance should change by R15. Our mathematical representation
gives (5)(3) = 15 using the rule that a plus times a plus is a plus. So our rule
fits the situation.
* If you increase the amount in your account daily by R5, then three days ago
your balance would have been R15 less. Our mathematical representation
gives 5(−3) = −15 using the rule that a plus times a minus is a minus. So our
rule fits the situation.
* If you withdraw R5 from your bank account daily, then within 3 days your
balance will change by (−5)3 = −15, i.e. it will decrease by R15. So a minus
times a plus is a minus. (We see that 5(−3) = (−5)3 = −15.)
* If you withdraw R5 from your bank account daily, then three days ago your
balance would have been different by (−5)(−3) = 15, i.e. it would have been
R15 more than the present amount. So a minus times a minus is a plus.
14
Study unit 1 The development of numbers systems: Z +, Z ≥ and Z COS1501/1
Don’t fall into the trap of thinking that − x always denotes a negative number. See and
read the hyphen (the minus sign) as an abbreviation for the phrase “− x is the additive
inverse of ”.
We can use the “additive identity element” and an “additive inverse” when we
want to change an equation to get it into some standard form.
An additive inverse can play a role in the solving of equations of the form
p2 = q. Let’s look at the following example, and also remember that we call p a
square root of q if p2 = q.
Example
Consider the technique for solving quadratic equations known as “completing
the square”. It is based on the fact that an equation, such as x2 = 9 can easily be
solved by taking the square root on each side.
If x2 = 9, then
x = 3 or x = −3.
So 3 and −3 are square roots of 9.
15
Study unit 1 The development of numbers systems: Z +, Z ≥ and Z COS1501/1
Example
Let’s consider x2 − 2x = 15.
We can try to get the left-hand side into the form (something)2. To do this, we
use the fact that adding 0 (the additive identity element) to one side doesn’t
change a thing, and we write 0 as
12 − 12 = 1 − 1.
So we get
x2 − 2x + (1 − 1) = 15 (adding 0 to the left-hand side)
i. e. x2 − 2x + 1 = 16 (adding 1 to both sides)
i. e. (x − 1)2 = 16 (completing the square)
= (±4)2
Therefore x − 1 = 4 or x − 1 = −4
i. e. x=5 or x = −3
For instance
Suppose we want to solve x2 − 2x − 3 = 0.
So x+0=0+3 or x+0=0−1
i.e. x=3 or x = −1.
From these examples we see that zero is a very special and unique integer, and
an additive inverse also comes in handy sometimes.
-3 -2 -1 0 1 2 3 4
We say that x is less than y (abbreviated by x < y) if x lies to the left of y on the
number line. This amounts to saying that x < y if y + (−x) is positive.
16
Study unit 1 The development of numbers systems: Z +, Z ≥ and Z COS1501/1
Is the number 2 to the right of the zero on your line? Is the negative number to
the left of the zero?
There is another way in which we use the concept of size. In ordinary life we
speak not only of big credits but also of big debits, of big profits and of big
losses, and so on. So, an “absolute value” is useful for large numbers.
We can do this by defining the absolute value of a number. This tells us how far
from zero the number sits on the number line, without taking into account the
direction. Let’s look at the definition.
This sounds more complicated than it really is. We can look at some examples.
Examples
|2| makes sense since 2 lies two steps to the right of 0, and
|−2| also makes sense since the absolute value does not care in which
direction one has to step.
In terms of <, we saw that 2 was greater than −5. In terms of the absolute
values, the situation is reversed, since −5 is more steps away from 0 than 2 is,
so
|2| < |−5|.
We can apply the concept of absolute value to fix the invalid argument
involving square roots which we used earlier to show that 5 = 3. The crucial
step there was taking the square root on each side of
In order to fix the argument, one can choose the positive or the negative root
on each side by the following reasoning:
So, to get rid of the absolute value signs we must go to its additive inverse, i.e.
|y − z| = − (y − z).
17
Study unit 1 The development of numbers systems: Z +, Z ≥ and Z COS1501/1
Also: x−z
=5−4
=1
The list of prime numbers thus includes the numbers 2, 3, 5, 7, 11, 13, 17, 19,
and so on. We see that the number 7 is prime because its only factors are 1
and 7. On the other hand, a number such as 4 is not prime since it can be
factored as 4 = 2⋅2 where 2 is greater than 1.
Before we conclude this study unit, we would like to introduce you to the
concept of a factorial, if you are not already familiar with it. This is a concept
you will often encounter in your further studies.
To find the value of 6!, for example, we need to do the following calculation:
6! = 6 ⋅ 5 ⋅ 4 ⋅ 3 ⋅ 2 ⋅ 1 = 720.
(a) x2 + 6x + 9
(b) x2 – x – 2
(c) x2 – 5x + 6
(d) x2 + 4x – 12
2. Solve x2 − 4x + 4 = 0 by factorising.
4. Is 21 a prime number?
18
Study unit 1 The development of numbers systems: Z +, Z ≥ and Z COS1501/1
Law 1 (commutativity):
For all non-negative integers m and n,
m + n = n + m and mn = nm.
Law 2 (associativity):
For all non-negative integers m, n and k,
m + (n + k) = (m + n) + k and m(nk) = (mn)k.
Law 3 (distributivity):
For all non-negative integers m, n and k,
m(n+k) = (mn) + (mk).
Law 5 (linearity):
For all non-negative integers m and n, exactly one of the following
statements are true:
m < n, m = n, m > n.
19
Study unit 1 The development of numbers systems: Z +, Z ≥ and Z COS1501/1
What about Z?
All the laws listed above hold for Z, except for the monotonicity law, which looks
slightly different for Z:
Law 6 (monotonicity):
For all integers m, n and k,
if m = n, then m + k = n + k and mk = nk;
if m < n, then m + k < n + k;
if k > 0, then mk < nk; and
if k < 0, then mk > nk (negative numbers must also be taken into account).
In this study unit you ensured that you can answer the following basic
questions:
• What are the differences amongst the three number systems: Z+, Z≥ (also
referred to as N) and Z?
• Why does zero play an important role in some number systems?
• Why is a minus (−) times a minus equal to a plus, i.e. (−)(−) = +?
• Why is a minus (−) times a plus equal to a minus, i.e. (−)(+) = −?
• What is the usefulness of properties such as commutativity?
In the next study session we will concentrate on the rational numbers and the
real numbers.
NOTES
20
Study unit 2 Rational and real numbers COS1501/1
This study unit follows on study unit 1. In study unit 1 we discussed positive
integers, non-negative integers and the integer number system. Here we shall
look at the rational numbers, describe what an irrational number is, and finally
consider real numbers. These number systems do not form the complete set of all
numbers. We are, for example, not considering complex numbers.
Your mind map should include the concepts of rational numbers, irrational
numbers, repeating decimals, a quadratic formula and the Theorem of
Pythagoras. The concepts in study units 1 and 2 focus on the knowledge we
expect you to have as underpinning (“building blocks”) for this module and
further modules.
21
Study unit 2 Rational and real numbers COS1501/1
So far the numbers at our disposal do not allow us to solve simple equations such
as 2x = 1. Let’s see how such an equation could arise in practice.
Example
A cook uses 1 bag of flour to bake 2 loaves of bread. How much flour does she
need to bake a single loaf?
Well, if x represents the amount of flour needed for one loaf, then what do we
know about x? Certainly, we know that two times x is one whole bag of flour,
because we get 2 loaves of bread from 1 bag of flour. We see that x is the number
by which 2 must be multiplied to give 1, and so we can write this as 2x = 1.
Furthermore we know that x is not an integer. To see this, we note firstly that
there are no integers between 0 and 1. Then we see that x must be greater than 0.
Why? Because (2)(0) = 0. This is less than the required result, so zero is too small.
Next we see that x must be less than 1, since (2)(1) = 2, which is bigger than the
required result, so one is too big.
So, for example, the x above could be written as 1/2. Now it is clear that we have
to multiply 2 by ½ to get 1.
22
Study unit 2 Rational and real numbers COS1501/1
• Suppose p ≠ 0 and q = 0. Then p/q would mean the number by which q must
be multiplied to give p. But no such number exists, since q is zero, and zero
multiplied by anything must give zero, whereas p is not zero.
• Suppose p = q = 0. Then p/q = 0/0 would mean the number by which q must
be multiplied in order to give p. Now the problem is that any number will
do, since 0 multiplied by any number is zero. And this is no good, for we
would never know what number is being talked about when someone
refers to 0/0.
A famous mathematician called De Morgan, who lived nearly two centuries ago, showed
some of the disastrous things that would happen if we tried to make it possible to divide by
zero.
One would be able to prove that any number is equal to zero (which, of course, is nonsense).
The nonsense proof works as follows:
Suppose x = a.
It is possible to show that x = 0?
Multiply by x: x2 = ax
Subtract a2: x2 – a2 = ax – a2
i.e. (x + a)(x – a) = a(x – a)
Divide by x – a (using the statement above x = a, so x – a = 0): x+a=a
Subtract a: x=0 QED
Note: We indicate the end of a proof by QED, which is an acronym of the Latin phrase “quod
erat demonstrandum”, which means “that which was to be demonstrated”.
Of course, every integer can be written in the form p/q just by giving it a
denominator equal to 1, i.e. by making q one (1).
How does one add and multiply rational numbers? To multiply is very easy. For
instance
= = .
We simply multiply the tops (called numerators) with each other and multiply the
bottoms (called denominators) with each other.
23
Study unit 2 Rational and real numbers COS1501/1
(a/b)(c/d) = ac/bd
Addition is not so simple. In order to add, say, 1/2 and 3/5 we have to find a
common denominator, which in this case is 10.
Then
+ = = .
A hidden part of this reasoning involves the idea of equivalent fractions. You
know that
This is because 1 remains the multiplicative identity for Q, and 1 can be written
as any fraction in which the numerator and denominator are the same, for
instance as 5/5 (the number by which the 5 at the bottom must be multiplied to
give the 5 at the top). So 5/10 and 10/20 and 30/60 are all equal to 1/2, since
they are all obtained from 1/2 by multiplying by 1, with 1 written in an
appropriate form.
How does one find common denominators? There are two methods:
The quick method just multiplies the denominators of the given fractions. For example, in the
case of 1/2 + 3/5 this method gives 10 as the common denominator. The drawback of this
method is that it does not always give the least common denominator, although for the
purposes of this module, it’s not a problem.
The more elegant method involves using things called prime factors to build the least
common denominator. We don’t require you to use this method, so we will ignore it for this
module.
24
Study unit 2 Rational and real numbers COS1501/1
The idea of a multiplicative inverse is simple. If you think about the notation 1/x
for a moment, you will recall that it means the number by which x must be
multiplied to give 1.
Given x, the number 1/x is called the reciprocal of x (in older books). This fits the
following idea: Think of every rational number as having a numerator and a
denominator. Now the multiplicative inverse of any number can be found by
simply turning it upside down, i.e. writing the numerator as the denominator and
the denominator as the numerator.
We use this property whenever we want to solve linear equations of the form
ax = b. Multiplying both sides by 1/a gives the solution x = b/a. Remember that
this cannot be done if a = 0.
There is no need to speak of division. To say that one is dividing x by y is the same as to say
that one is multiplying x by 1/y.
Similar laws hold for Q as for Z, but set Q has one law that the set Z does not
have:
Suppose a ladder leaning against a wall reaches 1 meter high when its foot is 1
meter away from the wall. How long is the ladder?
The Theorem of Pythagoras can help us solve the problem, because the situation
can be represented by a right-angled triangle in which the length of the ladder is
given by the unknown x.
25
Study unit 2 Rational and real numbers COS1501/1
x2 = y2 + z2
i.e. the square on the hypotenuse is the sum of the squares on the other two sides.
x z
So if x, which indicates the hypotenuse, represents the length of the ladder, and y
and z are both equal to 1,
we have x2 = 12 + 12
i.e. x=
x 1
Theorem
There is no rational number whose square equals 2.
Proof
We will use a technique known as reductio ad absurdum, also called proof by
contradiction (to be discussed in greater detail in subsequent study units).
Any fraction can be expressed in lowest terms by cancelling any common factors
shared by the numerator and denominator. So we may assume that p/q is a
fraction in lowest terms.
26
Study unit 2 Rational and real numbers COS1501/1
By the next argument we show that both p and q are even, i.e. both p and q are
multiples of 2 and hence have a common factor, namely 2, which is a direct
contradiction of what we have just noted.
If (p/q)2 = 2
then p2 = 2q2 .
Note: Even integers can be written in the form 2k for some integer k.
Note: Odd integers can be written in the form 2k + 1 for some integer k.
Squaring 2k + 1
gives (2k + 1)2 = 4k2 + 4k + 1
= 2(2k2 + 2k) + 1
= 2m + 1
This means that p by itself cannot be odd (remember that we showed that p2 is an
even integer), and p must therefore be even.
Returning to the proof of the theorem discussed above, we have now shown that
p = 2k for some k because it is even, so that
p2 = 4k2 = 2q2
i.e. q2 = 2k2
and thus q2 is even, and ultimately q is also even.
Hence both p and q are even.
27
Study unit 2 Rational and real numbers COS1501/1
Now we have some idea of what is not. It is not any of the rational numbers. In order to
solve simple equations such as x2 = 2, we need to expand Q by including what we call
irrational numbers, such as
We can get a clearer picture of what irrationals are like, if we use decimal
notation. Just as a non-negative integer such as thirty could be written as
any other number can be expressed in decimal notation, for instance −3/8 could
be written as
− 0.375 signifying
i.e. −[ + + ].
Some decimals cannot be expressed in such a simple form, because the fractional
part goes on forever, for example
1/3 = 0.3333 …
Of course you know how to express 1/3 and 5/7 as decimals: just divide the bottom into the
top. But you may be wondering how we got the decimal expansion of
We know that 1 < < 2, i.e. that lies between 1 and 2. How do we know
this? Well, 12 = 1 is too small, and 22 = 4 is too big, because
( )2 = 2.
Now then, let’s take as our first approximation of the number 1.5. Since
(1.5) = 2.25, we see that 1.5 is too big, i.e.
2 < 1.5. What about 1.4 as an
approximation? But (1.4) = 1.96 so 1.4 is too small, i.e. 1.4 <
2 Matters have
improved. Earlier we knew only that 1 < < 2. Now we know that 1.4 < < 1.5.
28
Study unit 2 Rational and real numbers COS1501/1
So let’s look at the approximation 1.45 for But (1.45)2 = 2.1025 which is too
big. So we look at 1.44, and so forth. Eventually we will get to the point where we
can show that
Let’s return to the point we made earlier, namely that some decimal expansions
never terminate. There is a subtle difference between the decimal expansions of
the rationals 1/3 and 5/7, on the one hand, and those of the irrationals, such as
on the other. In the case of the rationals, the expansions repeat a digit (3 in
0.333 ...) or a group of digits (714285 in 0.7142857142857 ...), and so we call
these expansions repeating decimals.
In the case of , it can be proved that the decimal expansion never even begins
to repeat.
What about arithmetic in R? Well, addition and multiplication have exactly the same useful
properties as addition and multiplication in Q, but it is much harder to describe exactly
what is going on. You see, to handle infinite decimals, one really needs the concept of a limit,
which you will encounter only if you take a Calculus module. Not having the concept at our
disposal, we will not investigate the arithmetic of real numbers any further.
There are also, of course, the complex number system, but a discussion of this
topic is beyond the scope of this module.
There are many ways to express 0 as a ratio, for instance 0/1 (since 0/1
represents the number by which 1 must be multiplied to give 0 and we know that
number is 0), or 0/2 (since 0/2 represents the number by which 2 must be
multiplied to give 0, and we know that multiplying 2 by 0 will do the trick), and
so on.
In general, 0 may be written in the form 0/b, where b is any non-zero integer.
29
Study unit 2 Rational and real numbers COS1501/1
The reason the multiplicative inverse is defined for non-zero rationals only, is
that a multiplicative inverse for 0 would have to be a number that, when
multiplied by 0, gives 1. But no such number exists; in the previous study unit we
have already learned that any number multiplied by 0 will be 0.
Simple. The ratio n/n represents the number by which the denominator n must
be multiplied to give the numerator n. By which number should n be multiplied
to give n back again? The multiplicative identity, 1, of course.
People use the word “fraction” ambiguously, that is, we cannot be sure what they
mean. Often they have in mind “a part of the whole”, in other words a number
between 0 and 1. Certainly 113 is not a fraction in this sense, but in the context of
the present section, any number that can be written as a ratio may be called a
fraction, and since 113 may be written as 113/1, we are allowed to refer to 113
as a fraction.
To avoid confusion between the two uses of the word “fraction”, we call a number
between 0 and 1 a proper fraction and a number such as 113/1 an improper
fraction.
30
Study unit 2 Rational and real numbers COS1501/1
In this study unit you ensured that you can answer the following questions:
NOTES
31
Study unit 2 Rational and real numbers COS1501/1
NOTES
32
Study unit 3 Sets COS1501/1
The previous study unit covered study material that is very important
to understand so that the remaining units in this study guide make
sense. In this study unit, we start with the serious stuff and introduce
you to set theory. Set theory is just an important-sounding word that
refers to discussions on topics that have to do with sets. It is essential
for your computing studies that you understand the concepts we cover
in this study unit.
33
Study unit 3 Sets COS1501/1
Suppose we want to tell you something interesting about the set of all
positive integers less than 5. Then, of course, we can refer to it as “the
set of all positive integers less than 5”. But this appears rather clumsy.
34
Study unit 3 Sets COS1501/1
Example
Suppose we want to talk about some positive integers using list
notation. We can’t possibly write down the names of all the elements.
All we can do is to list the names of the first few and then put down
what is called an ellipsis, i.e. three little dots that stand for “and so on”:
{3, 5, 7, ...}
But notice how the dots introduce an element of vagueness. After all, if
we look at the set {3, 5, 7, ...}, we are unsure whether we’re talking
about the set of odd integers greater than 1 or about the set of prime
numbers greater than 2. The latter set differs from the former, as we
can see by listing a few more elements:
{ x | x is a positive integer}.
{ x | x is a positive integer}
↑ ↑ ↑ ↑
The set ... of all x’s … such that ... x is a positive integer.
The letter x is called a variable, because it is not the name of a specific number. In
mathematics the word “variable” means “place-holder”, because one gets a
specific statement if one replaces the variable with the name of something.
35
Study unit 3 Sets COS1501/1
Examples
From “x > 3” we get the specific statement “5 > 3” if we push the name
5 into the space kept open by the variable x.
Another example: Suppose we want to talk about the set of all positive
integers less than 5. Using set-builder notation, we can write
It could be that some element, say −2, is not a member of the set Z+,
then we say “−2 is not a member of Z+”, and we may write “−2 ∉ Z+”.
The symbol “∈” is a streamlined version of the letter epsilon (ε) which is the
Greek version of the English letter e, and e is the first letter of the word “element”.
Examples
The set of even non-negative integers less than 10 can be described in
(at least) three ways:
{0, 2, 4, 6, 8},
{x | x is an even non-negative integer less than 10}, and
{x | x ∈ Z≥, x is an even integer less than or equal to 8}.
These three descriptions might look different, but clearly they refer to
the same collection of things. We indicate this by writing
Another example: Suppose we want to talk about the set of all negative
integers greater than −5. We can describe this set by using
list notation: {−4, −3, −2, −1}, or
set-builder notation: {x | x is a negative integer greater than −5}.
We may write
{−4, −3, −2, −1} = {x | x is a negative integer greater than −5}
= {y | y ∈ Z, −4 ≤ y < 0}.
There are also other alternatives that can describe this set.
36
Study unit 3 Sets COS1501/1
Here the “=” stands for “is the same set as” or, if you prefer, “is equal to”.
Note that “x is an even non-negative integer less than 10”, and “x is a negative
integer greater than −5” are referred to as property descriptions.
But how do we check whether or not two sets are equal? We can’t
always expect it to be obvious.
Example
Consider, on the one hand
{x | x is a real number and 1 < x < 2}, and on the other hand
{x | x is a real number and x2 − 3x + 2 < 0}.
It is certainly not obvious whether or not these descriptions refer to
the same set.
The test for equality can be done using the following principle: The
important thing about a set is the elements which are inside the set,
just as the important thing about a shopping bag is the groceries inside.
So it makes sense to regard two sets as equal if they have precisely the
same elements. So, for example {3, 4} = {4, 3}.
Although the order in which the elements are listed differs, exactly the
same numbers are in {3, 4} as are in {4, 3}, so these sets are equal.
It is important to note from this example that the order in which the
elements are listed is not significant.
You might wonder whether there are some instances in which the order is
important, but we will discuss this in the next study unit.
Although the number 5 is listed twice in the right-hand set, it does not
tell us anything we don’t already know. The numbers which are in
{5, 7} are 5 and 7, and these are exactly the numbers that are in
{5, 5, 7}. So these sets are equal.
This brings up another important point: Elements may live in more than one set.
A repetition does not change the elements of a set.
37
Study unit 3 Sets COS1501/1
Note: Sets do not need to have only numbers as elements. We may actually throw
different objects of our choice into a “bag”. Let’s look at a few examples:
We looked at sets that have some elements, but do all sets have elements?
Examples
Consider the set {1}. This set only has one element namely 1.
The set {0
/ , 1, {1} } has three elements namely 0
/ , 1 and {1}.
38
Study unit 3 Sets COS1501/1
Does it bother you that 0 / and {1} could be elements of a set? Later in this study
unit we will see that a special kind of set namely a “powerset” can be formed with
0
/ and some other sets as members.
In Activity 6 of the introductory unit of this study guide and in tutorial letter 101
we discuss the interactive computer-aided instruction (CAI) tutorial that is
available on a CD which you should have received. This tutorial will help you to
understand the concept “sets”.
When we want to talk about some subset, we need to place this subset
in the context of some universal set. A universal set is simply the
collection of all things of the kind we want to talk about. If not
otherwise specified, we usually name a universal set “U”.
Now let’s talk about subsets. Suppose we take the set of integers Z to
be our universal set, then we can form some set {1, 2} from Z. What did
we do to form {1, 2}? Well, by singling out the elements 1 and 2, we
have in a certain sense thrown away all the other members of Z.
The simplest way to build a new set is to throw away some of the
elements of an old set. It’s rather like having a bag of sweets, pulling
one out, and eating it. Something has changed; the bag of sweets is not
the same as it was.
39
Study unit 3 Sets COS1501/1
Definition: Subset
If A and B are sets from a universal set U, we say that A is a subset of B
if and only if every element of A is also an element of B.
We may abbreviate “A is a subset of B” by writing “A ⊆ B”.
We can abbreviate “if and only if” by writing “iff”, so we can write “A is a subset of
B iff every element of A is also an element of B”. Only in the next study unit will we
see what is exactly meant by “iff”.
Note: One can throw away none, one, or more elements from some set
B, then the resulting set, let’s call it A, is a subset of B, i.e. A ⊆ B.
Just as we write “x ≤ y” to say that x is less than or equal to y (or x is not greater
than y), so “A ⊆ B” means that A has no elements which do not also belong to B,
i.e. every element of A is also an element of B.
Examples
Suppose that B = {1, 2, 3}. Throwing away the element 2 gives the
subset A = {1, 3}. So A is a subset of B, i.e. A ⊆ B.
(Each element of A is an element of B.)
Note: We can consider any set and throw away all its elements, then we
are left with the subset { }. This means that { } is a subset of any set.
40
Study unit 3 Sets COS1501/1
Another way to build new sets is to form the union of two sets. This is
rather like going to school on Monday with your History and English
books in your bag, on Tuesday with your English and Maths books, and
on Wednesday with your History books, your English books and your
Maths books as well. If you think of your bag on Monday as set A, your
bag on Tuesday as set B, and your bag on Wednesday as set C, then set
C is the union of sets A and B.
In the next study unit we will see that these two statements can be
combined:
“x ∈ A ∪ B iff x ∈ A or x ∈ B”.
Example
Let A = {1, 2} and B = {0, 1},
then A ∪ B = {0, 1, 2},
i.e. the set of those elements that belong to A or to B.
41
Study unit 3 Sets COS1501/1
Example
Let A = {1, 2} and B = {0, 1},
then A ∩ B = {1},
i.e. the set of those elements that belong to both A and B.
We can write
“if x ∈ A − B, then x ∈ A and x ∉ B”, and
“if x ∈ A and x ∉ B, then x ∈ A − B”.
Example
Let A = {1, 2} and B = {0, 1},
then A − B = {2},
i.e. the set of those elements that belong to A but not to B.
It often happens that all the sets involved in a particular discussion are
subsets of a single larger set. For instance, if a problem involves the
sets H = {Java, C++, C#}, I = {Haskell, Prolog}, and J = {COBOL, Visual
Basic}, then these are all subsets of U = {x | x is a programming
language}. This means that {Java, C++, C#, Haskell, Prolog, COBOL,
Visual Basic} ⊆ U.
42
Study unit 3 Sets COS1501/1
Since all the elements of sets H, I and J are also elements of U, U can be
called a universal set for this particular problem.
Now, if U is a universal set and B is a subset of U, then U − B is called the
complement of B for short (i.e. we may omit the phrase “relative to U”)
and is denoted more briefly by B′. So B′ = {x | x ∉ B}.
Example
Let U = {0, 1, 2, 3} and A = {0, 1}, then A′ = U − A = {2, 3},
i.e. the set of all those elements that belong to U but not to A.
Notation: You will find that different books refer to the complement of B in
different ways, for example by writing BC or ~B. So always make sure what
notation a particular author is using.
Example
Let A = {0, 1, 2, 3} and B = {0, 1, 3, 4}, then A + B = {2, 4},
i.e. the set of those elements that belong to A or to B, but not to both.
43
Study unit 3 Sets COS1501/1
It is clear that the results from these two operations are not the same.
This is due to the fact that, as we have mentioned before, in the English
language, there are two different ways in which one can interpret the
word “or”.
An example can illustrate this: Suppose A = {2, 4} and B = {5, 6}, then we have
A ∪ B = A + B = {2, 4, 5, 6}. (Note that A and B have no common elements.)
Example
Let A = {1, 2, 3, 4} and B = {5, 6} with U = {1, 2, 3, 4, 5, 6}.
Then we can say that A and B are disjoint. There are no elements that
belong to both A and B, i.e. A ∩ B = 0
/.
Example
Let A = {1, 2, 3, 4} and B = {5, 6} be subsets of U = {1, 2, 3, 4, 5, 6},
then |A| = 4, |B| = 2 and |U| = 6,
i.e. A has four, B has two, and U has six elements.
44
Study unit 3 Sets COS1501/1
When we determine the power set of some set B (i.e. Ƥ (B)), we first
have to determine all the subsets of B. All these subsets of B are the
elements of Ƥ (B). We illustrate this with an example:
Example
Let B = {1, 2, 3}. Which sets are all subsets of B?
One can throw away all the elements of any set, then the subset { } = 0/
/ is a subset of any set. When a power set is
is formed. This means that 0
/ will always be included as a member of the power set.
formed, 0
We now want to look at some subsets of Ƥ (B). Note that every member
of a subset of Ƥ (B) is also a member of Ƥ (B).
/ } ⊆ Ƥ (B), since {0
{0 / } has only one member namely 0
/ , and 0
/ is also a
member of Ƥ (B).
/ , {1}, {2} } ⊆ Ƥ (B), since every member of { 0
{0 / , {1}, {2} } (i.e. 0
/ , {1}
and {2}) are also members of Ƥ (B).
{ {1}, {1, 2, 3} } ⊆ Ƥ (B), since very member of { {1}, {1, 2, 3} } (i.e. {1}
and {1, 2, 3}) are also members of Ƥ (B).
{ } ⊆ Ƥ (B). The subset { } is formed by throwing away all the members
of Ƥ (B).
We also have that Ƥ (B) ⊆ Ƥ (B).
Can you determine the other subsets of Ƥ (B)?
45
Study unit 3 Sets COS1501/1
(c) A − B and B − A
(d) A + B and B + A
In this study unit you ensured that you can answer the following
questions on set theory:
In the following study unit we will learn more about Venn diagrams that can be used to give a
graphical representation of a set or of operations involving sets. We also look at proofs where
sets are involved.
46
Study unit 4 Proofs involving sets COS1501/1
Your map should include the concepts of a Venn diagram, different kinds of
proof involving sets, a counterexample in the context of sets and the inclusion-
exclusion principle.
47
Study unit 4 Proofs involving sets COS1501/1
One can draw pictures of sets. If the drawing is done as described below, we
call the picture a Venn diagram.
Let's begin with the simplest case: a single set A, which is a subset of a
universal set U (for example, A might be Z+ and U might be R).
Draw a rectangle to represent the “bag” U, called the universal set, and draw a
circle inside the rectangle to represent A. The diagram shows that all the
elements of A are also elements of U, but there might be elements of U that fall
outside the boundaries of the set A:
U
Suppose we are given two sets A and B and a universal set U. As before, we
represent each of the sets by means of a circle inside the rectangle, as shown
in the following figure:
U
A B
We could also have a Venn diagram with three sets A, B and C, as shown in the
following figure:
U
A B
Let us recap on the definition for “subset”: For all sets A and B, A is a subset of
B, i.e. A ⊆ B, iff every element of A is also an element of B.
48
Study unit 4 Proofs involving sets COS1501/1
Note: B could have some elements that are not in A, and U could have some
elements that are not in A or B.
Example
Let A = {♣, [♣]} and B = {♣, [♣], ♠}. Every element in A, namely ♣ and [♣], is
also an element of B. This means that A ⊆ B.
As we have seen in the previous study unit, it is possible that two sets can be regarded as
being equal if they have the same distinct elements. We provide a formal definition:
A (or B)
Note: In all the Venn diagrams that follow, the shaded area represents the result of the
particular set operation and the whole rectangle represents the set “U”.
We provide the specific definition of each set operation as it was provided in the previous
study unit. Relate the shaded area in each Venn diagram to the relevant definition.
49
Study unit 4 Proofs involving sets COS1501/1
Set complement:
Set A′ = {x | x ∉ A}, which is the complement of set A, is represented as follows
in a Venn diagram:
A'
A B
As can be seen from the Venn diagram for A′ , no element x lives inside A (i.e. x∉ A).
We can now illustrate a number of operations on sets by shading the appropriate areas
in Venn diagrams.
Union:
The union of any sets A and B, i.e. A ∪ B = {x | x ∈ A or x ∈ B}, is depicted by
the shaded area:
AUB
A B
Intersection:
The intersection of any sets A and B, i.e. A ∩ B = {x | x ∈ A and x ∈ B}, is
depicted by the shaded area:
AnB
A B
50
Study unit 4 Proofs involving sets COS1501/1
Set difference:
The complement of set B relative to set A, i.e. A – B = {x | x ∈ A and x ∉ B}, is
depicted by the shaded area:
A-B
A B
Symmetric difference:
For sets A and B, the symmetric difference,
i.e. A + B = {x | x ∈ A or x ∈ B, but not both}, is depicted by the shaded area:
A+B
A B
Let’s draw a Venn diagram for a more complex expression before the
self-assessment exercises can be attempted.
Note: Include the universal set U and all three sets A, B and C in each diagram.
51
Study unit 4 Proofs involving sets COS1501/1
Step 1: A ∪ B is depicted by the shaded area: Step 2: A ∩ B is depicted by the shaded area:
AUB A nB
A B A B
C C
Consider the shaded areas in the above diagrams. The shaded area for (A ∪ B) − (A ∩ B) can be
derived from the following: the shaded area A ∩ B should be removed from the shaded area A ∪ B as
we see in step 3. (The elements of (A ∪ B) − (A ∩ B) live in (A ∪ B) but not in (A ∩ B).)
Step 3: (A ∪ B) − (A ∩ B) is depicted by the shaded area: Step 4: C is depicted by the shaded area:
(A U B) – (A n B) C
A B A B
C C
Consider the shaded areas in the above diagrams. The shaded area for [(A ∪ B) − (A ∩ B)] ∪ C can be
derived from the following: add the shaded area of C to that of [(A ∪ B) − (A ∩ B)] as we see in step 5.
(The elements of [(A ∪ B) − (A ∩ B)] ∪ C live in (A ∪ B) − (A ∩ B) or in C, or in both.)
52
Study unit 4 Proofs involving sets COS1501/1
(a) (X ∪ Y)′
(b) X′ ∩ Y′
(c) (X ∩ Y)′
(d) X′ ∪ Y′
(a) X − (Y ∪ Z)
(b) (X − Y) ∪ (X − Z)
(c) X ∩ (Y − Z)
(d) (X ∩ Y) − (X ∩ Z)
(e) X ∩ (Y + Z)
(f) (X ∩ Y) + (X ∩ Z)
4.2 Proofs
We first look at an example. Let A = {1, 2} and B = {2, 4} with U = {1, 2, 4}. Then
A ∪ B = {1, 2, 4}. Similarly B ∪ A = {1, 2, 4}. In other words, A ∪ B = B ∪ A for
the given sets.
If we think a little bit about unions, we realise that the order of A and B does
not play a role in the definition of union. And so it ought to be true for all
possible choices of sets A and B that A ∪ B = B ∪ A.
Now if only we could prove that for all sets A and B, A ∪ B = B ∪ A, then it
would not be necessary to test whether {2, 7} ∪ {5, 9} is the same set as
{5, 9} ∪ {2, 7}, and whether {3, 4, 5} ∪ {1} is equal to {1} ∪ {3, 4, 5}, and so
forth.
53
Study unit 4 Proofs involving sets COS1501/1
Left-hand side: Draw the Venn diagram of A ∪ B by first shading A and then B.
AUB
A B
A B
By using Venn diagrams, we have shown that A ∪ B = B ∪ A for any sets A and
B. Perhaps our “proof ” is not very convincing, because it relies on our
willingness to accept that Venn diagrams give an accurate picture of sets. The
study of more rigorous proofs is called logic and we will give you just a taste of
logic later in this module.
There are some limitations to the use of Venn diagrams in proofs. One has already been
mentioned, namely that some people might claim that the proofs are not rigorous
enough, because there are assumptions built into the technique that are not obvious –
such as the assumption that Venn diagrams give a good picture of sets. This objection is
not our main problem, since we do not, on this level need to be very formal and rigorous.
However, Venn diagrams become difficult to draw when there are more than three
subsets involved, but we will not investigate these further.
(a) X – (Y ∩ W) = (X – Y) ∪ (X – W)
(b) X ∩ (Y ∩ W) = (X ∩ Y) ∩ W
(c) X ∩ (Y ∪ W) = (X ∩ Y) ∪ (X ∩ W)
(d) (Xʹ )ʹ = X
54
Study unit 4 Proofs involving sets COS1501/1
When looking at a Venn diagram, one is inclined to forget that some (or all) of
the sets represented in the picture may be empty. We will therefore also
practise writing out proofs in words. We begin by practising on simple
examples for which we have already drawn Venn diagrams.
Example
Let us prove that, for all subsets A and B of U, A ∪ B = B ∪ A.
In our proof we have to show that the set A ∪ B has exactly the same elements
as the set B ∪ A.
There is a standard technique for doing proofs of this kind. First we show that every
element of the left-hand side set is also an element of the right-hand side set (i.e. we show
that LHSset ⊆ RHSset). Then we go in reverse and show that every element of the right-
hand side set is also an element of the left-hand side set (i.e. RHSset ⊆ LHSset).
If LHSset ⊆ RHS set and RHSset ⊆ LHSset, then we may conclude that LHSset = RHSset.
For the converse part of the proof, begin by choosing any element x of B ∪ A.
If x∈B∪A
then x ∈ B or x ∈ A
i.e. x ∈ A or x ∈ B
i.e. x ∈ (A ∪ B).
Note that we have not tried to be particularly brief in the proof. Conciseness comes with
practice. It is more important that the reader should be happy with each line of the proof
before going on to the next line.
55
Study unit 4 Proofs involving sets COS1501/1
Example
Prove that A ∪ (B ∪ C) = (A ∪ B) ∪ C for all sets A, B, C ⊆ U.
Let x ∈ A ∪ (B ∪ C).
Then x ∈ A or x ∈ (B ∪ C)
i.e. x ∈ A or (x ∈ B or x ∈ C)
i.e. (x ∈ A or x ∈ B) or x ∈ C (since surely the statements
“x ∈ A or (x ∈ B or x ∈ C)” and
“(x ∈ A or x ∈ B) or x ∈ C” mean the same)
i.e. x ∈ A ∪ B or x ∈ C
i.e. x ∈ (A ∪ B) ∪ C.
(This ends the first half of the proof.)
Conversely, let x ∈ (A ∪ B) ∪ C.
Then x ∈ (A ∪ B) or x ∈ C
i.e. (x ∈ A or x ∈ B) or x ∈ C
i.e. x ∈ A or (x ∈ B or x ∈ C)
i.e. x ∈ A or x ∈ (B ∪ C)
i.e. x ∈ A ∪ (B ∪ C).
(This ends the second half of the proof.)
At this stage you might want to know whether we can somehow shorten this
type of proof. The arguments used in the examples above fall into two halves.
The first half begins with the assumption “Let x belong to the left-hand set”
and reasons are given step by step up to the conclusion “then x belongs to the
right-hand set”. The second half begins with the assumption “Let x belong to
the right-hand set” and reasons are logically given up to the conclusion “then x
also belongs to the left-hand set”.
In such cases, we use the phrase “if and only if”, which we abbreviate as “iff”. The “if” part
represents the backward reasoning of the second half, while the “only if” part represents
the forward reasoning of the first half. We will discuss this further in a subsequent study
unit.
If we look back at our subset definition in the previous study unit, we can now see that “A
is a subset of B “iff” every element of A is also an element of B” means that “A is a subset of
B if every element of A is also an element of B” and “if A is a subset of B then every
element of A is also an element of B”.
56
Study unit 4 Proofs involving sets COS1501/1
When working with the complement, the symbol “∉” can be used as follows:
x ∈ Y′ iff x ∉ Y.
However, when we use the notation “∉” combined with “∪” or “∩”, we get a
few surprises!
x ∈ (X ∪ Y)′
iff x ∉( X ∪ Y)
iff x ∉ X and x ∉ Y
iff x ∈ X′ and x ∈ Y′
iff x ∈ X′ ∩ Y′
It helps to draw Venn diagrams for A ∪ B and (A ∪ B)′ – then we can see it
clearly.
x ∈ (X ∩ Y)′
iff x ∉ X ∩ Y
.
.
.
Can you prove that (X ∩ Y)′ = X′ ∪ Y′? If you are not sure about the proof, draw
the Venn diagrams and look at the definitions of “union”, “intersection” and
“complement” again.
57
Study unit 4 Proofs involving sets COS1501/1
(a) (X′)′ = X
(b) X – (Y ∩ W) = (X – Y) ∪ (X – W)
(c) X ∩ (Y ∩ W) = (X ∩ Y) ∩ W
(d) X ∩ (Y ∪ W) = (X ∩ Y) ∪ (X ∩ W)
Example
Use Venn diagrams to investigate whether or not, for all subsets X, Y, and W of
U, X − (Y ∪ W) = (X − Y) ∩ (X − W).
Solution:
Left-hand side:
X YUW
X Y X Y
W
W
X – (Y U W)
X Y
The shaded area represents the set of elements that live in X but not in Y ∪ W.
58
Study unit 4 Proofs involving sets COS1501/1
Right-hand side:
X–Y X–W
X Y X Y
W W
(X – Y) n (X – W)
X Y
The shaded area represents the set of elements that live in X − Y and in X − W.
Since the two resulting Venn diagrams are identical, it appears that the
statement holds, so we provide a proof. (In this proof we apply the definitions
of the set operations provided in the previous study unit.)
x ∈ X − (Y ∪ W)
iff x ∈ X and x ∉ (Y ∪ W)
iff x ∈ X and x ∈ (Y ∪ W)′
iff x ∈ X and (x ∈ Y′ and x ∈ W′)
iff x ∈ X and (x ∉ Y and x ∉ W)
iff (x ∈ X and x ∉ Y) and (x ∈ X and x ∉ W)
iff x ∈ (X − Y) and x ∈ (X − W)
iff x ∈ (X − Y) ∩ (X − W)
So far we have only dealt with proofs of equality, and these involve proofs
which go in two directions and which can be shortened using iff.
There are other kinds of proof that are important too. For instance, we might
want to show that two sets are not necessarily equal.
59
Study unit 4 Proofs involving sets COS1501/1
A B A B
C C
(A + B) U C
A B
A B A B
C C
(A U C) + (B U C)
A B
60
Study unit 4 Proofs involving sets COS1501/1
So what we want is a concrete example of sets which shows that the left-hand
side is different from the right-hand side.
The sets we choose for the counterexample must be chosen in such a way that
some element is present in a part of the respective diagrams where they differ.
In the example we used above, the two final diagrams differ in respect of C, so
we choose some element that appears in C only. (We choose 4 ∈ C but 4 ∉ A
and 4 ∉ B. We choose any other elements from U to live in sets A, B and C.)
Counterexample:
Left-hand side:
(A + B) ∪ C = {1, 3} ∪ {1, 4} = {1, 3, 4} i.e. those elements that reside in
{1, 3} or {1, 4} or both.
Right-hand side:
(A ∪ C) + (B ∪ C) = {1, 2, 4} + {1, 2, 3, 4} = {3}, i.e. an element that resides in
either {1, 2, 4} or {1, 2, 3, 4} but not both.
Perhaps this is a good moment to say more about the term “identity”, which we referred
to earlier in this study unit. You know that an equation such as ax = b has either no real
solution (e.g. when a = 0 and b = 2), or a real solution (e.g. when a = 3 and b = 0), or else
allows every real number to be a solution (e.g. when a = 0 and b = 0).
Definition: An identity
An equation which is satisfied by every possible value of the unknown(s) is
called an identity.
On the previous pages we have been showing that certain equations such as
A∪B=B∪A
are identities, i.e. are satisfied by any subsets A and B of any universal set.
Another type of proof involves showing, not that one set is equal to another,
but that one set is a subset of another set. This is easy, since it involves just the
first half of an equality proof.
We give an example of such a proof. The example involves the very important
concept of power sets which was defined in the previous study unit.
Example
Ƥ (A) ∪ Ƥ (B) ⊆ Ƥ (A ∪ B), i.e. the union of power sets is a subset of the power
set of the union.
(Refer to the definitions of “subset”, “union” and “power set” in the previous
study unit.)
Sometimes we might also want to show that one set is not necessarily a subset
of another. As you may have suspected, we do this by finding a
counterexample.
62
Study unit 4 Proofs involving sets COS1501/1
Examples
We determine the cardinality of some sets:
(a) 0
/ The empty set has no elements.
The cardinality of set 0
/ : |0
/ | = 0.
(c) {0
/ , {1, 2}} 0
/ and {1, 2} are the elements of {0 /, {1, 2}}.
The cardinality of set {0
/ , {1, 2}}: |{0
/ , {1, 2}}| = 2.
Sometimes we want to determine how many elements live in some sets. The intersection
of sets can be empty or some sets might have common members. The Inclusion-exclusion
principle can be applied to determine the number of elements that live in some sets.
Proof
To calculate |X| + |Y|, count the elements of X and of Y and add the two
numbers. The elements that belong to both X and Y will have been counted
twice, so subtract |X ∩ Y|.
Example
Let X = {a, b, c, 1} and Y = {1, 2, 3}. It is clear that X ∩ Y = {1} thus |X ∩ Y| = 1.
We see that
Check the answer: X ∪ Y = {a, b, c, 1, 2, 3}. How many elements live in this set?
The theorem can be applied when X and Y have no common members. This
leads to the sum rule:
Example
Let X = {a, b} and Y = {1, 2, 3}. It is clear that X ∩ Y = { }. We see that
|X| = 2 and |Y| = 3, thus |X ∪ Y| = 2 + 3 = 5.
63
Study unit 4 Proofs involving sets COS1501/1
In the second type of question the unknown, which we must determine, is the
number of persons (or objects) that live in an intersection of sets, frequently
the central intersection of three sets. So we call the unknown x, and carry on
from there, taking special care to do the algebra accurately!
Example
In a group of 50 learners, 25 play Mastermind, 30 play basketball, and
10 play both.
(a) How many students play Mastermind or basketball (or both)?
(b) How many students do not play either Mastermind or basketball?
Let U be the set of all the students in the group, M the set of those playing
Mastermind, and B the set of those playing basketball. Then
|U| = 50, |M| = 25, |B| = 30, and |M ∩ B| = 10.
We use the above information to fill in the number of elements that live in
each region, starting with the region in the middle. We know |M ∩ B| = 10:
|U|=50
M B
10
M B
25 – 10 = 10
15
64
Study unit 4 Proofs involving sets COS1501/1
Take the region on the right-hand side. How many elements live in B but not
in M ∩ B? Since |B| = 30 and |M ∩ B| = 10, there are 30−10 = 20 elements in
this region.
|U|=50
M B
25 – 10 = 10 30 – 10 =
15 20
Now all the regions have been filled in and we can answer the question:
(b) We determine the number of students who do not play either Mastermind
or basketball:
Example
A questionnaire filled in by the 100 subscribers to Blue Scalpel Medical
Insurance who submitted no claims during 2009 reveals that 45 jog regularly,
30 do aerobics regularly, 20 cycle regularly, 6 jog and do aerobics, 1 jogs and
cycles, 5 do aerobics and cycle, and 1 jogs, cycles and does aerobics.
(a) How many of these healthy people do not participate regularly in any of
the three activities mentioned?
(b) How many only jog?
We use the same Venn diagram to answer both questions. Let us firstly display
the available information neatly. Let U be the set of subscribers who filled in
the questionnaire, J the set of those that jog, A the set of those that do aerobics
and C the set of those that cycle. Then
|U| = 100,
|J| = 45,
|A| = 30,
|C| = 20,
|J ∩ A| = 6,
|J ∩ C| = 1,
|A ∩ C| = 5, and
|J ∩ A ∩ C| = 1.
65
Study unit 4 Proofs involving sets COS1501/1
|U| = 100
16
J A
6–1=
45 – 5 – 1 – 0 = 5 30 – 5 – 1 – 4 =
39 1 20
1–1 = 0 5–1 = 4
20 – 4 – 0 –1 = 15
(a) How many of these healthy people do not participate regularly in any of
the three activities mentioned?
We can prove that two specific sets are equal. Let’s look at an example:
Example
Prove that
{w ∈ R | w2 − 3w + 2 < 0} = {z ∈ R | 1 < z < 2}.
We should prove that each member of the left-hand side set belongs to the
right-hand side set and conversely.
Proof
x ∈ {w ∈ R | w2 − 3w + 2 < 0}
iff x ∈ R and x2 − 3x + 2 < 0
iff x ∈ R and (x − 2)(x − 1) < 0
iff x ∈ R and either (x − 2 < 0 and x − 1 > 0) or (x − 2 > 0 and x − 1 < 0)
(since a minus times a plus gives a minus, or
a plus times a minus gives a minus )
iff x ∈ R and either (x < 2 and x > 1) or (x > 2 and x < 1)
(there are no real numbers that are
simultaneously greater than 2 and less than 1)
iff x ∈ R and 1 < x < 2
iff x ∈ {x ∈ R | 1 < x < 2} iff x ∈ {z ∈ R | 1 < z < 2}
Note: Any variable can be used for a set description - it does not change the
members in the set.
To go from the step x ∈ R and ((x < 2 and x > 1) or (x > 2 and x <1)) to the step x ∈ R
and (1 < x < 2), we gave as justification that (x > 2 and x < 1) is false. But we must not
forget that we are making use of “iff” and therefore we must also know why it is correct
to go in the opposite direction. Given a true statement such as “The earth is round”, we
can add any other statement to it using “or”, whether the added statement is true or not,
and the resulting statement will still be true. For example, the statement “The earth is
round or elephants are green” is true even though “elephants are green” is not true.
6. Is it the case that for every subset X of U there is some subset Y such
that X ∩ Y = U? Justify your answer.
In this study unit you ensured that you can answer the following basic
questions:
• How do you prove the theoretic identities of sets using Venn diagrams?
• How do you prove the theoretic identities of sets using the phrase “if and
only if”?
• How do you establish the falsity of universal assertions by providing a
counterexample?
• How do you handle proofs involving specific sets?
• What is the usefulness of the Inclusion-exclusion principle?
68
Study unit 5 Relations COS1501/1
Your map should include the concepts of an ordered pair, a Cartesian product,
a relation, domain, codomain, range, reflexivity, irreflexive, symmetry,
antisymmetry, transitivity, the composition of relations, inverse relations.
69
Study unit 5 Relations COS1501/1
As we saw earlier, {1, 2} = {2, 1}, so the order in which the elements of a set
are listed does not matter. We now introduce a way to “encode” a new
concept. This is done by using round brackets (parentheses) instead of curly
brackets {braces} to get something that looks like this: (3, 0). The parentheses
tells us that we are not talking about a set, but that we are dealing with an
ordered pair, in which 3 is the first co-ordinate and 0 the second co-ordinate.
Since the order is important, it follows that (3, 0) ≠ (0, 3).
The original use for this notation was to plot points on a graph in a plane. A
Cartesian co-ordinate system in a plane consists of two perpendicular lines,
one horizontal and one vertical, with a unit of measurement marked on each
line. The horizontal line is usually called the x-axis and the vertical line the y-
axis. The point where they meet is called the origin. The origin can be
represented by the ordered pair (0, 0). Figure 5-1 illustrates this idea:
positive y-axis
(0, 0)
negative x-axis positive x-axis
negative y-axis
Figure 5-1
Now, each point in the plane occurs at an address provided by an ordered pair.
Let’s look at (4, −2) as an example. The first co-ordinate tells us to move, from
our starting point at the origin, 4 steps in the positive direction along the x-
axis. The second co-ordinate tells us that we should then move 2 steps in the
negative direction along the y-axis.
70
Study unit 5 Relations COS1501/1
Figure 5-2
Apart from being able to represent points in a plane, ordered pairs have many
other uses. All the uses are based on the fact that we can use the fixed order of
the co-ordinates to provide information about some relationship. The
resulting set of ordered pairs is then conveniently called a relation.
5.2 Relations
Let’s look at an example. Consider the set {2, 3, 5}. We know that 2 < 3, 2 < 5
and 3 < 5. We can call this specific relationship “is less than” and we can
represent it graphically by drawing arrows from 2 to 3, 2 to 5, and 3 to 5. This
relationship is illustrated in Figure 5-3:
Figure 5-3
Applying what we have just learned about ordered pairs, we can use ordered
pairs to represent the elements of this example of an order relation. In the
place of the arrows, we can consider the ordered pairs (2, 3), (2, 5) and (3, 5).
The set of these pairs, R = { (2, 3), (2, 5), (3, 5) }, completely captures the
information in our picture. R is an order relation (which we could also call "<")
on the set {2, 3, 5}.
Note: There are many other examples of order relations other than the “<”
order relation.
71
Study unit 5 Relations COS1501/1
As we will see in this study unit, if R is a relation on {2, 3, 5}, it means that R is a relation
from {2, 3, 5} to {2, 3, 5}, i.e. the first and second co-ordinates come from the set {2, 3, 5}.
Instead of writing (2, 3) ∈ R we could also use what is called infix notation,
and write 2 R 3. Usually this specific relation is given the name < rather than R,
so we write 2 < 3 (using infix notation) rather than (2, 3) ∈ <.
Now it is important to note that any set of ordered pairs may be called a
relation. It also often happens that a relation represents a relationship
between one sort of thing and another. We can then say that all the first co-
ordinates in the ordered pairs are of the same sort, whereas the second co-
ordinates are all of a sort which may be different from the sort of the first co-
ordinates.
Example
In the relation
R = {(xi , yi) | xi is the husband of yi, i = 1, 2, …, n},
the first co-ordinates are all men and the second co-ordinates are all women.
We describe the relation as the relation R from M to W, where
M = {x1, x2, x3,… xn} is a set of men and W = {y1, y2, y3,… yn} is a set of women.
Ordered pairs live in R, i.e. (x1, y1) ∈ R (x1 is the husband of y1),
(x2, y2) ∈ R (x2 is the husband of y2), and so on.
Note: We can write (xi , yi) ∈ R or we could use infix notation to write xi R yi.
Another example
++
When a C compiler translates a source program into the machine language
of the object program, it constructs a symbol table which contains the
following sets:
If you have not been exposed to programming, you need not be concerned if you do not
understand the concept of a symbol table. Just imagine it as a table with three columns:
column 1 contains a set of names, column 2 a set of attributes (or properties) of the
names in column 1, and column 3 a set of locations where the names can be found.
Let’s investigate more carefully this idea of having a relation from one set to
another.
72
Study unit 5 Relations COS1501/1
The Cartesian product A × B denotes a set of ordered pairs such that all the
first co-ordinates are members of A and all the second co-ordinates are
members of B. Each member of A is combined with each member of B in the
set of ordered pairs A × B consists of.
Examples
Suppose A = {2, 3, 4} and B = {5, 6}. Then
(a) A × B = { (2, 5), (2, 6), (3, 5), (3, 6), (4, 5), (4, 6) }
(b) B × A = { (5, 2), (5, 3), (5, 4), (6, 2), (6, 3), (6, 4) }
(c) B2 = B × B = { (5, 5), (5, 6), (6, 5), (6, 6) }.
(d) A2 = A × A = { (2, 2), (2, 3), (2, 4), (3, 2), (3, 3), (3, 4), (4, 2), (4, 3), (4, 4)}.
Although the two sets A and B might contain different types of things, they often contain
exactly the same type of thing. In the example above, both A and B contain some natural
numbers.
Definition: Relation
A subset of a Cartesian product C × D is called a relation from C to D.
Examples
With A = {2, 3, 4} and B = {6, 7}, the following are some relations from A to B:
(a) 0
/
(b) { (3, 7) }
(c) { (2, 6), (2, 7) }
(d) { (2, 6), (3, 6), (4, 6) }
(e) A × B.
73
Study unit 5 Relations COS1501/1
If R is some relation from A to B, all the members of A and B do not necessarily appear as
first and second co-ordinates respectively in the relation. This leads us to the following
definitions:
dom(T) = {x | for some y ∈ Y, (x, y) ∈ T}, i.e. the set of all elements that actually
appear as first co-ordinates in the ordered pairs of T.
ran(T) = {y | for some x ∈ X, (x, y) ∈ T}, i.e. the set of all elements that actually
appear as second co-ordinates in the ordered pairs of T.
Note: One has to be a little careful when reading textbooks, because some authors use the
word range to describe what we have called the codomain. But rest assured, we are
following the most common practice.
Example
Let S = { (a, 1) }, { (b, 1), (a, 2) } be a relation from {a, b, c} to {1, 2, 3}.
Then dom(S) = {a, b} ⊆ {a, b, c} and ran(S) = {1, 2} ⊆ {1, 2, 3}. The codomain is
the set {1, 2, 3}.
74
Study unit 5 Relations COS1501/1
Examples
Let A = {2, 3, 4} and B = {a, b}.
The codomain of all these relations is {a, b} = B; the domain and range of 0 / is
the set 0
/ ; the domain of { (2, a), (4, b) } is {2, 4} and its range is {a, b}; the
domain of A × B is A and its range is B.
We now look specifically at some relations R that are subsets of A × A for some
set A. Such relations may, of course, be called relations from A to A, but it is
more usual to refer to them as relations on A.
Definition: Reflexive
A relation R on A (also written as R ⊆ A × A) is called reflexive on A iff for every
x ∈ A, we have (x, x) ∈ R.
Examples
Let A = {2, 3, 5}. In order for some relation S to be reflexive on A, we should
have { (2, 2), (3, 3), (5, 5) } ⊆ S, which means that, among the elements of S,
there should at least be the ordered pairs (2, 2), (3, 3) and (5, 5). Note that
each element of A should be related to itself.
Now S = { (2, 2), (3, 3), (5, 5), (2, 3) } is an example of a reflexive relation on A.
Definition: Irreflexive
A relation R ⊆ A × A is called irreflexive iff there is no x ∈ A such that
(x, x) ∈ R. In other words, for any x ∈ A, (x, x) ∉ R.
The idea is that R ⊆ A2 is irreflexive iff there is no element of A related (in the
context of R) to itself.
75
Study unit 5 Relations COS1501/1
Examples
Let A = {2, 3, 5}. We look at properties of some relations on A:
R = {(3, 2), (2, 5), (3, 5)} is irreflexive since no member of A is related to itself,
i.e. not one of the pairs (2, 2), (3, 3) and (5, 5) belong to R.
S = {(2, 2), (2, 5), (3, 5)} is neither reflexive nor irreflexive. Why do we say
this? S is not reflexive since not all elements of A are related to itself, i.e. not all
the pairs (2, 2), (3, 3) and (5, 5) belong to S. S is not irreflexive either since
(2, 2) is an element of S. For irreflexivity not one of the ordered pairs
(2, 2), (3, 3) and (5, 5) should belong to S.
Yes, it can never be the case that x < x, therefore (x, x) ∉ R for all x ∈ Z.
Definition: Symmetric
A relation R ⊆ A × A is symmetric iff R has the property that, for all x, y ∈ A,
if (x, y) ∈ R, then (y, x) ∈ R.
The idea is that whenever an ordered pair (x, y) lives in R, then a pair with the
order of the elements reversed (i.e. the mirror image pair) must also live in R.
Examples
Let B = {1, 2, 3}. We look at properties of some relations on B:
(a) R1 = { (1, 2), (2, 1), (1, 3), (3, 1) } is symmetric and irreflexive.
(b) R2 = { (1, 1), (2, 2), (3, 3), (2, 3) } is reflexive on B but not symmetric.
(c) R3 = { (1, 1), (2, 2), (3, 3), (2, 3), (3, 2) } is reflexive on B and symmetric.
(d) R4 = { (1, 1), (2, 3), (3, 3) } is neither reflexive on B, nor irreflexive, nor
symmetric.
Definition: Antisymmetric
A relation R ⊆ A × A is antisymmetric iff R has the property that, for all x, y ∈ A,
if x ≠ y and (x, y) ∈ R then (y, x) ∉ R.
The idea is that whenever x ≠ y and (x, y) lives in R, then a pair with the order
of the elements reversed (i.e. the mirror image pair) may not live in R.
76
Study unit 5 Relations COS1501/1
Examples
Let A = {a, b, c}.
Definition: Transitive
A relation R ⊆ A × A is transitive iff R has the property that for all x, y, z ∈ A,
whenever (x, y) ∈ R and (y, z) ∈ R, then (x, z) ∈ R.
Transitivity means that if x "is related to" y and y "is related to" z, then x "is
related to" z with y acting as a sort of intermediary. One could say that, if the
relation is transitive, and one can get from x to z in two steps, then one can
also get from x to z in one step.
Examples
Let R = {(1, 1), (2, 2), (1, 2), (2, 1) } be a relation on A = {1, 2, 3}.
This relation is transitive: Consider the ordered pairs (1, 2) and (2, 1):
if 2 acts as the “intermediary” then (1, 1) ∈ R.
If 1 acts as the “intermediary” for (2, 1) and (1, 2) then (2, 2) ∈ R.
One should also consider pairs such as (1, 1) and (1, 1): 1 acts as the
“intermediary” so (1, 1) ∈ R. In this case the pair (1, 1) plays a triple role.
All the different possibilities should be investigated systematically.
77
Study unit 5 Relations COS1501/1
Many relationships in real life are transitive, for example "is heavier than". Others might
give one the impression that they should be transitive, but are in fact not. In soccer, for
instance, we might have "Liverpool beats Real Madrid", and "Real Madrid beats Arsenal",
but this does not necessarily mean that "Liverpool beats Arsenal".
Definition: Trichotomy
A relation R on A satisfies the requirement for trichotomy iff, for every x and y
chosen from A such that x ≠ y, we have that x and y are comparable,
i.e. for all x, y ∈ A such that x ≠ y, x R y or y R x (i.e. (x, y) ∈ R or (y, x) ∈ R).
This means that we should be able to compare any two distinct elements x and
y belonging to A in terms of the relation. So, if we pick any distinct elements x
and y from A, then either x is the first co-ordinate and y the second co-
ordinate in an ordered pair, i.e. x R y, or x is the second and y the first co-
ordinate in an ordered pair, i.e. y R x (it is possible that both x R y and y R x
since “or” is used in the inclusive sense in this definition).
All distinct elements x and y that belong to A should be considered when
investigating whether x R y or y R x. (It is possible that pairs of the form (x, x)
could belong to some relation that satisfies trichotomy.)
Examples
Suppose S = { (1, 1), (3, 2), (2, 1), (3, 1), (3, 1) } is a relation on A = {1, 2, 3},
then S satisfies the requirement for trichotomy since any element of A is
related to each other element of A that is different from itself. This means that
all the distinct elements belonging to A are comparable:
(3, 2), (2, 1), (3, 1) ∈ S.
(A pair (x, y) belongs to R iff x is less than or equal to y. Instead of “R” we could
just as well have named the relation “≤”. For example, 1 ≤ 2, i.e. (1, 2) ∈ R but
6 ≰ 2 thus (6, 2) ∉ R.)
78
Study unit 5 Relations COS1501/1
Now suppose (1, 2) ∈ R and (2, 3) ∈ R, then we need to add (2, 1) and (3, 2) to
ensure that R is symmetric.
At this stage { (1, 1), (2, 2), (3, 3), (1, 2), (2, 3), (2, 1), (3, 2) } ⊆ R.
Thus R = { (1, 1), (2, 2), (3, 3), (1, 2), (2, 3), (2, 1), (3, 2), (1, 3), (3, 1) }.
It is also possible to build new relations from old ones. There are various ways of doing
this, two of which we will consider next. Firstly, we will look at the inverse of a relation,
and secondly we will investigate how the composition of two relations is formed.
Note that this definition also tells us that the inverse of R-1 is R, so we could
simply say that these two relations are inverses of each other.
(Adapted from Ensley & Crawley, 2006.)
Example
Let X = {a, b, c} and R = { (a, b), (b, c), (a, c) }.
It is worth spending some time thinking about this definition. If x is a first co-
ordinate in some pair of R; S, can you see that x must be a member of A? This
is the case because if x appears as a first co-ordinate in R; S, then there has to
be some b ∈ B such that (x, b) ∈ R. Similarly, if y appears as a second co-
79
Study unit 5 Relations COS1501/1
R S
a b c
S ○ R or R; S
Examples
Let R = { (1, a), (2, b) } be a relation from {1, 2} to {a, b} and let
S = { (a, s), (b, s), (b, t) } be a relation from {a, b} to {s, t}.
The first co-ordinates of S ○ R come from {1, 2} (dom(R)) and the second co-
ordinates come from {s, t} (ran(S)).
If we want to determine S ○ R, i.e. R;S, then we first write down a pair of R, let’s
take (1, a), then we look for a pair in S that has as first co-ordinate an a. If we
link (1, a) of R with (a, s) of S (a is the linking co-ordinate), then by the
“relation composition” definition, (1, s) ∈ S ○ R.
Let’s consider the other member of R, namely (2, b), and inspect S to see
whether or not (2, b) can link with some members in S. We see that (2, b) can
link with (b, s) and also with (b, t). By definition (2, s) and (2, t) are members
of S ○ R.
80
Study unit 5 Relations COS1501/1
More examples
In the following examples, we consider relations defined on X = {a, b, c}.
We can form the compositions R; R (i.e. R ○ R), R; R-1 (i.e. R-1 ○ R),
R-1; R (i.e. R ○ R-1) and R-1; R-1 (i.e. R-1 ○ R-1):
(a) Let R = { (a, a), (b, c), (c, b) }, then R-1 = { (a, a), (c, b), (b, c) }.
To determine R; R, we start with the pair (a, a) of R, and then we look for a
pair in R that has as first co-ordinate an a, and then see where it takes us.
Link (a, a) of R with (a, a) of R, then (a, a) ∈ R; R. Continuing in this vein gives
R ○ R = { (a, a), (b, b), (c, c) }.
And of course R-1 ○ R-1 = {(a, a), (b, b), (c, c)}.
(b) Let R = { (a, b), (b, c), (a, c) } then R-1 = { (b, a), (c, b), (c, a) }.
Only the pair (a, b) of R can link with a pair in R, namely (b, c) of R, thus
R; R = {(a, c)}.
R; R-1 = { (a, a), (b, a), (b, b), (a, b) }. We obtain the four ordered pairs in R; R-1
as follows:
(a, a): link (a, b) of R with (b, a) of R-1, or link (a, c) of R with (c, a) of R-1;
Similarly, R ○ R-1= { (b, b), (b, c), (c, c), (c, b) } and R-1 ○ R-1 = { (c, a) }.
81
Study unit 5 Relations COS1501/1
2. Let A = {a, b}. For each of the specifications given below, find suitable
examples of relations on Ƥ (A).
First of all let us write down Ƥ (A): Ƥ (A) = {0
/ , {a}, {b}, {a,b}},
and Ƥ (A)×Ƥ (A) = { (0 /, 0
/ ), (0
/ , {a}), (0
/ , {b}), (0
/ , {a,b}), ({a}, 0
/ ), ({a}, {a}),
({a}, {b}), ({a}, {a, b}), ({b}, 0 / ), ({b}, {a}), ({b}, {b}), ({b}, {a, b}),
({a, b}, 0
/ ), ({a, b}, {a}), ({a, b}, {b}), ({a, b},{a,b}) }.
Let R be a relation on A:
R is reflexive on A iff for all x ∈ A, we have (x, x) ∈ R.
R is irreflexive iff for any x ∈ A, (x, x) ∉ R.
R is symmetric iff for all x, y ∈ A, if (x, y) ∈ R, then (y, x) ∈ R.
R is antisymmetric iff for all x, y ∈ A, if x ≠ y and (x, y) ∈ R, then (y, x) ∉ R, or
alternatively: for all x, y ∈ A, if (x, y) ∈ R and (y, x) ∈ R, then x = y.
R is transitive iff for all x, y, z ∈ A, if (x, y) ∈ R and (y, z) ∈ R, then (x, z) ∈ R.
In this study unit you ensured that you can answer the following questions
regarding set theory:
In the following study unit we will learn more about additional properties that
relations might have and also study special kinds of relation.
82
Study unit 6 Special kinds of relation COS1501/1
Your map should include the concepts of order relations, partial orders,
trichotomy, total order, equivalence relations, equivalence classes, partitions,
n-ary relations, functions, domain, range and codomain.
83
Study unit 6 Special kinds of relation COS1501/1
Familiar concepts from study unit 5 play a role in the following definition of a
special kind of relation, namely a weak partial order:
We will later see that it is possible for some order relation to be irreflexive, antisymmetric
and transitive. We call such a relation a “strict partial order”.
Examples
Let A = { {a}, {a, b} }. A relation S on A is defined by (B, C)∈ S iff B ⊆ C, i.e.
S = { ({a}, {a}), ({a}, {a, b}), ({a, b}, {a, b}) }. (Each first co-ordinate is a subset of
the second co-ordinate.)
Yes, S is reflexive on A:
Each element of A is related to itself: ({a}, {a}) ∈ S and ({a, b}, {a, b}) ∈ S.
Yes, S is antisymmetric:
We see that {a} ≠ {a, b} and ({a}, {a, b}) ∈ S, but ({a, b}, {a}) ∉ S.
Transitivity: Is it true that for all B, C, D ∈ A, if (B, C)∈ S and (C, D)∈ S, then
(B, D) ∈ S?
Yes, S is transitive:
We have ({a}, {a})∈ S and ({a}, {a})∈ S, then also ({a}, {a})∈ S (({a}, {a}) plays a
triple role);
({a}, {a})∈ S and ({a}, {a, b})∈ S, then also ({a}, {a, b})∈ S;
({a}, {a, b})∈ S and ({a, b}, {a, b})∈ S, then also ({a}, {a, b})∈ S; and lastly
({a, b}, {a, b})∈ S and ({a, b}, {a, b})∈ S, then also ({a, b}, {a, b})∈ S.
84
Study unit 6 Special kinds of relation COS1501/1
Reflexivity:
For each x ∈ Z+ we have that x = 1⋅x with k = 1, so (x, x) ∈ R.
Therefore R is antisymmetric.
Transitivity: For all x, y, z ∈ Z+ such that (x, y) ∈ R and (y, z) ∈ R. Does it follow
that (x, z) ∈ R?
Therefore R is transitive.
85
Study unit 6 Special kinds of relation COS1501/1
Example
Let A = {1, 2, 3} and let S on A be the relation S = { (1, 2), (1, 3), (2, 3) }.
(Each first co-ordinate is less than the second co-ordinate.)
Yes, S is irreflexive:
No element of A is related to itself, so (x, x) ∉ S for any element of A.
Yes, S is antisymmetric:
We see 1 ≠ 2 and (1, 2) ∈ S, but (2, 1) ∉ S,
1 ≠ 3 and (1, 3) ∈ S, but (3, 1) ∉ S, and
2 ≠ 3 and (2, 3) ∈ S, but (3, 2) ∉ S.
Transitivity: Is it true that for all x, y, z ∈ A, if (x, y)∈ S and (y, z)∈ S, then
(x, z) ∈ S?
Yes, S is transitive:
We have (1, 2) ∈ S and (2, 3) ∈ S, then also (1, 3) ∈ S.
This relation S also satisfies the condition of trichotomy (as defined in the
previous study unit). Any element of A is related to any other element of A
that is different from itself. We have (1, 2), (1, 3) and (2, 3) ∈ S.
(a) Let A = {a, {a}, {b}} and let S on A be the relation S = { (a, {a}), (a, {b})}.
(b) Define R ⊆ (Z × Z) × (Z × Z) by (a, b) R (c, d) iff a < c.
Why do we use the word partial? The reason for this is that, if we choose any two
elements from A, say x and y, they need not be related. The two most basic examples of
partial orders are the usual ordering of numbers, on the one hand, and the subset
relation on the other. A comparison of these relations illustrates that the “is less than or
equal to” relation has a property (namely “trichotomy”) that the subset relation does not
have. We will presently give a name to these new kinds of relation with this property. The
word “partial” indicates that some of the relations that we are talking about might not
have this special property.
86
Study unit 6 Special kinds of relation COS1501/1
Let’s look at the concept of power sets again. Consider the set
U = {1, 2}. Then Ƥ (U) has as members the subsets 0 / , {1}, {2} and {1, 2}.
Can we say that any two subsets of U can be compared (are comparable) in
terms of the subset relation? The answer is NO.
For instance, pick the subsets {1} and {2}. Not every element of {1} belongs to {2}, so we
do not have {1} ⊆ {2}. Similarly, not every element of {2} belongs to {1}, so we don't have
{2} ⊆ {1}. This means that it is not the case that if we pick any two elements from the
subset relation on Ƥ (U), that they are related, i.e. that they are comparable.
A B
1 2
A simple way to remember what this means is to think of any two members of the set A as
being comparable (related).
87
Study unit 6 Special kinds of relation COS1501/1
Examples
The relation ≤ is a weak total order relation on Z. (In Activity 6.6 you will
determine that ≤ is reflexive, antisymmetric and transitive.)
We define the relation: ≤ = {(m, n)| m ≤ n with m, n ∈ Z}
i.e. for all m, n ∈ Z, either m ≤ n or n ≤ m.
The relation ≤ is a weak total order relation on Z because we can compare any
two integers in terms of this total order relation. We see that either the first
co-ordinate is less than the second, or they are equal, or the second co-
ordinate is less than the first.
0, −1 then −1 ≤ 0.
1, 1 then 1 ≤ 1.
45, 113 then 45 ≤ 113.
−20, −250 then −250 ≤ −20 … and so on.
We see that it is possible to differentiate between weak and strict total order relations.
The difference being that a weak total order relation is reflexive, whereas a strict total
order relation is irreflexive. This means that “≤” is a weak total order and “<” is a strict
total order.
N.B.: Note the way in which we differentiate between a “weak” order and a
“strict” order.
88
Study unit 6 Special kinds of relation COS1501/1
When we consider relations (or functions, a topic which is studied later in this
study unit) and we want to investigate whether or not they have certain
properties, we must keep the following in mind:
One cannot use examples to prove general statements of the form:
We have made the point that an example does not constitute a general proof. However,
examples have a valuable role to play in helping us to get an intuitive “feel” for some
problems.
The first thing you should do is to get a “gut feel” for T by determining some of
its outputs. We know that the difference between x and y should be a multiple
of 3, so we determine the outputs of T when the following ordered pairs are
the inputs:
Thinking about these pairs and outputs will help you as you consider the tests
for the various properties, and will make it easier to decide on your approach
to the proof – or, maybe to provide a counterexample.
Example
Say, for example, we want to investigate whether or not the previous relation
T is reflexive on Z, i.e. for all x ∈ Z, is it the case that (x, x) ∈ T? We must
provide a general proof:
x–x=0
i.e. x – x = 3⋅0 with k = 0,
so (x, x) ∈ T for all x ∈ Z.
Therefore T is reflexive on Z.
89
Study unit 6 Special kinds of relation COS1501/1
Example
We use a counterexample to prove that the relation T in the previous example
does not satisfy trichotomy:
Another approach to prove something is called the brute force approach. What we do in
this type of proof is to write down all the elements we are working with, and show that
whatever we want to prove holds for all the possible elements. The first exercise in the
following activity is an example of such a proof.
{ (a, b) }, { (a, c) }, … write down the other 4 strict partial orders that have only
one element;
{ (a, b), (a, c) }, { (a, b), (c, b) }, … write down the other 4 strict partial orders
that have two elements; and
{ (a, b), (b, c), (a, c) }, … write down the other 5 strict partial orders that have
three elements.
During your computing studies you will often come across the term
“equivalence relation”. This type of relation is used in many applications and
what make them special are the properties that these relations have.
90
Study unit 6 Special kinds of relation COS1501/1
Examples
Suppose A is the set of all people that were living in the Republic of South
Africa on the night of the last census. Let R be the relation on A defined by
x R y if x slept under the same roof as y on that particular night. If we ignore
the possibility of someone sleepwalking from one house to another, then R is
an equivalence relation. This means that we divide the population not into
humans with individual characteristics, but into households. The single
property we use to separate objects into groups is the place where a person
slept on that particular night.
Consider the rational numbers (or fractions). You are probably used to thinking of
rational numbers as quotients of integers a/b with b ≠ 0. But do you regard 1/3 as
different from 2/6, or 2/5 as different from 20/50? No of course not.
91
Study unit 6 Special kinds of relation COS1501/1
Now all the quotients a/b, 2a/2b, 3a/3b, 4a/4b, … are equivalent to one
another, in other words, each belongs to the equivalence class [a/b]. These
equivalence classes are actually the rational numbers. When we write 1/3, we
really mean [1/3], the equivalence class of 1/3, because when we write 1/3
we are talking simultaneously about all the equivalent fractions 1/3, 2/6,
4/12, and so on.
Note: The equivalence classes [0] and [1] are the “parts” of the partition S of
the set Z induced by the relation R.
It is clear that [ 0 ] ∩ [ 1 ] = 0
/ and [ 0 ] ∪ [ 1 ] = Z.
A given equivalence class [x] can be described in many ways. To be precise, [x] = [y] for
each y ∈ [x]. We say that we have made a choice of representative x or y, depending on
whether we denote this one equivalence class by [x] or by [y]. When we deal with
equivalence relations, it is conventional to pick as representative the smallest non-
negative member of the equivalence class. E.g. if {2, 4, 6, …} is an equivalence class of
some relation, we denote the class by [2].
Let R3 be the relation Z that maps an integer x to the result of calculating x modulo 3.
This means that x maps to the remainder of x/3. Since the remainder can only be 0, 1 or
2, we have three equivalence classes, namely [0], [1] and [2].
92
Study unit 6 Special kinds of relation COS1501/1
We have seen that the basic thing an equivalence relation R on A does, is to split the set A
into a bunch of subsets, each of which is an equivalence class. We formally state this.
Theorem 6.1
(i) If R is an equivalence relation on A, then x ∈ [x] for each x ∈ A, i.e. every
member of A belongs to some equivalence class with respect to R.
(ii) If x R y, then [x] = [y], i.e. if two elements are equivalent with respect to
R, then they belong to the same equivalence class.
(iii) If [x] = [y], then x R y, i.e. if x and y are different representatives of the
same equivalence class, then x and y are equivalent with respect to R.
(iv) Either [x] = [y] or [x] ∩ [y] = 0 /, i.e. different equivalence classes do not
have any elements in common.
Proof
(i) R is reflexive on A, so (x, x) ∈ R for all x ∈ A, i.e. x ∈ [x] for all x ∈ A.
(ii) Suppose (x, y) ∈ R. We want to show that [x] = [y], so we have to show
that the two sets, [x] and [y], are equal.
w ∈ [x]
iff x R w
iff w R x (by symmetry)
iff w R y (since x R y and R is transitive)
iff y R w (by symmetry)
iff w ∈ [y].
Hence [x] = [y].
93
Study unit 6 Special kinds of relation COS1501/1
(iv) Let us suppose that [x] ≠ [y]. We will show that [x] ∩ [y] = 0
/ . The
method we use is known as reductio ad absurdum, or (in English)
reduction to an absurdity. The idea is to assume temporarily the
opposite of what we want to prove, and to derive a contradiction. Since
contradictions cannot be tolerated, it would mean that something is
wrong somewhere. But the only weak link in our argument is the
temporary assumption we have made, so we have to conclude that our
assumption was wrong.
Right, let's start. We assume that [x] ≠ [y]. Our temporary assumption is:
[x] ∩ [y] ≠ 0/.
There are two possibilities for [x] and [y]. Either [x] = [y] or [x] ≠ [y] .
But if [x] ≠ [y], then [x] ∩ [y] = 0
/.
So either [x] = [y] or [x] ∩ [y] = 0/
QED
The above theorem suggests a simple and fail-safe way to build
equivalence relations. We'll get to it in a moment. But first, we
reconsider a new term we have already referred to earlier in the
context of equivalence relations.
Definition: Partitions
For a nonempty set A, a partition of A is a set S = {S1, S2, S3, …}. The members of
S are subsets of A (each set Si is called a part of S) such that
1. for all i, Si =
/0/ (that is, each part is nonempty),
2. / Sj, then Si ∩ Sj = 0
for all i and j, if Si = / (that is, different parts have
nothing in common), and
3. S1 ∪ S2 ∪ S3 ∪ … = A (that is, every element in A is in some part Si).
94
Study unit 6 Special kinds of relation COS1501/1
Examples
For example, let A = {a, 2, b}. Let's split A into two subsets {a, 2} and {b}. Then
{{a, 2}, {3}} is a partition of A, because
But suppose we throw the subsets {a} and {b} of A in a set, then the resulting
set {{a}, {b}} is not a partition of A, because 2 has no part (subset) where it
belongs; {a} ∪ {b} = {a, b} ≠ {a, 2, b}.
No, it is not. One of the conditions of a partition is that the intersection of its
parts must be the empty set.
A partition splits a set into subsets just like a fence subdivides a farm into
different parts. Each animal on the farm reside in some part of the farm, and
no animal can be in two areas at the same time.
Example
Consider the partition of {1, 2, 3} given by { {1, 2}, {3} }.
The subset {1, 2} tells us that [1] = {1, 2} = [2]. This means that a relation R has
the pairs (1, 1), (2, 2), (1, 2) and (2, 1) as elements.
And the subset {3} tells us that [3] = {3}, i.e. (3, 3) ∈ R.
Of course, the fact that something works for one example doesn't mean it will always
work. So let's try to prove that it always works.
Theorem 6.2
Suppose A is a nonempty set, and suppose further that we have a partition of
A. Then the relation R defined on A by (x, y) ∈ R iff x and y belong to the same
partitioning subset, is an equivalence relation on A.
95
Study unit 6 Special kinds of relation COS1501/1
Proof
Let's see whether R is reflexive on A. Suppose x is an arbitrary member of A.
Then certainly x is in the same partitioning subset of A as itself. So x R x.
Let's see whether R is symmetric. Suppose x R y, then x and y belong to the
same partitioning subset of A. But we can just as well say that y and x belong
to the same partitioning subset of A. So y R x.
Let's see whether R is transitive. Suppose x R y and y R z. The former implies
that x and y live in the same partitioning subset. The latter implies that y and z
live in the same partitioning subset. Since y can only live in one partitioning
subset, it follows that x, y and z are all present in the same partitioning subset.
So, more particularly, x and z live in the same partitioning subset, which
means that x R z.
QED
Activity 6-12: Self-assessment exercises Application skills
Determine whether P is a partition of X in each of the following cases. If it is,
describe the corresponding equivalence relation.
Let us conclude this section by asking the following question: Why does one need to know
about equivalence relations and partitions?
Firstly, you will apply this knowledge in the field of Boolean algebra, which you will
encounter in other Computing modules.
Secondly, in later modules you will encounter things called finite state machines, and you
will learn how to reduce the complexity and cost of such finite state machines by a
minimisation process. The minimisation process involves defining a certain equivalence
relation on the machine.
Up to now we have worked with relations that had ordered pairs as members.
Just as we can form ordered pairs, we can form ordered triples (x1, x2, x3) in
which x1 is the first co-ordinate, x2 the second co-ordinate and x3 the third co-
ordinate; ordered quadruples (4-tuples) (x1, x2, x3, x4) in which x1 is the first
co-ordinate, x2 the second, x3 the third, and x4 the fourth; ordered quintuples
(5-tuples) (x1, x2, x3, x4, x5), and so on.
96
Study unit 6 Special kinds of relation COS1501/1
Now, a set of ordered pairs (a relation), is actually a binary or 2-ary relation; the word
binary tells us that the relation consists of ordered pairs, not triples or 6-tuples.
A set of ordered triples such as {(1, 0, 0), (0, 1, 2), (-1, -2, 5)} will be called a 3-ary or
ternary relation. Similarly a 4-ary (quaternary) relation consists of ordered quadruples,
and in general an n-ary relation consists of ordered n-tuples.
But why are these complications useful? All the important relations dealt with
so far have been binary relations.
Worked example
Consider the student records of some university. They contain various
different kinds of data. The data items of each type can be grouped quite
naturally into a set. This might, for example, yield the following sets:
Suppose we choose a student from the set X1 above, and then select, in the
same order as the sets above, a data item associated with that student from
each of the remaining sets. We end up with a 10-tuple (or just "a tuple") that
looks something like this:
Of course, for some applications not all items of data are relevant. We can, for
instance, restrict ourselves to forming tuples from the sets X1, X4 and X7, for
example (Mary Wright, FEMALE, 113).
The relations that we form depend on the applications we have in mind for the
data. But the point is that by forming appropriate n-ary relations, we can
organise the storage of information in a computer in such a way that the data
is easily accessible, the storage space is efficiently utilised, and the data can
easily be modified. This approach to database organisation is called the
relational database model. This will be discussed further in the modules on
databases.
97
Study unit 6 Special kinds of relation COS1501/1
6.5 Functions
A relation from X to Y can be functional. What does this term mean?
We can say that a relation is functional iff each first co-ordinate lives with only
one second co-ordinate in an ordered pair of the relation. Let’s look at some
examples.
Examples
Suppose S is a relation from {1, 2, 3} to {a, b, c}, then S = { (1, a), (2, c) } is
functional. We can claim this because 1 and 2 are members of {1, 2, 3}, and
each one of the elements 1 and 2 appears as first co-ordinate in exactly one
pair of S.
We have shown that each first co-ordinate lives with only one special second
co-ordinate in an ordered pair of R.
This brings us to a very important point in this study unit, namely the concept
of a function. A function is a special kind of relation.
98
Study unit 6 Special kinds of relation COS1501/1
Definition: Function
Suppose R ⊆ A × B is a binary relation (i.e. it involves two sets) from a set A to
a set B. We may call R a function from A to B if every element of A appears
exactly once as the first co-ordinate of an ordered pair in R (i.e. f is functional),
and the domain of R is exactly the set A, i.e. dom(R) = A.
This function is denoted by R: A → B, i.e. R is a function from A to B.
Examples
Suppose S = {(1, c)} is a relation from A = {1, 3} to B = {a, c}, then S is
functional but it is not a function since dom(S) ≠ {1, 3}.
Dom(R)
= {x | for some y ∈ Z, (x, y) ∈ R}
= {x | for some y ∈ Z, y = x + 5}
= {x | x + 5 is an integer} (y ∈ Z and y = x + 5, thus (x + 5) ∈ Z.)
= Z.
R is functional and dom(R) = Z, thus R is a function. We may write R: Z → Z.
Note: If it must be proved that the relation R in the above example is a function, then a
general statement such as “every element of Z appears exactly once as the first co-
ordinate of an ordered pair in R, and the domain of R is exactly the set Z” does not
constitute a proof. Rather: It should be proved that R is functional and dom(R) should
be determined (by using the definition of “domain”) to prove that dom(R) = A.
We usually give relations names such as R or S, but because functions are so important,
we usually denote these as f, g or h, and so on. We use the notation f: X → Y to indicate
that f is a function from X to Y.
The equation f(a) = b means, of course, that f(a) is an alternative name we may
use for that particular b which stands next to a in the ordered pair.
The usefulness of functions is based on the fact that we can think of a function as a rule
that tells us how to get from A to B – if you're at the point a ∈ A, go to f(a) ∈ B. This
works only because we are never uncertain about where to go – for each a ∈ A there is
only one f(a) ∈ B, since “a” appears as first co-ordinate in only one ordered pair of f. Can
you spot the application of this reasoning in the following function g?
Let A = {Mary, Thabo, Shawren} and B = {Memel, Polokwane, Durban, Ibhayi} and let
g = {(Mary, Memel), (Thabo, Ibhayi), (Shawren, Durban)} be a function from A to B such
that a person and the city where he/she resides are grouped together in an ordered pair.
99
Study unit 6 Special kinds of relation COS1501/1
Note: Vague explanations will not do, so formal proofs should be provided.
We note that for every element x in A, there is exactly one element y in B such
that (x, y)∈ f. This means that dom(f) must be equal to A, i.e. each domain
element must appear exactly once as first co-ordinate, and that ran(f) ⊆ B.
To illustrate: Let S = {(1, a), (1, c)} be the relation from X to Y where
X = {1, 2, 3} and Y = {a, b, c}. It is clear that 1 is the only element in X that
appears as first co-ordinate in ordered pairs of S (each element in X does not
appear as first co-ordinate, i.e. dom(S) ≠ X). It is also the case that 1 appears as
first co-ordinate in more than one ordered pair, so 1 is related to more than
one element in the codomain (so S is not functional). dom(S) ≠ X and S is not
functional, thus S is not a function.
Example
Let S = {(4, a), (5, b), (6, a)} be a relation from X to Y with X = {4, 5, 6} and
Y = {a, b, c}.
S is functional:
If (x, y) ∈ S and (x, z) ∈ S, then
either x = 4 with y = a = z, or x = 5 with y = b = z, or x = 6 with y = a = z.
This means that for every x ∈ X, there is exactly one element y ∈ Y such that
(x, y) ∈ S.
100
Study unit 6 Special kinds of relation COS1501/1
On the other hand, S-1 = {(a, 4), (b, 5), (a, 6)} is not functional, because it is
possible to find pairs (x, y) ∈ S-1 and (x, z) ∈ S-1 such that y ≠ z, namely the
pairs with x = a, y = 4 and z = 6.
More examples
We look at some examples of functions that arise in Computing:
In C++ a function called trunc, the truncation function, are often used and it is a
function from R to Z which transforms a real number into an integer by
deleting any fractional part, e.g. trunc (3.78) = 3, trunc (5) = 5,
trunc (−7.22) = −7.
SOMETHING FOOLISH THAT MIGHT HELP YOU REMEMBER THE BASIC IDEA: Think of a
function f: A → B as a monster that eats little woolly a-nimals that live in A and spits out
each little woolly animal's b-ackbone to be b-uried in B.
Another example
Prove that f defined by (x, y) ∈ f iff y = 5x2 + 3 is a function on R.
Dom(f)
= {x | for some y ∈ R, (x, y) ∈ f}
= {x | for some y ∈ R, y = 5x2 + 3}
= {x | 5x2 + 3 is a real number}
= R.
We can now say that f is a function because we proved that f is functional and
that dom(f) = R.
101
Study unit 6 Special kinds of relation COS1501/1
5. Consider the set Ƥ (A) = {0/ , {a}, {b} , {c} , {a, b} , {a, c} , {b, c} , {a, b, c}}.
Show that the relations f, g, and h described below are functional and
have as domains Ƥ (A), Ƥ (A) × Ƥ (A), and Ƥ (A) × Ƥ (A) respectively:
(a) Let f = {(x, y) | x, y ∈Ƥ (A) and y = x′}.
(b) Let g = {((u, v), y) | (u, v) ∈Ƥ (A) × Ƥ (A) and y = u ∪ v}.
(c) Let h = {((u, v), y) | (u, v) ∈Ƥ (A) × Ƥ (A) and y = u ∩ v}.
7. Is the relation R on Z+, which consists of all pairs (x, y) such that
y = x − 1, a function from Z+ to Z+?
In this study unit you ensured that you can answer the following questions on
special kinds of relation:
In the following study unit we will learn more about the properties of
functions.
102
Study unit 7 More about functions COS1501/1
103
Study unit 7 More about functions COS1501/1
It's rather like having a set A of factories, a set B of markets, and a set f of
roads connecting each factory in A with one of the markets in B. (In other
words, f is a function from A to B and we interpret each ordered pair in f as
saying “There is a road from my first co-ordinate to my second co-ordinate”.)
Because f is a function, every factory in A is connected to a market in B by only
one road. It is important to know whether all the markets in B can be reached.
Does this definition remind you of the definition of the range of a relation that was
provided in the previous study unit? If f is a function on A, the sets {f(x) | x ∈ A} and
{y | for some x ∈ A, (x, y) ∈ f } both defines ran(f).
Examples
Suppose A = {1, 2, 3} and B = {5, 7, 9} and h: A → B is the function defined by
the following: h(1) = 5, h(2) = 5 and h(3) = 7.
Then ran(h) = {5, 7}. If 1, 2 and 3 represent factories and 5, 7 and 9 represent
markets, then the fact that ran(h) is not equal to codomain B means that not
all the markets can be reached using the roads in h.
If, for some reason, we want to prove that ran(f) ≠ Z, we can provide a
counterexample: Choose y = 3, then there is no x ∈ Z such that 2x = 3
(i.e. x = 3/2 ∉ Z) and so 3 ∉ ran(g). Thus ran(g) ≠ Z.
104
Study unit 7 More about functions COS1501/1
ran(g) = {g(x) | x ∈ Z}
= {x + 5 | x ∈ Z}
= {y | y − 5 is an integer} (y = x + 5, i.e. x = y − 5)
=Z
Definition: Surjectivity
Given a function f: A → B, we say that f: A → B is surjective iff the range of f is
equal to the codomain of f, i.e. f[A] = B.
For equality, we also require that B ⊆ f[A]. So f: A → B is surjective iff for every
b ∈ B, we can find some a ∈ A such that b = f(a).
People often say f maps onto B when they want to explain what it means when
a function is surjective.
Define f: A → B by
f(1) = 5, f(2) = 5, and f(3) = 7, then
f is the function {(1, 5), (2, 5), (3, 7)}.
Note: The range of f, i.e. f[A], is the set {5, 7} - one cannot merely give 5, 7 as
the range.
105
Study unit 7 More about functions COS1501/1
(a) Determine f[Z] (or ran(f)). (Do not give specific examples of elements in
f[Z].)
(b) Is f surjective? If f is not surjective, provide a counterexample to show
why it is not surjective.
(a) Determine g[Z] (or ran(g)). (Do not give specific examples.)
(b) Is g surjective? If g is not surjective, provide a counterexample to show
why it is not surjective.
Suppose a company buys 5 new word processor packages. Nine typists are
hoping to obtain one of the new word processor packages.
Suppose one of the typists is the favourite of the company director. Would it
be a good idea for him to give her two of the word processors? I doubt it. Some
unlucky typist who didn't get a word processor would be most upset. We see
that it is important for f to map different word processors to different typists.
Another way to think of it is that each typist should get at most one word
processor.
Definition: Injectivity
A function f: A → B is injective iff f has the property that
whenever f(a1) = f(a2) then a1 = a2.
What would the formal version of this reasoning look like? If a typist gets a word
processor, then the typist can be called f(a1), where a1 is the word processor she gets. To
make sure that she gets no more than a single word processor, we could require that
whenever f(a1) = f(a2) then a1 = a2, i.e. whenever a typist receives word processors a1 and
a2, then it should be the case that a1 and a2 represent the same word processor.
Alternative definition:
A function f: A → B is injective iff f has the property that
whenever a1 ≠ a2 then f(a1) ≠ f(a2).
The definition captures the idea that different word processors must go to
different typists. Instead, we could have captured the idea that each typist
should get at most one word processor.
106
Study unit 7 More about functions COS1501/1
In the part on logic that follows in a later study unit, we will show you that the following
two conditions:
are equivalent, since the one is what we call the contrapositive of the other.
Instead of using the term “injective”, people often say a function f is one-to-one.
Examples
Let A = {1, 2, 3} and B = {6, 7, 8}.
Therefore f is injective.
107
Study unit 7 More about functions COS1501/1
Examples
We look at some diagrams that show different correspondences:
(a) a function (e) neither surjective, (f) injective,
(b) not a function (c) surjective, (d) injective,
nor injective and surjective
1 not injective not surjective
w° ° 1 1 °
w °
1
w° ° ° w °
2 w °
w ° 2 2
x° ° 2 2 2 x° ° x° °
x° ° x° ° x° °
3 3 3
y° ° 3 3 3 y° °
y° °
y° ° °
4 y° y° ° 4 4
z° ° 4 4 4 z° ° z° °
° °
z° °
Let's forget about functions for a moment and recap some definitions that are
closely related to what we discuss in this section. So we have a little bit of
repetition here.
In study unit 5 we have already seen that there is an important way to build a
new relation from R and S, called forming the composition of R followed by S.
This new relation is denoted by S ○ R (pronounced S little circle R) or we can
write R; S. According to the convention, although it is the composition of R
followed by S, we write down S ○ R, i.e. we write down S first (i.e. on the left)
and then R. (Remember, by using the notation R; S rather than S ○ R, it helps
us to remember that R is followed by S.)
What exactly is S ○ R?
It is worth spending some time thinking about this definition. If x is a first co-ordinate in
some pair of S ○ R, is it clear to you that x must be a member of A? We can say this
because if x appears as a first co-ordinate in S ○ R, then there has to be some b∈ B such
that (x, b)∈ R. Similarly, if y appears as a second co-ordinate in S ○ R then there has to be
some b ∈ B such that (b, y) ∈ S, which means that y must be a member of C. So the
definition ensures that S ○ R ⊆ A × C.
108
Study unit 7 More about functions COS1501/1
What is the intuitive idea behind the composition definition? Let’s think in terms of a
concrete example: Suppose A is a set of people who work in Johannesburg, but live in
Limpopo, and B is a set of busses taking people from Johannesburg to Polokwane. C is a
set of taxi services between Polokwane and other towns in Limpopo. Think of each
ordered pair (a, b) in R ⊆ A × B as representing the fact that “there is bus service for
person a to town b”. Suppose further that each ordered pair (b, c) in S ⊆ B × C represents
“there is a regular taxi service between b and c”. Then S ○ R consists of pairs (a, c) which
may be thought of as saying “there is an efficient transportation service for person a to
town c”.
A B C
y S
R z
S
v
x
R
S w
u
Examples
Suppose A = {1, 2, 3}, B = {4, 5} and C = {6, 7, 8, 9}.
Let R = { (1, 4), (1, 5), (3, 5) } and S = { (4, 7), (5, 8) }.
With the same sets A, B, and C, let f: A → B be { (1, 4), (2, 4), (3, 5) } and let
g: B → C be { (4, 7), (5, 9) }.
Did it surprise you to suddenly see functions popping up? But remember, functions are
relations with special properties!
The composition of relations is a pretty useful construction, but it becomes really special
when you apply it to functions. We'll see some of the uses later. First we must ask
ourselves some obvious questions.
What happens when we form the composition of two functions? Will the result
be a function?
109
Study unit 7 More about functions COS1501/1
That is, for each a ∈ A there exists just one c ∈ C such that (a, c) ∈ g ○ f.
Therefore we may write g ○ f: A → C
Theorem 7.1
The composition of two functions is also a function.
The composite function g ○ f is defined for all x for which f(x) and g(f(x)) exist.
Examples
Suppose f: Z → Z is defined by f(n) = 3n + 1 and
g: Z → Z is defined by g(n) = n3. We determine g ○ f:
g ○ f: Z → Z is defined by
(g ○ f)(n) = g( f(n) )
= g(3n + 1) (g(f(n)) = g(3n + 1), i.e f(n) is replaced by 3n+1)
= (3n + 1) 3 (g(n) = n3, thus g(3n + 1) = (3n + 1)3)
= (3n + 1)(3n + 1)2
= (3n + 1)(9n2 + 6n + 1)
= 27n3 + 18n2 + 3n + 9n2 + 6n + 1
= 27n3 + 27n2 + 9n + 1
110
Study unit 7 More about functions COS1501/1
g ○ f: R → R is defined by
(g ○ f)(x) = g( f(x) )
= g(2x) (g(f(x)) = g(2x), note that f(x) is replaced by 2x)
= 3(2x)2 + 5 (g(x) = 3x2 + 5, thus g(2x) = 3(2x)2 + 5)
= 3(4x2) + 5
= 12x2 + 5
Let’s investigate further: Suppose we start off with two surjective functions f: A → B and
g: B → C. Is the composition g ○ f: A → C by any chance surjective?
Yes! We mentioned above that the composition of functions is special. To check whether
g ○ f: A → C is surjective, one must check that every c ∈ C appears as second co-ordinate
in some pair in g ○ f, i.e. that for each c ∈ C there is some a ∈ A such that c = g(f(a)).
Is this reasonable? Well, pick any c ∈ C. Since g: B → C is surjective, we can find some
b ∈ B such that c = g(b). Now let's focus on that specific b. Since f: A → B is surjective, we
can find an a ∈ A such that b = f(a). But this means that there exists an a ∈ A such that
c = g( f(a) ), i.e. such that (a, c) ∈ g ○ f. Hence g ○ f: A → C is surjective.
Theorem 7.2
The composition of two surjective functions is surjective.
Well, suppose that inside C we find elements g( f(a1) ) and g( f(a2) ). Using only
the information we have about f and g, we need to show that
if g( f(a1) ) = g( f(a2) ), then a1 = a2.
But since we know that g is injective, it follows from g( f(a1) ) = g( f(a2) ) that
f(a1) = f(a2). (Remember that the injective function g spits out equal things
only if fed equal things).
And because we know that f is injective, it follows from f(a1) = f(a2) that a1 = a2.
Theorem 7.3
The composition of two injective functions is injective.
111
Study unit 7 More about functions COS1501/1
For example, if A = {1, 2, 3}, B = {5, 6, 7}, and R = { (1, 7), (3, 5) } then the new
relation R-1 (called the inverse relation of R) is the relation from B to A:
R-1 = { (7, 1), (5, 3) }.
Remark: For a real number x, the notation x -1 means 1/x. But if we apply the notation to
a relation R, then we must be careful not to read into the notation things that aren't
there. We have not defined anything of the form 1/R.
We will only be able to answer this question by using the following two
definitions and the theorem that follows from them:
This means that if a function f: A → B is invertible, then the inverse relation f-1
of f is a function from B to A, and if the inverse relation f-1 of f is a function
from B to A, then f is invertible.
112
Study unit 7 More about functions COS1501/1
Theorem 7.4
Let f: A → B be a function. Then f is invertible iff f is bijective.
Proof
Since we have an if and only if statement to prove, our argument will have to
run in two directions.
So the domain of f-1 is B. But the domain of f-1 is also the set of all y's such that
(x, y) ∈ f for some x, i.e. the domain of f-1 is just the range of f. So the range of f
is B, which means that f: A → B is surjective.
Thus if f(x1) = f(x2), then x1 = x2, which in turn tells us that f is injective.
Since the second co-ordinates of f-1 are clearly members of A, we may say that
f-1: B → A, i.e. f-1 is the inverse function from B to A.
Example
Let us again consider g: Z → Z defined by g(x) = x + 5. In this unit we have
proved that g is injective and surjective, i.e. g is a bijective function. Because g
is bijective, it is invertible (from Theorem 7.4), so by definition g-1 is a function
from Z to Z, i.e. g-1 is the inverse function from Z to Z. We determine the
inverse function g-1:
Before we close this discussion of functions and their properties, there is one important
function we need to introduce namely the identity function.
113
Study unit 7 More about functions COS1501/1
Since iB(x) = x for all x ∈ B, we have iB(1) = 1, iB(2) = 2, iB(3) = 3 and iB(4) = 4,
so iB = {(1, 1), (2, 2), (3, 3), (4, 4)}.
Can you see that “iB” is just another name for the equality relation usually
called “=”?
(a) X={0
/ , {113} } and Y = { {1} }.
(b) X={0
/ , {113} } and Y = { {1}, {2} }.
(c) X={0
/ , {113} } and Y = { {1}, {2}, {7} }
In this study unit you ensured that you can answer the following questions
regarding relations and functions:
In the following study unit we will learn more about some special operations
and their properties.
114
Study unit 8 Operations COS1501/1
Your map should include the concepts of finite and infinite sets, binary
operations, vectors, scalars, the vector sum and dot product of two vectors,
matrices, matrix addition and multiplication.
115
Study unit 8 Operations COS1501/1
This is like having a function which takes the ordered pair (A, B) as input and
delivers A ∪ B as output. What is the domain of this function? Well, if it eats
ordered pairs of subsets of U, then the domain must be the Cartesian product
Ƥ (U) × Ƥ (U). And since the function spits out subsets of U, a reasonable
choice for the codomain would be Ƥ (U). So if we give the function the name f,
we have the function
Example
Consider some universal set U = {a}, then Ƥ (U) = { 0
/ , {a} } and
Ƥ (U) × Ƥ (U) = { (0/, 0/), (0/, {a}), ({a}, 0/), ({a}, {a}) }.
If (0
/, 0 /∪0
/ ) is the input, then 0 /=0 / is the output, if (0
/, {a}) is the input, then
/ ∪ {a} = {a} is the output, the input ({a}, 0
0 / ) delivers {a}, and the input
({a}, {a}) delivers {a}.
In mathematics, we frequently find functions such as these, which “eat” pairs and “spit
out” single objects. So they deserve a special name. We call them binary operations. The
word “binary” (binary meaning two) reminds us that the inputs are ordered pairs.
Suppose that f is the name of some binary operation. The image of a pair (x, y)
can be given either in prefix notation, as f(x, y), or in infix notation, as x f y.
While infix notation probably looks odd to you, the interesting fact is that we
normally use it for binary operations such as the addition and multiplication
of real numbers.
Let’s think about addition. It is a way to combine two real numbers in order to
get a third. So addition is a function (that is traditionally called “+”) with R × R
as its domain and R as codomain,
i.e. +: R × R → R.
116
Study unit 8 Operations COS1501/1
⋅:R×R→R
Of course, the example with which we started, i.e. the binary operation
involving the formation of unions of sets, is usually written using infix
notation, so we write A ∪ B rather than ∪ (A, B).
The binary operations we have discussed so far have all been of the form g: A × A → A for
some set A. That is, the codomain and the relevant sets that were used to form the
Cartesian product have been equal. This is no coincidence. Binary operations are usually
supposed to take two animals of the same species and use them to produce another
animal of the same species.
When we have a binary operation of the form g: A × A → A we may say A is closed under
g, or g is a binary operation on A, to indicate that g spits out elements of A and not things
totally different from the animals living in A.
Quite often one is interested in binary operations on a finite set. We first look
at the concepts of finite and infinite sets.
Examples
We look at some examples to illustrate the concepts of finite and infinite sets:
A = {1, 2, 3, 4} = {x | 0 < x ≤ 4}
B = {2, 4, 6, 8, …, 16, 18} = {y | x ∈ Z+, y = 2x and y ≤ 18}
C = {1, 4, 9, 16, …} = {y2 | y ∈ Z+}
Sets such as A and B are finite sets. The cardinality of these sets are
respectively |A| = 4 and |B| = 9. (We can count the number of distinct elements
in these two sets.)
A very popular way to describe binary operations on finite sets is to use a table. The
operators “+”, “•” and “∧” in the following examples do not refer to addition,
multiplication and conjunction as we know it. The entries in the tables are not
determined by any logic calculation.
117
Study unit 8 Operations COS1501/1
Examples
1. Suppose A = {a, b, c, d}. Then we could define a binary operation (which
we shall call “+”) on A by providing the following table:
+ a b c d
a a b c d
b b c d a
c c d a b
d d a b c
How does one interpret such a table? The idea is that if we want to
know what “+” does to a pair such as (b, d) for example, then we look at
the row labelled b and the column labelled d, and the entry at the
intersection tells us what +(b, d) is. In this case +(b, d) = a.
Note: Here the symbol + does not stand for ordinary addition. We use
the symbol “+” to denote the function defined by the table. It need not
even be the case that a, b, c and d are numbers. When you work with a
binary operation, you have to make a deliberate effort to forget that
ordinary addition on R is also called +.
2. Let us define a different binary operation on the set A = {a, b, c, d}. Let’s
use “•” to represent the new operation, and let us call it the dot
operation:
• a b c d
a a b c d
b b a d c
c c d a b
d d c b a
Note: Here the symbol • is not being used to denote the ordinary
multiplication of real numbers.
∇ T F
T T T
F F T
118
Study unit 8 Operations COS1501/1
* 1 2
1 1 2
2 2 1
Refer to the table provided in the above example, then it is clear that * is
commutative:
1 * 1 = 1 * 1 = 1,
1 * 2 = 2 * 1 = 2, and
2 * 2 = 2 * 2 = 1.
We can also observe from the table that * is commutative, because there is
symmetry about the diagonal from the top left to the bottom right corners
of the table.
(1 * 1) * 1 = 1 * 1 = 1 and 1 * (1 * 1) = 1 * 1 = 1,
(1 * 1) * 2 = 1 * 2 = 2 and 1 * (1 * 2) = 1 * 2 = 2,
(1 * 2) * 1 = 2 * 1 = 2 and 1 * (2 * 1) = 1 * 2 = 2
(1 * 2) * 2 = 2 * 2 = 1 and 1 * (2 * 2) = 1 * 1 = 1,
(2 * 2) * 1 = 1 * 1 = 1 and 2 * (2 * 1) = 2 * 2 = 1,
(2 * 2) * 2 = 1 * 2 = 2 and 2 * (2 * 2) = 2 * 1 = 2,
(2 * 1) * 1 = 2 * 1 = 2 and 2 * (1 * 1) = 2 * 1 = 2, and
(2 * 1) * 2 = 2 * 2 = 1 and 2 * (1 * 2) = 2 * 2 = 1.
1 * 1 = 1 * 1 = 1 and
1 * 2 = 2 * 1 = 2.
Another example
Suppose we want to construct a binary operation on the set A = {a, b, c}.
Construct a table with columns and rows labelled with the elements of A and
put the symbol you want to use for the operation in the upper left-hand
corner:
□ a b c
a
b
c
Now simply fill in the spaces where the rows and columns intersect with
elements of A according to taste, for example:
□ a b c
a b c a
b c a b
c a b c
As you can see, we need to use a brute force approach in order to determine
whether □ is commutative, so we consider all possible cases:
120
Study unit 8 Operations COS1501/1
By looking at the table which defines the operation, one can also see that □ is
commutative: Draw a diagonal line from the top leftmost corner to the bottom rightmost
corner of the table. Then it is clear that you have mirror images of the two triangles.
Case (x □ y) □ z x □ (y □ z)
x = a, y = a, z = a (a □ a) □ a = b □ a = c a □ (a □ a) = a □ b = c
x = a, y = a, z = b (a □ a) □ b = b □ b = a a □ (a □ b) = a □ c = a
x = a, y = a, z = c (a □ a) □ c = b □ c = b a □ (a □ c) = a □ a = b
x = a, y = b, z = a (a □ b) □ a = c □ a = a a □ (b □ a) = a □ c = a
x = a, y = b, z = b (a □ b) □ b = c □ b = b a □ (b □ b) = a □ a = b, …
And so one can go on to inspect all the combinations of x, y and z to see that
(x □ y) □ z = x □ (y □ z) in all the different cases. This means that □ is
associative.
We first look at the number set Z. In the set Z, 0 is an additive identity (i.e.
m + 0 = m = 0 + m for all m ∈ Z) and 1 is a multiplicative identity (i.e.
m⋅1 = m = 1⋅m for all m ∈ Z). So 0 is the identity element with respect to
+: Z × Z → Z and 1 is the identity element with respect to ⋅ : Z × Z → Z.
Well, if we inspect the table describing □, we can see similar orderings of the
variables (a, b and c) in the top row and the row labelled c:
□ a b c
a b c a
b c a b
c a b c
We can also see similar orderings of the variables in the left-most column and
the column labelled c:
□ a b c
a b c a
b c a b
c a b c
c□a = a □ c = a,
c□b = b □ c = b, and
c□c = c □ c = c.
3. Consider the dot operation, “•”, defined in Section 8.1. Let us compare
the dot operation on A = {a, b, c, d} with ordinary multiplication.
We have discussed only binary operations so far, i.e. functions of the form
f: A × A → A.
f: A → A (a unary operation)
g: A × A × A → A (a 3-ary, or ternary, operation)
h: A × A × A × A → A (a 4-ary, or quaternary, operation)
and so on.
The word vector, for our purposes, will be understood to mean an ordered
n-tuple of numbers.
Definition: Vector
A vector is represented by an n-tuple in the following way:
u = (u1, u2, ..., un) for some n ≥ 2.
122
Study unit 8 Operations COS1501/1
You have already encountered such specimens in study unit 5. In that unit, our
discussion of n-ary relations should have left you with the feeling that n-tuples
(or vectors as we call them in this unit) can be used to represent information.
What is new in this present discussion is the idea that there are useful ways to
combine old vectors in order to get new vectors.
Example
At the Benoni Institute of Technology, Professor Thaddeus Twiddle teaches a
course in Creative Television Repair. He has 43 students in his class.
During the year each student earns a year mark (out of a possible total of 100).
If the students are ordered alphabetically, the year marks can be represented
by a vector
In the final exam, each student earns an exam mark (again out of a possible
maximum of 100). The exam marks can be represented by a vector
If there were some kind of addition on vectors, he could first use it to combine
a and b. Then, if there were some sort of multiplication available, he could
multiply a + b by some factor to get a vector whose co-ordinates are the
percentages.
So, what we can do, is to define the product of the number ½ and the vector
(a + b) to be the new vector
123
Study unit 8 Operations COS1501/1
u + v = (u1, u2, ..., un) + (v1, v2, ..., vn) = (u1+ v1, u2+ v2,..., un+ vn).
Important terminology: The number r is often called a scalar, and the operation defined
above is then referred to as the multiplication of a vector by a scalar.
(a) 2u + v
(b) u − 3v
(c) −3(v + w)
So far we have defined a kind of addition for vectors, and a weird kind of multiplication
which combines vectors and things that aren't vectors (i.e. scalars) to produce a new
vector.
There is another kind of multiplication which is useful. It is called the dot product, and it
combines two vectors to obtain a scalar as the answer.
Of what use is the dot product? Well, suppose you want to buy groceries: a1
tins of beans, a2 tins of peas, and so on. The quantities you need to buy can be
124
Study unit 8 Operations COS1501/1
represented by the vector a = (a1, a2, ..., an). Now suppose that each tin of beans
costs b1 cents, each tin of peas costs b2 cents, and so on.
The total amount you spend can now be determined by taking the dot product
of a and b, since
(a) u⋅v
(b) v(2u)
Example
Suppose you are going shopping. You want to pop in at the bakery to buy 3
loaves of whole wheat bread and 1 fruit cake. Then you want to go to the local
grocer to get 2 of their whole wheat loaves and 5 of their cream cakes. One can
display this information in a table as follows:
Bakery Grocer
loaves 3 2
cakes 1 5
If one rewrites the table in a streamlined form, omitting the labels, one gets:
We call this a matrix, and the numbers inside the square brackets are called
the entries. Of course, one can replace the original table with the streamlined
version only if the context makes it clear what the various rows and columns
represent. In the example above, we need to agree that the first row will deal
with loaves, and the second row with cakes, while the first column will deal
with the bakery, and the second column with the grocer.
Remember that the term “matrix” carries the connotation that the positions of entries
are important. The plural of the word “matrix” is “matrices”, pronounced “maytrisseez”
and not “matresses”.
125
Study unit 8 Operations COS1501/1
A matrix, then, is an array of numbers organised into rows and columns and
enclosed within brackets. If there are m number of rows and n number of
columns, we speak of an m × n matrix (an "em-by-en" matrix, when you read it
out loud).
whereas is a 3 × 4 matrix.
a11 a ... a
12 1n
a 21 a 22
... a
2n
. . .
. . .
a m1 a m2
... a mn
where aij is the entry in the i-th row and j-th column of the above m × n matrix.
We can define a kind of addition for matrices which is pretty useful. Let's look
at an example.
represents our shopping plans for Monday, and that the following matrix
represents our shopping list for a later date:
That is, the first matrix (let's call it A) represents the table
Bakery Grocer
loaves 3 2
cakes 1 5
while the second matrix (let's call it B) is a streamlined version of the table
Bakery Grocer
loaves 4 1
cakes 4 2
126
Study unit 8 Operations COS1501/1
a21 a 22
... a2 n b21 b22 ... b 2n
Let A = . . . and B = . . .
. . . . . .
am1 a m2
... amn
bm1 bm 2 ... bmn
a11 + b a + b ... a + b
11 12 12 1n 1n
a 21 + b 21 a 22
+ b 22
... a 2n
+ b2n
C= . . .
. . .
a m1 + b m1 a m2
+ b m2
... a mn
+ bmn
One can only add matrices if they are of the same “size”.
(a) A= B=
(b) A= B=
(c) A= B=
(d) A= B=
Example
One can also multiply a matrix by a number to get a new matrix. For instance,
suppose our old friend
A=
represents our shopping list for a certain day and we discover that twice as
many guests than expected will be visiting. Since the demand for groceries has
doubled, we must use a revised shopping list in which each entry has been
multiplied by two:
2A =
a11 a ... a
12 1n
a21 a 22
... 2n a
A = . . .
. . .
am1 a m2
... amn
ra11 ra ...
ra
12 1n
ra 21 ra 22
... 2n ra
rA = . . .
. . .
ra m1 ra m2
... ra mn
−1 2 2
2 2 − 3 1 + 4 1
3 0 5
At this stage you might well ask “Is it possible to multiply matrices”? There is actually a
special kind of multiplication of matrices that resembles the dot product of vectors,
except that in the end we get a matrix, not a real number.
Example
Let A be the matrix [3 ½].
128
Study unit 8 Operations COS1501/1
Note that the answer is a matrix and therefore has square brackets around it. Of course,
a 1 × 1 matrix such as [5] is nothing other than a number, but we will shortly see
examples in which the answer is a bigger matrix.
First, let us remind ourselves why this sort of multiplication is useful. (At the same time,
we're really reminding ourselves why the dot product of vectors is useful.)
The local bakery produces three items, namely brown bread, white bread, and
raisin bread. The prices of these items are R7, R9, and R12 per loaf,
respectively. In a certain week the bakery sells 3000 loaves of brown bread,
4800 loaves of white bread and 937 loaves of raisin bread.
A = [7 9 12]
B=
AB = [7 9 12]
Note that the multiplication must match brown bread with brown bread, white bread
with white bread, and raisin bread with raisin bread.
To obtain the entries of the product, we multiply the rows of the left matrix by
the columns of the right matrix, taking care to arrange the products in a
specific way to yield a matrix. Start with the first (top) row on the left, [2 1],
and the first column on the right, .
129
Study unit 8 Operations COS1501/1
Their product is [2⋅1 + 1⋅4] = [6], so we enter 6 as the entry a11 of the
product:
Next, we obtain the product of the first row on the left and the second column
on the right, which is [2⋅1 + 1⋅2] = [4], so in the resulting product matrix we
have a12 = 4:
Now there are no more columns that can be multiplied by the first row, so we
move down to the second row and start the same process again using the first
column of the right-hand matrix:
We have now exhausted the second row on the left, so we shift our attention
to the third row. Of course, we also move down a row in the resulting product:
Now we have multiplied every row of the left matrix by every column of the
right matrix, so we can stop.
Our product is .
130
Study unit 8 Operations COS1501/1
a11: =
a12: =
a21: =
a22: =
Note that this method cannot always be used to compute AB. For the procedure to work,
a row in A must have as many entries as a column in B. So if we want to multiply A by B,
the sizes of A and of B must match up in a special way. We can form AB if A is m × n and B
is n × k. The product is an m × k matrix.
Schematically: A ⋅ B = C
m×n n×k m×k
(equal)
a11 a ... a
12 1n
a21 a 22
... 2n a
A = . . . and
. . .
am1 a m2
... amn
b11 b ... b
12 1k
b21 b 22
... b
2k
B = . . .
. . .
bn1 b n2
... bnk
then AB is the matrix C in which Cij is the dot product of the i-th row in A with
the j-th column in B, i.e.
131
Study unit 8 Operations COS1501/1
Example
As a last example before you tackle some exercises, let's look at the 2 x 2 zero
matrix. This is a matrix of which all the entries are zero:
Work it out step by step and test this for yourself. For instance, the product of
the first row of the zero matrix with the first column of the other matrix is
(0)(2) + (0)(1) = 0.
Can you see that the product of a zero matrix with any other appropriately
sized matrix will always be equal to a zero matrix?
This means that if we have an n × n matrix, and we calculate IA, the result is A.
Similarly, if we calculate AI, we get A. (I is also a n × n matrix.)
Example
Let A be the 2 × 2 matrix
1 5
3 2
1 0
Let’s try I =
0 1
Calculating AI and IA gives A, so I is an identity matrix.
1.
31 −3 2 0
2
5 1 1
3 0 0 5
2.
9 3 1 0
1
5 2 4
3 0 5 1
132
Study unit 8 Operations COS1501/1
3.
1 −3 2 0 −1 3
0
6 4 1 1/ 3 1
3 0 3 1 / 2 5 0
0 0
i. e. XY =
0 0
In this study unit you ensured that you can answer the following questions
regarding operations in general, and operations on vectors and matrices in
particular.
In the following study unit we will learn more about logic and how truth tables
are used in this field.
133
Study unit 8 Operations COS1501/1
NOTES
134
Study unit 9 Logic: Truth tables COS1501/1
135
Study unit 9 Logic: Truth tables COS1501/1
Well, like all scientists they're interested in discovering, as best they can, the
truth about things. But it is not good enough for them to establish the facts to
their own satisfaction; they also have to establish the facts to the satisfaction
of everybody else. So whenever a logician (or computer scientist!) makes a
claim, she/he has to be willing to justify it by presenting a convincing
argument in support of her/his claim. That is to say, he/she needs to provide a
proof.
"Is 3 an even integer?" (A question, asked in order to acquire information, not to convey
it.)
"Add 3 to 5!" (A command, given in order to induce certain behaviour, not to convey
information.)
"Inconceivable!" (An exclamation, uttered in order to give vent to some emotion, not to
convey information.)
Examples
"3 is an even integer" is false, because dividing 3 by 2 leaves a remainder of 1,
"The capital of France is Paris" is true, because Paris really is the capital of
France.
However the isolated statement "This sentence is false" has no truth value, i.e.
is neither true nor false.
136
Study unit 9 Logic: Truth tables COS1501/1
To see this, suppose the statement was true. If it is true, its description of the facts is
accurate. So the sentence is false. Similarly, if we begin by assuming the statement to be
false, we can reason quite logically to reach the conclusion that the sentence is true. But
since it makes no sense to say of a statement that it is both true and false, we conclude
that this particular statement is neither true nor false.
In proofs, we only use declarative statements that have a truth value of either
true or false.
• The examples we've seen so far are simple (or atomic) statements,
conveying just one (true or false) fact.
• Other statements are compound; they are built up by connecting simple
statements.
Example
" > 1 and < 2 " is a compound declarative statement which is clearly
either true or false (and, in fact, is true). It is a compound statement, because it
is built up by connecting the two simple statements " > 1 " and " <2"
with the word "and".
is true precisely because both of the simple statements from which it is built
up are true.
Let’s take the statement " > 1 and < 2 " as an example:
and ∧ conjunction
or ∨ disjunction
if ..., then ... → the conditional (also
referred to as implication)
if and only if ↔ the biconditional
it is not the case that ¬ negation
137
Study unit 9 Logic: Truth tables COS1501/1
Definition: Conjunction
If p and q represent statements, then p ∧ q represents the statement “p and q”,
and is called the conjunction of p and q.
Example
Let p represent “All rational numbers are repeating decimals” and let q
represent “All irrational numbers are non-repeating decimals”. Then p ∧ q
represents “All rational numbers are repeating decimals and all irrational
numbers are non-repeating decimals”.
Conjunction: Let us analyse the way in which the truth values of the component
statements p and q determine the truth value of the compound statement p ∧ q. The
following example will assist us.
The first compound statement is true (T) since both component statements are true. Each
of the compound statements (b) to (d) is false (F), because each has at least one
component statement that is false.
This leads us to summarise in tabular form the rule that p ∧ q is true if p and q are both
true, but false otherwise.
p q p∧q
T T T
T F F
F T F
F F F
Later in this study unit we will see how a truth table for more than two
statements can be compiled.
In English there are different ways in which to say the same thing. For instance, the
statement “Rationals are repeating decimals and irrationals are non-repeating decimals”
conveys the same information as “Rationals are repeating decimals, but irrationals are
non-repeating decimals”. Perhaps “but” also gives a feeling of opposing things being
compared, but (!) for the purposes of logic we ignore vague statements (or statements
that are ambiguous) and formalise statements of the form “p but q” as “p and q”, that is,
“p ∧ q”.
138
Study unit 9 Logic: Truth tables COS1501/1
Definition: Disjunction
If p and q represent statements, then p ∨ q represents the statement “p or q”,
and is called the disjunction of p and q.
Example
Let p represent “113 divides 17 304 without a remainder” and let q represent
“113 leaves a remainder of 2 when divided into 17 304”. Then p ∨ q
represents “113 divides 17 304 without a remainder or 113 leaves a
remainder of 2 when divided into 17 304”.
Disjunction: The basic idea behind disjunctions is that we want p ∨ q to stand for “either
p, or q, or both”. For reasons of brevity we write “either ... or ... or both” simply as “or”.
Now consider the example below.
The first three compound statements are true, because in each case either the first or the
second or both component statements are true. The last compound statement is false,
because both component statements are false.
We summarise in tabular form the rule that p ∨ q is true if at least one of p and q is true –
otherwise it is false.
p q p∨q
T T T
T F T
F T T
F F F
The word “or” is used in two different ways in an ordinary English conversation. Some-
times it means “either ... or ... but not both”, which is called the exclusive sense of “or”.
Sometimes it means “either ... or ... or both”, which is called the inclusive sense of “or”. We
use only the inclusive “or” when we write “∨”. The reason is that we shall be able to
express statements of the form “p or q, but not both” in terms of conjunctions,
disjunctions, and negations.
Definition: Conditional
If p and q represent statements, then p → q represents the statement “If p,
then q”, and we may describe p → q as a conditional statement with hypothesis
p and conclusion q.
Example
Let p represent “ has a non-repeating decimal expansion”, and let
q represent “ is irrational”. Then p → q represents
“If has a non-repeating decimal expansion, then is irrational”.
139
Study unit 9 Logic: Truth tables COS1501/1
p q p→q
T T T
T F F
F T T
F F T
We see that the first row of the truth table corresponds to the case in which
they do go to town (since p is true) and she does get her ice-cream (q is true).
Then the promise is fulfilled, so p → q ought to be true.
The third and fourth rows both correspond to situations in which they do not
go to town. Whatever else may happen, i.e. whether or not the daughter gets
an ice-cream, the father did not break his promise and so p → q ought not to
be false, i.e. it must be regarded as being true.
In p → q, p is often referred to as the antecedent (which means “an event that happens
before another”) and q as the consequent.
There are many ways to express p → q in English. Some are listed below. Remember, each
statement below really means “If p, then q”, i.e. p → q.
• p implies q
• p only if q
• q is a necessary condition for p
• p is a sufficient condition for q
• q if p
• q provided that p
• q whenever p
140
Study unit 9 Logic: Truth tables COS1501/1
You might require a slightly more mathematical motivation for the truth table of p → q.
Think of it this way: If q is true, then q is true regardless of whether anything else is true
or false. That is, “If p then 1 = 1” is true for any statement p, whether p is true or false,
because 1 = 1. So we give the conditional → the value T in rows one and three in its truth
table.
As for row four, which involves the falsity of both antecedent and consequent, consider a
statement such as “If 1 = 2 then 3 = 4”. This statement deserves to be regarded as true,
because if we assume that 1 = 2, then we can prove that 3 = 4:
Assume 1 = 2.
Add 2 to each side of the equation then 3 = 4.
Definition: Biconditional
If p and q represent statements, then p ↔ q represents the statement “p if and
only if q” which, as we saw in earlier study units, can be written as “p iff q”.
This is referred to as the biconditional.
Example
Let p represent “ + 1 has a non-repeating decimal expansion” and q
represent “ + 1 is irrational”. Then p ↔ q represents “ + 1 has a non-
repeating decimal expansion iff + 1 is irrational”.
Biconditional: What is the basic idea behind biconditional statements? Well, as a first
approximation think of p ↔ q as p and q saying the same thing in different words. Then
clearly the only circumstance under which p ↔ q really must be false is when p and q
have opposite truth values. The truth table below summarises this idea:
p q p↔q
T T T
T F F
F T F
F F T
There are many ways to express p ↔ q in English. Remember that each of the following
really means “p iff q”.
Definition: Negation
If p represents some statement, then ¬p represents the statement “It is not the
case that p”, or more briefly “not p”. This is called the negation of a given
statement.
141
Study unit 9 Logic: Truth tables COS1501/1
Example
Let p represent “ is irrational”. Then ¬ p represents “It is not the case that
is irrational” which could be rewritten as “ is not irrational”.
Clearly the statements p and ¬ p must always have opposite truth values. This
leads to the following truth table:
p ¬p
T F
F T
Negation is different from the other connectives (such as conjunction) because it doesn't
actually connect two statements. However, it is an important way to build compound
statements from simple statements.
English can be confusing where negations are involved. For instance, the negation of “I
like Brazilian jazz” is “It is not the case that I like Brazilian jazz”. Usually we say this
more briefly as “I do not like Brazilian jazz”. The danger is that we might think that this
is the same as “I dislike Brazilian jazz”. Of course it isn't. Someone who has no particular
preference in this regard may feel completely neutral about Brazilian jazz music and
may say “I do not like Brazilian jazz” without meaning “I dislike Brazilian jazz”. It is to
avoid this sort of confusion that we make a point of putting the “not” in front of the state-
ment, at least until we feel confident. After all, it is not quite so easy to slide from “It is not
the case that I like Brazilian jazz” to “I dislike Brazilian jazz”.
What have we done so far? We have constructed the fundamental truth tables
for conjunctions, disjunctions, conditionals, biconditionals, and negations.
This enables us to take any compound statement (which is, after all, built up
from simple statements by means of the connectives) and construct a truth
table for it. Such a truth table then displays the way in which the truth values
of the simple statements determine the truth value of the whole statement.
Before we discuss the truth table procedure in general, consider the following
two illustrative examples.
Example
We construct a truth table for p ∧ (¬ q) in a number of steps.
p q
142
Study unit 9 Logic: Truth tables COS1501/1
Step 2: Each simple statement has one of two possible truth values – either T
or F. So there are four possible combinations of truth values to be entered in
successive rows:
p q
T T
T F
F T
F F
p q ¬q
T T F
T F T
F T F
F F T
(Here we have used our knowledge of the truth table for negation, which tells
us that when q is T then ¬ q is F and vice versa.)
p q ¬q p ∧ (¬ q)
T T F F
T F T T
F T F F
F F T F
How exactly do we use our knowledge of conjunction here? Well, take row 1.
We see that columns 1 and 3 give the truth values T and F for p and ¬ q
respectively. By looking again at the following truth table for conjunction, we
see that the combination T and F appears in row 2 and we see that the truth
value for p ∧ q is F:
p q p∧q
T T T
T F F
F T F
F F F
By the above reasoning it tells us that p ∧ (¬ q) has the truth value F because
the truth value for p is T and the truth value for ¬ q is F. So we enter F in row
1 in the fourth column that represents p ∧ (¬ q) in the given table.
143
Study unit 9 Logic: Truth tables COS1501/1
There are eight possible combinations of truth values for the simple
declarative statements p, q and r. Hence our truth table has eight rows. The
fourth column contains the truth values of the negation of p. The fifth column
contains the truth values of the conjunction of q and r. The sixth column
contains the truth values of the conditional statement ¬ p → (q ∧ r) Finally the
seventh column contains the truth values of the disjunction of [¬ p → (q ∧ r)]
with r.
p q r ¬p (q ∧ r) [¬ p → (q ∧ r)] [¬ p → (q ∧ r)] ∨ r
T T T F T T T
T T F F F T T
T F T F F T T
T F F F F T T
F T T T T T T
F T F T F F F
F F T T F F T
F F F T F F F
Suppose we want to construct a truth table for a compound statement built up from n
simple declarative statements. There will be 2n rows in such a table. In the above activity,
n = 3, thus we have 23 = 8 rows.
To determine the columns, we begin by listing the simple statements. Then we fill up
these n columns as follows:
In the first column, enter T in the first half of the rows and F in the second half.
In the second column, for the rows which have T in the first column, enter T in the upper
half and F in the lower half. Then do the same for the rows which have F in the first
column.
Continue until, in the n-th column, T and F alternate. In the above activity, T and F
alternate in the third column.
We then form columns for each statement we have built up, and which forms part of the
compound statement that we're interested in. For instance, when we constructed the
truth table for p ∧ ¬ q we had a column for ¬ q since it is a statement built up along the
way to building p ∧ ¬ q. Fill in such columns by consulting the truth table of the relevant
connective given previously.
The last column represents the compound statement we are interested in.
144
Study unit 9 Logic: Truth tables COS1501/1
Sometimes a compound statement is always true. For example, the truth table
for p ∨ ¬ p shows that this statement is always true:
p ¬p p∨ ¬p
T F T
F T T
Definition: Tautology
Some compound statements are always true. Such a statement is called a
tautology.
On the other hand, some compound statements are always false. For example,
the truth table for p ∧ ¬ p shows that this statement is always false:
p ¬p p ∧¬p
T F F
F T F
Definition: Contradiction
Some compound statements are always false. Such a statement is called a
contradiction.
145
Study unit 9 Logic: Truth tables COS1501/1
If demand has remained constant and prices have been increased, then
turnover must have decreased.
Use p for “demand has remained constant”, q for “prices have been
increased” and r for “turnover must have decreased”.
2. Refer to Activity 9-5, Question 2. From the truth tables you have
constructed for (a) to (g), determine whether each of the statements is a
tautology, a contradiction or neither of the two.
Suppose that a and b are statements, and not necessarily simple ones. Then we can use
the concept of tautology to spell out the idea that a and b have the same meaning or that
a and b say the same thing in different words.
Recall that a ↔ b has the value T if and only if a and b have the same truth
value. So, to check that a ↔ b is always T, it is enough to check that the final
columns in the truth tables of a and b are identical.
Example
Let’s look at the truth table for (p → q) ↔ (¬ q → ¬ p):
p q ¬q ¬p p→q ¬q→¬p (p → q) ↔ (¬ q → ¬ p)
T T F F T T T
T F T F F F T
F T F T T T T
F F T T T T T
Because there are only T’s in the final column, it follows that
(p → q) ↔ (¬ q → ¬ p) is a tautology.
146
Study unit 9 Logic: Truth tables COS1501/1
(a) p∨q≡q∨p
p∧q≡q∧p (commutative laws)
(b) p ∨ (q ∨ r) ≡ (p ∨ q)∨ r
p ∧ (q ∧ r) ≡ (p ∧ q) ∧ r (associative laws)
(c) p ∧ (q ∨ r) ≡ (p ∧ q) ∨ (p ∧ r)
p ∨ (q ∧ r) ≡ (p ∨ q) ∧ (p ∨ r) (distributive laws)
(d) p∨p≡p
p∧p≡p (idempotent laws)
(f) ¬ (p ∨ q) ≡ ¬ p ∧ ¬ q
¬ (p ∧ q) ≡ ¬ p ∨ ¬ q (De Morgan’s laws)
(h) ¬ FO ≡ TO
¬ TO ≡ F0 (negations of TO and F0)
(i) p ∨ FO ≡ p
p ∧ TO ≡ p (identity)
(j) p ∨ TO ≡ TO
p ∧ FO ≡ FO (universal bound)
(You can use truth tables to verify that these are indeed logical equivalences.)
Now that we have the notion of logical equivalence, we can derive a rather surprising
result: We only require negation plus the connectives ∧ and ∨ !
which means that we can always work with the latter rather than use ↔. Then we show
that
p → q is logically equivalent to ¬ p ∨ q,
147
Study unit 9 Logic: Truth tables COS1501/1
Examples
Here we have used a single truth table to show that the truth tables of
(p → q) ∧ (q → p) and of p ↔ q are identical. Writing out two truth tables
would have involved some tedious repetition.
p q ¬p ¬p∨q p→q
T T F T T
T F F F F
F T T T T
F F T T T
Again we use a single truth table in which the last two columns are identical,
rather than write out two separate truth tables.
5. Use the law of double negation and De Morgan’s laws to rewrite the
following statements so that the not symbol (¬) does not appear outside
parentheses.
148
Study unit 9 Logic: Truth tables COS1501/1
In this study unit you ensured that you can answer the following questions
regarding logical connectives and truth tables:
In the next unit, we look at quantifiers, some basics for predicate logic are
introduced, and we look at different proof strategies.
NOTES
149
Study unit 9 Logic: Truth tables COS1501/1
NOTES
150
Study unit 10 Logic: Quantifiers, predicates, and proof strategies COS1501/1
151
Study unit 10 Logic: Quantifiers, predicates, and proof strategies COS1501/1
The great logician Alfred Tarski gives a striking example of how useful
variables can be in shortening what we want to say. Consider the arithmetic
fact that:
Without the use of variables, the same information would be conveyed more clumsily as
follows: The difference of the third powers of any two real numbers is equal to the
product of the difference of these numbers and a sum of three terms, the first of which is
the square of the first number, the second the product of the two numbers, and the third
the square of the second number.
Is this statement true or false? How can we decide if we don't know what x is?
There are two ways to change “x is an even integer” into a statement that has a
truth value.
The first way is to replace the variable x with the name of some specific thing.
For example, we may substitute for x to get the statement
This is the kind of process we're involved in when we solve equations: to solve
2x = 6 means to find all objects which, when their names are substituted for x,
give a true statement.
The second way is to quantify. One can use either universal or existential
quantifiers.
∀ x ∈ Z …, or
∀ x ∈ {1, 2, 3} … respectively.
152
Study unit 10 Logic: Quantifiers, predicates, and proof strategies COS1501/1
“∀ x ∈ R, x is an even integer”,
153
Study unit 10 Logic: Quantifiers, predicates, and proof strategies COS1501/1
Examples
We write down the English equivalences of some statements:
The statement “∃ x ∈ Z+, x > 3” tells us that “there exists some positive integer
that is greater than 3”. (This statement is true.)
(a) ∃ y ∈ Q, y =
(b) ∀ x ∈ R, 2x < x2
(c) ∀ x ∈ Z, x > 0
(d) ∃ x ∈ Z+, x = 0
When we think carefully about it, we see that universal quantification can be
regarded as a generalisation of conjunction.
Each one of the component statements (1 > ), (2 > ) and (3 > )is either
true or false. The compound statement (1 > ) ∧ (2 > ) ∧ (3 > ), by the
way, is false. This will be investigated later in this study unit.
The usefulness of quantification arises from the fact that the set A over which
we quantify need not be finite. That is, we can say things such as
∀ x ∈ Z, x2 ≥ 0
which could not be said with the aid of conjunctions alone, because we would
never finish saying
(02 ≥ 0) ∧ (12 ≥ 0) ∧ ((−1)2 ≥ 0) ∧ (22 ≥ 0) ∧ ((−2)2 ≥ 0) ∧ ...
154
Study unit 10 Logic: Quantifiers, predicates, and proof strategies COS1501/1
Similarly
∃ x ∈ Z, x > π
could not be said with the help of disjunctions alone, since we would be
unable to complete the infinitely long statement
But first we must answer the following question: How does one get “¬” inside
a quantified statement? After all, “¬” is something we usually put in front of a
statement. We first look at the influence “¬” has on compound declarative
statements.
Examples
Consider
∀ x ∈ {1, 2, 3}, x >
Negating gives ¬(∀ x ∈ {1, 2, 3}, x > ) which means the same as
which, as you know from the activities you have just completed, is logically
equivalent to
¬ (1 > ) ∨ ¬ (2 > ) ∨ ¬ (3 > )
i.e. (1 ≤ ∨ (2 ≤ ) ∨ (3 ≤ ).
155
Study unit 10 Logic: Quantifiers, predicates, and proof strategies COS1501/1
Note that we have simply used the fact that if x is not greater than y, then x is less than or
equal to y, for real numbers x and y.
But now (1 ≤ ∨ (2 ≤ ) ∨ (3 ≤ )
So we conclude that
In order to determine whether or not ∀ x ∈ {1, 2, 3}, x > is true, one can
determine whether
Since = 1.4142, we know 1 > is false, 2 > is true, and 3 > is true.
Alternatively, one could say that ∀ x ∈ {1, 2, 3}, x > is false since a
counterexample can be found, namely x = 1.
156
Study unit 10 Logic: Quantifiers, predicates, and proof strategies COS1501/1
We have seen that it can be determined whether a statement is true or false for some
quantified variables. For instance, in the previous example we determined whether the
statement “x > ” is true or false for each x ∈ {1, 2, 3}. We name such statements
“predicates”:
Definition: Predicate
A statement P(x) is called a predicate if it expresses some property of a
variable x ∈ A, and returns either true or false depending on the value of x.
P(x) is true for any variable x ∈ A that has the property, and P(x) is false if x
does not have the property.
For example, the statement “n is even” (with n ∈ Z), is a predicate that can be
written as P(n), such that P(n) is true for all even integers and P(n) is false for
all non-even (odd) integers. In this case, statements such as P(−2) and P(6) are
true, whereas P(−3) and P(7) are false.
Example
If P(x) is the predicate “x > ”, then
“∀ x ∈ {1, 2, 3}, x > ” can be written as
“∀ x ∈ {1, 2, 3}, P(x)”, and
We summarise the rules for writing the negation of a quantified statement in a useful
form (i.e. with the “not” taken as far inside the statement as possible):
Examples
Determine the negation of the quantified statement “∀ x ∈ A, P(x) ∨ Q(x)”.
¬ (∀ x ∈ A, P(x) ∨ Q(x))
≡ ∃ x ∈ A, ¬ (P(x) ∨ Q(x)) (from rule (a) above)
≡ ∃ x ∈ A, ¬ P(x) ∧ ¬ Q(x) (refer to Activity 10-5)
QED
157
Study unit 10 Logic: Quantifiers, predicates, and proof strategies COS1501/1
Another example:
Well, if y = 1, then
(y + 1> 0) means that (1 + 1> 0) i.e. (2 > 0), and
(y3 ≤ 1) means that (13 ≤ 1) i.e. (1 ≤ 1).
Example
Determine the negation of the statement
“∀ x ∈ Z+, (x ≤ 2) → (x2 + 2x > 1)”.
158
Study unit 10 Logic: Quantifiers, predicates, and proof strategies COS1501/1
There are a number of different proof strategies we can follow. In this study
unit we look at a direct proof, a proof by contradiction (reductio ad absurdum),
a proof by contrapositive and a vacuous proof.
When using this strategy, we start the proof by assuming the truth of p (the
“if” part of the statement), and then reason step by step until we can show that
q (the “then” part of the statement) is true.
How about an example? Well, there are plenty, but here is one that you haven't
encountered before.
Example
Prove that the following statement is true for all x ∈ R:
Remark: We in fact want to prove that the above holds for all real numbers x∈ R.
We start the proof by assuming that x2 – 4x + 3 < 0 (the “if” part of the
statement) is true.
Assume x2 – 4x + 3 < 0
i.e. (x – 3)(x – 1) < 0 (by factorisation)
then
(i) (x – 3) > 0 and (x – 1) < 0 (since a plus times a minus gives a minus)
i.e. x > 3 and x < 1, but this cannot be the case since there are no real numbers
that are simultaneously greater than 3 and less than 1.
OR
159
Study unit 10 Logic: Quantifiers, predicates, and proof strategies COS1501/1
(ii) (x – 3) < 0 and (x – 1) > 0 (since a minus times a plus gives a minus)
i.e. x < 3 and x > 1,
i.e. 1 < x < 3
so x > 0
which is what we had to prove.
Suppose we have to prove by contradiction that “if p then q”. The basic
principle we use in this strategy is to assume that p is true. At this point, we
have two possibilities – either q is false (the “bad” possibility) or q is true (the
“good” possibility). What we do now is to assume that q is false. By using step-
by-step reasoning we get a contradiction. This shows that q must be true.
Let’s illustrate this with the same example that we used when we applied the
direct proof.
Remark: We are going to start the same way as with the direct proof. Then, at the
strategic moment, we'll throw in the questionable assumption (the “bad” possibility).
We’ll show that it leads to a contradiction and will therefore conclude that the
questionable assumption was false.
Example
We start the proof by assuming that the antecedent is true:
Now we’ll prove that the “bad” possibility leads to a contradiction and then
deduce that the “good” possibility must be true.
However, this contradicts the initial assumption. Hence it cannot be the case
that x ≤ 0, and thus we conclude that our questionable assumption was
incorrect, and consequently it is true that x > 0.
Definition: Contrapositive
The contrapositive of p → q is ¬ q → ¬ p. In other words:
p → q is logically equivalent to ¬ q → ¬ p.
160
Study unit 10 Logic: Quantifiers, predicates, and proof strategies COS1501/1
Example
We want to prove that “if x2 − 4x + 3 < 0, then x > 0”.
x2 – 4x + 3 = (x – 3)(x – 1)
(x – 3) ≤ 0 and (x – 1) ≤ 0.
N.B.: Do not confuse the contrapositive of a statement with the converse, which is defined
as follows:
Definition: Converse
The converse of p → q is written as q → p.
161
Study unit 10 Logic: Quantifiers, predicates, and proof strategies COS1501/1
we cannot conclude
"If x2 > 0 then x ∈ Z +”, since x might have a value such as –113.
Similarly, from
for it may well have been a logician enraged by the confusion of converse and
contrapositive who battered the poor victim to a pulp with a truth table.
Example
“If f(x) = f(y), then x = y”
Truth tables cannot be used to prove any quantified statement where the
domain is infinite. What should we do when we have to prove a statement
such as “∀ x ∈ A, P(x)” where A is finite?
162
Study unit 10 Logic: Quantifiers, predicates, and proof strategies COS1501/1
Example
To prove ∀ x ∈ R, x2 + 1 > 0, we reason as follows:
If x ∈ R then
x2 ≥ 0
i.e. x2 + 1 ≥ 1
i.e. x2 + 1 > 0
In words this says: "If x is any real number, then x2 ≥ 0, i.e. x2 + 1 ≥ 1, which
means that x2 + 1 > 0.” The word "any" can be included, because x is a variable.
Our conclusion: Proving a statement of the form ∀ x ∈ A, P(x) offers no new problems.
We apply the knowledge we already have.
∀ x ∈ R, x2 – 4x + 3 ≥ 0,
we may decide after some thought that it is false. How do we prove that it is
false? Well, by proving that its negation is true.
The negation of
∀ x ∈ A, P(x)
is the statement
¬ (∀ x ∈ A, P(x)),
∃ x ∈ A, ¬ P(x) .
To disprove
∀ x ∈ R, x2 – 4x + 3 ≥ 0,
∃ x ∈ R, x2 – 4x + 3 < 0.
163
Study unit 10 Logic: Quantifiers, predicates, and proof strategies COS1501/1
Choose x = 3/2.
So we have shown that there exists some x (in this case x = 3/2) such that
x2 – 4x + 3 < 0.
Example
Suppose we want to prove that
/ ⊆ X.
0
Proof:
0
/ is an empty set,
so “x ∈ 0/ ” is false,
thus “if x ∈ 0 / then x ∈ X” is vacuously true.
QED
What does the last line in the proof say? We can refer to the truth table of the
conditional statement “if p then q” in the previous study unit. Whenever p is
false, we know that p → q is true, no matter whether q is true or false. In our
example “x ∈ 0 / ” is false, so no matter whether “x ∈ X” is true or false, we may
say that the statement “if x ∈ 0 / then x ∈ X” is vacuously true.
Example
Let S be a relation on {a, b, c, d}:
S = {(a, b), (a, d)}.
Is S transitive?
Proof:
By the definition of transitivity provided in a previous study unit,
whenever (x, y) ∈ S and (y, z) ∈ S then
(x, z) must also live in S.
It is not possible to find two pairs of the form (x, y) and (y, z) in S,
so it is vacuously true that S is transitive.
164
Study unit 10 Logic: Quantifiers, predicates, and proof strategies COS1501/1
In this study unit you ensured that you can answer the following questions:
165
Study unit 10 Logic: Quantifiers, predicates, and proof strategies COS1501/1
NOTES
166
Appendix A: Index COS1501/1
INDEX
Q (rational numbers), 22
R (real numbers), 25
Z+ (positive integers), 3
Z≥ (non-negative integers), 7
Z (integers), 11
A
absolute value, 17
abstract reasoning, 89
antecedent, 140
B
base, 9
biconditional, 141
binary operation, 116
C
Cartesian product, 73
codomain, 98
common factor, 6
common denominator, 24
complement, 50
conclusion, 139
conditional, 139
conjunction, 138
connective, 137
consequent, 140
contradiction, 145
contrapositive, 160
converse, 161
counterexample, 61, 89, 156
D
decimals
non-repeating, 29
repeating, 29
de Morgan’s laws, 147
digit, 8
denominator, 23
common, 24
least common, 24
disjunction, 139
domain, 74, 98
dot product, 124
E
element (member), 3, 36
ellipses, 35
equivalence class, 91
exclusive, 44
Appendix A: Index COS1501/1
F
factorisation, 11
fraction
equivalent, 24
improper, 30
proper, 30
function
bijective, 112
composition, 108
identity, 114
injective, 106
invertible, 112
little circle, 108
one-to-one, 107
onto, 105
surjective, 105
functional, 98
G
general proof, 89
generalisation of conjunction, 154
generalised form of disjunction, 154
H
hypothesis, 139
I
identity, 53, 61, 147
additive, 10
iff, 56
implication, 140
Inclusion-exclusion principle, 63
inclusive, 41, 139
infix notation, 72, 116
integer
even, 27
odd, 27
intersection, 42, 50
inverse
additive, 15
multiplicative, 25
L
logical equivalence, 146
logical equivalences, 147
logical connective, 137
lowest terms, 26
M
matrix, 125
addition, 127
column, 126
identity, 132
Appendix A: Index COS1501/1
multiplication, 128
row, 126
zero, 132
member, 36
modulo, 92
monotonicity, 19, 20
N
negation, 141
n factorial (n!), 18
notation
infix, 72, 116
list (roster method), 34
prefix, 116
set-builder, 35
number
prime, 18
number line, 16
numbers
irrational, 28
real, 29
numerator, 23
O
operation
3-ary, 122
4-ary, 122
binary, 116
unary, 122
or
exclusive, 139
inclusive, 139
order
weak partial, 84
strict partial, 86
ordered pairs, 70
origin, 70
P
partition, 94
power set, 45
predicate, 157
proof
by contradiction, 160
by contrapositive, 107, 160
direct, 159
proposition, 136
Pythagoras’ Theorem, 25
Q
QED, 23
quantified variable, 152
quantifier
existential, 153
Appendix A: Index COS1501/1
universal, 152
R
radix, 9
range, 98, 104
ran(T), 74
rational numbers, 22
reciprocal, 25
reduction ad absurdum, 26, 94, 160
reflexive, 75
relation, 73
antisymmetric, 76
binary, 74, 97
composition, 79, 108
equivalence, 91
inverse, 79, 112
n-ary, 97
order, 71
reflexive, 75
irreflexive, 75
symmetric, 76
ternary, 97
total order, 87
transitive, 77
relationship, 72
repeated addition, 13
repeating decimals, 29
roster method, 34
S
scalar, 124
set, 3, 34, 35
cardinality, 44
complement, 42, 43
difference, 42
disjointness, 44
empty, 38
equality, 49
finite, 117
identity, 53
infinite, 117
intersection, 41, 50
power, 45
symmetric difference, 43, 51
union, 41, 50
universal, 39, 48
square root, 11, 12, 15, 17
statement
atomic, 137
compound, 137
declarative, 136
simple, 137
subset, 40
proper, 41
sum rule, 63
Appendix A: Index COS1501/1
T
tautology, 145
transitivity, 19
trichotomy, 78
truth value, 154
U
union, 41, 50
V
variable, 35
vector, 122
dot product, 124
sum, 124
Venn diagrams, 48
Appendix B: Bibliography COS1501/1
Bibliography
Ensley, DE & Crawley, JW. 2006. Discrete mathematics: mathematical reasoning. Available as a
free ebook from http://www.ebooktoyou.net/ebook/discrete-mathematics-ensley-pdf.php.
Accessed on 4 May 2010.
Post, T, Behr, M & Lesh, R. 1982. Interpretations of rational number concepts. In Silvey, L &
Smart, J (eds). Mathematics for Grades 5-9, 1982 NCTM Yearbook (pp 59-72). Reston, Virginia:
NCTM. Available from http://www.cehd.umn.edu/rationalnumberproject/82_1.html. Accessed
on 10 May 2010.
Roberts, FS. 2001. International encyclopedia of the social & behavioral sciences, Discreet
mathematics. Available from:
http://dimacs.rutgers.edu/People/Staff/froberts/encyclopediafinal.pdf. Accessed on 14 May
2011. Elsevier Science.