0% found this document useful (0 votes)
162 views50 pages

MATU9S1 A Notes

This document provides lecture notes on discrete structures that cover set theory concepts. It begins with definitions of fundamental set theory terms like set, member, subset, union, intersection, difference, and complement. Several examples are given to illustrate each concept. The document also defines special sets of numbers like natural numbers, integers, rational numbers, and real numbers. It explains how sets of numbers can be defined and combined using set operations.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
162 views50 pages

MATU9S1 A Notes

This document provides lecture notes on discrete structures that cover set theory concepts. It begins with definitions of fundamental set theory terms like set, member, subset, union, intersection, difference, and complement. Several examples are given to illustrate each concept. The document also defines special sets of numbers like natural numbers, integers, rational numbers, and real numbers. It explains how sets of numbers can be defined and combined using set operations.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

MATU9S1

Discrete Structures

Section A - Lecture Notes


Computing Science and Mathematics

University of Stirling

Autumn Semester

These notes are not to be regarded as a substitute for attending lectures. They sum-
marise the key points and give a general outline of the topics covered in this module.
However, additional information and explanation will be given in lectures and is also
available in the recommended textbooks. As with all mathematics, doing the tutorial
questions is the best way to ensure that you understand the material.

0
1 Set Theory
This first section serves two purposes. The concept of a set is fundamental to mathematics
and will be used throughout this module and, indeed, throughout future modules also.
On the face of it, it is a very straightforward concept (and so gives us a good starting
point) although the ideas can become surprisingly difficult the more deeply you look into
them! Secondly, this gives a good structure on which to develop the precision required
to read and write mathematics, which is rather different from reading and writing plain
English.

1.1 Definitions
The language of mathematics is built around a number of definitions. Before we can prove
statements, we need to be absolutely sure that we know exactly what we are talking about.
Often these will be definitions of ordinary English words, and will fit very closely with
our previous understanding of the meaning of these words. Sometimes new terms will be
introduced.
Knowing definitions is essential to understanding what questions mean, and often the
solution to a problem will begin by re-examining the definitions of some of the terms used
in the question.

Definition 1.1 A set is a well defined collection of objects.

The objects can be numbers, letters, shapes, animals, addresses or anything else we
want, including a mixture of different types of object. Each of the objects in a set is
known as a member or element of the set.
Normally we shall use upper-case letters, A, B, C, . . . to stand for sets and lower-case
letters x, y, z, . . . to represent members of sets.

Notation 1.2 If x is a member of A we write x ∈ A and if x is not a member of A we


write x 6∈ A.

Definition 1.3 Two sets are equal if they contain precisely the same members.

Small sets are usually defined by listing the members between braces (curly brackets).
When listing a set, each member should be included once and once only but the order
does not matter.

• {odd numbers between 2 and 10} = {3, 5, 7, 9} = {7, 3, 9, 5}.

• If A = {a, b, c} then a ∈ A but d 6∈ A.

1
• If B = {UK, USA, Germany, France} then France ∈ B but Italy 6∈ B.

• We could define the set C by C = {1, a, Stirling, StJohnstone FC}, though why
we would want to do such a thing I don’t know!

This listing notation becomes clumsy for larger sets and so we more usually define
a set by giving a rule or rules that describe the members of the set. This is known as
set-builder notation. For example, {x : x is a vowel} is read as ‘the set of (objects) x such
that x is a vowel’ and is exactly the same as {a, e, i, o, u}.

• {x : x < 5 and x is a positive integer} = {1, 2, 3, 4}.

• {x: x is a student in MAT911}

• {x: x is a positive even number} = {2, 4, 6, 8, . . .}.

• {t : t < 5 and t is a positive integer} = {1, 2, 3, 4}.

Notice that the first and last examples above are exactly the same and in fact have
nothing to do with the variables x and t. These are merely labels to allow us to talk about
the members of the set generally and are therefore sometimes called dummy variables.
The example on even numbers also shows that a set might have an infinite number of
members. Often in these cases the set-builder notation is more accurate than trying to
list the members and finishing with ‘. . . ’ meaning ‘and so on’.
One special set, which may seem trivial but is in fact very useful, is the empty set, the
set which does not contain any members at all.

Notation 1.4 The empty set is denoted by ∅ or { }.

Definition 1.5 The set B is a subset of the set A if every member of B is also a member
of A. This can be written as ‘x ∈ B ⇒ x ∈ A’ where ⇒ is read ‘implies’, in other words
‘if x is a member of B then x is a member of A’.
If B is a subset of A we write B ⊆ A.

Warning: be careful of the difference between ‘⊆’ (is a subset of) and ‘∈’ (is a member
of). For example:

• {a, b} ⊆ {a, b, c} and {a} ⊆ {a, b, c} but a ∈ {a, b, c}.

• The set of even numbers is a subset of the set of integers.

• For all sets A, we have ∅ ⊆ A and A ⊆ A.

2
Note also that you may come across a different notation in some books. The symbol
⊂ is often used as an alternative to ⊆, while some authors reserve ⊂ to indicate a proper
subset, ie a subset that is not equal to the original set.

Example 1.1 Prove that if P ⊆ Q and Q ⊆ R then P ⊆ R.

Solution. This should be intuitively obvious, but it gives a good example of how defi-
nitions can form the basis of a rigorous proof. We simply turn our intuition into more
mathematical language.
Let x ∈ P . Then, since P ⊆ Q, x ∈ Q. Now, since Q ⊆ R, it follows that x ∈ R.
Hence any member of P (ie every member of P ) is a member of R and so P ⊆ R.

Definition 1.6 The order of a set is the number of members it contains. The order of
A is written |A|. If A contains an infinite number of members we say that |A| = ∞. The
order of a set is sometimes called the cardinality of the set.

• If A = {5, 7, 11} then |A| = 3.

• {whole numbers strictly between 2 and 8} has order 5.

• |{integers}| = ∞.

1.2 Sets of numbers


The most common sets used in mathematics are sets of numbers. You will have met some
different types of numbers already and there are a few particular sets that you need to be
familiar with.

Notation 1.7 N = {1, 2, 3, 4, . . .}, the natural numbers.


Z = {. . . , −3, −2, −1, 0, 1, 2, 3, . . .}, the integers.
Q = {p/q : p, q ∈ Z and q 6= 0}, the rational numbers.
R denotes the set of real numbers.

You will sometimes see the natural numbers defined to include zero, but I shall use
N to mean only positive integers.
Rational numbers are those that can be written as fractions. Note that, by the defini-
tion above, the integers are all included in Q since, for example, 5 = 5/1, −3 = −3/1 and
even 0 = 0/1. All terminating decimals are rational, and some non-terminating decimals
also, eg 0.333 . . . = 1/3.
Irrational numbers are those that cannot be written as fractions. You have already
√ √
met examples of these, such as 2, 3, π and possibly e. If you try to write any of these

3
as a decimal, it will go on for ever but without settling into a recurring pattern. We shall

prove in Section 5 that 2 is irrational.
Real numbers consist of all the rational and irrational numbers taken together and can
almost be thought of as ‘all numbers’. However, you may have previously met complex
numbers, denoted by C, which do go beyond real numbers. We shall not be concerned
with complex numbers in this module but will learn about them in MAT912.
Notice that each of these sets is contained in the next one on the list:

N ⊆ Z ⊆ Q ⊆ R ⊆ C.

All real numbers are either positive, negative or zero, but note that zero itself is neither
positive nor negative. Hence the positive integers are the same as the natural numbers,
ie {1, 2, 3, 4, . . .}, whereas the set {0, 1, 2, 3, 4, . . .} would be described as the non-negative
integers.
When defining sets of numbers, it is sometimes clear from the context what type of
numbers we are talking about, but if there is any doubt then this should be made explicit
in the definition. For example:

• {x : x < 4 and x ∈ N} = {1, 2, 3}.

• {x : 5 < x < 6 and x ∈ R} cannot be listed but includes, for example, the numbers

5.3, 5.8726 and 30.

This general description of type of number is sometimes included in the first part of
the set-builder notation, so that the first example above might be written

• {x : x < 4 and x ∈ N} = {x ∈ N : x < 4}, read ‘the set of x in N such that x is less
than 4’.

1.3 Operations on sets


Having defined what sets are, we now look at ways of combining sets to make new ones.

Definition 1.8 The union of two sets A and B is the set {x : x ∈ A or x ∈ B} and is
denoted by A ∪ B.

The word ‘or’ is used here in its inclusive sense, so that an object is in the union of A
and B if it is either in A, or in B, or possibly in both.
Taking A = {2, 5, 7, 12}, B = {1, 2, 5, 11} and C = {prime numbers less than 10} we
have:

4
• A ∪ B = {1, 2, 5, 7, 11, 12}.

• B ∪ C = {1, 2, 3, 5, 7, 11}.

• A ∪ N = N.

• For any set P , we have P ∪ ∅ = P and P ∪ P = P .

Definition 1.9 The intersection of two sets A and B is the set {x : x ∈ A and x ∈ B}
and is denoted by A ∩ B.

Using the same sets as above:

• A ∩ B = {2, 5}.

• B ∩ C = {2, 5}.

• A ∩ N = A.

• For any set P , we have P ∩ ∅ = ∅ and P ∩ P = P .

Definition 1.10 The difference of two sets A and B is the set {x : x ∈ A and x 6∈ B}
and is denoted by A\B, read ‘A minus B’.

Using the same sets as above:

• A\B = {7, 12}.

• B\C = {1, 11}.

• A\N = ∅.

• For any set P , we have P \∅ = P and P \P = ∅.

Definition 1.11 The complement of a set A is the set {x : x 6∈ A} and is denoted by A.

This definition only makes sense if it is clear what objects are under consideration in
any particular question. We do not want the complement of a set to include every other
object in the entire universe! This gives us the concept of a universal set, often denoted
by E (standing for ‘entirety’) or U , which will vary from question to question.

• If the universal set is N, the complement of {1, 2, 3, 4} is {5, 6, 7, 8, . . .}.

• If the universal set is Z, the complement of {1, 2, 3, 4} is {. . . , −2, −1, 0, 5, 6, 7, 8, . . .}.

5
• If the universal set is {letters of the alphabet}, the complement of {vowels} is
{consonants}.

You will see other notations in use for the complement of a set, such as A0 and AC .

Definition 1.12 Two sets A and B are disjoint if A ∩ B = ∅.

In other words, disjoint sets are completely separate and have no members in common.

Example 1.2 Prove the associative law for union of sets, ie that for any sets A, B, C,
A ∪ (B ∪ C) = (A ∪ B) ∪ C.

Solution. In lecture.
This result shows that the position of brackets in the expression A ∪ B ∪ C does not
matter and so we can write A ∪ B ∪ C without any ambiguity. Since this can be extended
to any number of sets, it is possible to extend the definition of union of sets to include
more than two sets at a time.

Notation 1.13 A1 ∪ A2 ∪ A3 ∪ . . . ∪ An is denoted by ni=1 Ai and is the set


S

{x: x is a member of at least one of A1 , A2 , A3 , . . . , An }.

The ideas of union and intersection of sets are fairly obvious ones to explore but our
next operation, the multiplication of sets is perhaps not so natural.

Definition 1.14 The Cartesian Product of two sets A and B is the set
A × B = {(x, y) : x ∈ A, y ∈ B}.

This means that A × B is a set of ordered pairs where the first member of each pair
is in A and the second is in B. By ‘ordered pair’ we mean that (x, y) is not the same as
(y, x). Some examples will help to clarify this.

• If A = {a, b} and B = {4, 7} then A × B = {(a, 4), (a, 7), (b, 4), (b, 7)}.

• If S = {soup, salad} and M = {meat, fish, eggs} then S ×M is the set of all possible
2-course menus choosing a starter from S and a main course from M :
S×M = {(soup,meat), (soup,fish), (soup,eggs), (salad,meat), (salad,fish), (salad,eggs)}.

• R × R = {(x, y) : x, y ∈ R} = R2 .

This last example is very important. R2 is the set of all ordered pairs of real numbers
and can be thought of as being the coordinates of all points in the plane. For any set A
we use the abbreviation A × A = A2 .
It should be clear that, for any finite sets A and B, |A × B| = |A|.|B|.

6
1.4 Venn diagrams
Venn diagrams are a very simple but effective way of representing sets visually. One shape
(usually a rectangle) is used to represent the universal set and other shapes (usually circles)
are placed within this to represent other sets. Unless we are told otherwise, we should
always bear in mind that different sets may have some members in common and so the
typical 2-set Venn diagram will look like this.

In the left-hand diagram the rectangle has been divided into 4 regions, which are labelled
in the right-hand diagram so that we can refer to them.
Thus set A consists of regions (i) and (ii), while set B consists of regions (ii) and (iii).
We can describe the 4 regions by their contents.
(i) Members of A which are not in B, ie A\B;
(ii) Members which are in both A and B, ie A ∩ B;
(iii) Members of B which are not in A, ie B\A;
(iv) Members which are not in either A or B, ie A ∪ B.
It is very important to remember that set A includes both regions (i) and (ii), not just (i),
and similarly region (i) cannot be described as A, but as A\B. The bounding rectangle
indicates all the objects (people, numbers, letters, events etc) which we are considering
in a particular problem, ie the universal set.
The basic operations union, intersection and complement can now be thought of in
terms of these diagrams.

union: A ∪ B intersection: A ∩ B complement: A


Remember: A OR B Remember: A AND B Remember: NOT A

7
disjoint sets B⊆A

A typical Venn diagram for three sets needs to show a possible intersection of any two
of them and so will generally be drawn like this.

It is very difficult to illustrate more than three general sets neatly in a Venn diagram,
though if we know, for example, that some of the sets are disjoint (do not intersect), or
that one set is a subset of another, then the picture will be significantly simplified.
Venn diagrams can be used to help us think about problems and to give us an idea
of how to prove certain results, though strictly speaking looking at a picture does not
constitute a proof: it merely points us in the right direction.

Example 1.3 Illustrate the sets A = {p, q, r, s} and B = {q, s, v} on a Venn diagram
with the universal set E = {p, q, r, s, t, u, v}. List the members of A ∩ B.

Solution.

Since A ∩ B = {q, s} its complement is A ∩ B = {p, r, t, u, v}.

Example 1.4 Use Venn diagrams to illustrate that (A ∪ B) ∩ C is not usually the same
as A ∪ (B ∩ C).

8
Solution. Build up pictures of these two sets (second and fourth diagrams below) and
note that they are not the same.

A∪B (A ∪ B) ∩ C B∩C A ∪ (B ∩ C)

We saw in Example 1.2 that the associative law applies to the operation ‘union’, ie
that we can write A ∪ B ∪ C without ambiguity since the positioning of brackets makes
no difference, and the same is true for ‘intersection’. However, Example 1.4 demonstrates
that when we have a mixture of intersections and unions it is crucial to show by brackets
the order in which the operations are to be carried out.
The expressions A ∪ B ∩ C and A ∩ B ∪ C are ambiguous and should never be written
without brackets.
We shall return to Venn diagrams and their uses in Section 4.

1.5 Power sets and infinite sets


Since the members of a set can be any kind of object, it is possible to construct sets whose
members are other sets. We could define A = {red, blue, {a, b, c}}. This set has order 3,
its elements being two colours and a set.

Definition 1.15 The power set of a set A is the set whose members are all the possible
subsets of A. The power set of A is denoted by P(A).

Example 1.5 List the set P(A) where A = {x, y}.

Solution. A has 4 subsets and so P(A) = {∅, {x}, {y}, {x, y}}.

Example 1.6 How many subsets does B = {a, b, c} have?

Solution. Without listing the subsets, if we count them systematically we can see that
there is 1 subset with no elements (∅), 3 subsets with one element, 3 subsets with two
elements and 1 subset with three elements (B itself). Hence there are 8 subsets in all and
so |P(B)| = 8.
Clearly what the actual members are in this example does not matter and so any set
with 3 members will have 8 subsets.

9
Another way of doing that calculation would be to argue like this. Subsets can be
constructed by choosing to include or exclude each element in turn. Thus a could be in
the subset or not (two choices). For each of these choices, b could be in the subset or not,
which doubles the number of choices from 2 to 4. Finally for each of these 4 choices, we
can choose to include or exclude c, giving 8 possible subsets in all.
Extending this argument, it should be clear that a set containing n members will have
n
2 subsets.

Theorem 1.7 If A is a finite set of order n then |P(A)| = 2n .

It seems natural to say that if we can pair up the elements of one set precisely with
the elements of another then the orders (or cardinalities) of the two sets are the same.
We extend this idea to sets of infinite order. This can lead to some odd-looking results.
Let A be the set of positive even numbers and compare this with N. There is a natural
pairing of the elements, given by 2 ↔ 1, 4 ↔ 2, 6 ↔ 3, 8 ↔ 4, . . .
Each member of A has a ‘partner’ in N and vice versa. We therefore say that A and
N have the same cardinality. It may seem strange that after throwing out all the odd
numbers from N there are still, in a sense, as many numbers remaining as there were
originally!

Definition 1.16 Any infinite set whose elements can be paired in this way with the nat-
ural numbers is called a countable set. Not every infinite set is countable.

Example 1.8 Show that the integers are countable.

Solution. The problem here is that the integers are usually listed as {. . . , −2, −1, 0, 1, 2, . . .},
stretching out for ever in both directions. This means that we cannot simply count the
integers from left to right. However, we can set up the pairing between N and Z as follows:
1 ↔ 0, 2 ↔ 1, 3 ↔ −1, 4 ↔ 2, 5 ↔ −2, 6 ↔ 3, . . . , in other words we count the
integers from the middle out, in the order 0, 1, − 1, 2, − 2, 3, − 3 etc. This shows
that N and Z have the same cardinality and that Z is countable.

10
2 Number Bases
Have you ever wondered why our number system is based on the number ten? This has
become such a part of our lives that it is hard to imagine anything else, but in fact there
is no good mathematical reason for it. Of course we might argue that we only have digits
0-9 and it makes decimal fractions and percentages easier, but that is actually a circular
argument: decimal fractions and percentages arise because we use 10 as our base, not the
other way around.
If we were reinventing counting systems now, and nobody already had a built-in fa-
miliarity with base 10, there would be no reason why we could not use a system based
on 8, or 12, or 16. (I think my vote might go to 12!) In fact, over the course of history,
there have been civilisations which used 12, 20 and even 60 as their base, and computers
work best in base 2.

2.1 Bases other than ten


First we need to examine the main features of our familiar base-10 system. We need 10
different symbols (digits) to stand for small numbers: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. There
is not a separate digit for 10, but instead we use a 2-digit number where place-value is
essential. Thus the 1 in 10 indicates ten and the 0 indicates no units. Similarly 27 means
2 tens and 7 units. This is what base-10 means: we are counting in groups of ten.
This is then extended to larger numbers. 346 means 3 hundreds, 4 tens and 6 units.
Hundreds are just ten tens and thousands are ten hundreds. You probably remember from
primary school writing the headings Th H T U above numbers to remind you of this.
The key to this is that we do not need a digit to stand for ten since whenever you
reach ten in any column you represent it by one in the column to the left. This principle
will be carried forward to other number bases.
Now let us consider how this would apply to a different number base, say base 8.
Firstly we only use the 8 digits from 0 to 7: there is no 8 or 9 in base 8. Secondly,
whenever we reach 8 in one column we represent this by a 1 in the column to the left; in
other words we count in groups of 8. Thus 258 (meaning that the number 25 is a base-8
number) means 2 eights and 5 units, in other words 21.
The headings for the columns in base 8 are not units, tens, hundreds and thousands
but units, eights, sixty-fours and five-hundred-and-twelves ie 1, 8, 82 , 83 , from right to
left.

11
Example 2.1 What digits are needed in base 7 and in base 5, and what would the headings
be for the columns?

Solution. In lecture.

In general, to represent a number in base n we only use the n digits from 0 up to n − 1,


inclusive. The headings for the columns, from right to left, are then 1, n, n2 , n3 , ...

2.2 Conversion between bases


We convert numbers from other bases into base 10 simply by interpreting what the rep-
resentation means, by considering the headings of the columns.

Example 2.2 Convert the following numbers to base 10.


(i) 348 (ii) 527 (iii) 324 (iv) 415
(v) 2356 (vi) 4758 (vii) 4125 (viii) 21223

Solution. (i) The headings are 1 and 8 so 348 = 8 × 3 + 4 = 28.


(v) The headings are 1, 6 and 36 and so 2356 = 36 × 2 + 6 × 3 + 5 = 95.
(viii) The headings are 1, 3, 9 and 27 and so 21223 = 27 × 2 + 9 × 1 + 3 × 2 + 2 = 71.
Other parts in lecture.

To convert the other way, from base 10 to another base, it is sometimes possible to
do this almost by inspection by thinking what the headings of the columns will be and
making up the number you require by starting with the large values, ie moving from left
to right.

Example 2.3 Convert these numbers from base 10 to the bases shown.
(i) 4710 to base 5. (ii) 14110 to base 4. (iii) 16710 to base 8.

Solution. (i) How do we make up 47 by using 1, 5 and 25? Start at the high end (the
leftmost column). We need one 25 and that leaves 22 still to be found. For 22, we need
four 5s and that leaves 2. Hence 4710 = 25 × 1 + 5 × 4 + 2 = 1425 .
(ii) and (iii) in lecture.

If this seems rather an informal approach, or if you are dealing with much bigger
numbers, there is an algorithm we can use, ie a routine method. It may not be so clear
why this works, but it is a good practical method.
Keep dividing the base-10 number by the new base, removing the remainder each time.
When you can divide no more, read off all the remainders from the bottom to the top
and that will be the representation in the new base.

12
Example 2.4 Repeat the previous example by this method.

Solution. (i) 5 47 Reading the remainders from bottom to top gives 4710 = 1425 .
5 9 2
5 1 4
0 1
(ii) and (iii) in lecture.

The reason this works (referring to part (i) above) is that the first division told us
that 47 = 5 × 9 + 2. We have expressed 47 in groups of 5, with 2 units left over. The
second division takes these 9 groups of 5 and creates 1 group of five fives (ie 25) and 4
groups of 5 left over. Thus we have 47 = 25 × 1 + 5 × 4 + 2.

The above methods allow you to change to and from base 10. If you need to change
from one base to another (neither of which is 10) usually the easiest way is to convert
into base 10 first and then convert out. However we shall later see one or two particular
cases where there is a shortcut.

2.3 Operations in different bases


It is possible to add, subtract, multiply and divide numbers in a different number base
without converting them into base 10. If we are working in, say, base 8, we just have to
remember that every time we reach a total of 8 in any one column, we have to represent
this by a 1 in the column on the left, ie we carry 1. Thus adding 6 and 7 gives 13, but
we write down 5 and carry 1 since 13 = 8 + 5. The 8 is represented by a 1 in the column
to its left. This is the same procedure no matter which column we are working in.

Example 2.5 Carry out the following calculations in the bases indicated.
(i) 478 + 268 (ii) 3468 + 5748 + 3748 (iii) 2314 + 3324 (iv) 5347 × 5
(v) 2213 × 2 (vi) 3689 + 7589 (vii) 556 + 436 + 546 (viii) 4325 × 4

Solution. (i) 4 7
+ 21 6
7 5
7 + 6 = 13. This is 1 eight and 5 units so we put down 5 and carry 1. Then 4 + 2 + 1 = 7.
(ii) 3 4 6
5 7 4
+ 32 71 4
1 5 3 6

13
Starting from the right, 6 + 4 + 4 = 14. This is 1 eight and 6 units so write down 6 and
carry 1. 4 + 7 + 7 + 1 = 19. This is 2 eights and 3 units so write down 3 and carry 2.
Finally, 3 + 5 + 3 + 2 = 13 so write down 5 and carry 1, which goes in a column on its
own.
Other parts in lecture or as exercises.

Example 2.6 Check the answers to the previous example by converting the original num-
bers into base 10, doing the calculation in base 10 and converting your answer back into
the given base.

Solution. (i) 478 = 3910 and 268 = 2210 . Adding 39 and 22 in base 10 gives 61. 61 is 7
eights and 5 units and so 6110 = 758 , which agrees with our original answer.
Other parts in lecture or as exercises.

2.4 Larger bases


So far we have only considered number bases less than 10, but there is no reason why we
cannot work in bases bigger than 10 as well, although here we encounter a slight difficulty.
Take base 12, for example. According to our rule, we need separate digits for all numbers
less than 12, which means that we need to create digits for 10 and 11 since we cannot use
2-figure numbers for these.
We could use any symbols we like, but let’s be boring and use t to stand for ten and
e to stand for eleven. The headings for the columns in base 12 (sometimes called the
duodecimal system) are 1, 12, 144, etc (ie powers of 12) and so a number such as t2 means
10 twelves and 2 units, ie 122. The number 35e12 represents 144 × 3 + 12 × 5 + 11 or 50310 .
Apart from this additional piece of notation, calculations are performed the same way
as for smaller number bases. Whenever you have 12 in one column, you represent this by
a 1 in the column on the left. Thus t + e = 19 in duodecimal because 10 + 11 = 21 which
is 1 twelve and 9 units.

Another very common number base greater than 10 is 16, giving rise to the hexadecimal
system. This is used a lot in computing science because 16 is a power of 2 (more later).
Here we need new symbols for 10, 11, 12, 13, 14 and 15 and we can no longer extend
the idea of using initial letters because too many of these start with t or f . Instead it
is conventional to use the letters A-E (sometimes in lower-case a-e) with the meanings
A=10, B=11, C=12, D=13, E=14 and F=15.
The headings for the columns are the powers of 16, from right to left 1, 16, 256 etc.
Thus 4716 represents 16 × 4 + 7 or 7110 , 3B16 represents 16 × 3 + 11 or 5910 and AF16
represents 16 × 10 + 15 or 17510 .

14
Other notations are used to indicate that a number is in hexadecimal. 0xf3, 0xF3,
F3x, F316 and f316 all mean the same thing. (x means hex, short for hexadecimal.)

Example 2.7 (i) Convert the hexadecimal numbers 7A, 4E and 216 into decimal.
(ii) Convert the duodecimal numbers t5, 47 and 3e1 into decimal.
(iii) Convert the decimal numbers 57, 183 and 622 into both base 16 and base 12.

Solution. In lecture.

2.5 Binary
Another very useful number base is base 2, also known as binary. This is the system used
by computers to store numbers. In base 10 we use the digits 0-9, in base 7 we use the
digits 0-6 and therefore in base 2 we only use the digits 0 and 1.
This is both an advantage and a disadvantage. The benefit is that we need only two
states: 0 and 1, on and off, yes and no, true and false, positive or negative etc to be able
to represent all numbers. The downside is that large numbers are very long and strings
of 1s and 0s can be a bit confusing to the eye.
The headings for the columns are the powers of 2: from right to left these are 1, 2,
4, 8, 16, 32, etc. Thus 19 can be made up of 16 + 2 + 1 and so 1910 = 100112 , that is
a 16, no 8s, no 4s, a 2 and a 1. Notice that this is the only way of representing 19 as
a sum of (different) powers of 2. Note that this could also have been worked out by the
algorithm we used earlier: to change from base 10 to base 2 keep dividing by 2 and taking
the remainder.
2 19
2 9 1
2 4 1
Now read the remainders up the way, giving 10011.
2 2 0
2 1 0
0 1

Example 2.8 Convert the following binary numbers to decimal (base 10).
(i) 1011 (ii) 10010 (iii) 101101 (iv) 1001001

Solution. In lectures.

Example 2.9 Convert the following decimal numbers to binary.


(i) 27 (ii) 46 (iii) 11 (iv) 511

Solution. In lectures.

15
Example 2.10 Carry out the following calculations in binary. Check your answers by
converting the numbers to decimal and converting the answer back to binary.
(i) 1011 + 10 (ii) 10010 + 11011 (iii) 101101 × 11 (iv) 10101 × 10

Solution. (i) Remember that we can only use the digits 0 and 1 in binary and whenever
we have 2 in a column we need to represent this as a 1 in the column to the left (carry 1).
1 0 1 1
1 0
1 1 0 1
The only thing to watch here is that in the second column from the right we added 1 and
1 and got 2, which is 10 in binary and so we put down 0 and carry 1.
Check by converting: 10112 + 102 = 1110 + 2 = 1310 = 11012 .
Other parts in lecture.

Since 16 is a power of 2, there is a very close connection between binary and hexadec-
imal numbers. Hexadecimal numbers are expressed in powers of 16, which are themselves
powers of 2, and so each hexadecimal digit is exactly equivalent to 4 binary digits. Note
that 4 binary digits (called bits in computing parlance) can represent any number from 0
to 15, the same as one hex digit.
To convert a hex number to binary, therefore, we can take each digit and convert it
to 4 binary digits, stringing our answers together.

Example 2.11 Convert 3D616 to binary.

Solution. Take the hexadecimal number digit by digit. 3 becomes 112 . D (ie 1310 )
becomes 1101 and 6 becomes 0110. (Note the initial zero to pad this out to 4 digits.)
Putting these together gives 3D616 = 11110101102 . Check: the hexadecimal version
means 256 × 3 + 16 × 13 + 6 = 982 in decimal and the binary version translates as
512 + 256 + 128 + 64 + 16 + 4 + 2 = 982 also.

Converting the other way is similar. Take a binary number and split it up into groups
of 4 bits from the right-hand end. Each set of 4 bits can then be turned into a single hex
digit.

Example 2.12 Convert 110101101112 to hexadecimal.

Solution. Grouping in fours from the right gives 110 1011 0111. (It is OK that the
leftmost group has only 3 digits in it.) These groups now convert, in decimal, to 6, 11
and 7 making the hexadecimal number 6B7.

16
2.6 Applications
In computers, all data is stored in binary, using only ones and zeros. We have seen how
numbers can be represented, but in fact all letters, pictures and sounds can also be stored
this way, ie in a digital format. Here are some examples to illustrate how this can be
done.

2.6.1 Colours

“All the colours of the rainbow” should really refer to an infinite number of colours, not
just seven, since there can be tiny variations between similar colours. Computers are
not good at storing an infinite number of things, but they can certainly deal with large
numbers.
One way of storing a colour is to think of it as a mixture of red, green and blue,
specifying how much of each is required. This is known as the RGB format. If we allow
256 (ie 28 ) shades of each of red, green and blue that gives us a combination of 2563 or
224 or 16 777 216 colours, more than enough for our human eyes to cope with!
If we call the 256 shades of each colour 0 (none of it) up to 255 (as much as you
can get) then we can represent each of R, G and B by a 2-digit hexadecimal number
from 00 up to FF (255). Putting these numbers together gives us a 6-digit hex number
representing one of the 16 777 216 colours.
For example, FFFF00 means “lots of red, lots of green and no blue”, in other words
yellow. 000000 means no colour at all, ie black, and FFFFFF mixes all colours fully, giving
white. Similarly, 808080 mixes each colour equally at about half-strength (8016 = 12810 )
and so this gives grey.

2.6.2 Black and white pictures

The way in which a computer stores a picture is to split it up into a rectangular array
of ‘picture elements’ or pixels and then to record what colour each pixel should be. The
simplest case is a black and white image, where we can use 0 to stand for white and 1 to
stand for black. (This assumes that the background is white: there are other conventions.)
Then we store the picture row by row, from left to right, but conventionally from the
bottom to the top, which is maybe not what you would expect.

17
Hence the above 8 × 8 image can be saved as follows:

binary hexadecimal
row 8 (top) 00000000 00
row 7 10000000 80
row 6 11000000 C0
row 5 01111110 7E
row 4 00111100 3C
row 3 00010010 12
row 2 00001001 09
row 1 (bottom) 00000000 00

The binary version then strings these 8 numbers together:


0000 0000 0000 1001 0001 0010 0011 1100 0111 1110 1100 0000 1000 0000 0000 0000.
This is not very clear, even separating the bits into groups of 4 (purely for readability),
and so it would be better in hexadecimal: 00 09 12 3C 7E C0 80 00.

Conversely, given a 16-digit hexadecimal number we can reconstruct a black and white
picture on an 8 × 8 grid.

Example 2.13 Reconstruct the 8 × 8 black and white picture which has been saved in
hexadecimal as FF 10 10 7C 54 54 54 10.

Solution. Remember this goes from the bottom to the top, with 2 digits for each row.

hexadecimal binary
row 8 (top) 10 00010000
row 7 54 01010100
row 6 54 01010100
row 5 54 01010100
row 4 7C 01111100
row 3 10 00010000
row 2 10 00010000
row 1 (bottom) FF 11111111

18
Example 2.14 Reconstruct the 4 × 4 black and white picture which has been saved in
hexadecimal as ECA1.

Solution. For a 4 × 4 grid, the 4 bits in each row can be represented by a single hex digit,
again going from bottom to top.

hexadecimal binary
row 4 (top) 1 0001
row 3 A 1010
row 2 C 1100
row 1 (bottom) E 1110

2.6.3 Colour pictures

In black and white pictures, we used one bit (0 or 1) for each pixel. For colour pictures we
need to use as many bits for each pixel as are required to cover all colours, but the principle
is the same. For a full ‘millions of colours’ RGB picture we would need 24 bits per pixel,
but we can illustrate this by restricting our picture to only 4 colours, coded as 0, 1, 2 and 3.

1 1 0 0 0 1 1 0 0 0 0 1 4 0
1 1 0 0 0 1 1 0 0 0 0 1 4 0
3 3 3 3 3 3 0 3 3 3 3 3 3 0 3 F F C
2 2 2 2 0 0 2 2 2 2 0 0 0 A A 0
→ →
1 1 0 0 0 1 1 0 0 0 0 1 4 0
2 2 2 2 0 0 2 2 2 2 0 0 0 A A 0
3 3 3 3 3 3 0 3 3 3 3 3 3 0 3 F F C
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 5 5 5 5

The second table is in base 4. The third table is a conversion into base 16, with every
two base-4 digits making one base-16 digit. For example, to convert the row 03333330,
note that 034 = 310 = 316 , 334 = 1510 =F16 and 304 = 1210 =C16 . Hence the final hex
coding for the picture is 55 55 3F FC 0A A0 01 40 0A A0 3F FC 01 40 01 40.
It should be straightforward to see how to reverse this process to construct a 4-colour
picture from its hexadecimal coding.

19
2.6.4 ASCII coding

We have seen how colours and pictures can be stored in a computer purely in binary. The
same is true of text: letters and punctuation marks. All that is needed is to give each
character a unique numeric code. Two frequently used schemes for doing this are ASCII
(American Standard Code for Information Interchange) and UNICODE, which is much
more extensive, including Japanese and Chinese characters.
ASCII uses 7 bits and therefore has a range of 0-127. In reference tables, these are
usually given in hex (00-7F) rather than binary (00000000-01111111) and the ones that
are of most interest to us are in the range 20-7E. These are given below.

0 1 2 3 4 5 6 7 8 9 A B C D E F
2 sp ! ” # $ % & ’ ( ) * + , - . /
3 0 1 2 3 4 5 6 7 8 9 : ; < = > ?
4 @ A B C D E F G H I J K L M N O
5 P Q R S T U V W X Y Z [ \ ] ˆ
6 ‘ a b c d e f g h i j k l m n o
7 p q r s t u v w x y z { | } ˜

Example 2.15 What does the ASCII code 47 6F 6F 64 20 6C 75 63 6B 2E represent?

Solution. Two hex characters are required for each ASCII character. From the left,
47→G, 6F→o, 6F→ o, 64→d, 20→ space, etc, giving the phrase ‘Good luck.’

20
3 Switching Circuits
A switching circuit is a network containing a set of switches that allow or prevent flow
along the branches of the network. This can be thought of in terms of electricity in wires
(with switches), or fluid flow along pipes (with taps or valves) or even traffic on a country
road (with gates).
However, note that the concepts open and closed are different for these different mod-
els. We shall use the electrical model here, meaning that when a switch is closed a
connection is made and so the current can flow, whereas when a switch is open the circuit
is broken and current cannot flow. Note that this is the opposite of the ‘gates on roads’
model!

3.1 Truth tables


The two most basic combinations of switches are shown below. The switches are named
p and q and we say the switches are in series in the first diagram and in parallel in the
second.

series parallel

To help us analyse such circuits, we shall use the convention that 0 indicates an open
switch (so current is blocked) while 1 indicates a closed switch (so current can flow).
(Remember 1 for yes and 0 for no.) We are particularly interested in which circuits allow
a flow from beginning to end and we shall use the same notation for the output, ie 1 if
flow is possible right through the circuit and 0 otherwise.
The above circuits can now be represented by truth tables or input-output tables.

series parallel
p q output p q output
1 1 1 1 1 1
1 0 0 1 0 1
0 1 0 0 1 1
0 0 0 0 0 0

21
The 4 rows of each table show the 4 possible combinations of open and closed switches
and the output column indicates whether or not flow is possible through the entire circuit.
When you are constructing truth tables, it is conventional to follow this order of rows, ie
11, 10, 01, 00. It makes comparison of different tables easier if the rows are always in the
same order.
In some circuits, switches can be linked in the sense that they are either both open
or both closed (we shall simply label them with the same letter) or whenever one is open
the other is closed (in which case we shall label the ‘opposite’ of p as p).

Example 3.1 Construct the truth table for the following circuit.

Solution. p q output
1 1 0
1 0 0
0 1 1
0 0 0
Notice that it is always impossible to pass through the top branch of the parallel part of
this circuit since if p is closed then p is open and vice versa. Hence the only way through
the circuit is if q and p are both closed, ie if q = 1 and p = 0.

Example 3.2 Construct the truth table for the following circuit.

22
Solution. Here we have 3 unconnected switches, p, q and r, and so our truth table will
now require 8 lines to cover all possible combinations of open and closed switches. Again,
note the conventional order of rows and try to stick to this yourself.

p q r output This will be explained in lecture.


1 1 1 1
1 1 0 0
1 0 1 1
1 0 0 1
0 1 1 1
0 1 0 1
0 0 1 1
0 0 0 1

3.2 Designing circuits


Often we want to design a circuit to solve a particular problem, that is a circuit which
will produce a pre-defined set of outputs. This is best done by considering the truth table
first.

Example 3.3 The hall light of a house is controlled by two switches, one upstairs and
one downstairs. Design a switching circuit such that flicking either of the switches turns
the light on if it was off and off if it was on.

Solution. Let us say that the light is on when both switches are closed. By considering
what happens when either switch is flicked, it is easy to see that the truth table we require
is as follows.
p q light
1 1 1
1 0 0
0 1 0
0 0 1

Check the lines of the truth table to convince yourself that it satisfies the conditions of
the question in every state the switches can be in.
Now we use the truth table to construct a possible circuit. Notice that there are two
lines which produce an output of 1, ie that put the light on. If we make a branch of the
circuit for each of these and then set the branches in parallel, that will mean that either
of these combinations of switches will work.

23
We want one branch to allow flow when both switches are closed (so put p and q in
series) and the other to allow flow when both switches are open (so put p and q in series).
This gives:

(The diagram has been simplified by putting the switch-labels inside the switches. We
shall adopt this convention from now on.)

Example 3.4 Design a switching circuit in which a lamp lights up if the majority of
members of a committee of 3 vote ‘yes’ on a motion.

Solution. In lecture.

Example 3.5 Design a switching circuit to add binary digits.

Solution. In lecture.

3.3 The algebra of switching circuits


One drawback of this method for constructing circuits is that it may not give the simplest
answer. (By a simple circuit I mean one with a small number of switches.) Before we see
how to simplify circuits, let us introduce a notation for describing them.

The compound series switch will be denoted


by the product p.q

and the compound parallel switch will be


denoted by the sum p + q.

To find the algebraic expression for a more complicated circuit we break that circuit down
into parallel and series components.

24
Example 3.6 Represent the following circuits with algebraic expressions.

(i) (ii)
Solution. (i) The lower part consists of q and r in parallel and so is denoted by q + r.
This part is then put in parallel with p, giving p + (q + r). It is safer to use brackets when
first constructing algebraic expressions, to show the order in which the circuit has been
constructed, although in this case the expression is equivalent to (p + q) + r and so we
can just write p + q + r without ambiguity.
(ii) In lecture.
Note that, as with ordinary algebra, the convention is that products are carried out before
sums unless the brackets indicate otherwise. Thus p+q.r means p+(q.r) and not (p+q).r.

Example 3.7 Draw the circuit represented by the expression (p + q).(r + s).

Solution. In lecture.

3.4 Equivalences
We have used the terms product and sum and the symbols . and + to stand for series and
parallel, so we might wonder if there is any similarity with multiplication and addition in
ordinary algebra. It turns out that certain rules are the same, but not all.
Consider the following two circuits.

p.(q + r) p.q + p.r


It is easy to see that these two circuits are entirely equivalent. You could do this in-
formally by noting that to pass through either circuit you need to go through p and q or
else through p and r. More formally, you could construct the truth table for each circuit.
You will see that the truth tables are identical, and that is our definition of equivalent
circuits: if the same inputs produce the same outputs then the circuits are essentially the
same. So we have

25
(E1) p.(q + r) = p.q + p.r

(E1) is referred to as an (algebraic) identity because it is true for any switches, or even
mini-circuits, p, q and r in the same way that in ordinary algebra this would be true for
any numbers p, q and r: it is just our familiar ‘multiplying out of brackets’.
However, there is another identity for circuits which does not apply to ordinary algebra.

(E2) p + q.r = (p + q).(p + r)

This can again be seen by comparing the circuits visually or by constructing their truth
tables.

p + q.r (p + q).(p + r)
These identities involved 3 switches but there are a few which only involve 2 or even
only 1 switch.

(E3) p + p.q = p
(E4) p + p.q = p + q
(E5) p+p=p
(E6) p.p = p

There are two special circuits which we include in our algebra. 0 means ‘always open’, ie
no current can flow, and 1 means ‘always closed’, ie current can always flow. These can
be included in our equivalences. They behave a little like the numbers 0 and 1 but be
careful because the similarities cannot always be assumed.

(E7) p.1 = p
(E8) p+0=p
(E9) p.0 = 0
(E10) p+1=1
(E11) p.p = 0
(E12) p+p=1

Example 3.8 Prove the identities (E3) to (E12).

Solution. These can be done by considering the circuits visually. They can also be
confirmed by constructing the truth tables for both sides of the identity and noting that
they are the same. Some will be illustrated in lecture and the rest are left as an exercise.

26
Example 3.9 Express the following circuit algebraically and then simplify the expression
using the equivalences (E1) to (E12).

Solution. The top branch is p.(p+q) and the bottom branch is p+p.q. These are combined
in parallel and so the whole circuit can be expressed as p.(p + q) + (p + p.q).

p.(p + q) + (p + p.q)
= p.p + p.q + (p + p.q) (E1)
= p + p.q + (p + p.q) (E6)
= (p + p.q) + p (E3)
= p+p (E3)
= 1 (E12)

So there is always a flow through the circuit, whatever position the switches are in. Quite
a simplification!
There is an important point illustrated in step 4 concerning the use of the equivalences.
In specifying these identities we used p, q and r but of course these can be replaced by
any other switches or combinations of switches. Thus since p + p.q = p it also follows that
p + p.q = p.

Example 3.10 Look back to the majority voting circuit produced in Example 3.4. By
expressing it algebraically and simplifying the resulting expression, redraw the circuit with
fewer switches.

Solution. In lecture.

27
4 Venn Diagrams
4.1 Organising information
Venn diagrams were introduced in section 1.4 as a useful way of visualising sets and how
they relate to one another. We now look at some more uses of Venn diagrams. Firstly
they can be used to organise information effectively. Note that in questions involving sets
containing a large number of members we sometimes mark the number of elements in each
region of the Venn diagram rather than indicating each element individually.

Example 4.1 Of the 100 students in a first-year class, 42 had passed Higher Physics.
Of these, 11 had also passed Higher French. 45 of the class did not have a pass in either
Physics or French. Draw a Venn diagram to illustrate this situation and determine how
many of the students had passed French.

Solution. We start by drawing a blank 2-set Venn diagram (which I have labelled for
reference). Some of the information cannot immediately be filled in because it refers to
more than one of our regions. However, we can start with the 45 who have passed neither
subject (region(iv)) and the 11 who have passed both (region (ii)). Then we can complete
the Physics set (42 − 11 = 31 in region (i)). Finally, since there are 100 students in
the class (which must be the total of all the regions) we see that region (iii) contains
100 − 31 − 11 − 45 = 13 students.

This lets us see that the number of students who passed French is 24, the total of regions
(ii) and (iii) (NB not just region (iii) - they are the ones who passed French but not
Physics).

Example 4.2 Of 250 people questioned in Edinburgh yesterday, 137 said they normally
travelled by public transport when they went to Glasgow. Of these, 107 had at some time
used the train and 65 had gone by bus. How many of the people questioned used only the
train, how many only the bus and how many had used both?

Solution. In lecture.

28
If our problem involves 3 different sets, we need to draw 3 intersecting circles, which
divide the rectangle into 8 regions. The typical diagram looks like this.

Now, for example, set A consists of regions (i), (ii), (iv) and (v). Region (vii) has to be
described as ‘the members of C which are not in A or B’. ‘The members which are in
both B and C’ describes the two regions (v) and (vi).

Example 4.3 Of 540 students in the Department of Marketing,


406 take Business Studies;
125 take Computing Science; and
178 take Economics.
All but 40 of the students are studying at least one of these subjects and 24 are studying
all three. Of those studying Business Studies
63 are taking Computing Science; and
125 are taking Economics.
How many students are studying Computing Science and Economics but not Business
Studies?

Solution. In lecture. The final Venn diagram is shown and the answer is 21.

4.2 Probability
Venn diagrams can also be used to illustrate different events and hence to calculate the
probability of their occurrence.

29
Example 4.4 Two 4-sided dice (showing 1-4) are thrown. Let A be the event that the
sum of the numbers is 4 and let B be the event that the two numbers shown are equal.
What is the probability that (i) A occurs, (ii) B occurs and (iii) either A or B occurs,
when the dice are thrown?

Solution. There are 16 possible outcomes when the dice are thrown, which we shall denote
by (1,1), (1,2), (2,1) ... (4,4). Event A consists of the outcomes {(1,3), (2,2), (3,1)} and
event B consists of the outcomes {(1,1), (2,2), (3,3), (4,4)}. These can be represented
in a Venn diagram, but note that (2,2) occurs in both sets. Start completing the Venn
diagram from the centre.

1
Since the different outcomes are equally likely, each has a probability of 16 . We can now
3
see from the Venn diagram that since event A consists of 3 outcomes its probability is 16 ;
4 1
B consists of 4 outcomes, with probability 16 or 4 ; and the event A or B, corresponding
6
to the set A ∪ B, consists of 2 + 1 + 3 = 6 outcomes with probability 16 or 38 .

Example 4.5 Add a third event C to the previous example, that the product of the num-
bers on the two dice is odd. What is the probability that, on any throw of the dice, the
numbers are equal and either the sum is 4 or the product is odd, ie B and either A or C?

Solution. We now need a 3-set Venn diagram. C = {(1, 1), (1, 3), (3, 1), (3, 3)}. Since
2 of these outcomes are in A and 2 are in B but none are in both A and B we can now
adjust the Venn diagram for the previous example to become:

The shaded region is the part we are interested in, representing B ∩ (A ∪ C), and so the
3
probability is 16 .

30
4.3 Elementary logic
So far we have used Venn diagrams to help us count different categories but they are also
very useful when we do not know how many people are represented by each region, using
them in a more structural manner.

Example 4.6 (i) All students regularly attending lectures pass the course. Lazy students
do not regularly attend lectures. Does it follow that no lazy students pass the course?
(ii) All students regularly attending lectures pass the course. Lazy students do not pass
the course. Does it follow that no lazy students regularly attend lectures?

Solution. (i) Draw a 3-set Venn diagram to represent the qualities ‘attend lectures’, ‘pass’
and ‘lazy’.

The first statement tells us that regions (i) and (iv) are empty, since anyone in these parts
attends lectures but does not pass. The second statement tells us that regions (iv) and
(v) are empty. In the second diagram, the shaded regions are empty. However, region
(vi), marked X, is not necessarily empty and so it is possible that some lazy students pass
the course.
(ii) In lecture.

4.4 The algebra of Venn diagrams


Recall the definitions of union, intersection and complement from section 1.3.
The union of A and B, denoted by A ∪ B, is the set of those points which are in either
A or B (or both, but we usually don’t say ‘or both’).
The intersection of A and B, denoted by A ∩ B, is the set of those points which are in
both A and B.
The complement of A, denoted by A, is the set of those points which are not in A.

31
union: A ∪ B intersection: A ∩ B complement: A

Example 4.7 Draw Venn diagrams to represent the sets (i) A ∩ B


and (ii) (A ∩ B) ∪ (B ∩ A).

Solution. In lecture.

Example 4.8 (i) By drawing a sequence of 3-set Venn diagrams, illustrate A ∩ (B ∪ C)


and (A ∩ B) ∪ (A ∩ C).
(ii) Repeat for A ∪ (B ∩ C) and (A ∪ B) ∩ (A ∪ C)

Solution. In lecture.

Note that the two Venn diagrams in each part of the last example are identical. This
illustrates the very important distributive laws, that:

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

You should recognise the similarity between these two identities and the equivalences (E1)
and (E2) we had with switching circuits:

p.(q + r) = p.q + p.r (E1)


p + q.r = (p + q).(p + r) (E2)

This connection between switching circuits and Venn diagrams is not a coincidence! In
fact, all the equivalences we obtained for switching circuits have their analogies for Venn
diagrams.

Example 4.9 By drawing Venn diagrams, show that


(i) A ∪ (A ∩ B) = A (E3)
(ii) A ∪ (A ∩ B) = A ∪ B (E4).

32
Solution. Exercise.

De Morgan’s Laws
Two very important identities which we did not include with switching circuits are De
Morgan’s Laws, which tell us how to take complements of compound sets:

A∩B =A∪B A∪B =A∩B

Example 4.10 Illustrate De Morgan’s Laws using Venn diagrams.

Solution. In lecture

Note carefully what these laws say. The complement of an intersection is a union and
vice versa. These have clear parallels in everyday language.
For example, consider the set of bachelors who are both rich and handsome. Now take
a bachelor who is not in this set, ie he is in the complement of the set. He is either not
rich or not handsome. He does not have to be both not rich and not handsome (though
of course he may be!).
Similarly, consider the set of people who like either plain chocolate or milk chocolate.
Anyone not in this set must dislike both plain and milk chocolate.

4.5 Boolean algebra


The exact parallels between the algebra of Venn diagrams and the algebra of switching
circuits are in fact matched in other areas of mathematics and so give rise to what is called
Boolean algebra, named after the 19th century English mathematician George Boole, who
first developed it.
Before we pull together all the laws of Boolean algebra, we need the definitions that 0
will stand for the empty set (previously denoted ∅) and 1 will stand for the universal set,
ie the whole rectangle.

33
Boolean Algebra Identities
(B1) A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C) (B2) A ∪ (B ∩ C) = (A ∪ B) ∩ (A ∪ C)
(B3) A ∪ (A ∩ B) = A (B4) A ∩ (A ∪ B) = A
(B5) A ∪ (A ∩ B) = A ∪ B (B6) A ∩ (A ∪ B) = A ∩ B
(B7) A∪B =A∩B (B8) A ∩ B = A ∪ B
(B9) A=A
(B10) A∪A=A (B11) A∩A=A
(B12) A∪A=1 (B13) A∩A=0
(B14) A∪0=A (B15) A∩1=A
(B16) A∪1=1 (B17) A∩0=0
(B18) A∪B =B∪A (B19) A∩B =B∩A
(B20) A ∪ (B ∪ C) = (A ∪ B) ∪ C (B21) A ∩ (B ∩ C) = (A ∩ B) ∩ C
(B22) 0=1 (B23) 1=0

Note the duality between the identities in the two columns: those on the right can be
formed from those on the left by interchanging ∪ and ∩ and also interchanging 0 and 1.
These identities are not all independent: for example, (B5) can be deduced from (B2),
(B12), (B19) and (B15).
Some of these identities have special names:
(B1) and (B2) are distributive laws;
(B3) and (B4) are absorption laws;
(B5) and (B6) are redundancy laws;
(B7) and (B8) are De Morgan’s laws;
(B18) and (B19) are commutative laws; and
(B20) and (B21) are associative laws.
These identities can be extended to any compound sets. Thus, since A ∩ A = 0, it
follows that (B ∪ C) ∩ B ∪ C = 0 also.
Recall from Examples 1.2 and 1.4 that the associative laws allow us to write A ∪ B ∪ C
and A ∩ B ∩ C without brackets and with no ambiguity, but that any expression involving
both union and intersection must have brackets to indicate which operation is to be
performed first.

Example 4.11 Draw Venn diagrams to illustrate the following sets.


(i) A ∩ (B ∪ (A ∩ C))
(ii) B ∩ (A ∪ B ∪ (B ∩ C))
(iii) A ∩ (A ∪ B ∪ C)
(iv) A ∪ B ∪ C

Solution. (i) It is possible to construct the required area from its component pieces.

34
A∩C B ∪ (A ∩ C) A ∩ (B ∪ (A ∩ C))

Alternatively, the original expression can be simplified first, using the Boolean identities.
A ∩ (B ∪ (A ∩ C)) = (A ∩ B) ∪ (A ∩ A ∩ C) = (A ∩ B) ∪ (0 ∩ C) = (A ∩ B) ∪ 0 = A ∩ B
which gives the same Venn diagram very simply.
(ii)-(iv) In lecture.

Example 4.12 Find algebraic expressions for the following areas.

(i) (ii)

Solution. (i) Break the area up into bits for which expressions are known.

given area = A∩B ∪ B∩C

so one possible expression is (A ∩ B) ∪ (B ∩ C), though there are other equivalent expres-
sions.
(ii) In lecture.

35
Truth tables can also be used to solve Venn diagram problems. We use 1 to indicate
that we are in a set and 0 to mean that we are not.

Example 4.13 Draw Venn diagrams to represent the following sets by first constructing
a truth table for each one.
(i) (A ∩ B) ∪ (A ∩ B) (ii) A ∪ (B ∩ C)

Solution. (i) The 4 regions of the Venn diagram correspond to the 4 lines of the truth table.

region description A B B A∩B A A∩B (A ∩ B) ∪ (A ∩ B)


(ii) in both A and B 1 1 0 0 0 0 0
(i) in A but not B 1 0 1 1 0 0 1
(iii) in B but not A 0 1 0 0 1 1 1
(iv) in neither A nor B 0 0 1 0 1 0 0

(A ∩ B) ∪ (A ∩ B)
(ii) In lecture.

36
5 Guessing or Proving?
5.1 Induction
A common technique in investigative maths is to solve a general problem by first solving
it for some particular, usually small, numbers; then spot a pattern in the results; and
finally generalise this to all numbers. Sadly, the generalisation process is not always as
obvious as it looks.

Example 5.1 (i) Find a simple formula for 1 + 2 + 3 + 4 + · · · + n and hence find
1 + 2 + 3 + 4 + · · · + 100.
(ii) Draw a circle and mark n points on its circumference. Join every point to every other
point with a straight line. How many separate regions is the circle divided into?

Solution. In lecture.

The second example above shows that it is not always safe to say, “It works for 1, 2,
3 and 4 so it must work for all numbers”. We need to find a more rigorous approach to
such problems.

The Principle of Mathematical Induction (PMI)


To prove that the statement P (n) is true for all positive integers n:
(1) Prove that P (1) is true. (The base step.)
(2) Prove that, whenever P (k) is true, P (k + 1) is also true. (The inductive step.)
Then it follows that P (n) is true for all positive integers n.
Think of this in terms of a line of dominoes, all standing on end. If you knock over
the first domino [P (1)] and you know that whenever one domino falls over it takes the
next one with it [P (k) leads to P (k + 1)] then it must follow that every domino will be
knocked over.

Example 5.2 (i) Prove that 1 + 2 + 3 + 4 + ... + n = 12 n(n + 1) for all positive integers n.

(ii) Using the fact that log(ab) = log a + log b prove that
log(a1 a2 a3 . . . an ) = log a1 + log a2 + log a3 + · · · + log an for all positive integers n.

(iii) In matrix theory, using the fact that (AB)T = B T AT for all square matrices A,
B of the same order, prove that (M n )T = (M T )n for all positive integers n.

37
Solution. (i) Let P (n) be the statement 1 + 2 + 3 + 4 + · · · + n = 12 n(n + 1).
The base step P (1) says 1 = 21 .1.2, which is obviously true.
Let us assume that P (k) is true for some particular integer k,
ie 1+2+3+4+· · ·+k = 21 k(k +1). For the inductive step, we want to prove that P (k +1)
must also be true. P (k + 1) is the statement 1 + 2 + 3 + · · · + (k + 1) = 21 (k + 1)(k + 2).
LHS = 1 + 2 + 3 + · · · + (k + 1)
= (1 + 2 + 3 + · · · + k) + (k + 1)
= 21 k(k + 1) + (k + 1) by the induction hypothesis P (k)
1 1
= 2 k(k + 1) + 2 .2(k + 1)
= 12 (k + 1)(k + 2)
= RHS
so we have proved the inductive step, that P (k + 1) follows from P (k).
Hence 1 + 2 + 3 + 4 + · · · + n = 21 n(n + 1) for all positive integers n by the Principle
of Mathematical Induction.

(ii)-(iii) In lecture.

5.2 Summation of series


A series is a sum of terms, which can be either finite or infinite in length,
eg 1 + 3 + 5 + · · · + 19 or 1 + 0.1 + 0.01 + · · · The sum of the first is 100 and the sum
of the second is the recurring decimal 1.1111 . . . or 1 19 . Two special kinds of series are
arithmetic and geometric series.
Arithmetic Series. These are series in which successive terms differ by a constant
amount, the common difference. For example,
1 + 3 + 5 + 7 + 9 (common difference 2).
5 + 4 + 3 + 2 + 1 + 0 − 1 − 2 (common difference −1).
7 + 11 + 15 + 19 + · · · + 43 (common difference 4).
a + (a + d) + (a + 2d) + (a + 3d) + · · · + (a + (n − 1)d) (common difference d).

Example 5.3 Prove that the sum of n terms of the general arithmetic series

a + (a + d) + (a + 2d) + (a + 3d) + · · · + (a + (n − 1)d) = 12 n(2a + (n − 1)d).

Solution. In lecture.

38
Geometric Series. These are series in which successive terms are multiplied by a con-
stant factor, the common ratio. For example,
2 + 6 + 18 + 54 + · · · + 1458 (common ratio 3).
5 + 50 + 500 + 5000 + 50000 (common ratio 10).
8 + 4 + 2 + 1 + 21 + 14 + · · · (common ratio 21 ).
a + ar + ar2 + ar3 + ar4 + · · · (common ratio r).

Example 5.4 Prove that, provided r 6= 1,


a(1 − rn )
a + ar + ar2 + ar3 + · · · + arn−1 =
1−r
and that, provided |r| < 1,
a
a + ar + ar2 + ar3 + · · · = .
1−r
Solution. In lecture.

Example 5.5 Evaluate the following sums.


(i) 2 + 5 + 8 + 11 + · · · + 38
(ii) 3 + 43 + 163 3
+ · · · + 1024
(iii) 3 + 34 + 16
3
+ ···

Solution. (i) This is an arithmetic series with a = 2, d = 3 and n = 13.


Using Sn = 21 n(2a + (n − 1)d) gives S13 = 12 .13(4 + 12.3) = 260.
(ii) and (iii) in lecture.

Example 5.6 A wise man, having solved a particularly tricky problem for the king, was
allowed to choose his own reward. He asked for one grain of rice for the first square of a
chessboard, two for the second, four for the third, eight for the fourth and so on for the
entire board. This didn’t seem much to the king and he gladly agreed. How many grains
of rice would this amount to?

Solution. 1 + 2 + 22 + 23 + · · · + 263 is a geometric series with a = 1, r = 2 and n = 64.


a(1 − rn ) 1 − 264
Using Sn = gives S64 = = 264 − 1, ie almost twice as much as there is
1−r 1−2
on the last square alone.

There is a shorthand notation for sums of series, using Σ, the Greek letter sigma
(similar to our S), to stand for ‘sum’. Thus:
9
X
k 3 = 53 + 63 + 73 + 83 + 93
k=5

39
n
X
k = 1 + 2 + 3 + ··· + n
k=1
n
X
k 2 = 12 + 22 + 32 + · · · + n2
k=1
n
X
xk = 1 + x + x2 + x3 + · · · + xn
k=0
n
X
xr = 1 + x + x2 + x3 + · · · + xn
r=0

where the lower and upper labels on Σ indicate the range of values taken by k or r, the
index of summation. Note that the last two examples are exactly the same. The index
of summation is a dummy variable and can be replaced by any letter since it disappears
from the final expression.
It is often useful, particularly in proofs by induction, to note that
n+1
X
ar = a1 + a2 + a3 + · · · + an + an+1
r=1
n
X
= ar + an+1
r=1

Example 5.7 Prove by induction that the sum of the first n odd numbers is n2 .

Solution. Note that the nth odd number is 2n − 1 and let P (n) be the statement
1 + 3 + 5 + · · · + (2n − 1) = n2 .
Base step: P (1) says that 1 = 12 , which is clearly true.
Inductive step: suppose that P (k) is true for some k, ie 1 + 3 + 5 + · · · + (2k − 1) = k 2 .
We must prove that P (k + 1) is true, ie that 1 + 3 + 5 + · · · + (2(k + 1) − 1) = (k + 1)2 .

LHS = 1 + 3 + 5 + · · · + (2(k + 1) − 1)
= [1 + 3 + 5 + · · · + (2k − 1)] + (2k + 1)
= k 2 + (2k + 1) (by the induction hypothesis)
= (k + 1)2
= RHS

Hence the sum of the first n odd numbers is n2 for all positive integers n by the Principle
of Mathematical Induction.

40
5.3 Propositions and proofs
A proposition is a statement which is either true or false. Consider the following propo-
sitions.
(i) There is no largest prime number.
(ii) If A and B are matrices with AB = 0 then either A or B is the zero matrix.

(iii) 2 is a rational number.
(iv) If the matrix product AB is diagonal then so are the matrices A and B.
(v) If the product of two integers is even, then at least one of them is even.
(vi) If x2 > 1 then x > 1 where x is a real number.
There are a number of standard types of proof which can be useful when trying to
determine if such propositions are true or false.

5.3.1 Proof by Counterexample

If a proposition about all objects or a number of objects is suspected to be false, then


we only need to find one instance when it is false (a counterexample) to disprove the
proposition.

Example 5.8 Show that propositions (ii) and (iv) above are false.
!
0 1
Solution. (ii) Take A = B = . Then AB = 0 but neither A nor B is the zero
0 0
matrix.
(iv) In lecture.

5.3.2 Proof by Contradiction

The essence of a proof by contradiction is to assume that what you want to prove is not
true and prove that this leads to a contradiction, thus showing that your assumption must
have been wrong. This is sometimes known as reductio ad absurdum, ‘by reducing it to
the absurd’.

Example 5.9 Prove that propositions (i) and (v) above are true and that (iii) is false.

Solution. (v) Let us assume the opposite, ie we can find two odd integers p and q
with pq even. But p can be written 2n + 1 and q can be written 2m + 1 and so pq =
(2n + 1)(2m + 1) = 4mn + 2n + 2m + 1 = 2(2mn + n + m) + 1 which must be odd. This
is a contradiction and so our assumption must have been false, thus proving that (v) is
true.
(i) and (iii) in lecture.

41
5.3.3 Converse

Many propositions are of the form ‘if p then q’, where p and q are more basic propositions
(eg (ii), (iv), (v) and (vi) above). Such implications have a converse, formed by switching
round the if and then parts.

The converse of ‘if p then q’ is ‘if q then p’.

It is very important to note that, whether or not the original implication is true, the
converse may be true or false. There is no guarantee that a proposition and its converse
will be both true or both false.

Example 5.10 Determine whether the following implications are true or false. Give the
converse of each and decide whether the converse is true or false.
(i) If x > 1 then x2 > 1.
(ii) If Mariska is not Dutch then she is German.
(iii) If x = 6 then 2x − 3 = 9.

Solution. (i) The given proposition is true. The converse is “if x2 > 1 then x > 1”. This
is false: we could take −2 as a counterexample.
(ii) Unless we have some more information about Mariska, the given implication is false.
The converse is “if Mariska is German then she is not Dutch”. This is true.
(iii) In lecture.

If we know that the implication ‘if p then q’ is true, then we say that p is sufficient
for q to hold and that q is necessary for p to hold. This fits in with our everyday usage
of necessary and sufficient.

Example 5.11 Identify necessary and sufficient conditions in the following implications.
(i) If it is raining then the pavements are wet.
(ii) If John is the brother of Sarah then Sarah is the sister of John.

Solution. (i) ‘It is raining’ is sufficient but not necessary for the pavements to be wet.
‘The pavements are wet’ is a necessary but not sufficient condition for it to be raining. (I
may just have washed my car.)
(ii) In lecture.

42
5.3.4 Contrapositive

The contrapositive of ‘if p then q’ is ‘if not-q then not-p’. The contrapositive is logically
equivalent to the original implication, ie they are both true or both false. Consideration
of a few implications should easily convince you of this.
The proposition ‘if I lose my key then I shall be locked out’ is true. Its contrapositive
is ‘if I am not locked out then I have not lost my key’ and that is also true.
The proposition ‘if x = 5 then 2x = 7’ is false. Its contrapositive is ‘if 2x 6= 7 then
x 6= 5’ and that is also false.
A proof by contradiction is essentially using this equivalence. In Example 5.9 we
wanted to prove that if pq is even then p or q is even. Instead we proved the contrapositive:
if neither p nor q is even (ie both odd) then pq is not even.

Example 5.12 Give the contrapositive and the converse of each of these implications.
(i) If it snows tonight then I shall go skiing on Saturday.
(ii) Given that x > 10, if x is prime then x is odd.
(iii) If I am Scottish then I am British.

Solution. In lecture.

43
6 Propositional Calculus
Having looked at some of the basic terminology and tools for working with propositions,
we now go on to consider more ways of combining them.

If p and q are two propositions then:


p ∧ q means ‘both p and q’ (AND) (the conjunction of p and q);
p ∨ q means ‘either p or q (or both)’ (OR) (the disjunction of p and q);
p means ‘not p’ (NOT) (sometimes denoted by ¬p or ∼ p, the negation of p).

For example:
if p is the proposition ‘the sun is shining’
and q is the proposition ‘the birds are singing’
then p ∧ q denotes ‘the sun is shining and the birds are singing’,
p ∨ q denotes ‘the sun is shining or the birds are singing’, and
p denotes ‘the sun is not shining’.

Earlier we saw that the sets in Venn diagrams could be used to stand for propositions
and that, along with the operations ∩ and ∪, they formed a Boolean algebra. Note the
similarity in symbol and meaning between ∩ and ∧ (AND) and between ∪ and ∨ (OR).
It is therefore not surprising that the set of propositions, together with the signs ∧ and ∨
also form a Boolean algebra. All the laws we had for sets, Venn diagrams and switching
circuits apply to propositions also.

In particular, note De Morgan’s Laws: p∧q =p∨q and p ∨ q = p ∧ q.


For example, with p and q as above:
p ∧ q means the negation of ‘the sun is shining AND the birds are singing’ which
implies that either the sun is not shining OR the birds are not singing, in other words
p ∨ q.
p ∨ q means the negation of ‘the sun is shining OR the birds are singing’ which implies
that the sun is not shining AND the birds are not singing, in other words p ∧ q.

To complete the Boolean algebra, we need to find meanings for 1 and 0. 1 is the
proposition that is always true, called a tautology, and 0 is the proposition that is always
false, called a contradiction. Thus p ∨ p = 1 (eg either the sun is shining or the sun is not
shining - a tautology) and p ∧ p = 0 (eg the sun is shining and the sun is not shining - a
contradiction).
We say that two compound propositions are logically equivalent if they are different

44
ways of saying the same thing, eg p ∨ (p ∧ q) = p ∨ q. In this case the two propositions
will have the same truth table.

It is useful to have a symbol for the compound proposition ‘if p then q’, sometimes
called a conditional proposition. We shall denote this by ‘p → q’, read ‘p implies q’.
Although this looks like a new operation on the set of propositions, we shall see later that
it can in fact be expressed in terms of the existing operations and, or and not.

The converse of p → q is q → p. Remember that a conditional proposition and its


converse do not necessarily have the same truth value.

The contrapositive of p → q is q → p. A conditional proposition and its contrapositive


are logically equivalent.

The compound proposition (p → q) ∧ (q → p) is known as a biconditional statement


and is denoted by ‘p ↔ q’. Here the implication goes both ways: ‘p implies q and q implies
p’ or ‘p if and only if q’ or ‘q if and only if p’ or ‘p is a necessary and sufficient condition
for q’ or ‘q is a necessary and sufficient condition for p’ or ‘p is equivalent to q’. These all
mean the same thing.

6.1 Truth tables


Truth tables in propositional calculus use T for true and F for false, rather than the 1
and 0 that we used for switching circuits and Venn diagrams, but there is a clear parallel.
Again the conventional order of rows is TT, TF, FT, FF. With 3 basic propositions the
order is TTT, TTF, TFT, TFF, FTT etc.
We start with the 3 basic operations, and, or and not.

p q p∧q p q p∨q p p
T T T T T T T F
T F F T F T F T
F T F F T T
F F F F F F

From these three tables we can construct the truth tables for any compound proposition.

45
Example 6.1 Construct the truth tables for (i) (p∧q)∨(p∧q) and (ii) (p∨(p∧q))∧(p∨r).
Solution. (i) 1 2 3 4 5 6 7
p q p p ∧ q q p ∧ q (p ∧ q) ∨ (p ∧ q)
T T F F F F F
T F F F T T T
F T T T F F T
F F T F T F F
Column 3 is the negation of column 1. 4 is the conjunction of 2 and 3. 5 is the negation
of 2. 6 is the conjunction of 1 and 5. Finally 7 is the disjunction of 4 and 6.
(ii) In lecture.

The truth table for the conditional operator → is perhaps not as intuitively obvious as
the ones we have encountered so far. Consider the proposition ‘if the sun shines tomorrow
then I shall go for a walk’. If I know that this proposition is true, then it tells me what
will happen if the sun shines, but it tells me nothing about what will happen if the sun
does not shine: I may or may not go for a walk anyway.
Hence this is equivalent to ‘either the sun does not shine or it shines and I go for a
walk’, which in turn is equivalent to ‘either the sun does not shine or I go for a walk’.
Generalising, we can see that p → q is equivalent to p ∨ q and hence construct the
truth table for →.
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
The last two columns must be exactly the same since we have seen that the propositions
are logically equivalent. So p → q is false only when p is true and q is false, ie only when
a true proposition implies a false one. If p is false, this does not say anything about q and
so the implication is bound to be true.
Example 6.2 (i) Show by constructing truth tables that (p → q) ≡ (q → p). (The sign
≡ means ‘is logically equivalent to’.)
(ii) Show that (p ↔ q) ≡ ((p ∧ q) ∨ (p ∧ q)).
Solution. (i) p q p → q p q q p q→p
T T T T T F F T
T F F T F T F F
F T T F T F T T
F F T F F T T T

46
This shows that a conditional statement and its contrapositive have the same truth table
and so are logically equivalent. Alternatively, we could prove this by using Boolean algebra
equivalences:
q → p = q ∨ p = q ∨ p = p ∨ q = p → q.
(ii) In lecture.

6.2 Valid arguments


An argument is a sequence of statements
p1 , p2 , p3 , . . . , pn .· . pn+1
where the symbol .· . means ‘therefore’. p1 , . . . , pn are called premises and pn+1 is the
conclusion. An argument is said to be valid if whenever all the premises are true then
the conclusion is also true.

Consider the argument: If it is raining then it is cold.


It is not cold.
Therefore it is not raining.
If we denote ‘it is raining’ by r and ‘it is cold’ by c then this argument can be written
symbolically as r→c or r → c, c ; .· . r.
c
·
..r
We can test the validity of this argument with a truth table.
r c r→c c r
T T T F F
T F F T F
F T T F T
F F T T T
Only the 4th row has all (both) the premises true and in this case the conclusion is also
true: hence the argument is valid.
A critical row in a truth table is a row in which all the premises are true. An argument
is valid if in every critical row the conclusion is also true.
The validity of the argument above could also have been checked, without drawing the
truth table, by the method of contradiction. Suppose the argument is not valid. Then
there must be a critical row of the truth table where the conclusion is false. Thus
r→c true (1)
c true (2)
r false (3)

47
From (3), r is false so r must be true. From (1), since r is true c must be true. But from
(2) c is true so c must be false. This is a contradiction and so our assumption that the
argument is not valid must have been wrong. Hence the argument is valid.

Example 6.3 Determine whether the following argument is valid or not.

p → q, q∨r ; ∴ p→r

Solution. In lecture. Notice that in this example we are not told what the propositions
are. The point is that the validity of the argument is independent of the meaning of p, q
and r.

6.3 More notation


The quantifiers ∀ and ∃

∀ denotes ‘for all’, as in (∀x ≥ 2)(x2 ≥ 4).


∃ denotes ‘there exists’ or ‘for some’ or ‘for at least one’ as in ‘∃ a natural number n such
that n3 < 2n ’, abbreviated to (∃n ∈ N)(n3 < 2n ).
In general, ‘P (x) holds for all x in S’ is written ‘∀x ∈ S, P (x)’ or (∀x ∈ S)(P (x)).
Similarly, ‘P (x) holds for at least one x in S’ is written ‘∃x ∈ S such that P (x)’ or just
(∃x ∈ S)(P (x)). The phrase ‘such that’ can be abbreviated to ‘st’.

Negations involving quantifiers

The negation of ‘all people wear jeans’ is ‘some people do not wear jeans’, or even ‘at
least one person does not wear jeans’. It is not ‘no people wear jeans’.
The negation of ‘some people wear jeans’ is ‘no people wear jeans’.
In general, the negation of (∀x)(p) is (∃x)(p) and the negation of (∃x)(p) is (∀x)(p),
ie interchange ∀ and ∃ and negate whatever follows.

Example 6.4 Consider whether the following statements are true or false and write down
the negation of each one.
(i) (∀n ≥ 3)(n2 ≥ 50) (ii) (∃x > 3)(x2 < 20)
(iii) (∀n ∈ N)((n2 is divisible by 4)→ (n is divisible by 4)).

Solution. (i) (∀n ≥ 3)(n2 ≥ 50) is false. Take 3 as a counterexample. The negation is
(∃n ≥ 3)(n2 < 50) and, of course, this is true.
(ii) and (iii) In lecture.

48
6.4 Summing up
We have now seen 3 examples of Boolean algebra: switching circuits, sets (illustrated
by Venn diagrams) and propositional logic. We have also seen 3 ways of representing
problems: pictorially, by algebra and by truth tables. We even saw earlier that some
simple logic problems can be represented by Venn diagrams.
Some people find one of these ways easier as an aid to thinking and others prefer one
of the other methods. Unless a question specifies which method is required, it is up to
you to use the method that comes most easily to you.

49

You might also like