You are on page 1of 90

LECTURE NOTES

OF
DISCRETE MATHEMATICS

Lecture notes for Graduation/Post-graduation Students

By

Narinder Singh
Lovely Professional University
Phagwara

2022
Contents

1 Propositional Logic 1
1.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Proposition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.2.1 Method of producing new propositions from given propositions . . . . 3
1.2.2 Conditional Statements . . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.2.3 Truth Tables of Compound Propositions . . . . . . . . . . . . . . . . 15
1.2.4 Precedence of Logical Operators . . . . . . . . . . . . . . . . . . . . . 16
1.3 Application of Propositional Logic: . . . . . . . . . . . . . . . . . . . . . . . 16
1.3.1 Translating English Sentences . . . . . . . . . . . . . . . . . . . . . . 17
1.3.2 System Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
1.3.3 Logic Puzzles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
1.4 Logical Equivalences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
1.4.1 Classification of Compound propositions according to their truth value 22
1.5 Predicates and Quantifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
1.5.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
1.5.2 Predicates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
1.5.3 Quantifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
1.5.4 Qunatifiers with Restricted Domains . . . . . . . . . . . . . . . . . . 35
1.6 Introduction to Proof . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
1.6.1 Direct Proof . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
1.6.2 Proof by Contraposition . . . . . . . . . . . . . . . . . . . . . . . . . 40
1.6.3 Vacuous and Trivial Proofs . . . . . . . . . . . . . . . . . . . . . . . . 42
1.6.4 Proofs by Contradiction . . . . . . . . . . . . . . . . . . . . . . . . . 43
1.7 Mistakes in Proofs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
1.8 Some Basic selected Exercise Problems . . . . . . . . . . . . . . . . . . . . . 47

2 Reccurence relations 51
2.1 Reccurrence Relation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
2.2 Modeling with Recurrence Relations: . . . . . . . . . . . . . . . . . . . . . . 52
2.2.1 The colony of Bacteria . . . . . . . . . . . . . . . . . . . . . . . . . . 52
2.2.2 Compound Interest: . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
2.2.3 The Tower of Hanoi . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
2.3 Linear Homogeneous Recurrence Relations . . . . . . . . . . . . . . . . . . . 58
2.3.1 Shifting and Difference Operator . . . . . . . . . . . . . . . . . . . . 59

i
2.3.2 Solving Linear Homogeneous Recurrence relations with constant coef-
ficients of Degree 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
2.3.3 Exercise Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65

3 Counting principles and relations 67


3.1 Inclusion-Exclusion Principle . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
3.2 The Pigeonhole Principle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
3.3 The Generalized Pigeonhole Principle . . . . . . . . . . . . . . . . . . . . . . 69
3.4 Relation and Their Properties . . . . . . . . . . . . . . . . . . . . . . . . . . 71
3.5 Properties of Relations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
3.6 Combining Relations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
3.7 Representing Relations using Matrics and Graphs . . . . . . . . . . . . . . . 79
3.7.1 Reflexive relation and matix representation . . . . . . . . . . . . . . . 80
3.7.2 Symmetric Relations and Matrices . . . . . . . . . . . . . . . . . . . 81
3.7.3 Antisymmetric relations and Matrics . . . . . . . . . . . . . . . . . . 81
3.7.4 Union and Intersection of Relations and Matrices . . . . . . . . . . . 82
3.8 Partial Orderings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
3.9 Representing Relations using Digraphs . . . . . . . . . . . . . . . . . . . . . 85
Chapter 1

Propositional Logic

Course outcome UNIT 1: Understand several methods for proving


or disproving particular logical propositions.

1.1 Introduction

The rules of logic give precise meaning to mathematical statements.


These rules are used to distinguish between valid and invalid mathe-
matical arguements. We will teach reader how to construct and how
to understand mathematical logic.
Beside the importance of logic in understanding mathematical rea-
soning logic has numerous applications in computer science. These
rules are used in the design of computer circuits, the constructions of
computer programs, the varification of the correctness of programs,
and in many other ways. Furthermore software system has been
developed to constructing some, but not all, types of proofs auto-
matically. We will disscuss these applications of logic.

1
1.2. Proposition 2

1.2 Proposition

Definition 1.2.1
A proposition is a declarative sentence(that is, a sentence that
declares a fact) that is either true of false, but not both.

Example 1.2.1. Consider the following declarative sentences which


are propositions.
1. Delhi, is the capital of India.
2. 2+2=4.
3. 1+1=3
4. Toronto is the capital of Canada.
Propositions 1, 2 are true while the proposition 3, 4 are false as
1 + 1 ̸= 3 and Toronto is not a capital of Canada.
Some sentences that are not propositions are given in example 1.2.2:
Example 1.2.2. Consider the followinng sentences:
1. What time is it?
2. Read this carefully.
3. x + 1 = 2.
4. x + y = z.
Sentence 1, 2 are not propositions because they are not declarative
sentences. Sentence 3 and 4 can be turned into a proposition if we
assign values to the variables. We will also discuss other ways to turn
sentences such as these into propositions.
We use letters to denote propositional variables (state-
ment variables), that is, variables that represent propositions,
just as letters are used to denote numerical variables. The conven-
tional letters used for propositional variables are p, q, r, s, . . . The
3 Narinder Singh 1. Propositional Logic

truth value of a proposition is true, denoted by T, if it is a true


proposition, and the truth value of a proposition is false, denoted by
F, if it is a false proposition.
The area of logic that deals with propositions is called the propo-
sitional calculus or propositional logic. It is developed sys-
tematically by the Greek philospher Aristotle more than 2300 years
ago.

1.2.1 Method of producing new propositions from given proposi-


tions

We now turn our attention to methods for producing new proposi-


tions from those that we already have. These methods were discussed
by the English mathematician George Boole in 1854 in his book The
Laws of Thought. Many mathematical statements are constructed
by combining one or more propositions. New propositions, called
compound propositions, are formed from existing propositions
using logical operators.
Definition 1.2.2: Negation Operator
Let p be a proposition. The negation of p, denoted by ¬p(also
denoted by p̄), is a statement
“It is not the case that p.”
The proposition ¬p is read “not p.” The truth value of the nega-
tion of p, ¬p, is the opposite of the truth value of the p.

Example 1.2.3. Find the negation of the proposition.


“Michael’s PC runs Linux”
and express this in simple English.
1.2. Proposition 4

Solution: The negation is


“It is not the case that Michael’s PC runs Linux.”
This negation can be more simply expressed as
“Michael’s PC does not run Linux.”

Example 1.2.4. Find the negation of the proposition


“Vandana’s smartphone has atleast 32GB of memory”
and express this in simple English.

Solution: The negation is


“It is not the case that Vandana’s Smartphone has at least 32GB
of memory.”
This negation can be also be expressed as
“Vandana’s smartphone does not have atleast 32GB of memory.”
or more simply as “Vaandana’s smartphone has less than 32GB of
memory.”
The negation of the proposition can also be considered the result
of the operation of the negation operator on a proposition. The
negation operator constructs a new proposition from a single existing
proposition. We will now introduce the logical operators that are
used to form new propositions from two or more existing propositions.
These logical operators are also called connectives.

Definition 1.2.3
Let p and q be propositions. The conjuction of p and q,
denoted by p ∧ q, is the proposition “p and q.” The conjuction
p ∧ q is true when both p and q are true and is false otherwise.

Following is the truth table of p and q.


5 Narinder Singh 1. Propositional Logic

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

Table 1.1: Truth Table of p and q(p ∧ q)

This table has a row for each of the four possible combinations of
truth values of p and q. The four rows correspond to the pairs of the
truth values TT, TF, FT and FF, where first truth value in the pair
is truth value of p and second truth value is truth value of q.

Remark 1.2.1. In logic the word “but” sometimes is used instead of


“and” in conjuction. For example, the statement “The sun is shining,
but it is raining” is another way of saying “The sun is shining and it
is raining.”

Example 1.2.5. Find the conjuction of the propositions p and q


where p is the proposition “Rebecca’s PC has more than 16 GB
free hard disk space”, and q is the proposition “The processor in
Rebecca’s PC runs faster than 1 GHz.”
Solution: The conjuction of these propositions, p ∧ q, is the propo-
sition “Rebecca’s PC has more than 16 GB free hard disk space, and
the processor in Rebecca’s PC runs faster than 1GHz.” This conjuc-
tion can be expressed more simply as “Rebecca’s PC has more than
16 GB free hard disk space, and its processor runs faster than 1GHz.”
For this conjuction to be true, both conditions given must be true.
It is false, when one or both of these conditions are false.
1.2. Proposition 6

Definition 1.2.4
Let p and q be propositions. The disjunction of p and q,
denoted by p ∨ q, is the proposition “p or q” The disjunction
p ∨ q is false when both p and q are false and is true otherwise.

Make truth table of disjunction.


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

Table 1.2: Truth Table of p and q(p ∨ q)

The use of the connective or in a disjunction corresponds to one of


the two ways the word or is used in English, namely, as an inclusive
or. A disjunction is true when at least one of the two propositions
is true. For instance, the inclusive or is being used in the statement
“Students who have taken calculus or computer science can take this
class.”
Here, we mean that students who have taken both calculus and
computer science can take the class, as well as the students who have
taken one of the two subjects. On the other hand, we are using the
exclusive or when we say
“Students who have taken calculus or computer science, but not
both, can enroll in this class.”
Here, we mean that students who have taken both calculus and
computer science course cannot take the class. Only those who have
taken exactly one of the two courses can take the class.
Similarly, when a menu at a restaurant states, “Soup or salad
7 Narinder Singh 1. Propositional Logic

comes with an entree,” the restaurant almost always means that


customers can have either soup or salad, but not both. Hence, this
is an exclusive, rather than an inclusive, or.

Example 1.2.6. What is the disjunction of the propositions p and


q where p and q are the same propositions as in Example 1.2.5?
Solution: The disjunction of the propositions of p and q, p ∨ q, is
the proposition

“Rebecca’s PC has atleast 16 GB free hard disk space, or the


processor in Rebecca’s PC runs faster than 1 GHz.”

This proposition is true when Rebecca’s PC has at least 16 GB


free hard disk space, when the PC’s runs faster than 1GHz, and when
both conditions are true. It is false when both of these conditions
are false, that is, when Rebecca’s PC has less than 16 GB free hard
disk space and the processor in her PC runs at 1GHz or slower.
Remark: We have used inclusive or in disjunction. Sometime we
use or in an exclusive sense. When the exclusive or is used to connect
the propositions p and q, the proposition “p or q(but not both)” is
obtained. This proposition is true when p is true and q is false, and
when p is false and q is true. It is false when both p and q are false
and when both are true.

Definition 1.2.5
Let p and q be propositions. The exclusive or of p and q,
denoted by p ⊕ q, is the proposition that is true when exactly
one of p and q is true and is false otherwise.

Truth table for exclusive or:


1.2. Proposition 8

L
p q p q
T T F
T F T
F T T
F F F
L
Table 1.3: Truth Table of p and q (p q)

1.2.2 Conditional Statements

We will discuss several other important ways in which propositions


can be combined.

Definition 1.2.6
Let p and q be propositions. The conditional statement p → q
is the proposition “if p, then q.” The conditional statement
p → q is false when p is true and q is false, and true otherwise.
In the conditional statement p → q, p is called the hypothe-
sis(or antecedent or premise) and q is called the conclusion
(or consequence).

The statement p → q is called a conditional statement because


p → q asserts that q is true on the condition that p holds. A
conditional statement is also called an implication.
The following is a truth table for conditional statement p → q.

p q p→q
T T T
T F F
F T T
F F T
9 Narinder Singh 1. Propositional Logic

Note that the statement p → q is true when both p and q are true
and when p is false (no matter what truth value q has).
Because conditional statements play such an essential role in math-
ematical reasoning, a variety of terminology is used to express p → q.
You will encounter most if not all of the following ways to express
this conditional statement:
“if p then q” “if p, q”

“p is sufficient for q” “q if p”

“q when p” “a necessary condition for p is q”


“q unless ¬p”
“p implies q” “p only if q”
“a sufficient condition for q is p” “q whenever p”
“q necessary for p”

A useful way to understand the truth value of a conditional state-


ment is to think of an obligation or a contract. For example, the
pledge many politician make when running for office is

“If I am elected, then I will lower taxes.”

If politician is elected, voters would expect this politician to lower


the taxes. Furthermore, if the politician is not elected, then vot-
ers will not have any expectation that this person will lower taxes,
although the person may have sufficient influence to cause those in
power to lower taxes. It is only when politician is elected but does
not lower taxes that voters can say that the politician has broken the
campaign pledge. This last scenario corresponds to the case when p
is true but q is false in p → q.
Similarly, consider a statement that a professor might make:
1.2. Proposition 10

“If you get 100% marks on the final, then you will get an A.”
If you manage to get a 100% on the final, then you would expect
to receive an A. If you do not get 100% you may or may not receive
A depending on other factors. However, if you do get 100%, but
professor does not give you an A, you will feel cheated. ????
We illustrate the translation between conditional statements and
English statements in Example 1.2.7.
Example 1.2.7. Let p be the statement “Maria learns discrete
mathematics” and q is the statement “Maria will find a good job.”
Express the statement p → q as a statement in English.
Solution: From the definition of conditional statements, we see that
when p is the statement “Maria learns discrete mathematics” and q
is the statement “Maria will find a good job,” p → q represents the
statement
“If Maria learns discrete mathematics, then she will find a good job.”
There are many other ways to express this conditional statement
in English. Among the most natural of these are
“Maria will find a good job when she will learns discrete mathematics.”

Note that the way we have defined conditional statements is more


general than the meaning attached to such statements in English
language. For instance, the conditional statement in example 7 and
the statement
“If it is sunny, then we will go to the beach.”
are statements used in normal language where there is a relation-
ship between the hypothesis and the conclusion. Further, the first
of these statements is true unless Maria learns discrete mathematics,
but she does not get a good job, and the second is true unless it is
11 Narinder Singh 1. Propositional Logic

indeed sunny, but we do not go to the beach. On the other hand the
statement
“If Juan has a smartphone, then 2 + 3 = 6”
is true if Juan does not have a smartphone, even though 2+3=6
is false. We would not use these last two conditional statements
in natural language (except perhaps in sarcasm), because there is
no relationship between the hypothesis and the conclusion in either
statement. In mathematical reasoning, we consider conditional state-
ments of more general sort than we use in English. The mathematical
concept of a conditional statement is independent of a cause and ef-
fect relationship between hypothesis and conclusion. Our definition
of conditional statement specifies its truth values; it is not based on
English usage. Propositional language is an artificial language; we
only parallel English usage to make it easy to use and remember.
The if-then construction used in programming languages is differ-
ent from that used in logic. Most programming languages contain
statements such as if p then S, where p is a proposition and S is
a program segment (one or more statements to be executed). Then
execution of a program encounters such a statement, S is executed if
p is true, but S is not executed if p is false, as illustrated in Example
below:

Example 1.2.8. What is the value of the variable x after the state-
ment
if 2 + 2 = 4 then x := x + 1

if x = 0 before this statement is encountered? (The symbol :=


stabds for assignment.) The statement x := x + 1 means the assign-
ment of the value of x + 1 to x.
Because 2 + 2 = 4 is true, the assignment statement x := x + 1
1.2. Proposition 12

is executed. Hence, x has the value 0 + 1 = 1 after this statement is


encountered.

CONVERSE, CONTRAPOSITIVE, AND INVERSE


We can form some new conditional statements starting with a condi-
tional statement p → q. In particular, there are three related condi-
tional statements that occurs so often that they have special names.
The proposition q → p is called converse of p → q. The contra-
positive of p → q is the proposition ¬q → ¬p. The proposition
¬p → ¬q is called the inverse of p → q. We will see that of these
three conditional statements fromed from p → q, only the contra-
positive always has the same truth value as p → q.
We first show that the contrapositive, ¬q → ¬p, of a conditional
statement p → q always has the same truth value as p → q. To see
this, note that the contrapositive is false only when ¬p is false but ¬q
is true, that is, only when p is true and q is false. We now show that
neither the converse, q → p, nor the inverse, ¬p → ¬q, has the same
truth value as p → q for all possible truth values of p and q. Note
that when p is true and q is false, the orignal conditional statement
is false, but the converse and inverse are both true.
When two compound propositions always have the same truth
value we call them equivalent, so that a conditional statement and
its contrapositive. The converse and the inverse of a conditional
statement are also equivalent, as the reader can verify, but neither
is equivalent to the original conditional statement. (We will study
equivalent propositions in sec 1.4) Take note that one of the most
common logical errors is to assume the converse or the inverse of a
conditional statement is equivalent to this conditional statement.
We illustrate the use of conditional statement in Example below.
13 Narinder Singh 1. Propositional Logic

Example 1.2.9. What are the contrapositive, the converse, and


the inverse of the conditional statement
“The home team wins whenever it is raining?”

Solution: Because “ q whenever p” is one of the ways to express the


conditional statement p → q, the original statement can be rewritten
as
“If it is raining, then the home team wins.”
Consequently, the contrapositive of this conditional statement is
“If the home team does not win, then it is not raining.”
The inverse is
“If it is not raining, then the home team does not win.”
Only the contrapositive is equivalent to the original statement.

BICONDITIONALS We now introduce another way to com-


bine propositions that expresses that two propositions have the same
truth value.

Definition 1.2.7
Let p and q be propositions. The biconditional statement
p ↔ q is the proposition “p if and only if q.” The bicon-
ditional statement p ↔ q is true when p and q have the same
truth values, and is false otherwise. Biconditional statements
are also called bi-implications.

The truth table for p ↔ q is shown below:


1.2. Proposition 14

p q p↔q
T T T
T F F
F T F
F F T

Table 1.4: Truth Table of p and q(p ∧ q)

Note that the statement p ↔ q is true when both the conditional


statements p → q and q → p are true and is false otherwise. That is
why we use the words “if and only if” to express this logical connective
and why it is symbolically written by combining the symbol → and
← . There are some other common ways to express p ↔ q :
“p is necessary and sufficient for q”
“if p then q, and conversely”
“p iff q.”
Note that p ↔ q has exactly the same truth value as (p → q) ∧
(q → p).
Example 1.2.10. Let p be the statement “You can take the flight,”
and let q be the statement “You buy a ticket.” Then p ↔ q is the
statement
“You can take the flight if and only if you buy a ticket.”
This statement is true if p and q are either both true or both false,
that is, if you buy a ticket and can take the flight or if you do not
buy a ticket and you cannot take the flight. It is false when p and q
have the opposite truth values, that is when you buy a ticket but you
cannot take the flight (such as when airline bumps you) and when
you do not buy a ticket, but you can take the flight (such as when
you get a free trip)
15 Narinder Singh 1. Propositional Logic

1.2.3 Truth Tables of Compound Propositions

We have now introduced four important logical connectives-conjuctions,


conditional statements, and biconditional statements-as well as nega-
tions. We can use these connectives to build up complicated com-
pound propositions involving number of propositional variables. We
can use truth tables to determine the truth values of these compound
propositions, as next example illustrates.

Example 1.2.11. Construct the truth table of the compound propo-


sition (p ∨ q) → (p ∧ q).

Solution: Because this proposition involves two propositional vari-


ables p and q, there are four rows in this truth table, one for each of
the pairs of truth values T T, T F, F T and F F.
Following is the truth table:

p q ¬q p ∨ ¬q p∧q (p ∨ ¬q) → (p ∧ q)
T T F T T T
T F T T F F
F T F F F T
F F T T F F

Table 1.5: Truth Table of (p ∨ ¬q) → (p ∧ q)


1.3. Application of Propositional Logic: 16

1.2.4 Precedence of Logical Operators

How we should compute 2 + 3 − 5 × 10 ÷ 5? Well, we know this


can be done with the BODMAS rule very easily. Now such situation
may arise in case of logical operators also, like how to compute truth
value of
p ∧ q ∨ r ∧ ¬p → q?
The answer to this is given by the following table.
Operator Precedence
¬ 1 We can construct compound propositions using negation oper-
∧ 2 ator and the logical operators defined so far. We will generally
∨ 3 use parantheses to specify the order in which logical operators in
a compound proposition are to be applied. However to reduce
→ 4
the number of paranthesis we specify that the negation operator
↔ 5 is to be applied before all other logical operators. The order for
other is given in table 1.6.
Table 1.6: Precedence of
Logical Operators

1.3 Application of Propositional Logic:

Logic has many applications to mathematics, computer science, and


numerous other disciplines. Statements in mathematics and the sci-
ences and in natural language often are not precise or ambiguous. To
make such statement precise they can be translated into the language
of logic. For example, logic is used in the specification of software
and hardware, because these specifications need to be precise before
development begins. Furthermore, propositional logic and its rules
can be used to design computer circuits, to construct computer pro-
grams, to verify the correctness of the programs, and to build expert
systems. Logic can be used to analyze and solve many familiar puz-
zles. Software systems based on the rules of logic have been developed
17 Narinder Singh 1. Propositional Logic

for constructing some, but not all, types of proofs automatically. We


will discuss some of these applications of propositional logic in this
section and in later chapters.

1.3.1 Translating English Sentences

There are many reasons to translate English sentences into expres-


sions involving propositional variables and logical connectives. In
particular, English (and every other human language) is often am-
biguous. Translating sentences into compound statements (and other
types of logical expressions, which we will introduce in this chapter)
removes the ambiguity. Note that this may involve making a set of
reasonable assumptions based on the intended meaning of the sen-
tence. Moreover, once we have translated sentencs from English into
logical expressions we can analyze these logical expressions to deter-
mine their truth values, we can manipulate them, and we can use
rules of inference (which are discussed in section 1.6) to reason about
them.
To illustrate the process of translating an English sentence into a
logical expression, consider Example 1.3.1 and 1.3.2.
Example 1.3.1. How can this English sentence be translated into
logical expression?
“You can access the Internet from campus only if you are a
computer science major or you are not a freshman”
Solution: There are many ways to translate this sentence into a
logical expression. Although it is possible to represent the sentence
by a single propositional variable, such as p, this would not be useful
when analyzing its meaning or reasoning with it. Instead, we will use
propositional variables to represent each sentence part and determine
1.3. Application of Propositional Logic: 18

the appropriate logical connectives between them. In particular we


let
a = “You can access the Internet from campus”
c = “You are a computer science major”
f = “You are a freshman”
Noting that “only if” is one way a conditional statement can be
expressed, this sentence can be represented as

a → (c ∨ ¬f ).

Example 1.3.2. How can this English sentence be translated into


a logical expression? “You cannot ride the roller coaster if you are
under 4 feet tall unless you are older than 16 year old.”

Solution: Let q = “You can ride the roller coaster”


r = “You are under 4 feet tall”
s = “You are older than 16 years old.” Then the sentence can be
translated to
(r ∧ ¬s) → ¬q.
There are also other ways to represents original sentence as logical
expression, but the one we have used should meet our needs.

1.3.2 System Specifications

Translating sentences in natural language (such as english) into log-


ical expression is an essential part of specifying both hardware and
software systems. System and software engineers take requirements
in natural language and produce precise and unambiguous specifica-
tions that can be used as the basis for sytem development. Example
3 shows how compound propositions can be used in this process.
19 Narinder Singh 1. Propositional Logic

Example 1.3.3. Express the specification “The automated reply


cannot be sent when the file system is full” using logical connectives.
Solution: The only way to translate this is to let
p = “ The automated reply can be sent”
q =“The file system is full” Therefore

q → ¬p.

System specifications should be consistent, that is, they should


not contain conflicting requirements that could be used to derive a
contradiction. When specifications are not consistent, there would
be no way to develop a system that satisfies all specifications.

Example 1.3.4. Determine whether these system specifications are


consistent:
“The diagnostic message is stored in the buffer or it is retransmit-
ted.”
“The diagnostic message is not stored in the buffer.”
“If the diagnostic message is stored in the buffer, then it is retrans-
mitted.”
Solution: To determine whether these specifications are consistent,
we first express them using logical expressions. Let
p denote “The diagnostic message is stored in the buffer” and let
q denote “The diagnostic message is rettrasmitted.”
Then the specifications can be rewritten as
p ∨ q, ¬p, p → q.
An assignment of truth values that makes all three specifications
true must have p false to make ¬p ture. Because we want p ∨ q to
be true but p must be false, q must be true.
1.3. Application of Propositional Logic: 20

Example 1.3.5. Do the system specifications in Example 1.3.4 re-


main consistent if the specification “The diagnostic message is not
retransmitted” is added?
Solution: By the reasoning in previous Example, the three specifi-
cations from that example are true only in the case when p is false
and q is true. However new specification is ¬q, which is false when
q is true. However this new specification is ¬q, which is false when
q is true. Consequently, these four specifications are inconsistent.

1.3.3 Logic Puzzles

Puzzles can be solved using logical reasoning known as logic puzzles.


Solving logic puzzle is an excellent way to practice working with
the rules of logic. Also, computer programs designed to carry out
logical reasoning often use well-known logic puzzles to illustrate their
capabilities. Many people enjoy solving logic puzzles, published in
periodicals, books, and on the Web, as a recreational activity.
We will discuss two logic puzzles here.
Example 1.3.6. (Raymond Smullyan) An island has two kinds of
inhabitants, knights, who always tell the truth, and their opposites,
knaves who always lie. You encounter two people A and B. What
are A and B if A says “B is a knight” and B says “The two of us are
of opposite types”?
Solution: Let

p= A is knight
q= B is knight. Therefore
¬p = A is knave
¬q = B is knave
21 Narinder Singh 1. Propositional Logic

Let us first consider the possibility that A is knight; i.e. p is true.


If A is knight, then he is telling the truth when he says that B is
knight, then B’s statement that A and B are of opposite types, the
statement (p ∧ ¬q) ∨ (¬p ∧ q), would have to be true, which it is not,
because A and B are both knights. Consequently we can conclude
that A is not knight, that is, that p is false.
If A is knave, then because everything a knave says is false, A’s
statement that B is knight, that is, q is false and B is also a knave.
Furthermore, if B is knave, then B’s statement that A and B are of
opposite types is a lie, which is consistent with both A and B being
knaves. We can conclude that both A and B are knaves.

1.4 Logical Equivalences

An important type of step used in mathematical arguement is the


replacement of a statement with another statement with the same
truth value. Because of this, methods that produce the proposition
with the same truth value as a given compound proposition are used
extensively in the constrction of mathematical arguements.
1.4. Logical Equivalences 22

1.4.1 Classification of Compound propositions according to their


truth value

Definition 1.4.1
A compound proposition that is always true, no matter what
the truth values of the proposition variables that occur in it, is
called tautology.
A compound proposition that is always false is called a con-
tradiction.
A compound proposition that is neither a tautology nor a con-
tradiction is called a contingency.

Tautologies and contradictions are often important in mathemat-


ical reasoning. Example 1.4.1 illustrate these types of compound
propositions.

Example 1.4.1. Consider the truth table of p ∨ ¬p and p ∧ ¬p.


Because p ∨ ¬p is always true, it is tautology. Because p ∧ ¬p is

p ¬p p ∨ ¬p p ∧ ¬p
T F T F
F T T F

always false, it is a contradiction.

Compound proposition which have the same truth values in all


possible cases are called logically equivalent.
23 Narinder Singh 1. Propositional Logic

Definition 1.4.2
The compound propositions p and q are called logical equiv-
alent if p ↔ q is a tautology. The notation p ≡ q denotes that
p and q are logically equivalent. Somtime symbol ⇐⇒ is used
instead of ≡ .

De Morgan’s Laws
¬(p ∧ q) ≡ ¬p ∨ ¬q
¬(p ∨ q) ≡ ¬p ∧ ¬q
Example 1.4.2. Show that ¬(p ∧ q) ≡ ¬p ∨ ¬q.
Solution: This is clear from the truth table of these propositions.
p q ¬p ¬q ¬p ∨ ¬q (p ∧ q) ¬(p ∧ q)
T T F F F T F
T F F T T F T
F T T F T F T
F F T T T F T

Table 1.7: Precedence of Logical Operators

Example 1.4.3. Show that p → q and ¬p ∨ q are logically equiv-


alent.
We will now establish a logical equivalence of two compound propo-
sition involving three different propositional variables p, q and r. To
use a truth table to establish such a logical equivalence, we need eight
rows, one for each possible combination of truth values of these three
variables.
Example 1.4.4. Show that p ∨ (q ∧ r) and (p ∨ q) ∧ (p ∨ r) are
logically equivalent.
1.4. Logical Equivalences 24

In next table, T denotes tautology and F denotes contradiction.

Logical Equivalences.
Equivalence Name
p∧T ≡p Identity Laws
p∨F ≡p
p∨T ≡T Domination Laws
p∧F ≡F
p∨p≡p Idempotent Laws
p∧p≡p
¬(¬p) ≡ p Double negation law
p∨q ≡q∨p Commutative laws
p∧q ≡q∧p
p∨q ≡q∨p Associative laws
p∧q ≡q∧p
p ∨ (q ∧ r) ≡ (p ∨ q) ∧ (p ∨ r) Distributive laws
p ∧ (q ∨ r) ≡ (p ∧ q) ∨ (p ∧ r)
¬(p ∨ q) ≡ ¬p ∧ ¬q De Morgan’s laws
¬(p ∧ q) ≡ ¬p ∨ ¬q
p ∨ (p ∧ q) ≡ p Absorption laws
p ∧ (p ∨ q) ≡ p
p ∨ ¬p ≡ T Negation Laws
p ∧ ¬p ≡ F

Table 1.8
25 Narinder Singh 1. Propositional Logic

Exercise
Prove the following logical equivalences involving conditional state-
ments:

• p → q ≡ ¬p ∨ q.

• p → q ≡ ¬q → ¬p.

• p ∨ q ≡ ¬p → q

• p ∧ q ≡ ¬(p → ¬q)

• ¬(p → q) ≡ p ∧ ¬q

• (p → q) ∧ (q → r) ≡ p → (q ∧ r)

• (p → r) ∧ (q → r) ≡ (p ∨ q) → r

• (p → q) ∨ (p → q) ≡ p → (q ∨ r)

• (p → q) ≡ (p ∧ q) → r

Prove the following logical equivalences involving biconditional state-


ments

• p ↔ q ≡ (p → q) ∧ (q → p)

• p ↔ q ≡ ¬p ↔ ¬q

• p ↔ q ≡ (p ∧ q) ∨ (¬p ∧ ¬q)

• ¬(p ↔ q) ≡ p ↔ ¬q
1.5. Predicates and Quantifiers 26

1.5 Predicates and Quantifiers

1.5.1 Introduction

Propositional logic, studies in sections 1.1-1.3, cannot adequately


express the meaning of all statements in mathematics and in natural
language. For example, suppose that we know
“Every computer connected to the university network is function-
ing properly.”
No rules of propositional logic allow us to conclude the truth of
the statement
“MATH3 is functioning properly”
Where MATH3 is one of the computers connected to the university
network. Likewise we cannot use the rules of propositional logic to
conclude from the statement
“CS2 is under attack by and intruder,”
where CS2 is a computer on the university network, to conclude
the truth of
“There is a computer on the university network that is under at-
tack by an intruder.”
In this section we will introduce a more powerful type of logic
called predicate logic. We will see how predicate logic can be used
to express the meaning of wide range of statements in mathematics
and computer science in ways that premits us to reason and explore
relationships between objects. To understand predicate logic first we
need to introduce the concept of a predicate. Afterward, we will in-
troduce the notion of quantifiers, which will enable us to reason with
statements that assert that a certain property holds for all objects of
a certain type and that with statements that assert the existence of
an object with a particular property.
27 Narinder Singh 1. Propositional Logic

1.5.2 Predicates

Statements involving varibales, such as


“x > 3, x = y + 3, “x + y = z, ”
and “computer x is functioning properly,”
are often found in mathematical assertions, in computer programs,
and in system specifications. These statements are neither true nor
false when the values of the variables are not specified. In this section
we will discuss the ways that propositions can be produced from such
statements.
Definition 1.5.1
A predicate is a sentence that contains a finite number of
variables and becomes a statement when specific values are sub-
stituted for the variables. The domain of a predicate variable
is the set of all values that may be substituted in place of the
variable.

The statement “x is greater than 3” has two parts. The first part,
the variable x, is the subject of the statement. The second part-the
predicate, “is greater than 3”-refers to a property that the subject
of the statement can have. We denote the statement “x is greater
than 3” by P (x), where P denotes the predicate “is greater than 3”
and x is a variable. The statement P (x) is also said to be the value of
propositional function P at x. Once a value has been assigned
to the variable x, the statement P (x) becomes a proposition and has
a truth value. Consider the following examples:
Example 1.5.1. Let P (x) denotes the statement “x > 3.” What
are the truth values of P (4) and P (2)?
1.5. Predicates and Quantifiers 28

Solution: We obtain the statement P (4) by setting x = 4 in the


statement “x > 3.” Hence P (4), which is the statement “4 > 3”, is
true. However, P (2) which is that statement “2 > 3,” is false.
Example 1.5.2. Let A(x) denote the statement “Computer x is
under attack by an intruder.” Suppose that of the computers on cam-
pus, only CS2 and MATH1 are currently under attack by intruders.
What are truth values of A(CS1), A(CS2), and A(M AT H1)?
Solution: We obtain the statement A(CS1) by setting x = CS1
in the statement “Computer x is under attack by an intruder.” Be-
cause CS1 is not in the list of computers currently under attack, we
conclude that A(CS1) is false. Similarly, because CS2 and MATH1
are on the list of computers under attack, we know that A(CS2) and
A(M AT H1) are true.
We can also have statements that involve more than varibale. For
instance, consider the statement “x = y + 3.” We can denote this
statement by Q(x, y), where x, y are variables and Q is the predicate.
When values are assigned to the variables x and y, the statement
Q(x, y) has a truth value.
Example 1.5.3. Let Q(x, y) denote the statement “x = y + 3.”
What are the truth values of the proposition Q(1, 2) and Q(3, 0)?
Solution: To obtain Q(1, 2), set x = 1 and y = 2 in the statement
Q(x, y). Hence, Q(1, 2) is the statement “1 = 2 + 3,” which is false.
The statement Q(3, 0) is the proposition “3 = 0 + 3,” which is true.
Example 1.5.4. Let A(c, n) denote the statement “Computer c
is connected to network n,” where c is a variable representing a
computer and n is a variable representing a network. Suppose that
a computer MATH1 is connected to network CAMPUS2, but not to
29 Narinder Singh 1. Propositional Logic

the network CAMPUS1. What are the truth values of A(MATH1,


CAMPUS1) and A(MATH1, CAMPUS2)?

Example 1.5.5. Let P (x) be the predicate “x 2


> x” with domain
the set R of all real numbers. Write P (2), P 2 , and P 2 , and
   
1 −1

indicate which of these statements are true and which are false.

1.5.3 Quantifiers

When the variables in a propositional function are assigned values,


the resulting statement becomes a proposition with a certain truth
value. However, there is another important way, called quatifica-
tion, to create a proposition from a propositional function. Quantifi-
cation expresses the extent to which a predicate is true over a range
of elements. In English, the words all, some, many, few, none are
used in quantifications. We will focus on two types of quantification
here: universal quantification, which tells us that a predicate is ture
for every element under consideration, and existential quantification,
which tells us that there is one or more element under considera-
tion, and existential quantificaiton, which tells us that there is one
or more elements under consideration for which the predicate is true.
The area of logic that deals with predicates and quantifiers is called
the predicate calculus.

THE UNIVERSAL QUANTIFIER ∀ : Many mathemati-


cal statements assert that a property is true for all values of a variable
in a particular domain, called the domain of discourse(or the
universe of discourse), often just referred to as the domain.
Such a statement is expressed uning universal quantification. The
1.5. Predicates and Quantifiers 30

universal quantification of P (x) for a particular domain is the propo-


sition that asserts that P (x) is true for all values of x in this domain.
Note that the domain specifies the possible values of the variable x.
The meaning of the universal quantification of P (x) changes when
we change the domain. The domain must be specified when a uni-
versal quantifier is used; without it, the universal quantification of a
statement is not defined.
Definition 1.5.2
The universal quatification of P (x) is the statement
“P (x) for all values of x in the domain.”
The notation ∀ x P (x) denotes the universal quatification of
P (x). Here ∀ is called the universal quantifier. We read
∀ x P (x) as “for all x P (x)” or “for every x P (x).” An ele-
ment for which P (x) is false is called a counterexample of
∀ x P (x).

Quantifiers
Statement When True? When False?
∀ x P (x) P (x) is true for every x. There is an x for which P (x) is false.
∃ x P (x) There is an x for which P (x) is true. P (x) is false for every x.

Table 1.9: Quantifiers

Example 1.5.6. Let P (x) be the statement “x + 1 > x,” What


is the truth value of the quantification ∀ x P (x), where the domain
consist of all real numbers?
Solution: Because P (x) is true for all real numbers x, the quan-
tification ∀ x P (x) is true.
31 Narinder Singh 1. Propositional Logic

Besides “for all” and “for every,” universal quantifiction can be


expressed in many other ways, including “all of,” “for each,” “given
any,” “for arbitrary,” and “for any.”
A statement ∀ x P (x) is false, where P (x) is a propositional
function, if and only if P (x) is not always true when x is in the
domain. One way to show that P (x) is not always true when x is in
the domain is to find a counterexample to the statement ∀ x P (x).
Note that a single counterexample is all we need to establish that
∀ x P (x) is false. Following example illustrate this

Example 1.5.7. Let Q(x) be the statement “x < 2.” What is the
truth value of the quantification ∀ x Q(x), where the domain consists
of all real numbers?
Solution: Q(x) is not true for every real number x, because, for
instance, Q(3) is false. That is x = 3 is a counterexample for the
statement ∀ x Q(x). Thus ∀ x Q(x) is false.

Example 1.5.8. Suppose that P (x) is “x2 > 0.” To show that the
statement ∀ x P (x) is false where the universe of discouse (domain)
consists of all integers, we give a counterexample. We see that x = 0
is a counterexample because x2 = 0 when x = 0, so that x2 is not
greater than 0 when x = 0.

When all the elements of the domain can be listed-say x1, x2, . . . , xn
-it follows that the universal quantification ∀ x P (x) is same as the
conjuction.

P (x1) ∧ P (x2) ∧ · · · ∧ P (xn),

because this conjuction is true if and only if P (x1), P (x2), . . . , P (xn)


are all true.
1.5. Predicates and Quantifiers 32

Example 1.5.9. What is the truth value of ∀ x P (x) , where P (x)


is the statement “x2 < 10” and the domain consists of the positive
integers not exceeding 4?
Solution: The statement ∀ x P (x) is the same as the conjuction
P (1) ∧ P (x2) ∧ P (x3) ∧ P (x4), because the domain consist of the
integers 1, 2, 3, 4. Because P (4), which is the statement “42 < 10” is
false, it follows that ∀ x P (x) is false.
Example 1.5.10. What does the statement ∀ x P (x) mean if N (x)
is “Computer connected to the network” and the domain consists of
all computers on campus?
Solution: The statement ∀ x P (x) means that for every computer
x on campus, that computer x is connected to the network. This
statement can be expressed in English as “Every computer on campus
is connected to the network.”
Remark: Specifying domain is mandatory when quantifiers are
used. The truth value of a quantified statement often depends on
which elements are in this domain, the example 1.5.11 shows
Example 1.5.11. What is the truth value of ∀x (x2 ≥ x) if the
domain consists of all real numbers? What is the truth value of this
statement if the domain consists of all integers?
Solution: The universal quantification ∀x (x2 ≥ x), where  2
the
domain consists of all real numbers, is false. For example, 21 ̸≥ 12 .
Note that x2 ≥ x if and only if x2 −x = x(x−1) ≥ 0. Consequently,
x2 ≥ x if and only if x ≤ 0 or x ≥ 1. It follows that ∀x (x2 ≥ x) is
false if the domain consists of all real numbers (because the inequality
is false for all real numbers x with 0 < x < 1). However, if the
domain consists of the integers, ∀x (x2 ≥ x) is true, because there
are no integers x with 0 < x < 1.
33 Narinder Singh 1. Propositional Logic

THE EXISTENTIAL QUANTIFIER Many mathemati-


cal statements assert that there is an element with a certain property.
Such statements are expressed using existential quantification.

Definition 1.5.3
The existential quantification of P (x) is the proposition
“There exists an element x in the domain such that P (x).”
We use the notation ∃ x P (x) for the existential quantification
of P (x). Here ∃ is called the existential quantifier.

Remark 1.5.1. A domain must always be specified when a state-


ment ∃ x P (x) is used. Furthermore, the meaning of ∃ x P (x)
changes when the domain changes. Without specifying the domain,
the statement ∃ x P (x) has no meaning.
We can also express existential quantification in many other ways,
such as by using the words “for some,” “for atleast one,” or ”there
is.” The existential quantification ∃ x P (x) is read as
• “There is an x such that P (x),”
• “There is at least one x such that P (x),”
• “For some x P (x).”
Example 1.5.12. Let P (x) denote the statement “x > 3.” What
is the truth value of the quantification ∃ x P (x) where the domain
consists of all real numbers?
Solution: Because “x > 3” is sometimes true-for instance, when
x = 4−the existential quantification of P (x), which is ∃ x P (x) , is
true.
1.5. Predicates and Quantifiers 34

Remark 1.5.2. Oberserve that the statement ∃ x P (x) is false if


and only there is no element x in the domain for which P (x) is true.
That is, ∃ x P (x) is false if and only if P (x) is false for every element
of the domain.
Example 1.5.13. Let Q(x) denote the statement “x = x + 1.”
What is the truth value of the quantification ∃ x Q(x), where the
domain consist of all real numbers?
Solution: Because Q(x) is false for every real number x, the
existential qualification of Q(x) which is ∃ x Q(x), is false.
Remark 1.5.3. Generally, an implicit assumption is made that
all domains of discourse for quantifiers is nonempty. If the domain
is empty, then ∃ x P (x) is false whenever P (x) is a propositional
function because when to domain is empty, there can be no element
x in the domain for which Q(x) is true.
When all elements in the domain can be listed-say, x1, x2, . . . , xn−
the existential quantification ∃ x P (x) is the same as the disjunction

P (x1) ∧ P (x2) ∧ · · · ∧ P (xn),


because this disjunction is true if and only if at least one of P (x1), P (x2),
. . . , P (xn), is true.
Example 1.5.14. What is the truth value of ∃ x P (x) , where P (x)
is the statement “x2 > 10” and the universe of discourse consists of
the positive integers not exceeding 4?
Solution: Do yourself. Ans. True.
THE UNIQUENESS QUANTIFIER: The uniquness quan-
tifier denoted by ∃! or ∃1. states that “There exists a unique x such
35 Narinder Singh 1. Propositional Logic

that P (x) is true.” (Other pharase for uniqueness quantification in-


clude “there is exactly one” and “there is one and only one.”) For
instance, ∃! x (x − 1 = 0), where the domain is set of real numbers,
state that there is a unique real number x such that x − 1 = 0.
This statement is true as x = 1 is the unique real number such that
x − 1 = 0.

1.5.4 Qunatifiers with Restricted Domains

An abberiated notation is often used to restrict the domain of a


quantifier. In this notation, a condition that variable must satisfy is
included after the quantifier. This is illustrated in next example:
Example 1.5.15. What do the statement ∀ x < 0 (x2 > 0), ∀y ̸=
0(y 3 ̸= 0), and ∃ z > 0 (z 2 = 2) mean, where the domain in each
case consists of the real numbers?
Solution: The statement ∀ x < 0 (x2 > 0) states that for every
real number x with x < 0, x2 > 0. That is, it states “The square
of a negative real number is positive.” This statement is same as
∀ x (x < 0 → x2 > 0).
The statement ∀y ̸= 0(y 3 ̸= 0) states that for every real number y
with y ̸= 0, we have y 3 ̸= 0. That is it states “The cube of every non-
zero real number is non-zero.” Note that this statement is equivalent
to ∀y (y ̸= 0 → y 3 ̸= 0).
Finally, the statement ∃ z > 0 (z 2 = 0) states that there exists
a real number z with z > 0 such that z 2 = 2. That is, it states
“There is a positive square root of 2.” This statement is equivalent
to ∃ z (z > 0 ∧ z 2 = 2).
Precedence of Quantifiers
1.5. Predicates and Quantifiers 36

The quantifiers ∀ and ∃ have higher precedence than all logical


operators from propositional calculus. For example, ∀ x P (x)∨Q(x)
is the disjunction of ∀ x P (x) and Q(x). In other words, it means
(∀ x P (x)) ∨ Q(x) rather than ∀ x (P (x) ∨ Q(x)).

Negating Quantified Expressions


We will be often want to consider the negation of a quantified
expression. For instance,
Example 1.5.16. Consider the negation of the statement
“Every student in your class has taken a course in calculus.”
This statement is a universal quantification namerly ∀ x P (x) where
P (x) is a statement “x has taken a course in calculus” and the domain
consists of the stundents in your class. The negation of this statement
is “It is not the case that every student in your class has taken a
course in calculus.” This is equivalent to “There is a student in your
class who has not taken a course in calculus.” And this simply the
existential quantification of the negation of the original propositional
function, namely, ∃ x ¬P (x). This example illustrate the following
logical equivalence:

¬∀ x P (x) ≡ ∃x¬P (x).

To show logical equivalence of ¬∀ xP (x) ≡ ∃x¬P (x), first note


that ¬∀ xP (x) is true if and only if ∀ x P (x) is false. Next, note that
∀ x P (x) is false if and only if there is an element x in the domain
for which ¬P (x) is true. Finally, note that there is an element x in
the domain for which ¬P (x) is true if and only if ∃ x ¬P (x) is true.
Putting all these steps together, we can conclude that ¬∀ x P (x) is
true if and only if ∃ x ¬P (x) is true. Hence, ¬∀ xP (x) ≡ ∃x¬P (x).
37 Narinder Singh 1. Propositional Logic

Similarly we can prove that

¬∃xQ(x) ≡ ∀x¬Q(x).

The rules for negation of quantifiers are called De Morgan’s


laws for quantifiers. These rules are given in following table:
Demorgan’s Laws for Quantifiers.
Negation Equivalent Statement When Is Negation True? When False?
¬∃xP (x) ∀x¬P (x) For every x, P (x) is false There is an x for which P (x)
is true.
¬∀xP (x) ∃x¬P (x) There is an x for which P (x) P (x) is true for every x.
is false.

1.6 Introduction to Proof

One of the best ways to think of a mathematical proof is as a carefully


reasoned argument to convince a skeptical listener (often yourself)
that a given statement is true. Imagine the listener challenging your
reasoning every step of the way, constantly asking, “Why is that
so?” If you can counter every possible challenge, then your proof as
a whole will be correct.
Sometimes correctness of a mathematical argument can be a mat-
ter of life or death. Suppose, for example, that a mathematician is
part of a team charged with designing a new type of airplane engine,
and suppose that the mathematician is given the job of determining
whether the thrust delivered by various engine types is adequate. If
you knew that the mathematician was only fairly sure, but not posi-
tive, of the correctness of his analysis, you would probably not want
to ride in the resulting aircraft.
1.6. Introduction to Proof 38

Both discovery and proof are integral parts of problem solving.


When you think you have discovered that a certain statement is
true, try to figure out why it is true. If you succeed, you will know
that your discovery is genuine. Even if you fail, the process of trying
will give you insight into the nature of the problem and may lead to
the discovery that the statement is false. For complex problems, the
interplay between discovery and proof is not reserved to the end of
the problem-solving process but, rather, is an important part of each
step.
In order to evaluate the truth or falsity of a statement, you must
understand what the statement is about. In other words, you must
know the meanings of all terms that occur in the statement. Math-
ematicians define terms very carefully and precisely and consider it
important to learn definitions virtually word for word.
A proof is a valid argument that establishes the truth of a math-
ematical statement. Formally, a theorem is a statement that can
be shown to be true.
Types of Proof

Types of Proofs

Direct Proof Trival Proof

Proof by contraposition
Vaccous Proof
Proof by Contradiction
39 Narinder Singh 1. Propositional Logic

1.6.1 Direct Proof

A direct proof of a conditional statement p → q is constructed


when the first step is the assumption that p is true; subsequent steps
are constructed using rules of inference, with the final step showing
that q must also be true. A direct proof shows that a conditional
statement p → q is true by showing that if p is true, then q must
also be true, so that the combination p true and q false never occurs.
In direct proof, we assume that p is true and use axioms, definitions,
and previously proven theorems, together with rules of inference, to
show that q must also be true. Direct proofs of certain theorems are
quite straight forward, with a fairly obvious sequence of steps leading
from the hyposthesis to the conclusion.
Definition 1.6.1
An integer n is even if there exists an integer k such that
n = 2k, and n is odd if there exists an integer k such that
n = 2k + 1. (Note that every integer is either even or odd, and
no integer is both even and odd.)

Example 1.6.1. Give a direct proof of the theorem “If n is an odd


integer, then n2 is odd.”
Solution: Note that theorem states that ∀n(P (n) → Q(n)), where
P (n) = “n is an odd integer” and
Q(n) = “n2 is odd.”
For direct proof we assume that the hypothesis P (n) of this theorem
is true, namely, we assume that n is odd. By the definition of an odd
integer, if follows that
n = 2k + 1
1.6. Introduction to Proof 40

squaring both sides, we get


n2 = (2k + 1)2 = 4k 2 + 4k + 1
= 2(2k 2 + 2k) + 1
= 2k ′ + 1
Here k ′ = 2k 2 + 2k is an integer. Hence, n2 is odd integer.

Example 1.6.2. Give a direct proof that if m and n are both


perfect squares, then mn is also a perfect square. (An integer is a
perfect square if there is an integer b such that a = b2. )
Solution: To produce a direct proof of this theorem, we assume
that the hyposthesis of this conditional statement is true, namely,
we assume that m and n are both perfect squares. By definition of
perfect square, there exists integers s and t such that
m = s2 and n = t2
mn = s2t2 = (ss)(tt) = (st)(st) = (st)2
= s′2
Here, s′ = st is an integer. Therefore mn is perfect square.

1.6.2 Proof by Contraposition

Direct proofs often reach dead ends. We need other methods of


proving theorem of the form ∀x (P (x) → Q(x)). Proofs of theorem
of this type that are not direct proofs, that is, that do not start
with the premises and end with the conclusion, are called indirect
proofs.
41 Narinder Singh 1. Propositional Logic

An extremely useful type of indirect proof is known as proof by


contraposition. Proofs by contraposition, make use of the fact
that the conditional statement p → q is equivalent to its contra-
positive, ¬q → ¬p, is true. In a proof by contraposition of p → q
we take ¬q as a premise, and using axioms, definitions, and previ-
ously proven theorems, together with two examples. These examples
shows that proof by contraposition can be succeed when we cannot
easily find a direct proof.
Example 1.6.3. Prove that if n is an integer and 3n + 2 is odd,
then n is odd.
Solution: We first attempt a direct proof. To construct a direct
proof, let 3n + 2 is an odd integer. This gives
3n + 2 = 2k + 1 for some integer k. This gives
3n + 1 = 2k
This does not give any way to prove n is odd. So, we try a proof
by contraposition. Let us try to prove by contraposition. So assume
that n is not odd. Therefore n must be even. Hence

n = 2k

We find that

3n + 2 = 3(2k) + 2 = 2(3k + 1)
= 2k ′
Here k ′ = 3k + 1. This tells us that 3n + 2 is even and therefore
not odd. Therefore if n is not odd then 3n + 2 is not odd. This is
equivalent to if 3n + 2 is odd, then n is odd.
1.6. Introduction to Proof 42

Example 1.6.4. If n is an integer and n2 is odd then n is odd.


Solution: We first attempt a direct proof. Supppose that n is
an integer and n2 is odd. Then, there exists an integer k such that
n2 = 2k + 1. Can we use this information to conclude that n is odd?
There seems to be no obvious approach
√ to show that n is odd becuase
solving this will give n = + − 2k + 1, which is not useful.
Because this attempt to use a direct proof did not bear fruit, we
next attempt a proof by contraposition. We take as our hyposthesis
the statement that n is not odd. Because every integer is odd or
even, this means that n is even. This implies that there exists an
integer k such that n = 2k. To prove the theorem, we need to show
that this hypothesis implies the conclusion that n2 is not odd, that
is, n2 is even. This implies that there exists an integer k such that
n = 2k. To prove the theorem, we need to show that this hyposthesis
implies the conclusion that n2 is not odd, that is n2 is even. Can
we use the equation n = 2k to achieve this? By squaring both
sides n2 = 4k 2 = 2(2k 2), which implies that n2 is also even because
n2 = 2t, where t = 2k 2. We have proved that if n is an integer and n2
is odd, then n is odd. Our attempt to find a proof by contraposition
succeeded.

1.6.3 Vacuous and Trivial Proofs

We know that if p is false then p → q is always true. Therefore if p


is false we can say p → q is proved. Such a proof is called vacuous
proof of the conditional statement p → q.
Example 1.6.5. Show that the proposition P (0) is true, where
P (n) is “If n > 1, then n2 > n” and the domain consists of all
integers.
43 Narinder Singh 1. Propositional Logic

Solution: Note that P (0) is “If 0 > 1, then 02 > 0.” We can
show P (0) using a vacous proof. Indeed, the hypothesis 0 > 1 is
false. This tells us that P (0) is automatically true.
We know that p → q is true if q is true. Therefore if we prove q
is true, then p → q will be true. Such prove which use the fact that
q is true is called a trivial proof.
Example 1.6.6. Let P (n) be “If a and b are positive integers with
a ≥ b, then an ≥ bn,” where the domain consists of all nonnegative
integers. Show that P (0) is true.
Solution: The proposition P (0) is “if a ≥ b, then a0 ≥ b0” is true.
Because a0 = b0 = 1, the conclusion of the conditional statement “If
a ≥ b, then a0 ≥ b0” is true. Hence, this conditional statement,
which is P (0), is true. This is an example of the trivial proof.

1.6.4 Proofs by Contradiction

Suppose we want to prove that a statement p is true. Furthermore,


suppose that we can find a contradiction q such that ¬p → q is true.
Because q is false, but ¬p → q is true, we can conclude that ¬p is
false, which means tha p is true.
How can we find a contradiction q that might help us prove that
p is true in this way? Because r ∧ ¬r is a contradiction whenever
r is a proposition, we can prove that p is true if we can show that
¬p → (r ∧ ¬r) is true for some proposition r. Proofs of this type are
called proofs by contradiction. The following are examples of
proofs by contradiction.
Example 1.6.7. Show that at least four of any 22 days must fall
on the same day of the week.
1.6. Introduction to Proof 44

Solution: Let p = “At least four of 22 chosen days fall on the same
day of the week.”
Suppose that not p is true.
This means that at most three of 22 days fall on the same day of the
week. Because there are seven days of the week, this implies that
atmost 21 days could have been chosen, as for each of the days of the
week, at most three of the chosen days could fall on that day. This
contradicts the premise that we have 22 days under consideration.
That is, if r is the statement that 22 days are chosen, then we have
shown that ¬p → (r ∧ ¬r). Consequently, we know that p is true.
We have proved that atleast four of 22 days fall on the same day of
the week.

Example 1.6.8. Prove that 2 is irrational by giving a proof by
contradiction.

Solution:
√ Let p = “ 2 is irrational”.
√ Suppose not p is true. i.e.
2 is not irrational. This means 2 is rational. Therefore there
eixst integers a and b such that
√ a
2 = , where b ̸= 0, gcd(a, b) = 1.
b
Squaring both sides we have,
a2
2 = 2.
b
Hence 2b = a2.
2

By the definition of even, this means that a2 is even. We next use


the fact that if a2 is even, a must be even, therefore a = 2c for some
integer c.
2b2 = 4c2.
45 Narinder Singh 1. Propositional Logic

Dividing both sides of this equation by 2 gives

b2 = 2c2.

By the definition of even, this means that b2 is even. Using the fact
that if square of an integer is even, then the integer itself must be
even, we conclude that b must be even as well. This means both a, b
are both even, that is, 2 divides both a, b. However, gcd(a, b) = 1.
So we This is a contradiction. Therefore ¬p must be false. Hence

2 is irrational.

1.7 Mistakes in Proofs

Example 1.7.1. What is wrong with this famous supposed “proof”


that 1 = 2?
"Proof" We use these steps, where a and b are two equal positive
integers.
Step Reason
1. a = b Given
2. a2 = ab Multiply both sides of (1.) by a
3. a2 − b2 = ab − b2 Subtract b2 from both sides of (2)
4. (a − b)(a + b) = b(a − b) Factor both sides of (3)
5. a + b = b Divide both sides of (4) by a − b.
6. 2b = b Replace a by b in (5) because a =
b and simplify.
7. 2=1 Divide both sides of (6) by b.
1.7. Mistakes in Proofs 46

Solution: Every step is valid execpt, step 5 where we divided both


sides by a − b. The error is that a − b equals zero; division of both
sides of an equation by the same quantitiy is valid as long as this
quantity is not zero.
Example 1.7.2. What is wrong with the “proof” given below?
“Theorem:” If n2 is positive, then n is positive.
“Proof:” Suppose that n2 is positive. Because the conditional
statement “If n is positive, then n2 is positive” is true, we can con-
clude that n is positive.
Solution: Let P (n) be “n is positive” and Q(n) = “n2 is positive.”
Then our hypothesis is Q(n). The statement “If n is positive, then n2
is positive” is the statement ∀n(P (n) → Q(n)). From the hypothesis
Q(n) and the statement ∀n(P (n) → Q(n)) we cannot conclude
P (n).
Example 1.7.3. What is wrong with this “proof”?
“Theorem:” If n is not positive, then n2 is not positive.
“Proof:” Suppose that n is not positive. Because the conditional
statement “If n is positive, then n2 is positive is true, we can conclude
that n2 is not positive.
Solution: Let P (n) be “n is positive” and Q(n) = “n2 is positive.”
Then our hypothesis is ¬P (n) and the statement “If n is positive,
then n2 is positive” is the statement ∀n(P (n) → Q(n)). From the
hyposthesis ¬P (n) and the statement ∀n(P (n) → Q(n)) we cannot
conclude ¬Q(n).
Many wrong arguements are based on a fallacy called begging
the question. This fallacy occurs when one or more steps of a
proof are based on the truth of the statement being proved. In other
47 Narinder Singh 1. Propositional Logic

words, this fallacy arises when a statement is proved using itself,


or a statement equivalent to it. That is why this fallacy is called
circular reasoning.

Example 1.7.4. Is the following arguement correct? It is suppos-


edly shows that n is an even integer whenever n2 is an even integer.
“proof:” Suppose that n2 is even. Then n2 = 2k for some integer
k. Let n = 2l for some integer l, this shows that n is even.
Solution: This proof is incorrect. The statement “let n = 2l for
some integer l” occurs in the proof. No argument has been given to
show that n can be written as 2l for some integer l. This is circular
reasoning because this statement is equivalent to the statement being
proved. Ofcourse the result is itself correct only method of proof is
wrong.

Making mistakes is a part of learning process. When you make


mistakes that someone else finds, you should carefully analyze where
you went wrong and make sure that you do not make the same
mistake again.

1.8 Some Basic selected Exercise Problems

1. Which of the following are propositions? What are truth values of those propositions?

(a) The moon is made of greeen cheese.


(b) Do not pass go.
(c) 5+7=10.
(d) Answer this question.

2. Identify Truth Tables? What should be there in place of question marks in following
tables
1.8. Some Basic selected Exercise Problems 48

p q ? p q ? p q ?
T T T p ? T T T T T F
T F F T F T F T T F T
F T F F T F T T F T T
F F F Table 2 F F F F F F
Table 1 Table 3 Table 4

3. Let
p = “The election is decided”
q = “The votes have been counted”

Express each of the following in english sentence.

(a) ¬p
(b) p ∨ q
(c) ¬p ∧ q
(d) ¬q → ¬p

4. Find the Error in the following table??

p q p→q q→p p↔q


T T T T T
T F F T F
F T T F T
F F T F F
Table

5. What will be bitwise OR of

01 1011 0110
11 0001 1101

(Here 0 represents false and 1 represents true) Following are the options:

(a) 11 0010 1010


(b) 01 1101 0011
(c) 10 0101 1111
49 Narinder Singh 1. Propositional Logic

(d) 11 1011 1111

6. Let p and q be the propositions:

p : It is below freezing
q : It is snowing.

Write the following using p, q and logical connectives:

(a) It is below freezing and snowing.


(b) It is wither snowing or below freezing (or both).
(c) If it is below freezing, it is also snowing.
(d) That it is below freezing is necessary and sufficient for it to be snowing.

7. Determine whether these biconditionals are true or false?

(a) 2+2=4 if and only if 1+1=2.


(b) 1+1=3 if and only if monkeys can fly.
(c) 0>1 if and only if 2>1.

8. Determine whether these conditionals are true or false?

(a) If 1+1=3, then dogs can fly.


(b) If 1+1=2, then dogs can fly.
(c) If 2+2=4, then 1+2=3.

9. State the converse, contra-positive, and inverse of each of these conditional statements.

(a) If it snows today, I will ski tomorrow.


(b) I come to class whenever there is going to be quiz.
(c) A positive integer is prime only if it has no divisor other than 1 and itself.

What is the value of x after each of these statements is encountered in a computer


program, if x = 1 before the statement is reached?

(a) if x + 2 = 3 then x := x + 1.
(b) if (x + 1 = 3) OR (2x + 2 = 3)then x := x + 1.
(c) if x < 2 then x := x + 1.

10. Use the truth table to verify the associative law (p ∧ q) ∧ r ≡ p ∧ (q ∧ r). What will be
number of rows in that table?

11. What is the negation of each of these propositions?

(a) Today is Thursday.


1.8. Some Basic selected Exercise Problems 50

(b) There is no pollution in Ludhiana.


(c) The summer in Punjab is hot and sunny.

12. Let P (x) = “x > 3.” What are the truth values of P (4) and P (2)?

13. Translate each of the following into logical expression using predicates, quantifiers, and
logical connectives. First, domain consist of the students in your class.

(a) No one is perfect.


(b) Not everyone is perfect.
(c) All your friends are perfect.
(d) At least one of your friend is perfect.
(e) Everyone is your friend and is perfect.
(f) Not everybody is your friend or someone is not perfect.

Solution to (13a): Let P (x) be “x is perfect”, let F (x) be “x is perfect”. First, domain
is students in your class. (1) ∀x¬P (x).

Do problems given in textbook mentioned in the syllabus.

⋆⋆⋆
Chapter 2

Reccurence relations

2.1 Reccurrence Relation


Definition 2.1.1
A recurrence relation for the sequence {an} is an equation
that expresses an in terms of one or more of the previous terms
of the sequence, namely, a0, a1, . . . , an−1, for all integers n with
n ≥ n0, where n0 is a non-negative integer. A sequence is
called a solution of recurrence relation if its terms satisfy the
recurrence relation.

Example 2.1.1. Let {an} be a sequence that satisfy the recurrence


relation an = an−1 −an−2 for n = 2, 3, 4, . . . and suppose that a0 = 3
and a1 = 5. What are a2 and a3?
Solution: Given
an = an−1 − an−2
∴ a2 = a1 − a0 = 5 − 3 = 2 and
a3 = a2 − a1 = 2 − 5 = −3

Therefore

a3 = −3, a2 = 2.

51
2.2. Modeling with Recurrence Relations: 52

Example 2.1.2. Determine whether the sequence {an}, where an =


3n for every nonnegative integer n, is a solution of the recurrence re-
lation an = 2an−1 − an−2 for n = 2, 3, 4, . . . . Answer the same
question when an = 2n and an = 5.
Solution: Suppose that an = 3n for every non-negative integer n.
Then for n ≥ 2, we see that
2an−1 − an−2 = 2 (3 (n − 1)) − 3(n − 2) = 3n = an
Therfore an = 3n is solution of the recurrence relation. Let us check
for an = 2n.
2an−1 − an−2 = 2.2n−1 − 2n−2 = 3.2n−2.
Therefore an = 2n is not solution of the recurrence relation. Let us
check for an = 5.
2an−1 − an−2 = 2(5) − 5 = 5 = an.
Therefore an = 5 is solution of the given recurrence relation.

2.2 Modeling with Recurrence Relations:

We can use recurrence relations to model a wide variety of problems,


such as finding the compound interest, counting rabbits on an island,
determining the number of moves in the Tower of Hanoi puzzle, and
counting bit strings with certain properties.

2.2.1 The colony of Bacteria

The number of bacteria in a colony doubles every hour. If a colony


begins with five bacteria, how many will be present in n hours? To
53 Narinder Singh 2. Reccurence relations

solve this problem let an = number of bacteria at the end of n hours.


Because the number of bacteria doubles every hour, the relationship

an = 2an−1

holds whenever n is a positive integer. This relationship together


with the initial condition a0 = 5, uniquely determines an for all
non-negative integers n. We can find the formula for an from this
information.

2.2.2 Compound Interest:

Example 2.2.1. Suppose that a person deposits Rupees 10, 000


in a savings account at a bank yeilding 11% per year with interest
compounding annually. How much will be in the account after 30
years.

Solution: Let Pn denotes the amount in the account after n years.


As amount in the account after n years is equal to sum of the amount
in the account after n − 1 year and interst for the nth year. So,

Pn = Pn−1 + 0.11Pn−1 = 1.11Pn−1.

The initial condition is P0 = 10, 000. Note that

P1 = 1.11P0
P2 = 1.11P1 = (1.11)2P0
P3 = 1.11P2 = (1.11)2P1 = (1.11)3P0
...
Pn = (1.11)nP0 = (1.11)n10, 000.
2.2. Modeling with Recurrence Relations: 54

Mathematical induction can be used to verify this formula: Clear


this formula is valid for n = 0. Assume that the formula is valid for
n − 1. That is, let

Pn−1 = (1.11)n−110, 000.

Let us prove this formula for n.

Pn = Pn−1 + 0.11Pn−1 = 1.11Pn−1


= 1.11(1.11)n−110, 000 = (1.11)n10, 000.

Now we need to find Pn for n = 30.

P30 = (1.11)3010, 000 = 2, 28, 922.97.

2.2.3 The Tower of Hanoi

A popular puzzle of the late nineteenth century invented by the


French mathematician E. Lucas, called the Tower of Hanoi, con-
sists of three pegs(rods) on a board together with disks of different
sizes. Initially, these disks are placed on the first peg in order of size,
with the largest on the bottom.

Figure 2.1
55 Narinder Singh 2. Reccurence relations

The rules of the puzzle allow disks to be moved one at a time from
one peg to another as long as a disk is never placed on the top of a
smaller disk.
Hn = number of moves needed to solve the tower of Hanoi puzzle
with n disk. Then

Hn = 2Hn−1 + 1.

This can be understood from the following pictures:


Suppose we want to move n(one green and n−1 red) disk as given
in figure.

Figure 2.2

First we will move n − 1 disks from peg A to peg B as below and


moves Hn−1 moves will be taken for this.
2.2. Modeling with Recurrence Relations: 56

Figure 2.3

Then we will move largest disk to peg C and it will take 1 move.
So total moves used till now are Hn−1 + 1.

Figure 2.4

Now we will move n − 1 disk to peg C and it will take Hn−1


moves. So total moves will be Hn−1 + 1 + Hn−1 = 2Hn−1 + 1.
Therefore Hn = 2Hn−1 + 1.
57 Narinder Singh 2. Reccurence relations

Figure 2.5

Let us try to find some explicit formula for the Hn.

Hn = 2Hn−1 + 1
= 2(2Hn−2 + 1) + 1 = 22Hn−2 + 2 + 1
= 22(2Hn−3 + 1) + 2 + 1 = 23Hn−3 + 22 + 2 + 1
...
= 2n−1H1 + 2n−2 + · · · + 22 + 2 + 1
= 2n−1 + 2n−2 + · · · + 22 + 2 + 1 (H1 = 1)
= 2n − 1.
2.3. Linear Homogeneous Recurrence Relations 58

Now let us count H2, H3, H4, .....


H2 = 22 − 1 = 3
H3 = 23 − 1 = 7
H4 = 24 − 1 = 15
H5 = 25 − 1 = 31
H6 = 26 − 1 = 63
...
H10 = 210 − 1 = 1023
...
H64 = 264 − 1 = 18, 446, 744, 073, 709, 551, 615
18,446,744,073,709,551,615 seconds ≥ 500 billion years. If you take
1 sec to move 1 disk it will take us more than 500 billion years to
move all 64 disks to other peg in Hanoi Tower. So don’t try to play
practically with 64 disks.

2.3 Linear Homogeneous Recurrence Relations

Definition 2.3.1
A linear homogeneous recurrence relation of degree k
with constant coefficients is a recurrence relation of the form
an = c1an−1 + c2an−2 + · · · + ck an−k ,
where c1, c2, . . . , ck are real numbers, and ck ̸= 0.

The degree is k because an is expressed in terms of previous k


terms of the sequence. The recurrence relation in the definition is
59 Narinder Singh 2. Reccurence relations

linear because the RHS is sum of previous terms of sequence each


multiplied by constants. The recurrence relation is homogeneous
because no terms occur that are not the multiples of aj ’s.
Example 2.3.1. 1. The recurrence relation Pn = (1.11)Pn−1 is a
linear homogeneous recurrence relation of degree one.
2. The recurrence relation fn = fn−1 +fn−2 is a linear homogeneous
recurrence relation of degree two.
3. The recurrence relation an = an−5 is a linear homogeneous re-
currence relation of degree five.
Next example provide recurrence relations that are not linear ho-
mogeneous recurrence relations with constant coefficients.
Example 2.3.2. The recurrence relation an = an−1 + a2n−2 is not
linear. The recurrence relation Hn = 2Hn−1 + 1 is not homoge-
neous. The recurrence relation Bn = nBn−1 does not have constant
coefficients.

2.3.1 Shifting and Difference Operator

Definition 2.3.2
The shifting operator E is an operator which acts on an as
follows
Ean = an+1.

Definition 2.3.3
The difference operator ∆ is an operator which acts on an as
follows
∆an = an+1 − an.
2.3. Linear Homogeneous Recurrence Relations 60

2.3.2 Solving Linear Homogeneous Recurrence relations with con-


stant coefficients of Degree 2

Theorem 2.3.1: (Distinct Roots)


Let c1 and c2 be real numbers. Suppose that E 2 − c1E − c2 = 0
has two distinct roots of r1 and r2. Then the sequence {an} is
the solution of the recurrence relation an = c1an−1 + c2an−2 if
and only if an = α1r1n + α2r2n, for n = 0, 1, 2, . . . where α1, α2
are constants.

Example 2.3.3. Solve the recurrence relation, an = an−1 + 2an−2


with a0 = 2 and a1 = 7?

Solution: As degree of given recurrence relation is 2. We apply


shifting operator 2 times to make index of all aj greater than or
equal to n.

E 2 an = E 2(an−1) + E 2(2an−2)
an+2 = an+1 + 2an
an+2 − an+1 − 2an =0
(E 2 − E − 2)an = 0.

The Auxiliary equation is

r2 − r − 2 = 0

The roots of this equation are


r
−(−1) ± (−1)2 − 4(1)(−2)
r=
2
r = 2, −1
61 Narinder Singh 2. Reccurence relations

Therefore, the solution of the given recurrence relation is

an = c12n + c2(−1)n.

Using given condition a0 = 2.

a0 = c120 + c2(−1)0
2 = c1 + c2 (1)

Using the given condition a1 = 7

7 = 2c1 − c2 (2)

Now we will solve (1) and (2) to find the value of c1, c2. Adding (1)
and (2), we obtain

9 = 3c1
c1 = 3

substitute c1 = 3 in equation (1), we have

c2 = −1

Therefore

an = 3(2)n − 1(−1)n.
Example 2.3.4. Solve the recurrence relation yk+2 − 6yk+1 + 8yk =
0, y0 = 3, y1 = 2. Also find y5.
Solution: The degree of given recurrence relation is 2. The given
equation may be written as
(E 2 − 6E + 8)yk = 0
2.3. Linear Homogeneous Recurrence Relations 62

The Auxiliary equation is given by

r2 − 6r + 8 = 0.
r = 2, 4

Therefore the complimentory solution is given by

yk = c1(2)k + c2(4)k
Now we will use the given initial conditions, first using y0 = 3, we
have

y0 = c1 + c2
3 = c1 + c2 (2.1)

Using y1 = 2, we have

y1 = 2c1 + 4c2
2 = 2c1 + 4c2 (2.2)
Now let us solve (2.1) and (2.2). Multiplying (2.1) by 2 and sub-
tracting from eqn (2.2)

4 = −2c2
c2 = −2.

Substitute this value of c2 in equation (2.1) we have

c1 = 5.

Therefore,

yk = 5.2k − 2.4k .
y5 = 5.25 − 2.45 = 25(5 − 64) = −32(59) = −1888.
63 Narinder Singh 2. Reccurence relations

Theorem 2.3.2
Let c1 and c2 be real numbers with c2 ̸= 0. Suppose that
r2 − c1r − c2 = 0 has only one root r0 (when both roots
are same). Then an is soltution of the recurrence relation
an = c1an−1 + c2an−2 if and only if an = α1r0n + α2nr0n. Here
α1, α2 are constants.

Example 2.3.5. What is solution of the recurrence relation


an = 6an−1 − 9an−2.
With the initial conditions a0 = 1 and a1 = 6?
Solution: The given recurrence relation has degree = n - (n-2) = 2.
So applying shift operator two times to make all index greater than
or equal to n, we have:
an+2 = 6an+1 − 9an.
an+2 − 6an+1 + 9an = 0.
(E 2 − 6E + 9)an = 0.

The auxiliary equation is given by

r2 − 6r + 9 = 0.
r = 3, 3

Hence the solution of the recurrence relation is given by

an = (α1 + nα2)3k .

Now using initial conditions a0 = 1, a1 = 6 we have


2.3. Linear Homogeneous Recurrence Relations 64

Examples with complex roots of Auxiliary equation


Example 2.3.6. Solve yk+2 − 2yk+1 + 5yk = 0.
Solution: The given equation can be written as
yk+2 − 2yk+1 + 5yk = 0
E 2yk − 6Eyk + 8yk = 0
(E 2 − 2yk + 5)yk = 0

The auxiliary equation is

r2 − 2r + 5 = 0

2 ± 4 − 20
r=
2
2 ± 4i
r= = 1 ± 2i
2
Therefore the complimentary solution/function is

yk = c1(1 + 2i)k + c2(1 − 2i)k


Now
1 + 2i = r(cos θ + i sin θ) 1 − 2i = r(cos θ + i sin θ)

r = 12 + 2 2 θ= tan−1 12
 


r = 5. θ = tan −1
2

(1 + 2i)k = ( 5(cos θ + i sin θ))k
Applying De Moiver’s Theorem Simillarly
(1 + 2i)k = 5k/2(cos kθ + i sin kθ) (1−2i)k = 5k/2(cos kθ−i sin kθ).

Therefore the complimentary solution is


yk = c15k/2(cos kθ + i sin kθ) + c25k/2(cos kθ − i sin kθ)
65 Narinder Singh 2. Reccurence relations

yk = 5k/2((c1 + c2) cos kθ + i(c1 − c2) sin kθ)


yk = 5k/2(C1 cos kθ + C2 sin kθ)

2.3.3 Exercise Problems

Solve the following recurrence relations:


1. an + 6an−1 + 8an−2 = 0.
2. fn = fn−1 + fn−2, f0 = 0, f1 = 1.
3. yk+2 = 6yk+1 − 9yk , a0 = 1, a1 = 4.
4. an = 2(an−1 − an−2), a0 = 1, a1 = 2.
Hints to above Problems
√ n √ n
1 1 + 5 1 1 − 5
 

Hint Problem 2: fn = √   − √ 
5 2 5 2

Hint Problem 3: yk = 1 + 3k
 
k
3
n 
Hint Problem 4: an = 2 cos + sin

nπ nπ
2
4 4 .
2.3. Linear Homogeneous Recurrence Relations 66
Chapter 3

Counting principles and relations

3.1 Inclusion-Exclusion Principle

To correctly count the number of ways to do one of the two tasks, we


add the number of ways to do it in one way and number of ways to
do it in the other way, and then subtract the number of ways to do
the task in a way that is both among the set of n1 ways and the set of
n2 ways. This is called the principle of inclusion-exclusion.
Sometime also called subtraction principle.
Example 3.1.1. How many bit strings of length eight digit either
start with a 1 bit or end with the two bits 00?
Solution: 27 + 26 − 25 = 160
Let A1 and A2 be sets. Then there are |A1| ways to select an
element from A1 and |A2| ways to select an element from A2. The
number of ways to select an element from from A1 and or from A2,
that number of ways to select an element from A1 ∪ A2 is the sum
of number of ways to select an element from A1 and the number of
ways to select an element from A2, minus the number of ways to
select and element that is in both A1 and A2. In symbolic form

|A1 ∪ A2| = |A1| + |A2| − |A1 ∩ A2|

67
3.2. The Pigeonhole Principle 68

Example 3.1.2. A computer company receives 350 applications


from computer science graduates for a job of planning a line of new
web servers. Suppose that 220 of these people majored in computer
science, 147 majored in bussiness, and 51 majored both in computer
science and in business. How many of these applicants majored nei-
ther in computer science nor in bussiness?

3.2 The Pigeonhole Principle

Definition 3.2.1: The Pigeonhole Principle


If k is a positive integer and k + 1 or more objects are placed
into k boxes, then there is at least one box containing two or
more of the objects.

The pigeonhole principle is also called the Drichlet drawer


principle.
Example 3.2.1. Among any group of 367 people, there must be at
least two with the same birthday, because there are only 366 possible
birthdays.
Example 3.2.2. In any group of 27 English words, there must be
at least two that begin with the same letter, because there are 26
letter in the English alphabet.
Example 3.2.3. How many students must be in a class to guarantee
that atleast two students receive the same score on the final exam, if
the exam is graded on a scale from 0 to 100 points?
Solution: There are 101 possible scores on the final. The pigeonhole
principle shows that among any 102 students there must be at least
2 students with the same score.
69 Narinder Singh 3. Counting principles and relations

Example 3.2.4. Show that for every integer n there is a multiple


of n that has only 0s and 1s in its decimal expansion.
Solution: Let n be a positive integer. Consider the n + 1 integers
1, 11, 111, . . . , 11...1 (where the last integer in the list is the integer
with n+1 1s in its decimal expansion). Note that there are n possible
remainders when an integer is divided by n. Because there are n + 1
integers in this list, by the pigeonhole principle there must be two
with the same remainder when divided by n. The larger of these
integer less the smaller one is a multiple of n, which has a decimal
expansion consisting entirely of 0s and 1s.

3.3 The Generalized Pigeonhole Principle

Definition 3.3.1: GENERALIZED PIGEONHOLE PRINCIPLE


If N objects are placed into k boxes, then there is atleast one
box containing at least [N/k] objects.

Example 3.3.1. Among 100 people there are at least [100/12] = 9


who born in the same month.
Example 3.3.2. What is minimum number of students required in
a discrete mathematics class to be sure that at least six will receive
the same grade, if there are five possible grades, A, B, C, D and F?
Solution: The minimum number of students needed to ensure that
atelast six students receive the same grade is the smallest integer N
such that [N/5] = 6 The smallest integer N = 5.5 + 1 = 26. If you
have only 25 students, it is possible for there to be five who have
received each grade so that no six students have received the same
grade. Thus, 26 is the minimum number of students needed to ensure
that at least six students will receive the same grade.
3.3. The Generalized Pigeonhole Principle 70

Example 3.3.3. (a) How many cards must be selected from a stan-
dard deck of 52 cards to guarantee that at least three cards of the
same suit are chosen?
(b) How many must be selected to guarantee that at least three
hearts are selected?
Solution: (a) Suppose there are four boxes, one for each suit, and
as cards are selected they are placed in the box reserved for cards of
that suit using the generalized pigeonhole principle, we see that if N
cards are selected, there is at least one box containing at least [N/4]
cards. consequently, we know that at least three cards of one suit are
selected if [N/4] ≥ 3. The smallest integer N such that [N/4] ≥ 3 is
N = 2.4 + 1 = 9, so nine cards are suffice. Note that if 8 cards are
selected, it is possible to have two cards of each suit, so more than
eight cards are needed.
(b) We do not use the generalized pigeonhole principle to answer
this question, because we want to make sure that there are three
hearts, not just three cards of one suit. Note that in the worst case,
we can select all the clubs, diamonds, and spades, 39 cards in all
before we select a single heart. The next three cards will be all
hearts, so we may need to select 42 cards to get three hearts.
Example 3.3.4. What is the least number of area codes needed
to guarantee that the 25 million phones in a state can be assigned
distinct 10-digit telephone numbers? (Assume that telephone num-
ber are of the form NXX-NXX-XXXX, where the first three digits
form the area code, N represents a digit from 2 to 9 inclusive, and X
represents any digit.)
Solution: There are eight million different phone numbers of the
form NXX-XXXX. Hence, by generalized pigeonhole principle, among
25 million telephones, at least [25, 000, 000/8, 000, 000] = 4 of them
71 Narinder Singh 3. Counting principles and relations

must have identical phone numbers. Hence, at least four area codes
are required to ensure that all 10-digit numbers are differnt.

3.4 Relation and Their Properties

Definition 3.4.1
Let A, B be two non-empty sets. Then we defined cartesian
product of set A and B is denoted by A × B and is given by
A × B = {(a, b) : a ∈ A and b ∈ B}.

Example 3.4.1. Let A = {1, 2, 3} and B = {a, b} Then

A × B = {(1, a), (1, b), (2, a), (2, b), (3, a), (3, b)}

Note that if A has m elements and B has n elements then number


of elements in A × B is mn.
Definition 3.4.2
Let A and B be sets. A binary relation from A to B is a subset
of A × B.

In other words, a binary relation from A to B is a set R of ordered


pairs where the first element of each ordered pair comes from A and
the second element comes from B. We use the notation aRb to denote
that (a, b) ∈ R and a ̸ R b to denote that (a, b) ̸∈ R. Moreover,
when (a, b) belongs to R, a is said to be related to b by R.
Binary relations represent relationships between the elements of
two sets. We will introduce n-ary relations, which express relation-
ships among elements of more than two sets, later in this chapter.
We will omit the word binary when there is no danger of confusion.
3.4. Relation and Their Properties 72

Example 3.4.2. Let A be the set of students in your school, and


let B be the set of courses. Let R be the relation that consists of
those pairs (a, b), where a is a student enrolled in course b. For
instance, if Manpreet and Gurpreet are enrolled in CS518, the pairs
(Manpreet, CS518) and (Gurpreet, CS518) belong to R. If Manpreet
is also enrolled in CS510, then the pair (Manpreet, CS510) is also in
R. However, if Gurpreet is not enrolled for the course CS510, then
the pair (Gurpreet, CS510) is not in R.
Example 3.4.3. Let A be the set of cities in the India, and let B
be the set of the 29 states in India. Define a relation R by specifying
that (a, b) belong to R if a city with name a is in the state b. For
instance, (Ludhiana, Punjab), (New Tehri, Uttrakhand), (Bhopal,
Madhya Pardesh), (Ahamdabaad, Gujraat), (Ambala, Haryana) etc.
are in R.
Example 3.4.4. Let A = {0, 1, 2} and B = {a, b}. Then
R = {(0, a), (0, b), (1, a), (2, b)}
is a relation from A to B.
Definition 3.4.3
A relation on a set A is a relation from A to A. In other words,
a relation on a set A is a subset of A × A.

Example 3.4.5. Let A be the set {1, 2, 3, 4}. Which ordered pairs
are in the relation R = {(a, b)| a divides b}?
Solution: Because (a, b) is in R if and only if a divides b and
a, b ∈ {1, 2, 3, 4}, we see that
{(1, 1), (1, 2), (1, 3), (1, 4), (2, 2), (2, 4), (3, 3), (4, 4)}.
This relation is shown below in table and graph?? also:
73 Narinder Singh 3. Counting principles and relations

R 1 2 3 4
1 X X X X
2 X X
3 X
4 X

Table 3.1: Displaying the Ordered Pairs in the Relation R from Example 4

Example 3.4.6. Consider these relations on the set of integers:


1. R1 = {(a, b) : a ≤ b},
2. R2 = {(a, b) : a > b},
3. R3 = {(a, b) : a = b or a = −b},
4. R4 = {(a, b) : a = b},
5. R5 = {(a, b) : a = b + 1},
6. R6 = {a + b ≤ 3}.
Example 3.4.7. How many relations are there on a set with n
elements?
Solution: A relation on a set A is a subset of A×A. Since A×A has
n2 elements when A has n elements, and set with m elements has 2m
2 2
subsets, there are 2n subsets of A × A. Thus there are 2n relations
2
on a set with n elements. For example, there are 23 = 29 = 512
relations on a set {a, b, c}.

3.5 Properties of Relations

Definition 3.5.1
A relation R on a set A is called reflexive if (a, a) ∈ R for
every element a ∈ A.
3.5. Properties of Relations 74

Remark 3.5.1. Using quantifiers we see that the relation R on the


set A is reflexive if ∀ a ((a, a) ∈ R), where the universe of discourse
(domain) is the set of all elements in A.

Example 3.5.1. Consider the following relations on {1, 2, 3, 4} :

1. R1 = {(1, 1), (1, 2), (2, 1), (2, 2), (3, 4), (4, 1), (4, 4)},

2. R2 = {, (1, 1), (1, 2), (1, 4), (2, 1), (2, 2), (3, 3), (4, 1), (4, 4)},

3. R3 = {(1, 1), (1, 2), (2, 1)},


4. R4 = {(2, 1), (3, 1), (3, 2), (4, 1), (4, 2), (4, 3)},
5. R5 = {(1, 1), (1, 2), (1, 3), (1, 4), (2, 2), (2, 3), (2, 4), (3, 3), (3, 4), (4, 4)},

6. R6 = {(3, 4)}.

Which of these relations are reflexive?


Solution: R2, R5 are reflexive. Explain yourself.

Example 3.5.2. Is the “divide” relation on the set of positive in-


tegers reflexive?
Solution: Because a|a whenever a is a positive integer, the “divide”
relation is reflexive. (Note that if we replace the set of positive inte-
gers with the set of all integers the relation is not reflexive because
by definition 0 does not divide 0.)

Definition 3.5.2
A relation R on a set A is called symmetric if (b, a) ∈ R
whenever (a, b) ∈ R, for all a, b ∈ A.
A relation R on a set A such that for all a, b ∈ A, if (a, b) ∈ R
and (b, a) ∈ R, then a = b is called antisymmetric.
75 Narinder Singh 3. Counting principles and relations

Using quantifiers, we see that the relation R on the set A is sym-


metric if ∀ a ∀ b ((a, b) ∈ R → (b, a) ∈ R) . Similarly, the relation
R on the set A is antisymmetric if

∀ a ∀ b (((a, b) ∈ R ∧ (b, a) ∈ R) → (a = b)) .


2
Remark 3.5.2. Although relatively few of the 2n relations on a
set with n elements are symmetric or antisymmetric, as counting
arguements can show, many important relations have one of these
properties.
Example 3.5.3. Which of the relations in example 3.5.1 are sym-
metric and which are antisymmetric?
Solution: The relations R2 and R3 are symmetric, because in each
case (b, a) belong to the relation whenever (a, b) does.
The relations R4, R5 and R6 are all antisymmetric.
Example 3.5.4. Which of the relations from Example 3.4.6 are
symmetric and which are antisymmetric?
Solution: The relations R3, R4, and R6 are symmetric. R3 is
symmetric, for if a = b or a = −b then b = a or b = −a. R4
is symmetric because a = b implies that b = a. R6 is symmetric
because a + b ≤ 3 implies that b + a ≤ 3. None other relations are
symmetric.
The relations R1, R2, R4 and R5 are antisymmetric (verify your-
self).
Example 3.5.5. Is the “divide” relation on the set of positive in-
tegers symmetric? Is it antisymmetric?
Solution: This relation is not symmetric, because 2|4 but 4 ̸ |2. It
is antisymmetric (do yourself).
3.6. Combining Relations 76

Definition 3.5.3
A relation R on a set A is called transitive if whenever (a, b) ∈
R and (b, c) ∈ R, then (a, c) ∈ R, for all a, b, c ∈ A.

Remark 3.5.3. Using quantifiers we see that the relation R on a


set A is transitive if we have
∀ a ∀ b ∀ c (((a, b) ∈ R ∧ (b, c) ∈ R) → (a, c) ∈ R)
Example 3.5.6. Which of the relations in example 3.5.1 are tran-
sitive?
Solution: R4, R5, and R6 are transitive (Do yourself). R1, R2 and
R3 is not transitive. (Do yourself)

3.6 Combining Relations

As relation from A to B are subsets of A × B, two relations from


A to B can be combined in any way two sets can be combined. Con-
sider Example 17-19.
Let A = {1, 2, 3} and B = {1, 2, 3, 4}. The relations R1 =
{(1, 1), (2, 2), (3, 3)} and R2 = {(1, 1), (1, 2), (1, 3), (1, 4)} can be
combined to obtain
1. R1 ∪ R2 = {(1, 1), (1, 2), (1, 3), (1, 4), (2, 2), (3, 3)}
2. R1 ∩ R2 = {(1, 1)},
3. R1 − R2 = {(2, 2), (3, 3)},
4. R2 − R1 = {(1, 2), (1, 3), (1, 4)}.
Example 3.6.1. Let A and B be the set of all students and the set
of all courses at a school, respectively. Suppose that R1 consist of
77 Narinder Singh 3. Counting principles and relations

all ordered pairs (a, b), where a is a student who has taken course b,
and R2 consists of all ordered pairs (a, b), where a is a student who
requires course b to graduate. What are the relations R1 ∪ R2, R1 ∩
R2, R1 R2, R2 − R1, and R2 − R1?
L

Solution: The relation R1 ∪ R2 consists of all ordered pairs (a, b),


where a is a student who either has taken course b or needs course b
to graduate, and R1 ∩R2 is the set of all ordered pairs (a, b), where a
is a student who has taken course b and needs this course to graduate.
Also, R1 R2 consists of all ordered pairs (a, b), where student a has
L

taken course b but does not need it to graduate or needs course b to


graduate but has not taken it. R1 − R2 is the set of ordered pairs
(a, b), where a has taken course b but does not need it to graduate;
that is, b is an elective course that a has taken. R2 − R1 is the set of
all ordered pairs (a, b), where b is a course that a needs to graduate
but has not taken.

Example 3.6.2. Let R1 be the “less than” relation on the set of real
numbers and let R2 be the “greater than” relation on the set of real
numbers, that is, R1 = {(x, y) : x < y} and R2 = {(x, y) : x > y}.
What are R1 ∪ R2, R1 ∩ R2, R1 − R2, R2 − R1, and R1 R2?
L

Solution: We note that (x, y) ∈ R1 ∪ R2 if and only if (x, y) ∈ R1


or (x, y) ∈ R2. Hence (x, y) ∈ R1 ∪ R2 if and only if x < y or x > y.
This is the same condition as x ̸= y. Therefore R1 ∪ R2 = {(x, y) :
x ̸= y}. In other words union of the “less than” and “greater than”
relation is the “not equals” relation.
Next, as it is impossible that x > y and x < y so R1 ∩R2 = ∅. We
also see that R1 − R2 = R1, R2 − R1 = R2, and R1 ∪ R2 − R1 ∩ R2 =
{(x, y)|x ̸= y}.

Relations can be conbined like composition of functions:


3.6. Combining Relations 78

Definition 3.6.1
Let R be a relation from a set A to a set B and S a relation
from B to a set C. The composite of R and S is the relation
consisting of ordered pairs (a, c), where a ∈ A, c ∈ C, and for
which there exists an element b ∈ B such that (a, b) ∈ R and
(b, c) ∈ S. We denote the composite of R and S by SoR.

Computing the composite of two relations requires that we find


elements that are the second element of ordered pairs in the first
relation and the first element of ordered pairs in the second relation,
as following examples illustrate:

Example 3.6.3. What is the composite of the relations R and


S, where R is the relation from {1, 2, 3} to {1, 2, 3, 4} with R =
{(1, 1), (1, 4), (2, 3), (3, 1), (3, 4)} and S is the relation from {1, 2, 3, 4}
to {0, 1, 2} with S = {(1, 0), (2, 0), (3, 1), (3, 2), (4, 1)}?
Solution: SoR is constructed using all ordered pairs in R and
ordered pairs in S, where the second element of the ordered pair in R
agrees with the first element of the ordered pair in SoR. Computing
all the ordered pairs in the composite, we find

SoR = {(1, 0), (1, 1), (2, 1), (2, 2), (3, 0), (3, 1)}.

Example 3.6.4. Composing the parent relation with it-


self: Let R be the relation on the set of all people such that
(a, b) ∈ R if person a is a parent of person b. Then (a, c) ∈ RoR if
and only if there is a person b such that (a, b) ∈ R and (b, c) ∈ R,
that is, if and only if there is a person b such that a is a parent of b
and b is a parent of c. In other words (a, c) ∈ RoR if and only if a
is a grand parent of c.
79 Narinder Singh 3. Counting principles and relations

Definition 3.6.2
Let R be a relation on the set A. The powers Rm, n = 1, 2, 3, . . .
are defined recursively by R1 = R and Rn+1 = RnoR.

Example 3.6.5. Let R = {(1, 1), (2, 1), (3, 2), (4, 3)}. Find the
powers Rn, n = 1, 2, 3, . . . ,

Solution: R2 = RoR = {(1, 1), (2, 1), (3, 1), (4, 2)}.
R3 = R2oR = {(1, 1), (2, 1), (3, 1), (4, 1)}
R4 = R3oR = {(1, 1), (2, 1), (3, 1), (4, 1)}
...

All others Rn, n = 5, 6, 7, . . . will be same.

3.7 Representing Relations using Matrics and Graphs

A relation between finite sets can be represented by using zero-one


matrix. Suppose R is a relation from A = {a1, a2, . . . , am} to
B = {b1, b2, . . . , bn}. The relation R on A to B can be represented
by the matrix MR = [mij ], where


 1 if (ai, bj ) ∈ R
mij = 


 0 if (ai, bj ) ̸∈ R

Example 3.7.1. Suppose that A = {1, 2, 3} and B = {1, 2}. Let


R be the relation from A to B containing (a, b) if a ∈ A, b ∈ B,
and a > b. What is the matrix representing R if a1 = 1, a2 = 2, and
a3 = 3, and b1 = 1 and b2 = 2?
3.7. Representing Relations using Matrics and Graphs 80

Solution: Beccause R = {(2, 1), (3, 1), (3, 2)}, the matrix for R is
 


0 0
MR = 1 0
 
 
 
 
 
1 1
 

The 1s in MR show that the pairs (2, 1), (3, 1), and (3, 2) belong to
R. The 0s show that no other pairs belong to R.
Example 3.7.2. Let A = {a1, a2, a3} and B = {b1, b2, b3, b4, b5}.
Which ordered pairs are in the relation R represented by the matrix.
 
0 1 0 0 0


MR = 1 0 1 1 0?
 



 
1 0 1 0 1
 

Solution: R = {(a1 , b2 ), (a2 , b1 ), (a2 , b3 ), (a2 , b4 ), (a3 , b1 ), (a3 , b3 ), (a3 , b5 )}.

3.7.1 Reflexive relation and matix representation

We can relate matrix representation of relation and its properties.


For example a relation R on a set A is reflexive if and only if (ai, ai) ∈
R for all ai ∈ A. This is true if and only if mii = 1 for all i. That is,
for reflexive relation elements of main daigonal needs to be 1.
1
 
 
 
1
 
 
 
 
 
.
 
 
 
 
.
 
 
 
 
 


 . 


 
1
 
 
 
 
1
 
81 Narinder Singh 3. Counting principles and relations

3.7.2 Symmetric Relations and Matrices

A relation R is symmetric if (a, b) ∈ R implies that (b, a) ∈ R.


Consequently, the relation R on the set A = {a1, a2, . . . , an} is
symmetric if and only if (aj , ai) ∈ R whenever (ai, aj ) ∈ R. In terms
of entres of MR , R is symmetric if and only if mji = 1 whenever
mij = 1. Therefore, if mij = o then mji = 0. Consequently, R is
symmetric if and only if mij = mji for all pairs of integers i, j. Hence,
a relation R is symmetric if and only if MR is symmetric.

3.7.3 Antisymmetric relations and Matrics

The relation R is antisymmetric if and only if (a, b) ∈ R and (b, a) ∈


R imply that a = b. Consequently, the matrix of an antisymmetric
relation has the property that if mij = 1 with i ̸= j, then mij = 0.
Or, in other words, either mij = 0 or mji = 0 when i ̸= j. The
matrix of antisymmetric relation :???????????

Example 3.7.3. Suppose that the relation R on a set is represented


by the matrix
 


1 1 0
MR = 1 1 1 .
 



 
0 1 1
 

Is R reflexive, symmetric, and/or antisymmetric?


Solution: Because all the diagonal elements of this matrix are 1,
R is refelexive. Moreover, because MR is symmetric therefore R is
symmetric. R is not antisymmetric because m21 = 1 and m12 = 1.
3.8. Representing Relations using Matrics and Graphs 82

3.7.4 Union and Intersection of Relations and Matrices

Suppose that R1, R2 are relations on a set A represented by the


matrices MR1 and MR2 , respectively. The matrix representing the
union of these relations has a 1 in the positions where either MR1
or MR2 has a 1. The matrix representing the intersection of these
relations has a 1 in the positions where both MR1 and MR2 have a 1.
Thus, the matrices representing the union and intersection of these
relations are

MR1∪R2 = MR1 ∨ MR2 and MR1∩R2 = MR1 ∧ MR2 .

Example 3.7.4. Suppose that the relations R1 and R2 on a set A


are represented by the matrices
   


1 0 1 1 0 1


MR1 = 1 0 0 and MR2 = 0 1 1
   
   
   
   
   
0 1 0 1 0 0
   

Solution: The matrices are given as below:


 
1 0 1


MR1∪R2 = MR1 ∨ MR2 = 1 1 1
 
 
 
 
 
1 1 0
 

 
1 0 1


MR1∩R2 = MR1 ∧ MR2 = 0 0 0
 



 
0 0 0
 
83 Narinder Singh 3. Counting principles and relations

3.8 Partial Orderings

Definition 3.8.1
A relation R on a set S is called a partial ordering or partial
order if it is reflexive, antisymmetric, and transitive. A set S
together with the partial ordering R is called a partially ordered
set, or poset, and is denoted by (S, R). Members of S are called
elements of the poset.

Following are the some examples of posets:


Example 3.8.1. Show that the “greater than or equal” relation
(≥) is a partial ordering on the set of integers.
Solution: Because a ≥ a for every integer a, ≥ is reflexive. If
a ≥ b and b ≥ a then a = b. Therefore ≥ is anti-symmetric. Also,
≥ is transitive because if a ≥ b and b ≥ c, then a ≥ c. Hence,
“greater than or equal” is partial order on set of integers and (Z, ≥)
is a poset.
Example 3.8.2. The divisibility relation | is a partial ordering on
the set of positive integers.
Solution: Show that it is reflexive, antisymmetric and transitive
(Do yourself). Therefore, (Z+, |) is poset.
Example 3.8.3. Show that the inclusion relation ⊂ is a partial
ordering on the power set of a set S.
Solution: Reflexivity: As for any set A, we have A ⊂ A, therefore
⊂ is reflexive.
Antisymmetric: If A ⊂ B and B ⊂ A, then A = B. Therefore ⊂ is
antisymmetric.
Transitivity: If A ⊂ B and B ⊂ C, then A ⊂ C. Therefore ⊂ is
transitive relation. Hence ⊂ is partial order on the set P (S).
3.8. Partial Orderings 84

Next we provide an example of the relation that is not a partial


order.
Example 3.8.4. Let R be the relation on the set of people such
that sRy if x and y are people and x is older than y. Show that R
is not a partial ordering.
Solution: R is antisymmetric because if a person x is older than a
person y, then y is not older than x. That is, if xRy, then y ̸ Rx. The
relation R is transitive because if person x is older than person y and
y is older than z, then x is older than z. That is, if xRy and yRz,
then xRz. However, R is not reflexive, because no person is related
to himself or herself. That is, x ̸ Rx for all people x. Therefore, R is
no partial ordering.
In different posets different symbols such as ≤, ⊆, and |, are used
for a partial ordering. However, we need a symbol that we can use
when we discuss the ordering relation in an arbitrary poset. Cus-
tomarily, the notation a ⪯ b is used to denote that (a, b) ∈ R in an
arbitrary poset (S, R). The notation a << b is used if a ⪯ b, but
a ̸= b.
When a, b are elements of poset (S, ⪯), it is not necessary that
either a ⪯ b or b >>> a. For example, in P (Z, ⊆), {2, 3} is not
related to {1}, and vice versa, because neither set is subset of other.
Definition 3.8.2
The elements a and b of a poset (S, ⪯) are called comparable
if either a ⪯ b or b ⪯ a. When a, b are elements of S such that
neither a << b nor b ⪯ a, a and b are called incomparable.

Example 3.8.5. In the poset (Z+, |), are the integers 3 and 9 com-
parable? Are 5 and 7 comparable?
85 Narinder Singh 3. Counting principles and relations

Solution: The integers 3 and 9 are comparable, because 3|9. The


integers 5 and 7 are incomparable, because 5 ̸ |7 and 7 ̸ |5.

Definition 3.8.3
If (S, ⪯) is a poset and every two elements of S are comparable,
S is called a totally ordered or linearly ordered set, and
⪯ is called a total order or a linear order. A totally ordered set
is also called a chain.

Example 3.8.6. The poset (Z, ≤) is totally ordered, because a ≤ b


or b ≤ a whenever a and b are integers.

Example 3.8.7. The poset (Z +, |) is not totally ordered because


it contains elements that are incomparable, such as 2 and 3.

3.9 Representing Relations using Digraphs

We can represent a relation on a set by pictorial representation. Each


element of the set is represented by a point, and each ordered pair is
represented using an arc with its direction indicate by an arrow.

Definition 3.9.1
A directed graph, or a digraph, consist of a set V of vertices
(or nodes) together with a set E of ordered pairs of elements
of V called edges(or arcs). The vertex a is called the initial
vertex of the edge (a, b), and the vertex b is called the terminal
vertex of this edge.

An edge of the form (a, a) is represented using an arc from the


vertex a back to itself. Such an edge is called a loop.
3.9. Representing Relations using Digraphs 86

Example 3.9.1. Make a digraph of the relation


R = {(a, b), (a, d), (b, b), (b, d), (c, a), (c, b), (d, b)}
on the set A = {a, b, c, d}.

You might also like