47
1 PROPOSITIONS AND LOGICAL OPERATIONS INTRODUCTION What is logic? Logic is the discipline that deals with the methods of reasoning. Logic provides you rules & techniques for determining whether a given argument is valid. In logic we are interested in true or false of statements, and how the truth/falsehood of a statement can be determined from other statements. However, instead of dealing with individual specific statements, we are going to use symbols to represent arbitrary statements so that the results can be used in many similar but different cases. The formalization also promotes the clarity of thought and eliminates mistakes. There are various types of logic such as logic of sentences (propositional logic), logic of objects (predicate logic), logic involving uncertainties, logic dealing with fuzziness, temporal logic etc. Here we are going to be concerned with propositional logic and predicate logic, which are fundamental to all types of logic. Needs of logical reasoning Logical reasoning is used in used in Mathematics to prove theorems, in the natural & physical sciences to draw conclusions from experiments. Indeed we are constantly using logical reasoning. What do we mean by statement or proposition? A statement or proposition is a declarative sentence that is either true or false but not both e.g. 1) The earth is round Statement that happen to be true 2) Do you speak English? Question but not a statement 3) Take two aspirins Command but not a statement 4) The Sun will come out tomorrow Statement since it is either true or false but not both, although we have to wait until tomorrow to find out if it is true or false. 5) x is greater than 2 x is a variable representing a number, is not a proposition, because unless a specific value is given to x we can not say whether it is true or false, nor do we know what x represents. CONNECTIVES In mathematics, the letters x, y, z… denote variables & these variables can be combined with the familiar operations +, -, ÷ and ×. In logic the letters p, q, r …. denote propositional variables i.e. variables can be replaced by statements e.g. p: The sun is shining today q: It is cold

Discrete Maths

Embed Size (px)

DESCRIPTION

all discrete maths notes mca

Citation preview

Page 1: Discrete Maths

1

PROPOSITIONS AND LOGICAL OPERATIONS

INTRODUCTION

What is logic?

Logic is the discipline that deals with the methods of reasoning. Logic

provides you rules & techniques for determining whether a given

argument is valid. In logic we are interested in true or false of

statements, and how the truth/falsehood of a statement can be

determined from other statements. However, instead of dealing with

individual specific statements, we are going to use symbols to

represent arbitrary statements so that the results can be used in many

similar but different cases. The formalization also promotes the

clarity of thought and eliminates mistakes. There are various types of

logic such as logic of sentences (propositional logic), logic of

objects (predicate logic), logic involving uncertainties, logic dealing

with fuzziness, temporal logic etc. Here we are going to be concerned

with propositional logic and predicate logic, which are fundamental to

all types of

logic.

Needs of logical reasoning

Logical reasoning is used in used in Mathematics to prove theorems, in

the natural & physical sciences to draw conclusions from experiments.

Indeed we are constantly using logical reasoning.

What do we mean by statement or proposition?

A statement or proposition is a declarative sentence that is either

true or false but not both e.g.

1) The earth is round

Statement that happen to be true

2) Do you speak English?

Question but not a statement

3) Take two aspirins

Command but not a statement

4) The Sun will come out tomorrow

Statement since it is either true or false but not both, although

we have to wait until

tomorrow to find out if it is true or false.

5) x is greater than 2 x is a variable representing a number, is not a proposition,

because unless a specific value

is given to x we can not say whether it is true or false, nor do

we know what x

represents.

CONNECTIVES

In mathematics, the letters x, y, z… denote variables & these variables

can be combined with the familiar operations +, -, ÷ and ×. In logic

the letters p, q, r …. denote propositional variables i.e. variables

can be replaced by statements e.g.

p: The sun is shining today

q: It is cold

Page 2: Discrete Maths

2

Statements or propositional variables can be combined by logical

connectives to obtain compound sentences e.g. We may combine the above

sentences by the connective and to form the compound sentence p and q:

The Sun is shining and it is cold.

There are several ways in which we commonly combine simple statements

into compound ones. The words are or, and, not, if …. then and if and

only if can be added to one or more propositions to create a new

proposition i.e. compound propositions. The logical operators are also

called connectives.

TRUTH TABLE

The truth table of a logical operator specifies how the truth value of

a proposition using that operator is determined by the truth values of

the propositions. A truth table lists all possible combination of truth

values of the propositions in the left most columns and the truth value

of the resulting propositions in the right most column.

NEGATION (NOT)

If p is a proposition, its negation p is another proposition called the

negation p. the negation of p is denoted by ~ p. The proposition ~ p is

read “not p”.

Alternate symbol used in the literature are ¬ p, p and “not p”.

Truth table for negation

p ~ p

T F

F T

p: I went to my class yesterday.

~ p: I did not go to my class yesterday.

I was absent in my class yesterday.

It is not the case that I went to my class yesterday.

CONJUNCTION (AND)

If p and q are propositions, then the propositions “p and q”, denoted

by p Λ q, is true when both p and q are true and is false otherwise.

The proposition p Λ q is called the conjunction of p and q.

Truth table for conjunction

p q p Λ

q

T T T

T F F

F T F

F F F

There is difference between the logical and & English and e.g.

Jack and Jill are cousins – Here and is not conjunctions

He opened the book and started to read – Here and is used in the sense

“and then”.

Roses are red and Violets are blue – Proper conjunction

Example:

Page 3: Discrete Maths

3

Let p be “Ravi is rich” and let q be “Ravi is happy”. Write each of the

following in symbolic form.

a. Ravi is poor but happy.

b. Ravi is neither rich nor happy.

c. Ravi is rich and happy.

DISJUNCTION (OR)

If p and q are propositions, then disjunction “p or q”, denoted by p V

q, is false when both p and q are false and is true otherwise. The

proposition p V q is called the disjunction of p and q.

Truth table for conjunction

p q p V q

T T T

T F T

F T T

F F F

There is also difference between the logical or & English or e.g.

Twenty or thirty animals were killed in the fire today – indicating

approximate no. of animals and it is not used as connective.

There is something wrong with the bulb or with the wiring – the

possibility exists one or the other or both.

Normally in our everyday language, or is used two statements which have

some kind of relationship between them. But in logic it is not

necessary to have any relationship between them.

Example:

Let p be “Ravi is tall” and let q be “Ravi is handsome”. Write each of

the following in symbolic form.

a. Ravi is short or not handsome. b. Ravi is tall or handsome. c. It is not true that Ravi is short or not handsome.

OTHER DEFINITIONS

Atomic, primary or simple statements: are those statements which do not

contain any connectives.

Molecular, composite or compound statements: are those statements which

contain one or more primary statements or some connectives.

Example

Construct the truth table of (~ p Λ (~ q Λ r)) V (q Λ r) V (p Λ r)

Example

Given that the truth values of p and q are T and those of r and s are

F, find the truth value of the following

(~ (p Λ q) V ~r) V (((~p Λ q) V ~ r) Λ s)

Example

“It is not the case that houses are cold or haunted and it is false

that cottages are warm or houses ugly”. For what truth values will the

above statement be true ?

Page 4: Discrete Maths

4

MATHEMATICAL INDUCTION

PRINCIPLE OF MATHEMATICAL INDUCTION

Let P be a proposition defined on the positive integers N, i.e., P (n) is either true or false

for each n in N. suppose P has the following two properties:

1. P (1) is true.

2. P (n + 1) is true whenever P (n) is true.

Then P is true for every positive integer.

We shall not prove this principle. In fact, this principle is usually given as one of the

axioms when N is developed axiomatically.

Example 1

Show by mathematical induction that for all n ≥ 1

1 + 2 + 3 + ……… + n = n (n + 1) ⁄ 2

Example 2

Show by mathematical induction that for all n

1 + 21+ 2

2+ ……… +2

n =2

n + 1 - 1

BASIC CONCEPTS OF SET THEORY

A set is well defined collection of objects.

Any object belonging to a set is called a member or an element of that set.

We will generally us uppercase letters to denote sets and lowercase letters to denote the

members or elements of sets.

If an element p belongs to a set A, then we write p Є A.

If any element q does not belong to a set A, then we write q ¢ A

A set is finite if it contains a finite number of distinguishable elements e.g. the alphabets

of English, otherwise a set is infinite e.g. the set of real numbers.

Let A and B be any two sets. If every element of a is an element of B, then A is called a

subset of B or A is said to be included in B or B includes A, denoted by A B.

Two sets A and B are equal if A B and B A.

A set A is called a proper subset of a set B if A B and A ≠ B. Symbolically it is written

as A B.

A set is called a universal set if it includes every set under discussion. A universal set is

denoted by E or U.

Page 5: Discrete Maths

5

A set which doesn’t contain any element is called an empty set or null set. An empty set

will be denoted by .

For a set A, a collection or family of all subsets of a is called the power set of A. The

power set of A is denoted by P(A).

OPERATIONS ON SET

The intersection of any two sets A and B written as A ∩ B is the set consisting of all the

elements which belong to both A and B. Symbolically, A ∩ B = { x | x Є A Λ x Є B}

Two sets A and B are called disjoint iff A ∩ B = i.e. A and B have no element in

common.

For any two sets A and B, the unions of A and B, written as A U B is the set of all

elements which are members of the set A or the set B or both. Symbolically, A U B = {x |

x Є A V x Є B}.

Let A and B be any two sets. The relative complement of B with respect to A or

difference of A and B, written as A – B, is the set of consisting of all elements of A

which are not elements of B. Symbolically,

A - B = {x | x Є A Λ x B} Let E be the universal set. For any set A, the relative complement of A with respect to E

i.e. E – A is called the absolute complement or complement of A and is denoted by ~

A.

BASIC SET OF IDENTITIES 1. A U A = A, A ∩ A = A (Idempotent law)

2. (A ∩ B) =(B ∩ A) , (A U B) = (B U A) (Commutative Law)

3. (A U B) U C = A U (B U C), (A ∩ B) ∩ C = A ∩ (B∩C) (Associative Law)

4. A ∩ ( B U C) = (A ∩ B) U ( A ∩ C), A U ( B∩ C) = (A U B) ∩ ( A U C)

(Distributive Law)

5. A U = A, A ∩ E = A

6. A U E = E , A ∩ =

7. A U ~ A = E , A ∩ ~ A =

8. ~ (~ A) = A

9. A U ( A ∩ B) = A, A ∩ ( A U B) = A(Absorption Law)

10. ~ ( A U B) = ~ A ∩ ~ B , ~ ( A ∩ B) = ~ A U ~ B ( De Morgan’s law)

11. ~ = E

12. ~ E =

ORDERED PAIR

An ordered pair consists of two objects in a given fixed order. An ordered pair is not a

set consisting of two elements. The ordering of the two objects is important. The two

objects need not be distant. We generally denote an ordered pair by <x, y> or (x, y) e.g. a

Page 6: Discrete Maths

6

point in a two dimensional plane in Cartesian coordinates. The ordered pairs <1, 3>, <2,

4> … represent different points in a plane. The ordered pairs <a, b> and <c, d> are equal

iff a = c and b = d.

CARTESIAN PRODUCT

Let A and B be any two sets. The set of all ordered pair such that the 1st member of the

ordered pair is an element of A and the second is an element of B is called the Cartesian

product of A and B is written as A X B. Thus,

A X B = {<x, y> | x Є A Λ y Є B}

Example

A = {a, b}

B = {1, 2}

Find A X B and B X A.

PARTITIONS

A partition or quotient set of a nonempty set A is a collection PPPP of nonempty subsets of

A such that

1. Each element of A belongs to one of the sets in PPPP ....

2. If A1 and A2 are distinct elements of PPPP then A1 ∩ A2 =

The sets in PPPP are called the blocks or cells of the partition.

Page 7: Discrete Maths

7

MATHEMATICAL LOGIC

Example

~ (p ↔ q) (p V q) Λ ~ (p V q) Λ (p Λ q)

Example

(p → q) Λ (r → q) (p V r) → q

Important Definitions For any statement formula p → q, the statement formula q → p is called its converse ~p

→ ~q is called its inverse and ~q → ~p is called its contra positive.

IMPLICATION

A proposition p is said to logically imply or tautologically imply or simply imply a

proposition q if q is true whenever p is true. A proposition p is said to logically imply a

proposition q if p → q is a tautology. The implication of p to q is denoted by p q.

Method 1 To show the implication p q, we assume that p has the truth value T and

then show that this assumption leads to q having the value T. Then p → q must have the

truth value T.

Method 2 To show p q, we assume that q has the truth value F and then show that

this assumption leads to q having the value F. Then p → q must have the truth value T.

Example

1. (p Λ q) p → q

2. p → (q → r) (p → q) → (p → r)

3. (q → (p V ~ p)) → (r → ( p V ~ p)) r → q

4. p → q p → (p Λ q)

IMPORTANT IMPLICATION FORMULAS

13. p p V q (Disjunctive Addition)

14. (p Λ q) p (Conjunctive simplification)

15. (p Λ q) q (Conjunctive simplification)

16. p Λ (p → q) q (Detachment)

17. ~ q Λ (p → q) ~ p (Contra positive)

18. (p V q) V ~ q p (Disjunctive simplification)

19. (p V q) V ~ p p (Disjunctive simplification)

20. (p → q) Λ (q → r) (p → r) (Chain rule)

21. ~ p p → q

22. q p → q

23. ~ (p → q) p

24. ~ (p → q) ~q

25. (p V q) Λ (p → q) Λ (q → r) r (Dilemma)

26. p Λ q p ↔ q

27. p → (q → r) (p → q) → (p → r)

28. p (p V p) , p (p Λ p) (Idempotent law)

Page 8: Discrete Maths

8

29. (p Λ q) (q Λ p) , (p V q) (q V p) (Commutative Law)

30. (p V q) V r p V (q V r) , (p Λ q) Λ r p Λ (q Λ r) (Associative Law)

31. p Λ ( q V r) (p Λ q) V ( p Λ r), p V ( q Λ r) (p V q) Λ ( p V r)

(Distributive Law)

32. p V F p , p Λ T p

33. p V T T , p Λ F F

34. p V ~ p T , p Λ ~ p F

35. ~ (~ p) p

36. p V ( p Λ q) p , p Λ ( p V q) p (Absorption Law)

37. ~ ( p V q) ~ p Λ ~ q , ~ ( p Λ q) ~ p V ~ q ( De Morgan’s law)

38. p → q ~ p V q (Implication Law)

39. p ↔ q (p → q) Λ (q → p) (Equivalence Law)

40. (p Λ q) → r p → (q → r) (Exportation Law)

41. (p → q) Λ (p → ~q) ~ p (Absurdity Law)

42. p → q ~q → ~p (Contra positive Law)

43. p ↔ q ( p Λ q) V (~ p Λ ~q) (Biconditional Law)

OTHER CONNECTIVES

NAND (NOT AND)

If p and q are propositions, then the proposition “p NAND q” denoted by p ↑ q is false

when both p and q are true and is true otherwise. That is the word “NAND” is a

combination of “NOT” and “AND”.

NOR (NOT OR)

If p and q are propositions, then the proposition “p NOR q” denoted by p ↓ q is true

when p and q are both false and true otherwise. That is the word “NAND” is a

combination of “NOT” and “OR”.

Truth table for NAND and NOR

p q p ↑ q p ↓ q

T T F F

T F T F

F T T F

F F T T

FUNCTIONALLY COMPLETE SETS

Any set of connectives in which every formula can be expressed in terms of an equivalent

formula containing the connectives from Λ, V, ~, → and ↔ is called a functionally

complete set of connectives.

Example

1. Write an equivalent formula for p Λ (q ↔ r) V (r ↔ p) which does not contain the

biconditional.

Page 9: Discrete Maths

9

2. Write an equivalent formula for p Λ (q ↔ r) which contains neither the

biconditional nor the conditional.

3. Write the negation of the statement without using the conditional.

“If it snows they do not drive the car”.

4. Rewrite the following statement without using conditional.

“If you work hard, you will succeed”.

CONDITIONAL OPERATOR (IF ….. THEN) IMPLICATION

If p and q are two statements, then the statement p → q which is read as “If p then q” is

called a conditional statement. The statement p is called antecedent (premise, hypothesis)

and q the consequent (conclusion) in p → q.

Truth table for if ….. then

p q p → q

T T T

T F F

F T T

F F T

It is not necessary that there be any kind of relation between p and q in order to form

p → q. The conditional often appears very confusing to a beginner when one tries to

translate a conditional in English into symbolic form. Because implications arise in many

mathematical arguments, a wide variety of terminology is used to express p → q. Some

of the more common ways of expressing this implication are

1. p implies q

2. if p then q

3. q if p

4. p only if q

5. p is sufficient for q

6. q whenever p

7. q is necessary for p

In our everyday language, we use the conditional statements in a more restricted sense

e.g. If I get the book then I shall read it tonight sounds reasonable. On the other hand “If I

get the book then this room is red” does not make sense in English language. But in logic

Page 10: Discrete Maths

10

it is perfectly acceptable and has a truth value which depends on the truth values of the

two statements being connected.

BICONDITIONAL OPERATOR (IF AND ONLY IF)

If p and q are two statements, then the statement p q which is read as “p if and only if

q” and abbreviated as “p iff q” is called a biconditional statement. p q is also

translated as “p is necessary and sufficient for q”.

Truth table for if and only if

p q p q

T T T

T F F

F T F

F F T

Example Given the truth values of p and q are T and those of r and s as F find the truth value of

(~ (p Λ q) V~ r) V ((q ~ p) → (r V ~ s))

Example If p → q is false, determine the truth value of (~ (p Λ q)) → q

TAUTOLOGIES AND CONTRADICTIONS

TAUTOLOGY

A statement formula which is true regardless of the truth values of the statements which

replace the variables in it is called a tautology or a logical truth or a universally valid

formula.

Example ((p → q) Λ (q → r)) → (p → r) is a tautology

CONTRADICTION

A statement formula which is false regardless of the truth values of the statements which

replace the variables in it is called a contradiction.

Example Verify that the proposition (p Λ q) Λ ~ (p V q) is a contradiction.

CONTINGENCY

A statement formula that is neither a tautology nor a contradiction is called a

contingency.

EQUIVALENCE AND IMPLICATION

An important step used in mathematical argument is the replacement of a statement with

another statement with the same truth value.

Page 11: Discrete Maths

11

EQUIVALENCE

Two propositions are logically equivalent or simply equivalent if they have exactly the

same truth values under all circumstances.

The propositions p and q are logically equivalent if p q is a tautology. The

equivalence of p and q is denoted by p q.

Note 1. One way to determine whether two propositions are equivalent is to use a truth

table. In particular, the propositions p and q are logically equivalent if and only if the

columns giving their truth values agree.

Note 2. Whenever we find logically equivalent statements, we can substitute one for

another as we wish, since this action will not change the truth value of any statement.

Example

Prove (p → q) (~ p V q)

Example

Without using truth table show that ((p V q) Λ ~ (~ p Λ (~ q V ~ r))) V (~ p Λ ~ q) V (~ p

Λ ~ r) is a tautology.

Example

Without using truth table show that (~ p Λ (~ q Λ r)) V (q Λ r) V (p Λ r) r

Page 12: Discrete Maths

12

NORMAL FORMS

A statement formula is said to be in the normal form (or canonical form) if

1. only three connections ~, Λ, V have been used

2. negation has not been used for a group of letters

3. distributive law has been applied

4. parenthesis has not been used for the same connective(e.g. p V (q V r) is p V q V

r)

Note: In this section we will use word “product” in place of “conjunction” and “sum” in

place of “disjunction”.

Elementary product and sum

A product of the variables and their negations in a formula is called an elementary

product and a sum of the variables and their negation is called an elementary sum. Any

part of an elementary product or sum which itself an elementary product or sum is called

a factor of the elementary product or sum.

e.g.

1. p, ~p, ~p Λ q, ~q Λ p Λ ~p, p Λ ~p are some elementary products of the two

variables p and q

2. p, ~p, ~p V q, ~q V p V ~p, p Λ ~q are some elementary sums.

3. ~p, q Λ ~q , ~p Λ q are some of the factors of ~p Λ q Λ ~q

DISJUNCTIVE NORMAL FORM

A formula which is equivalent to a given formula and which consists of a sum of

elementary products is called a disjunctive normal form.

CONJUNCTIVE NORMAL FORM

A formula which is equivalent to a given formula and which consists of a product of

elementary sums is called a conjunctive normal form.

Example

Obtain the disjunctive normal form and conjunctive normal forms of

1. p Λ (p → q)

2. ~ (p V q) ↔ (p Λ q)

MINTERM

For a given number of variables, the minterm consists of conjunctions in which each

variable or its negation, but not both, appears only once.

e.g. for two variables p and q p Λ q, p Λ~ q, ~p Λ q and ~ p Λ ~q are called minterms.

From the truth table of these minterms, it is clear that no two minterms are equivalent.

p q p Λ q p Λ~ q ~p Λ q ~ p Λ ~q

T T T F F F

T F F T F F

F T F F T F

F F F F F T

Page 13: Discrete Maths

13

PRINCIPAL DISJUNCTIVE NORMAL

For a given formula, an equivalent formula consisting of disjunctions of only minterms is

known as its principal disjunctive normal form.

Note: For every truth value T in the truth table of the given formula, select the minterm

which has also has the value T for the same combination of the truth table of p and q.

The disjunction of only minterms will then be the equivalent to the given formula.

Example

Obtain the principal disjunctive normal form of

p → ((p → q) Λ ~ (~ q V ~p))

The method to obtain the principal disjunctive normal form of a given formula without

constructing the truth table is given below

1. Replace ↔ and → by ~, Λ, V.

2. Use De Morgan’s law and distributive law.

3. Drop any elementary product which is a contradiction.

4. Introduce the missing factors to obtain minterms.

5. Delete the identical minterms.

Example

Obtain the principal disjunctive normal form of

1. ~p V q

2. (p Λ q) V (~p Λ r) V (q Λ r)

MAXTERM

For a given number of variables, the maxterm consists of disjunctions in which each

variable or its negation, but not both, appears only once.

e.g. for two variables p and q p V q, p V~ q, ~p V q and ~ p V ~q are called maxterms.

PRINCIPAL CONJUNCTIVE NORMAL

For a given formula, an equivalent formula consisting of conjunctions of the maxterms is

known as its principal conjunctive normal form.

Note: If the principal disjunctive normal form of a given formula A is known then the

principal disjunctive normal form of ~A will consist of the disjunction of the remaining

minterms which do not appear in the principal disjunctive normal form of A.

From A ~ ~ A, one can obtain the principal conjunctive normal form of A.

Example

Obtain the principal disjunctive and principal conjunctive normal forms of the following

formulae.

1. q Λ (p V ~ q)

2. p → (p Λ ( q → p))

3. ( q → p) Λ (~ p Λ q)

4. p V (~ p → (q V (~ q → p)))

Page 14: Discrete Maths

14

PREDICATE CALCULUS

Consider the two statements “Rohit is brilliant” and “Manas is brilliant”. As propositions,

there is no relation between them, but they have something in common. Instead of writing

two statements we can write a single statement like “x is brilliant”, because is Rohit and

Manas share the same nature brilliant. By replacing x by any other name we get many

propositions. The common feature expressed by “is brilliant” is called predicate.

Predicate calculus deals with sentences involving predicates.

A p[art of a declarative sentence describing the properties of an object or relation among

objects can be referred as predicate, e.g. “is brilliant”. Denote the predicate “is brilliant”

by letter B, Rohit by r, Manas by m. then we can write the two statements as B(r) and

B(s) respectively.

QUANTIFIERS

There are two types of quantifiers

1. Universal quantifier

2. Existential quantifier

UNIVERSAL QUANTIFIER

The Universal quantification of a predicate p(x) is the statement “for all values of x, p(x)

is true”. The universal quantification of P(x) is denoted by x P(x). The symbol is

called the universal quantifier.

EXISTENTIAL QUANTIFIER

The Existential quantification of a predicate p(x) is the statement “there exists a value of

x for which p(x) is true”. The existential quantification of P(x) is denoted by x P(x).

The symbol is called the existential quantifier.

Consider statements involving the names of two objects e.g. Jack is taller than Jill can be

represented by T (j1, j2)

Example P(x): x is a person

F(x, y): x is the father of y

M(x, y): x is the mother of y

Write the predicate “x is the father of the mother of y”

Page 15: Discrete Maths

15

VALIDITY USING TRUTH TABLE

1. If you invest in the stock market, then you will get rich.

If you get rich, then you will be happy.

Therefore, if you invest in the stock market, then you will be happy.

2. I will become famous or I will not become a writer.

I will become a writer.

Therefore, I will become famous.

3. If I drive to work, then I will arrive tired.

I do not drive to work.

Therefore, I will not arrive tired.

4. Without constructing a truth value, show that a Λ e is not a valid consequence of

a ↔ b, b ↔ (c Λ d), c ↔ (a V e), a V e

RULES OF INFERENCE

A particular formula is a valid consequence of a given set of premises can be

proved by the rules of inference. There are two rules of inference which called

rules P and T.

P: A premise introduced at any point in the derivation.

T: A formula S may be introduced in a derivation if S is tautologically implied by

any one or more of the preceding formulas in the derivation.

IMPORTANT IMPLICATION FORMULAS

44. p p V q (Disjunctive Addition)

45. q p V q (Disjunctive Addition)

46. (p Λ q) p (Conjunctive simplification)

47. (p Λ q) q (Conjunctive simplification)

48. ~ p p → q

49. q p → q

50. ~ (p → q) p

51. ~ (p → q) ~q

52. p, q p Λ q

53. ~ p, p V q q

54. p , p → q q

55. ~ q , p → q ~ p

56. p → q , q → r p → r

57. p V q , p → r , q → r r

Example 1

Demonstrate that R is a valid inference from the premises p → q, q → r and p

Page 16: Discrete Maths

16

Example2

Show that r V s follows logically from the premises c V d, (c V d) → ~h, ~h → (a Λ ~b)

and (a Λ ~b) → r V s

There is a third inference rule known as rule CP or rule of conditional proof.

CP: If we can derive S from R and a set of premises, then we can derive R → S from the

set of premises alone. Rule CP is called deduction theorem and is generally use if the

conclusion is of the form R → S. In such cases R is taken as additional premises and S is

derived from the given premises and R.

Example 3

Show that R → S can be derived from the premises P → (Q → S), ~R V P and Q.

Example 4

If A works hard, then either B or C will enjoy themselves. If B enjoys himself, then A

will not work hard. If D enjoys himself, then C will not. Therefore, if A works hard, D

will not enjoy himself.

Page 17: Discrete Maths

17

Relations Relations means as it’s name implies it shows. The relation ship between minimum two entities, objects. In this unit we will discuss about relations and it’s properties, and it’s representation and some operations on relations. Before discussing about relations in detail we should know about product set.

1) Product Set If A and B are two non empty finite set then product set or Cartesian product A X B as said to be ordered pair (a, b) with a E A and b E B.

A X B = { (a, b) / a ∈ A and b ∈ B } Eg. A = { 1, 2, 3} B = { 4, 5} A X B = { (1, 4) (1, 5), (2, 4), (2, 5), (3, 4), (3, 5) } B X A = { (4, 1) , (4, 2), (4, 3), (5, 1), (5, 2), (5, 3) }

Is A X B ≠ B X A Let coordinately of a set A is about as n(A) or /A/ Then N (A X B) = n (A) X n (B) This can be verified from above eg: n (A X B) = 3 X 2 = 6 n (A) = 3 n (B) = 2

2) Relations Usually relations are defined on sets; and it’s condition product is how the elements of the sets are related and we are grouping those elements which satisfying the relation R. Let A and B are two sets. Then

A X B = { (a, b) / a ∈ A and b ∈ B } On the above set A X B we can define some relation R then the set R contain only those tables which satisfying the defined relation. Eg.: Let A = { 2, 3 } B = { 1, 4, 9, 10 } A X B = { (2, 1), (2 , 4) (2 , 9) (2, 10), (3, 1), (3, 4), (3, 9), (3, 10) } Her relation in given

2 R 4, 3 R 9 Read as 2 Related to 4 and 3 Related to 9 where 2, 3 ∈ A and 4, 9 ∈B. Her we can say that Let a E A and b E B then the above relation in b = a

2.

Page 18: Discrete Maths

18

So the relation R in defined on A X B is b is a Square of A. So R = { (a, b) / (a, b) ∈ A X B and b = a

2 }.

In the Relation R is defined as. R is a set which contain the element (a, b) in ordered pair and

every (a, b) ∈ A X B and b = a2. So the Relation set R is obtained as.

R = { (2, 4), (3, 9 ) } ∈ A X B Similarly any types of relations can be defined as sets such as. B < a ; b = a, a > b, a + 5 < b etc. . .

Where a ∈ A and b ∈ B. Where A and Bare two sets. So from the above discussions we can Understand that Relation R is a subset of A X B. If the relation is defined on two set A and B. R C A X B

3) Domain & Range of a Relation Let R be a relation defined on two sets A to B then Domain of R Dom (R) is a subset of A ie set of all first element in the pair that make up R. Similarly Range of R is Range (R) is a subset of B in Set of all Second element in the pair that make up R. We can explain it with example. Let A = { 1, 2, 3, 4} B = { 5, 6, 7, 10} A X B = { (1, 5), (1, 6), (1, 7), (1, 10) (2, 5), (2,6) (2,7) (2,10) (3,5), (3,6), (3,7), (3,10), (4,5), (4,6), (4, 7), (4, 10) }

Relation R = { (a, b) / (a, b) ∈ A X B and (a + 4 = b) } So R = { (1, 5), (2,6), (3,7) }.

Dom (R) = { 1, 2, 3 } ∈ A

Range (12) = { 5, 6, 7 } ∈ B

4) R- Relative set If R is a relation from A to B where A and B are two set and x E A is we define R(x), the R- Relative set of x is the all element y in B properly that x is Related Y x Ry for some x is A. R – Relative set of A is

R (A) = { y ∈ B / x R y for some x in A }

Let A = {1, 2, 3 } B {1, 2, 4, 5} Let R in a Relation x + 2 ≤ y where X ∈ A and y ∈ B the R = { (1, 4) (1,4) (2,4) (2,5) (3,5) }

Page 19: Discrete Maths

19

R relative set of 2 is R (2) = {4, 5) is in relation set 2

R 4 and 2

R 5.

R relative set of set A R (A) = { 4, 5} is in the above relation set only 4 and 5 are related to some of the elements in A.

• Let R be a relation from A to B and Let A, and A2 be subset of A Theorem 1 Then we can prove following Theorem

(A) If A1 ⊆ A2 then R (A1) ⊆ R (A2)

(B) R (A1 υ A2) = R (A1) υ R (A2)

(C) R (A1 ∩ A2) ⊆ R (A1) ∩ R(A2) Proof :

a) If y ∈ R (A1), then x R Y for X ∈ A1, Since A1 ⊆ A2, x ∈ A2 this y ∈ R (A2)

b) If y E R (A υ B) this is from the definition of R – relative set x R y for some X

in A υ B2 If x is in A1 them we must have y E R (A1). By the some argument if

X is in A2 then we must have y ∈ R (A2) is in either (are y ∈ R (A1) υ R (A2)

Ie we have taken that y ∈ R (A1 υ A2) and y ∈ R (A1) υ R (A2)

Ie R (A1 υ A2) ⊆ R (A1) υ R (A2) – 1

We know that A1 ⊆ (A1 υ A2)

A2 ⊆ (A1 υ A2)

We have show that R (A1) ⊆ R (A1 υ A2)

R (A2) ⊆ R (A1 υ A2)

R (A1) υ R (A2) ⊆ R (A1 υ A2) -2

From 1 and 2 ie x ⊆ y and y ⊆ x them x = y

So R (A1 υ A2) = R (A1) υ R (A2)

c) By using above notations we can prove A (A1 ∩ A2) ⊆ R (A1) ∩ R (A2) Left as an exercise.

5) Matrix Representation of Relation In order to represent a relation between two finite sets with a matrix as follows. If set A = {a1, a2 . . . . . . . . Am } and B = {b1, b2, b3 . . . . . bn } are finite set contain M and n elements respectively and R is a relation from A to B we can represent R by a Mxn matrix MR = [Mij] The matrix MR is defined as.

1 if (ai, bj) ∈ R.

Mij = 0 If (ai, bj) ∉ R. * Ie in mxn matrix each entry is matrix in filled with 1 If (ai, bj) is a element in Relation R else 0 if (ai, bj) in not a member relation.

Page 20: Discrete Maths

20

Example A = { 1, 2, 4, 6 } B = { 1, 4, 5, 16, 25, 36 }

Let R be a relation from A to B and relation is defined as y = x2 where x ∈ A and y ∈ B. So

Relation Set R = { (1,1), (2,4), (4,16) (6,36) }. Matrix Representation for the above Relation is n (A) = 4 n (b) = 6 So we have 4 X 6 matrix MR B

1 4 5 16 25 36

1 1 0 0 0 0 0 A = 2 0 1 0 0 0 0

4 0 0 0 1 0 0 6 0 0 0 0 0 1

(2 , 4) ∈ R so Correspondently is 1. Example 2 Let Mr be the Matrix of a Relation then prepare the Relation set from the matrix assume elements as a1 a2 . . . . an for A b1, b2, b3 . . bm for B. 1 0 0 1 0 MR = 0 0 1 0 0 0 1 1 0 0 Her n (A) = 3 n (B) = 5 Her Relation Set are R = { (a1, b1), (a1, b4), (a2, b3), (a3, b2), (a3, b3) }.

6) The Diagraph of a Relation A relation can also be represented as Diagraph. If a relation is defined on two different set then the diagraph for that relation usually a bi partiate graph. More discuss about this is in following see when. The Diagraph of a Relation A relation can also be represented as a diagraph. Digraph in pictorial representation of a relation usually the relation is defined on single set. Let A be a finite set with n elements. Then we can

define any relation R on AXA and a here R ∈ AXA. In order to represent a relation as A to A is R, we can draw a directed graph (Diagraph). Graph is a set of vertices along with set of Edges. Each vertex (node) in the graph represent the element in the set here A. Edge between two vertex represent say < Vi Vj are element of A.

Page 21: Discrete Maths

21

Eg : 1

A = { 1,2,3,4 } A relation R defined on A to A is R ∈ A X A. Relation R { (a,b) / (a ∈ A and b ∈ A), a < b}. R = { (1,2), (1,3) (1,4), (2,3) (2,4) (3,4) } Fig. 1 is the graph of a relation . . . . R. Eg : 2 Prepare the Relation set from the given Diagram Figure 2 A = { 1,2,3,4,5 } R = {1,1), (2,2) (1,3) (1,4) (1,5), (2,2), (2,3), (2,4), (2,5) (3,3) (3,4) (3,5) (4,4) (4,5) (5,5) }

R = { (a, b) / (a, b) ∈ A X B, a ≤ b }. Note : Suppose a Relation R is defined on two different sets A and B is a relation is defined from A to B. Then whose digraph in said to be a bipartiate graph. A = { 1,2,3 } B = { a, b, c}. A relation R is defmal on A X B in given. R = { (1, a) (2, c), (3, b), (1,c), (3, a) }. So graph for above relation in represented given below.

1 2 5

3 4

2

1 4

3

Page 22: Discrete Maths

22

Her the nodes (vertex) are divided in to two sets. {1,2,3} (a, b, c) and also seen that there in no relationship among elements in the some set. So we can partiation the graph in to exalt two halfs; these types of graph called bi partiate graph. [We will discuss the properties of graph is coming unit Graph theory].

7) Paths in Relations and Digraphs Path length in a relation R can be explained easily with help of a diagraph of a Relation. Let a be set A = { a, b, c, d, e }. And a Relation r definition A to a in R = { (a, a), (a, b,) (b, c) (c, e) (c, d), (d, e) }. The diagraph for the above relation is

Fig 3 Here the element in the relation set R are a

Ra, a

R b, b

R c, c

R d, c

R e, d

R e. are seen in the

graph with edges < a1, a2 >, < a, b >, < b, c >, < c, d > < c, e >, and < d, e >. Path length for above edges are in there a path of length are from are vertex to another vertex which is present in the relation observe the sequence. b

R c and c

R d. [ b Related to C and [ Related to d ] is contributing a path of length 1 each is a

relation from. B to d in a sequence as b R c, c

R d so path length from b to d is 2. [ is represented

with Doted Line ]. So, suppose R is a relation on set A, A path of length n in R from a to b is a finite sequence S = a

R x, x

R x2, x2

R x3 . . . . . . xn-1

R b

Where x1, x2 . . . . . xn-1 are intermediate nodes in the diagraph through which we can reach to from a bat the path of length is n. it is denoted as. a

Rn b meaning in the expression will generate

a sequence starting from a and ending at b through intermediate n-1 elements. Like A

R x1, x1

R x2 . . . . . . . x n –1

R b.

The notalian R (x) consist of all vertex that be reached from x bat whose path of length should be n. The Notalwon R (x), consist of all vertex that can be reach from x by some path in R. From the above digraph for a Relation defined on A to A. we can list different path of lengths.

2 2

22

2 2

Page 23: Discrete Maths

23

R = { (a, a) (a, b), (b, c) (c, d) (c, e) (d, e) } Path of length = 1 n = 1 a

R a

a R b

b R C

c R d

c R e

d R e

Path length n = 2 a

R2 a - a

R a and a

R a

a R2

b - a R a and a

R b

a R2

c - a R b and b

R c

b R2

e - b R c and c

R e

b R2

d - b R c and c

R d

c R2

e - C R d and c

R e

Path length n = 3 a

R3 a - a

R a, a

R a and a

R a

a R3

b - a R a, a

R a and a

R b

a R3

c - a R a, a

R b and b

R c

a R3

d - a R b, b

R c and c

R d

a R3

e - a R b, b

R c and c

R e

b R3

e - b R c, c

R d and d

R e

Path of length n = 4 a

R4 a - a

R a, a

R a, a

R a and a

R a

a R4 b - a

R a, a

R a, a

R a and a

R b.

a R4

c - a R a, a

R a, a

R b and a

R c

a R4

d - a R a, a

R b, b

R c and c

R d

a R4

e - a R a, a

R b, b

R c and c

R e

Here after in n > 3 we have no path from mode other than a But if the n ® is sufficiently large it is difficult to prepare the part of length by using above method. In order to made this taste easy, we are using another method Matrix method to calculate R

1, R

2 .

. . . Rn.

We have already discussed matrix representative of a Relation R is MR. With help of this matrix. We can calculate any path of length in the relation. MR

2 represent the matrix which gives the relation whose path of length in 2. Similarly MR

n is the

matrix with path of length n. Here MR

2 = MR MR M

R is the original relation matrix with path of length,

MR

3 = MR 0 MR 0 MR

Page 24: Discrete Maths

24

MR

n = MR 0 MR 0 MR . . . .MR (n tones).

(the operator is part are at relative positions) Guide Line for preparing MR

n.

1) Let MR be the Relational matrix with n rows and n columns and path of

length one.

Her MR = [Mij ] 1 ≤ I ≤ n and I ≤ j ≤ n.

2) Let MR2 is the Relational matrix with path of length 2 is MR

2 = [ nij ] 1 ≤ i ≤ n and 1 ≤ j ≤

n. 3) In MR

2 each entry

1 If and only if i

th row and j

th column of MR above R 1 in the some relative position

Nij =

0 If there is no 1 in some relative position of I row and jth column of MR.

4) MR

3 = MR

2 M

R and Her each entry in MR

3 = [ nij ]

1, if there is one in the some relative position of i

th row and j

th column of MR

2 and

MR [ Nij ] =

0, if there is no one in the some relative position of ith row and j

th column of MR

2

and MR. 5) Repeat the step for MR

4, MR

5 . . . . . . MR

n.

Is MRk = MR

k-1 MR.

Example 1 Let A = { a, b, c, d, e } R = { (a, a), (a, b), (b, c), (c, d), (c, e), (d, e) }. MR = 1 1 0 0 0 0 0 1 0 0 0 0 0 1 1 0 0 0 0 1 0 0 0 0 0 MR

2 = MR MR = 1

st 1 1 0 0 0

0 0 1 0 0 3

rd 0 0 0 1 1

0 0 0 0 1 0 0 0 0 0 1

st 4

th

Page 25: Discrete Maths

25

1 1 0 0 0 0 0 1 0 0 0 0 0 1 1 0 0 0 0 1 0 0 0 0 0 MR

2 = 1 1 1 0 0

0 0 0 1 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 Her in MR 1

st raw and 1

st column contain 1 in some relative position 1 is in marked in circle in MR

2

MR2 (1,1) = 1 MR, & MR

2

Similarly 3

rd row and 4

th column of MR contain 1 in some relative position at 4. So in MR

2 matrix 3

rd

row 4th column contain a which is marked in Rectangle MR

2. Like this way we can prepare MR

n.

8) Computer Representation of Relations.

A relation R can be represented in computer by using two methods. They are matrix representation, and another are in linked list representation. This same representation we are discussing in graph theory also any given relation R which can be represented as a diagraph as we have discussed. This diagraph we can represent as a matrix in graph theory we call it as adjacency matrix. Preparation of adjacency matrix is as given below. 1) Let R be a relative defined as set A with n (A) = M, so we have MR with mxm. 2) any entry in MR = [ Mij ] is

1 If there is a edge between ith vertex to j

th vertex. Ie i

th element with set A to J

th

element with set A Mij = 0 If there is no edge between i

th vertex to j

th vertex.

For the given graph

a a

Page 26: Discrete Maths

26

\

\

\

Fig. 5 a b c d e

A 1 1 0 0 0 MR = B 0 0 1 0 0

C 0 0 0 1 1

D 0 0 0 0 1 E 0 0 0 0 0 Adjacency list [ linked list representation] The Diagraph in Relation can be represented as. Linked list, it is usually a storage call which consist of at least one information field and one pointed field to point next node [Storage cell] INFO FIELD POINTER is the one such organization. The Linked list representation of the above diagraph is

a a b

b c

c d e

d e \

e Nil Her the \ in the pointed field indicated that there is no node after that in end of the list

9) Properties of Relations In many applications to computer science and applied mathematics, we deal with relations on a set A rather than relations from A to B. Moreover, these relations often satisfy certain properties that will be discussed in this section. Reflexive and Irreflexive Relations

A relation R on a set A is reflexive if (a, a) ∈ R for all a ∈ A, that is, if a R a for all a ∈ A. A relation

R on a set is irreflxive if a R a for every a ∈ A.

a a

a

Page 27: Discrete Maths

27

Thus R is reflexive if every element a ∈ A is related to itself and it is irreflexive if no element is related to itself.

a) Let ∆ = } (a,a) / a ∈ A] so that ∆ is the relation of equality on the set A. Then ∆ is reflexive,

since (a, a) ∈ ∆ for all ∈ A.

b) Let R = [ (a, b) ∈ A X A [a ≠ b], so that R is the relation of inequality on the set A. Then R

is irreflexive, since (a, a) ∉ R for all a ∈ A.

c) Let A = {1,2,3), and let R = {(1,1), (1,2)}. Then R is not reflexive since (2,2) ∉ R and (3,3)

∉ R. Also, R is not irreflexive, since (1,1) ∈ R.

d) Let A be a nonempty set. Let R = ∅ ⊆ A X A, the empty relation. Then R is not reflexive,

since (a, a) ∉ R for all a ∈ A (the empty set has no elements). However, R is irreflexive. We can identify a reflexive or irreflexive relation by its matrix as follows. The matrix of a reflexive relation must have all I’s on it’s main diagonal, while the matrix of an irreflexive relation must have all 0’s on its main diagonal. Similarly, we can characterize the digraph of a reflexive or irreflexive relation as follows. A reflexive relation has a cycle of length I at every vertex, while an irreflexive relation has no cycles

of length I. Another useful way of saying the same thing uses the equality relation ∆ on a set A : R

is reflexive if and only if ∆ ⊆ R, and R is irreflexive if and only if ∆ ∩ R = ∅ . Finally, we may note that if R is reflexive on a set A, then Dom (R) = Ran (R) = A. Symmetric, Asymmetric, and Antisymmetric Relations A relation R on a set A is symmetric if whenever a R b, then b R a. It then follows that R is not

symmetric if we have some a and b ∈ A with a R b, but b R a. A relation R on a set A is asymmetric if whenever a R b, then b R a. It then follows that R is not asymmetric if we have

some a and b ∈ A with both a R b and b R a. A relation R on a set A is antisymmetric if whenever a R b and b R a, then a = b. The

contrapositive of this definition is that R is antisymmetric if whenever a a ≠ b, then a R b or b R a.

It follows that R is not antisymmetric if we have and b in A, a ≠ b, and both a R b and b R a. Given a relation R, we shall want to determine which properties hold for R. Keep in mind the following remark : A property fails to hold in general if we can find one situation where the property does not hold. Now we will see how can we solve some problems by wing there properties. Before Doing problem. We clarify some notations. Z is a set of Integers both + ve and – ve 2

+ in set of +ve integers. 2

- in set of –ve Integers R in set

of Realnumbers. Example I Let A= Z, the set of integers, and let

R = { (a, b) ∈ A X A [ a < b ] So that R is the relation less than. Is R symmetric, asymmetric, or antisymmetric?

Page 28: Discrete Maths

28

Solution Symmetry : If a < b, then it is not true that b < a, So R is not symmetric. Asymmetry: If a < b, then b < a (b is not less than a), so R is asymmetric.

Antisymmetry: If a ≠ b, then either a < b or b < a, so that R is antisymmetric. Let A = {1,2,3,4) and let R = { (1,2), (2,2) (3,4), (4,1) }.

Then R is not symmetric, since (1,2) ∈ R, but (2,1) ∉ R. Also, R is not asymmetric, since (2,2) ∈

R. Finally, R is antisymmetric, since if a ≠ b, either (a, b) ∉ R or (b, a) ∉ R. Example – 3 Let A = Z

+, the set of positive integers, and let

R = { (a, b) ∈ A X A [ a divides b }. Is R symmetric, asymmetric, or anisymmetric ? Solution If a \ b, it does not follow that b \ a, so R is not symmetric. For example 214 but 4 X 2 (4 Dn 2) not equal to 2 dwe by 4) If a = b = 3, say, then a R b and b R a, so R is not asymmetric. If a \ b and b \ a, then a = b, so R is antisymmetric. We now relate symmetric, asymmetric, and antisymmetric properties of a relation to properties of its matrix. The matrix MR = [ Mij ] of a symmetric relation satisfies the property that If mij = 1, then mij = 1. Moreover, if m ji = 0, then mij = 0. Thus MR is a matrix such that each pair of entries, symmetrically placed about the main diagonal, are either both 0 or both 1. It follows that MR = M

TR, so that MR is

a symmetric matrix The matrix MR = [ mij ] of an asymmetric relation R satisfies the property that If mij = 1, then mji = 0. If R is asymmetric, it follows that M ii = 0 for all i; that is, the main diagonal of the matrix MR consists entirely of 0’s. This must be true since the asymmetric property implies that if M ii = 1, then m ii = 0, which is a contradiction.

Finally, the matrix MR = [ m ij] of an antisymmetric relation R satisfies the property that if i ≠ j, then m ij = 0 or m ji = 0. Example 4 given below Consider the matrix each of which is the matrix of relation, as indicated. Relations R1 and R2 are symmetric since the matrices MR1 and MR2 are symmetric matrices. Relation R3 is antisymmetric, since no symmetrically situated, off-diagonal positions of MR3 both

Page 29: Discrete Maths

29

contain 1’s. Such positions may both have 0’s, however, and the diagonal elements are unrestricted. The relation R3 is not asymmetric because MR3 has 1’s on the main diagonal. Relation R4 has none of the three properties: MR4 is not symmetric. The presence of the 1’s in positions 4, 1 and 1, 4 of MR4 violates both asymmetry and antisymmetry. Finally, R5 is antisymmetric but not asymmetric, and R6 is both asymmetric and antisymmetric. 1 0 1 0 1 1 0 0 0 1 = MR1 1 1 0 0 = MR2 1 1 1 1 0 1 1 0 0 1 1

(a) (b) 1 1 1 0 0 1 1 0 1 0 = MR3 0 0 1 0 = MR4 0 0 0 0 0 0 1

1 0 0 0

(c) (d) 1 0 0 1 0 1 1 1 0 1 1 1 = MR5 0 0 1 0 = MR6 0 0 1 0 0 0 0 1 0 0 0 1 0 0 0 0

(e) (f) We now consider the diagraphs of these three types of relations. If R is an asymmetric relation, then the digraph of R cannot simultaneously have an edge from vertex i to vertex j and an edge from vertex j to vertex i. This is true for any i and j, and in particular if i equals j. Thus there can be no cycles of length 1, and all edges are “one-way streets.” If R is an antisymmetric relations, then for different vertices i and j there cannot be an edge from vertex i to j and an edge from vertex j to vertex i. When i = j, no condition is imposed. Thus there may be cycles of length I, but again all edges are “one way.” We consider the diagraphs of symmetric relations in more detail. The diagraph of a symmetric relation R has the property that if there is edge from vertex i to vertex j, then there is an edge from vertex j to vertex i. Thus, if two vertices are connected by an edge, they must always be connected to both directions. Because of this, it is possible and quite useful to give a different representation of a symmetric relation. We keep he vertices as they appear in the diagraph, but if two vertices a and b are connected by edges in each direction, we replace these two edges with one undirected edge, or a “two-way street.” This undirected edge is just a single line without arrows and connects a and b. The resulting diagram will be called the graph of the symmetric relation. Example 5 Let A = { a, b, c, d, e } and let R be the symmetric relation given by

Page 30: Discrete Maths

30

R = { (a, b), (b, a), (a, d), (c, a), (b, c), (c, b), (b, e), (e, b), (e, d), (d, e), (c, d), (d, c) } The usual diagraph of R is shown in Figure 6 (a) while Figure 6 (b) shows the graph of R. Note that each undirected edge corresponds to two ordered pairs in the relation R.

(a) (b) figure 6

An undirected edge between a and b, in the graph of a symmetric relation R, corresponds to a set

{a, b] such that (a, b) ∈ R and (b, a) ∈ R. Sometimes we will also refer to such a set {a, b} as an undirected edge of the relation R and call a and b adjacent vertices. A symmetric relation R on a set A is called connected if there is a path from any element of A to any other element of A. This simply means that the graph of R is all in one piece. In figure 17 we show the graphs of two symmetric relations. The graph in Figure 7 (a) is connected, whereas that in Figure 7 (b) is not connected. Transitive Relations We say that a relation R on a set A is transitive if whenever a R b and b R c, then a R c. It is often convenient to say what it means for a relation to be not transitive. A relation R on A is not transitive if there exist a, b, and c in A so that a R b and b R c, but a R c. If such a, b, and c do not exist, then R is transitive.

(a) (b)

Figure 7 Eg: 1

Let A = Z, the set of integers, and let R be the relation less than. To see whether R is transitive, we assume that a R b and b R c. Thus a < b and b < c. It then follows that a < c, so a R c. Hence R is transitive.

Page 31: Discrete Maths

31

Eg: 2 Let A = {1, 2, 3, 4 } and let R = { (1, 2), (1, 3), (4, 2) }. Is R transitive? Solution Since there are no elements a, b, and c in A such that a R b and b R c, but a R c, we conclude that R is transitive. A relation R is transitive if and only if its matrix MR = [ m ij ] has the property If m ij = 1 and m jk = 1, then m ik = 1. The left – hand side of this statement simply means that (MR)

2 has a 1 in position i, k. Thus the

transitivity of R means that if (MR)2 has a 1 in any position, then M

R must have a 1 in the same

position. Thus, in particular, if (MR)2 = MR, then R is transitive. The converse is not true. Eg: 3 Let A = {1, 2, 3} and let R be the relation on A whose matrix is 1 1 1 MR = 0 0 1 0 0 1 Show that R is transitive. Solution By direct computation, (MR)

2 = MR; therefore, R is transitive.

134 Chapter 4 Relations and Digraphs To see what transitivity means for the digraph of a relation, we translate the definition of transitivity into geometric terms. If we consider particular vertices a and c, the conditions a R b and b R c mean that thee is a path of length 2 in R from a to c. In order words, a R

2 c. Therefore, we may rephrase the definition of

transitivity as follows: If a R2 c, then a R c; that is, R

2 ⊆ R (as subsets of A X A). In other words, if

a and c are connected by a path of length 2 in R, then they must be connected by a path of length 1. We can slightly generalize the foregoing geometric characterization of transitivity as follows. Theorem 1 A relation R is transitive if an only if it satisfies the following property: If there is a path of length greater than 1 from vertex a to vertex b, there is a path of length 1 from a to b (that is, a is related

to b). Algebraically stated, R is transitive if and only if Rn ⊆ R for all n ≥ 1.

Page 32: Discrete Maths

32

It will be convenient to have a restatement of some of these relational properties in terms of R - relative sets. We list there statements without proof. Theorem 2 Let R be a relation on a set A. Then

a) Reflexivity of R means that a ∈ R (a) for all a in A.

b) Symmetry of R means that a ∈ R (b) if and only if b ∈ R (a).

c) Transitivity of R means that if b ∈ R (a) and c ∈ R (b), then c ∈ R (a). 10 Equivalence Relations A relation R on a set a is called an equivalence relation if it is reflexive, symmetric, and transitive. EXAMPLE 1 Let A be the set of triangles in the plane and let R be the relation on A defined as follows:

R = { (a, b) ∈ A X A [ a is congruent to b }. It is easy to see that R is an equivalence relation. EXAMPLE 2 Let A = {1, 2, 3, 4 } and let R = { (1, 1), (1, 2), (2, 1) (2, 2), (3, 4), (4, 3), (3, 3), (4, 4) }. It is easy to verify that R is an equivalence relation. EXAMPLE 3

Let A = Z, the set of integers, and let R be defined by a R b if and only if a b ≤ b. Is R an equivalence relation? Solution

Since a ≤ a, R is reflexive. If a ≤ b, it need not follow that b ≤ a, so R is not symmetric.

Incidentally, R is transitive, since a ≤ b and b ≤ c imply that a ≤ c. We see that R is not an equivalence relation. EXAMPLE 4 Let A = Z and let

R = { (a, b) ∈ A X A [ a and b yield the same remainder when divided by 2 ].

In this case, we call 2 the modulus and write a ≡ b (mod 2), read “ a is congruent to b mod 2.” Show that congruence mod 2 is an equivalence relation. Solution

Page 33: Discrete Maths

33

First, clearly a ≡ a (mod 2). Thus R is reflexive.

Second, if a ≡ b (mod 2), then a and b yield the same remainder when divided by 2, so b ≡ a (mod 2). R is symmetric.

Finally, suppose that a ≡ b (mod 2) and b ≡ c (mod 2). Then a, b, and c yield the same remainder

when divided by 2. Thus, a ≡ c (mod 2). Hence congruence mod 2 is an equivalence relation. EXAMPLE 5

Let A = Z and let n ∈ Z+. We generalize the relation defined in Example 4 as follows. Let

R = { (a, b) ∈ A X A ] a ≡ b (mod n) }

That is, a ≡ b (mod n) if and only if a and b yield the same remainder when divided by n. Proceeding exactly as in Example 4, we can show that congruence mod n is equivalence relation.

We note that if a ≡ b (mod n), then a = qn + r and b = tn + r and a – b is a multiple of n. This, a ≡ b (mod n) if and only if n \ (a – b ). Partitions on set Partition or quotient set of a non empty set A in a collection of D of non empty sub set of a such that 1) Each element in a belongs to one of the set in partition D.

2) If A1 and A2 are distinct elements of p then A1 ∩ A2 = ∅ eg: A1 A4

A2 A3 A5 P = { A1, A2, A3, A4, A5 } Where each one A1, A2 . . . . A5 are individual set. Eg : 1 Let A = { 1, 2, 3, 4, 5, 6 } A1 = {1, 3 } A2 = { 2, 5, 6 }, A3 = { 4 } Her P = { A1, A2, A3 }

• Equivalence Relation and Partitions

Page 34: Discrete Maths

34

The following result shows that if P is a partition of a set A then P can be used to construct an equivalence relation on A. Theorem 1 Let P be a partition of a set A. Recall that the sets in P are called the blocks of P. Define the relation R on A as follows: a R b if and only if a and b are members of the same block. Then R is an equivalence relation on A. Proof

(a) If a ∈ A, then clearly a is in the same block as itself, so a R a. (b) If a R b, then a and b are in the same block; so b R a. (c) If a R b and b R c, then a, b, and c must all lie in the same block of P. Thus a R c. Since R s reflexive, symmetric, and transitive, R is an equivalence relation. R will be called the equivalence relation determined by P. EXAMPLE 6 Let A = { 1, 2, 3, 4 } and consider the partition P = { ( 1, 2, 3), (4) } of A. Find the equivalence relation R on A determined by P. Solution The blocks of P are { 1, 2, 3 } and { 4 }. Each element in a block is related to every other element in the same block and only to those elements. Thus, in this case, R = { ( 1, 1), ( 1, 2), ( 1, 3), ( 2, 1), ( 2, 2), ( 2, 3), ( 3, 1), ( 3, 2), ( 3, 3), ( 4, 4). If P is a partition of A and R is the equivalence relation determined by P, then the blocks of P can

easily be described in terms of R. If A1 is a block of P and a ∈ A; We see by definition that A1

consists of all elements X of A with a R x. That is, A1 = R (a). Thus the partition P is { R (a) \ a ∈ A }. In words, P consists of all distinct R – relative sets that arise from elements of A. For instance, in Example 6 the blocks { 1, 2, 3 } and { 4 } can be described, respectively, as R (1) and R (4). Of course, { 1, 2, 3 } could also be described as R (2) or R (3), so this way of representing the blocks is not unique. The foregoing construction of equivalence relations from partitions is very simple. We might be tempted to believe that few equivalence relations could be produced in this way. The fact is, as we will now show, that all equivalence relations on A can be produced from partitions. Lemma 1

Let R be an equivalence relation on a set A, and let a ∈ A and b ∈ A. Then a R b if and only if R (a) = R (b). Proof

First suppose that R (a) = R (b). Since R is reflexive, b ∈ R (b); therefore, b ∈ R (a), so a R b.

Page 35: Discrete Maths

35

-

• A lemma is a theorem whose main purpose is to aid in proving some other theorem. Conversely, suppose that a R b. Then note that

1. b ∈ R (a) by definition. Therefore, since R is symmetric,

2. a ∈ R (b), by Theorem 2 (b) of Section 9

We must show that R (a) = R (b). First, choose an element x ∈ R (b). Since R is transitive, the

fact that x ∈ R (b), together with (1), implies by Theorem 2 (c) of Section 4.4 that x ∈ R (a). Thus

R (b) ⊆ R (a). Now choose y ∈ R (a). This fact and (2) imply, as before, that y ∈ R (b). Thus R (a)

⊆ R (b), so we must have R (a) = R (b). Note the two – part structure of the lemma’s proof. Because we want to prove a biconditional, p

⇔ q, we must show q ⇒ p as well as p ⇒ q. We now prove our main result. Theorem 2 Let R be an equivalence relation on A, and let P be the collection of all distinct relative sets R (a) for a in A. Then P is a partition of A, and R is the equivalence relation determined by P. Proof According to the definition of a partition, we must show the following two properties: (a) Every element of A belongs to some relative set.

(b) If R (a) and R (b) are not identical, then R (a) ∩ R (b) = ∅.

Now property (a) is true, since a ∈ R (a) by reflexivity of R. To show property (b) we prove the following equivalent statement:

If R (a) ∩ R (b) ≠ ∅, then R (a) = R (b).

To prove this, we assume that c ∈ R (a) ∩ R (b). Then a R c and b R c. Since R is symmetric, we have c R b. Then a R c and c R b, o, by transitivity of R, a R b. Lemma 1 then tells us that R (a) = R (b). We have now proved that P is a partition. By Lemma 1 we see that a R b if and only if a and b belong to the same block of P. Thus P determines R, and the theorem is proved. Note the use of the contrapositive in this proof. If R is an equivalence relation on A, then the sets R (a) are traditionally called equivalence classes of R. Some authors denote the class R (a) by [a]. The partition P constructed in Theorem 2 therefore consists of all equivalence cases of R, and this partition will be denoted by A / R. Recall that partitions of A are also called quotient sets of A, and the notation A / R reminds us that P is the quotient set of A that is constructed form and determines R.

Page 36: Discrete Maths

36

EXAMPLE 7 Let R be the relation defined in Example 2. Determine A / R. Solution From Example 2 we have R (1) = { 1, 2 } = R (2). Also, R (3) = { 3, 4 } = R (4). Hence A / R = { { 1, 2 }, { 3, 4 } }. EXAMPLE 8 Let R be the equivalence relation define in Example 4 Determine A / R. Solution : - Let R(0) = {. . . . .-4 , -2, 0, 2, 4 . . . . } the set of even integers since reminder is zero when this member divided by 2 R (1) = . . . ., -5, -3, -1, 1, 1, 3, 5, 7 . . . . }, the set of odd integers, since each gives a remainder of 1 when divided by 2. Hence A / R consists of the set of even integers and the set of odd integers. From Examples 7 and 8 we can extract a general procedure for determining partition A / R for A finite or countable. The procedure is as follows: Step 1: Choose any element of A and compute the equivalence class R (a).

Step 2: If R (a) ≠ A, choose an element b, not included in R (a), and compute the equivalence class R (b).

Step 3: If A is not the union of previously computed equivalence classes, then choose an

element x of A that is not in any of those equivalence classes and compute R (x). Step 4: Repeat step 3 until all elements of A are included in the computed equivalence

classes. If A is countable, this process could continue indefinitely. In that case, continue until a pattern emerges that allows you to describe or give a formula for all equivalence classes.

4.5 Exercises Operations on Relations Now that we have investigated the classification of relations by properties they do or do not have, we next define some operations on relations. Let R and S be relations from a set A to a set B. Then, if we remember that R and S are simply subsets of A X B, we can use set operations on R and S. For example, the complement of R, R, is referred to as the complementary relation. It is, of course, a relation from A to B that can be expressed simply in terms of R: a R b if and only if a R b.

We can also form the intersection R ∩ S and the union R ∪ S of the relations R and S. In

relational terms, we see that a R ∩ S b means that a R b and a S b. All our set-theoretic operations can be used in this way to produce new relations.

Page 37: Discrete Maths

37

A different type of operation on a relation R from A to B is the formation of the inverse, usually written R

-1. The relation R

–1 is a relation from B to A (reverse order form R) defined by

b R

-1 a if and only if a R b.

It is clear from this that (R

-1)-1

= R. It is not hard to see that Dom (R-1

) = Ran (R) and Ran (R-1

) = Dom (R). We leave these simple facts for the reader to check. EXAMPLE 1 Let A = { 1, 2, 3, 4 } and B = {a, b, c } Let R = { (1, a), (1, b), (2, b), (2, c), (3, b), (4, a) } And S = { (1, b), (2, c), (3, b), (4, b) }

Compute (a) R; (b) R ∩ S; c) R ∪ S; and (d) R-1

Solution

a) We first find

A X B = { (1, a), (1, b), (1, c), (2, a), (2, b), (2, c), (3, a), (3, b), (3, c), (4, a), (4, b), (4, c) }. Then the complement of R in A X B is R = { (1, c), (2, a), (3, a), (3, c), (4, b), (4, c) }.

(b) We have R ∩ S = { (1, b), (3, b), (2, c) } (c) We have

R ∪ S = { (1, a), (1, b), (2, b), (2, c), (3, b), (4, a), (4, b) }.

(d) Since (x, y) ∈ R-1

if and only if (y, x ) ∈ R, we have R

-1 = { ( a, 1), ( b, 1), ( b, 2), ( c, 2), ( b, 3), ( a, 4) }

EXAMPLE 2

Let A = R. Let R be the relation ≤ on A and let S be ≥. Then the complement of R is the relation >,

Since a ≤ b means that a > b. Similarly, the complement of S is <. On the other hand, R-1

= S, since for any numbers a and b.

A R-1

b if and only if b R a if and only if b ≤ a if and only if a ≥ b. Similarly, we have S -1

= R. Also,

we note that R ∩ S is the relation of equality, since a (R ∩ S) b if and only if a ≤ b and a ≥ b if and

only if a = b. Since, for any a and b, a ≤ b or a ≥ b must hold, we see that R ∪ S = A X A; that is,

R ∪ S is the universal relation in which any a is related to any b. EXAMPLE 3

Page 38: Discrete Maths

38

Let A = { a, b, c, d, e } and let R and S be two relations on A whose corresponding digraphs are shown in Figure. Then the reader can verify the following facts. R = { (a, a), (b, b), (a, c), (b, a) (c, b), (c, d), (c, e), (c, a), (d, b), (d, a), (d, e), (e, b), (e, a), (e, d), (e, c) } R

-1 = { (b, a), (e, b), (c, c), (c, d), (d, d), (d, b), (c, b), (d, a), (e, e), (e, a) }

R ∩ S = { (a, b), (b, e), (c, c) }.

Figure 7

EXAMPLE 4 Let A = { 1, 2, 3 } and let R and S be relations on A. Suppose that the matrices of R and S are 1 0 1 0 1 1 MR = 0 1 1 and MS = 1 1 0 0 0 0 0 1 0

Then we can verify that

0 1 0 1 0 0 MR = 1 0 0 MR

-1 = 0 1 0

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

b a

c c b a

e d e d

Page 39: Discrete Maths

39

MR ∩ S = 0 1 0 M R ∪ S = 1 1 1 0 0 0 0 1 0 Example 4 illustrates some general facts. Recalling the operations on Boolean matrices that if R and S are relations on set A, then

M R ∩ S = MR ∧ Ms

M R ∪ S = M R ∨ MS M R

-1 = (M R)

T.

Moreover, if M is a Boolean matrix, we define the complement M of M as the matrix obtained from M by replacing every 1 in M by a 0 and every 0 by a 1. Thus, if 1 0 0 M = 0 1 1 1 0 0 then 0 1 1 M = 1 0 0 0 1 1 We can also show that if R is a relation on a set A, then MR = MR. We know that a symmetric relation is a relation R such that MR = (MR)

T, and since (MR)

T = MR-1,

we see that R is symmetric if and only if R = R-1

. We now prove a few useful properties about combinations of relations. Theorem 1 Suppose that R and S are relations from A to B.

(a) If R ⊆ S, then R-1

⊆ S-1

.

(b) If R ⊆ S, then S ⊆ R.

(c) (R ∩ S) –1

= R-1

∩ S -1

and (R ∪ S) –1

= R –1

∪ S -1

.

(d) R ∩ S = R ∪ S and R ∪ S = R ∩ S. Proof Parts (b) and (d) are special cases of general set properties we now prove part (a). Suppose that

R ⊆ S and let (a, b) ∈ R -1

. Then (b, a) ∈ R, so (b, a) ∈ S. This, in turn, implies that (a, b) ∈ S –1

. Since each element of R

-1 is in S

– 1, we are done.

Page 40: Discrete Maths

40

We next prove part (c). For the first part, suppose that (a, b) ∈ (R ∩ S)-1

. Then (b, a) ∈ R ∩ S, so

(b, a) ∈ R and (b, a) ∈ S. This means that (a, b) ∈ R-1

and ( a, b) ∈ S -1

, so (a, b) ∈ R-1

∩ S -1

. The converse containment can be proved by reversing the steps. A similar argument works to

show that (R ∪ S)-1

= R-1

∪ S-1

The relations R and R

-1 can be used to check if R has the properties of relations that we

presented in Section for instance, we saw earlier that R is symmetric if and only if R = R – 1

. Here are some other connections between operations on relations and properties of relations. Theorem 2 Let R and S be relations on a set A.

(a) If R is reflexive, so is R-1

.

(b) If R and S are reflexive, then so are R ∩ s and R ∪ S. (c) R is reflexive if and only if R is irreflexive.

Proof

Let ∆ be the equality relation on A. We know that R is reflexive if and only it ∆ ⊆ R. clearly, ∆ = ∆-

1, so if ∆ ⊆ R, then ∆ = ∆

-1 ⊆ R

-1 by Theorem 1, so R

-1 is also reflexive. This proves part (a). To

prove part (b), we note that if ∆ ⊆ R and ∆ ⊆ S, then ∆ ⊆ R ∩ S and ∆ ⊆ R ∪ S. To show part (c),

we note that a relation S is irreflexive if and only if S ∩ ∆ = ∅. Then R is reflexive if and only if ∆ ⊆

R if and only if ∆ ∩ R = ∅ if and only if R is irreflexive. EXAMPLE 5 Let A = { 1, 2, 3 } and consider the two reflexive relations R = { (1, 1), (1, 2), (1, 3), (2, 2), (3, 3) } And S = { (1, 1), (1, 2), (2, 2), (3, 2), (3, 3) }. Then

(a) R-1 = { (1,1), (2, 1), (3, 1), (2, 2), (3, 3) }; R and R-1

are both reflexive. (b) R = { (2, 1), (2, 3), (3, 1), (3, 2) } is irreflexive while R is reflexive.

(c) R ∩ S = { (1, 1), (1, 2), (2, 2), (3, 3) and R ∪ S = { (1, 1), (1, 2), (1, 3), (2, 2), (3, 2), (3, 3) } are both reflexive.

Theorem 3 Let R be a relation on a set A. Then

(a) R is symmetric if and only if R = R-1

.

(b) R is antisymmetric if and only if R ∩ R-1

⊆ ∆.

(c) R is asymmetric if and only if R ∩ R-1

= ∅.

Page 41: Discrete Maths

41

Theorem 4 Let R and S be relations on A.

(a) If R is symmetric, so are R-1

and R.

(b) If R and S are symmetric, so are R ∩ S and R ∪ S. Proof If R is symmetric, R = R

-1 and thus (R

-1)-1

= R = R-1

,which means that R-1

is also symmetric. Also,

(a, b) ∈ (R)-1

if and only if (b, a) ∈ R if and only if (b, a) ∉ R if and only if (a, b) ∉ R-1

= R if and

only if (a, b) ∈ R, so R is symmetric and part (a) is proved. The proof of part (b) follows immediately from Theorem 1(c). EXAMPLE 6 Let A = { 1, 2, 3 } and consider the symmetric relations R = { (1,1), (1, 2), (2, 1), (1, 3), (3, 1) } And S = { (1, 1), (1, 2), (2, 1), (2, 2), (3, 3) }. Then

(a) R-1

= {(1,1), (2,1), (1, 2), (3,1), (1, 3) } and R = { (2, 2), (2, 3), (3, 2), (3, 3) }; R-1

and R are symmetric.

(b) R ∩ S = { (1,1), (1, 2), (2,1) } and R ∪ S = { (1,1), (1, 2), (1, 3), (2,1), (2, 2), (3,1), (3, 3) }, which are both symmetric.

Theorem 5 Let R and S be relations on A.

(a) (R ∩ S)2

⊆ R2 ∩ S

2.

(b) If R and S are transitive, so is R ∩ S.

(c) If R and S are equivalence relations, so is R ∩ S. Proof

We prove part (a) geometrically. We have a (R ∩ S)2 b if and only if there is a path of length 2

from a to b in R ∩ S. Both edges of this path lie in R and in S, so a R2 b and a S

2 b, which implies

that a (R2

∩ S2) b. To show part (b), recall from Section 4.4 that a relation T is transitive if and

only if T2

⊆ T. If R and S are transitive, then R2 ⊆ R, S

2 ⊆ S, so (R ∩ S)

2 R2 ∩ S

2 [by part (a) ] ⊆

R ∩ S, so R ∩ S is transitive. We next prove part (c). Relations R and S are each reflexive,

symmetric, and transitive. The same properties hold for R ∩ S from Theorems 2(b), 4(b), and

5(b), respectively. Hence R ∩ S is an equivalence relation. EXAMPLE 7 Let R and S be equivalence relations on a finite set A, and let A / R and A/s be the corresponding

partitions (see Section 4.5). Since R ∩ S is an equivalence relation, it corresponds to a partition A

/ (R ∩ S). We now describe A / (R ∩ S) in terms of A / R and A / S. Let W be a block of A / (R ∩

Page 42: Discrete Maths

42

S) and suppose that a and b belong to W. Then a (R ∩ S) b, so a R b and a s b. Thus a and b belong to the same block, say X, of A / R and to the same block, say Y, of A / S. This means that

W ⊆ X ∩ Y. The steps in this argument are reversible; therefore, W = X ∩ Y. Thus we can directly

compute the partition A / (R ∩ S) by forming all possible intersections of blocks in A / R with blocks in A / S. Closures If R is a relation on a set A, it may well happen that R lacks some of the important relational properties discussed in Section 4.4, especially reflexivity, symmetry, and transitivity. If R does not possess a particular property, we may wish to add pain to R until we get a relation that does have the required property. Naturally, we want to add as few new pairs as possible, so what we need to find is the smallest relation R

1 on A that contains R and possesses the property we desire.

Sometimes R1 does not exist. If a relation such as R

1 does exist, we call it the closure of R with

respect to the property in question. EXAMPLE 8 Suppose that R is a relation on a set A, and R is not reflexive. This can only occur because some

pairs of the diagonal relation ∆ are not in R. Thus R1 ∪ = R ∆ is the smallest reflexive relation on

A containing R; that is, the reflexive closure of R is R ∪ ∆.

EXAMPLE 9 Suppose now that R is a relation on A that is not symmetric. Then there must exist pairs (x, y) in

R such that (y, x) is not in R. Of course, ( y, x) ∈ R-1

, so if R is to be symmetric we must add all

pairs from R-1

; that is, we must enlarge R to R ∪ R-1

. Clearly, (R ∪ R-1

)-1

= R ∪ R-1

, so R ∪ R-1

the

smallest symmetric relation containing R; that is, R ∪ R-1

is the symmetric closure of R. If A = { a, b, c, d } and R = { (a, b), (b, c), (a, c), (c, d)}, then R

-1 = \ (b, a), (c, b), (c, a), (d, c) }, so

the symmetric closure of R is

R ∪ R-1

= { (a, b), (b, a), (b, c), (c, b), (a, c), (c, a), (c, d), (d, c) }. The symmetric closure of a relation R is very easy to visualize geometrically. All edges in the

digraph of R become “two-way streets” in R ∪ R-1

. Thus the graph of the symmetric closure of R is simply the digraph of R with all edges made bi-directional. We show in Figure 8 (a) the digraph

of the relation R of Example 9. Figure (b)shows the graph of the symmetric closure R ∪ R-1

. b

(a) R (b) R ∪ R-1

The transitive closure of a relation R is the smallest transitive relation containing R. We will discuss the transitive closure in the next section. Composition

b

a c

d

b

a c

d

Page 43: Discrete Maths

43

Now suppose that A, B,. and C are sets, R is a relation from A to B, and S is a relation from B to

C. We can then define a new relation, the composition of R and S, written S ° R. The relation S °

R is a relation from A to C and is defined as follows. If a is in A and C is in C, then a (S ° R) c if

and only if for some b in B, we have a R b and b s c. In other words, a is related to c by S ° R if we can get from a to c in two stages: first to an intermediate vertex b by relation R and then from

b to c by relation S. The relation S ° R might be thought of as “S following R” since it represents the combined effect of two relations, first R, then S. EXAMPLE 10 Let A = {1, 2, 3, 4 }, R = { (1, 2), (1,1), (1, 3), (2, 4), (3, 2) }, and S = { (1, 4), (1, 3), (2, 3),(3, 1),(4,

1) }. Since (1, 2) ∈ R and (2, 3) ∈ S, we must have (1, 3) ∈ S ° R. Similarly, since (1, 1) ∈ R and

(1, 4) ∈ S, we see that (1, 4) ∈ S ° R. Proceeding in this way, we find that S ° R = { (1, 4), (1, 3), (1, 1), (2, 1), (3, 3) }. The following result shows how to compute relative sets for the composition of two relations. Theorem 7 Let R be a relation from A to B and let S be a relation from B to C. Then, if A

1 is any subset of A,

we have

(S ° R) (A1) = S (R (A

1) ). (1)

Proof

If an element z ∈ C is in (S ° R) (A1), then x (S ° R) for some x in A

1. By the definition of

compositions, this means that x R y and y S z for some y in B. Thus y ∈ R (x), so z ∈ S(R (x)).

Since (x) ⊆ A1, Theorem 1 (a) of Section 4 tells us that S (R (x) ) ⊆ S (R (A1) ). Hence z ∈ S (R

(A1) ), so (S ° R) (A1) S (R (A1) ).

Conversely , suppose that z ∈ S (R (A1) ). Then z ∈ S (y) for some y in R (A1) and, similarly, y ∈

R(x) for some x in A1. This means that x R y and y s z, so x (S ° R ) z. Thus z ∈ (S ° R) (A1), so S

(R (A1) ) (S ° R) (A1). This proves the theorem. EXAMPLE 11 Let A = {a, b, c } and let R and S be relations on A whose matrices are 1 0 1 1 0 0 MR = 1 1 1 Ms = 0 1 1 0 1 0 1 0 1 We see from the matrices that

(a, a) ∈ R and (a, a) ∈ S, so (a, a) ∈ S ° R

(a, c) ∈ R and (c, a) ∈ S, so (a, a) ∈ S ° R

(a, c) ∈ R and (c, c) ∈ S, so (a, c) ∈ S ° R.

It is easily seen that (a, b) ∉ S ° R since, if we had (a, x) ∈ R and (x, b) ∈ S, then matrix MR tells us that x would have to be a or c; but matrix Ms tells us that neither (a, b) nor (c, b) is an element of S.

Page 44: Discrete Maths

44

We see that the first row of Ms ° R is 1 0 1. The reader may show by similar analysis that 1 0 1

MS ° R = 1 1 1 0 1 1

We note that MS ° R = MR Θ MS (verify this). Example 11 illustrates a general and useful fact. Let A, B, and C be finite sets with n, p, and m elements, respectively, let R be a relation from A to B, and let S be a relation from B to C. Then R

and S have Boolean matrices MR and MS with respective sizes n X p and p X m. Thus MR Θ Ms

can be computed, and it equals MS ° R. To see this let A = {a1,…,an}, B = {b1,…,bp}, and C= {c1,…,cm}, Also, suppose that MR, = [rij], Ms = [Sij], and Ms0R = [tij]. Then tij = 1 if and only if (ai, cj) S 0 R, which means that for some k,

(ai, bk) ∈ R and (bk, cj) S. In other words, rik = 1 and skj = 1 for some k between 1 and p. This condition is identical to the condition needed for MR MS to have a 1 in position I, j, and thus MSOR and MR MS are equal. In th special case where R and S are equal, we have S O R = R2 and MSOR = MR2 = MR MR, as was shown Let us redo Example 10 using matrices. We see that 1 1 1 0 0 0 0 1 MR = 0 1 0 0 0 0 0 0 To see this let A = { a1 . . . . an], B = {b1 . . . . . bp}, and C = {c1 . . . . .. CR} Also, suppose that MR =

[ rij ], MS = [ sij ], and MS O R = [ tij ]. Then tij = 1 if and only if (ai, cj) ∈ S O R, which means that for

some k, (ai, bk) ∈ R and (bk, cj) ∈ S. In other words, rik = 1 and Skj = 1 for some k between 1 and

p. This condition is identical to the condition needed for MR Θ MS to have a 1 in position I, j and

thus MS O R and MR Θ Ms are equal.

In the special case where R and S are equal, we have S O R = R2 and MS O R = MR

2 = MR Θ MR, as

was shown EXAMPLE 12 Let Us redo example 10 using matrices. We see that 1 1 1 0 0 0 1 1 0 0 0 1 0 0 1 0 MR = 0 1 0 0 and MS = 1 0 0 0 0 0 0 0 1 0 0 0 Then

Page 45: Discrete Maths

45

1 0 1 1 1 0 0 0

MR Θ Ms = 0 0 1 0 0 0 0 0 so S O R = { (1,1), (1, 3), (1, 4), (2, 1), (3, 3) } As we found before. In cases where the number of pairs in R and S is large, the matrix method is much more reliable. Theorem 7 Let A, B, C, and D be sets, R a relation from A to B, S a relation from B to C and T a relation from C to D. Then T O (S O R) = T O S) O R. Proof The relations R, S and T are determined by their Boolean matrices MR, Ms, and MT, respectively. As we showed after Example 11, the matrix of the composition is the Boolean matrix product; that

is, MS O R = MR Θ Ms. Thus

MT O (S O R) = MS O R Θ MT = (MR Θ MS) Θ MT. Similarly,

M (T O S) O R = MR Θ (MS Θ MT). Since Boolean matrix multiplication is associative [see Exercise 37 of Section 1,5] we must have

(MR Θ Ms) Θ MT = MR Θ (MS Θ MT), and therefore MT O (S O R) = M (T O S) O R. Then T O (S O R) = (T O S) O R Since these relations have the same matrices. The proof illustrates the advantages of having several ways to represent a relation. Here using the matrix of the relation produces a simple proof.

In general, R O S ≠ S O R, as shown in the following example.

Page 46: Discrete Maths

46

EXAMPLE 13 Let A = {a, b}, R = { (a, a), (b, a), (b, b)}, and S = { (a, b), (b, a), (b, b) }. Then S O R = { (a, b), (b, a), (b, b)}, While R O S = { (a, a), (a, b), (b, a), (b, b) }. Theorem 8 Let A, B, and C be sets, R a relation from A to B, and S a relation from B to C. Then (S O R)

-1 = R

-

1 O S

-1.

Proof

Let c ∈ C and a ∈ A. Then (c, a) ∈ (S O R)-1

if and only if (a, c) ∈ S O R, that is, if and only if there

is a b ∈ B with (a, b) ∈ R and (b, c) ∈ S. Finally, this is equivalent to the statement that (c, b) ∈ S-

1 and (b, a) ∈ R

-1; that is, (c, a) ∈ R

-1 O S-1.

Here we will discuss relations, called binary relations between a pair of objects. Let A

and B be two nonempty sets. A relation R from A to B is a subset of A X B. If R A X

B and <a, b> Є R we say that a is related to b by R, we write aRb. If a is not related to

b by R, we write aRb. If A and B are equal we will say A is a relation on A, instead of a

relation from A to A e.g.

Example

Let A = {1, 2, 3, 4, 5}. Define the following relation(less than) on A aRb iff a < b.

Example

Let L denote the relation “less than or equal to” and D denote the relation “divides”

where xDy means “x divides y”. Both L and D are defined on the set {1, 2, 3, 6}. Write L

and D as sets and find L ∩ D.

DOMAIN

Let R A X B be a relation from A to b. Then the domain R denoted by Dom(R), a

subset of A, is the set of all first elements in the pairs that make up R.

RANGE

Similarly, we define the Range of R, denoted by Ran(R) to be the set of all elements in b

that are related to some element in A.

Example

A = {1, 2, 3, 4} aRb iff a < b. Find range and domain.

MATRIX OF A RELATION

If A = {a1, a2, …., an} and B = {b1, b2, …., bn}are sets containing m and n elements

respectively and R is a relation A to B, we represent R by the m X n matrix MR = [mij]

which is defined by

mij = 1 if < ai, bj> Є R

0 if < ai, bj> R

Page 47: Discrete Maths

47

MR is called the matrix of R. Often MR provides an easy way to check whether R has a

given property.

THE DIAGRAPH OF A RELATION

If A is a finite set and R is a relation on A. The pictorial representation of R is called a

directed graph or digraph of R.

PROPERTIES OF RELATIONS

REFLEXIVE AND IRREFLEXIVE RELATIONS

A relation R on a set A is reflexive if <a, a> Є R a Є A i.e. if aRa a Є A.

A relation R on a set A is irreflexive if aRa a Є A.

Thus R is reflexive if for every element a Є A is related to itself and it is irreflexive if no

element is related to itself e.g.

Let R denote the relation “equal to” on any set A. Then R is reflexive since <a, a> Є R a

Є A.

Let R denote the relation “less than” on any set A. Then R is irreflexive since <a, a>

R a Є A

We can identify a reflexive or irreflexive relation by its matrix as follows. The matrix of

a reflexive relation must have all 1’s on its main diagonal, while the matrix of an

irreflexive must have all 0’s on its main diagonal.

Example Let A = {1, 2, 3} and let R = {(1, 1), (1, 2)}. State whether R is reflexive, irreflexive or

not.