Prepare for your exams

Study with the several resources on Docsity

Earn points to download

Earn points by helping other students or get them with a premium plan

Guidelines and tips

Prepare for your exams

Study with the several resources on Docsity

Earn points to download

Earn points by helping other students or get them with a premium plan

Community

Ask the community

Ask the community for help and clear up your study doubts

University Rankings

Discover the best universities in your country according to Docsity users

Free resources

Our save-the-student-ebooks!

Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors

Hi there I'm interested to know what you think you can see the attached file is scanned image in PDF format of the individual or entity to which it is a tree don't send karna of O Lord of employment from you soon love mum and dad have a W

Typology: Schemes and Mind Maps

2022/2023

1 / 269

Download Discrete mathematics gv kumbhojkar and more Schemes and Mind Maps Discrete Mathematics in PDF only on Docsity! 1 REVISED SYLLABUS S.Y.B.SC. (I.T.), SEM. -III, LOGIC AND DISCRETE MATHEMATICS Unit 1 : Set Theory : Fundamentals - Sets and subsets, Venn Diagrams, Operations on sets, Laws of Set Theory, Power Sets and Products, Partition of sets, The Principle of Inclusion - Exclusion. Logic : Propositions and Logical operations, Truth tables, Equivalence, Implications, Laws of Logic, Normal forms, Predicates and quantifiers, Mathematical Induction. Unit 2 : Relations, diagraphs and lattices : Product sets and partitions, relations and diagraphs, paths in relations and diagraphs, properties of relations, equivalence and partially ordered relations, computer representation of relations and diagraphs, manipulation of relations, Transitive closure and Warshall’s algorithm, Posets and Hasse Diagrams, Lattice. Unit 3 : Functions and Pigeon Hole Principle : Definitions and types of functions : injective, subjective and bijective, Composition, identity and inverse, Pigeon hole principle. Unit 4 : Graphs and Trees : Graphs, Euler paths and circuits, Hamiltonian paths and circuits, Planner graphs, coloring graphs, Isomorphism of Graphs. Trees : Trees, rooted trees and path length in rooted trees, Spanning tree and Minimal Spanning tree, Isomorphism of trees, Weighted trees and Prefix Codes. Unit 5 : Algebric Structures : Algebraic structures with one binary operation - semi groups, monoids and groups, Product and quotient of algebraic structures, Isomorphism, homomorphism, automorphism, Cyclic groups, Normal sub group, codes and group codes, Algebraic structures with two binary operations - rings, integral domains and fields. Ring homomorphism and Isomorphism. 2 Unit 6 : Generating Functions and Recurrence relations : Series and Sequences, Generating Functions, Recurrence relations, Applications, Solving difference equations, Fibonacci. Books : Discrete mathematical structures by B Kolman RC Busby, S Ross PHI Pvt. Ltd. Discrete mathematical structures by R M Somasundaram (PHI) EEE Edition. Reference : Discrete structures by Liu, Tata McGraw -Hill. Digital Logic John M Yarbrough Brooks / cole, Thompson Learning Discrete Mathematics and its Applications, Kenneth H. Rosen, Tata McGraw - Hill. Discrete Mathematics for computer scientists and Mathematicians, Joe L. Mott, Abraham Kandel Theodore P. Baker, Prentice - Hall of India Pvt. Ltd. Discrete Mathematics With Applications, Susanna S. Epp, Books / Cole Publishing Company. Discrete Mathematics, Schaum’s Outlines Series, Seymour Lipschutz, Marc Lipson, Tata McGraw - Hill. 5 1.2.2 Some Basic Definitions – (a) Empty Set : A set without any element. It is denoted by or { } For examples, B = | and =x x x 1 C = | and +1 = 1 =x x x (b) Equal Sets :- Two sets A and B are said to be equal if they have same elements and we write A = B. For examples, (1) A = is a letter in the word 'ate'|x x B = y | y is a letter in the word 'eat' A = B (2) 2X = –3,3 and Y = | = 9, x x x i.e. X = Y (c) Subset :- Set A is said to be a subset of B if every element of A is an element of B and this is denoted by A B or B A . If A is not a subset of B we write A B . For example, (1) A = 1 , B = | = 1 2 ,x x x then A B and B A (2) Note : (1) Every set A is a subset of itself i.e. A A (2) If A B but A B then we say A is a proper subset of B and we write A B . If A is not a proper subset of B then we write A B . (3) A for any set ‘A’ (4) A = B iff A B and B A (d) Finite Set :- A set A with ‘n’ distinct elements, n is called as a finite set. For example, (1) A = | 5 20 ,x x x (2) B = y | y is a hair on some ones head 6 (e) Infinite Set :- A set which is not finite is Infinite. For example, (1) A = | ,1 2 x x x (2) (3) Note : is finite. (f) Cardinality of a set :- The number of elements in a set is called as cardinality of a set and it is denoted by n(A) or |A|. For example, (1) A = {1, 2, 3, 4, 5}, |A| = 5 (2) B = , |B| = 0 (g) Power set :- Let A be a given set. Then set of all possible subsets of A is called as a power set of ‘A’. it is denoted by P(A). For example, (1) A = {1, 2} P(A) = { , {1}, {2}, {1, 2}} Note : (1) If |A| = m then |P(A)| = 2m (h) Universal set :- Any larger set which contains some subsets is a universal set. It is denoted by U. For example, (1) contains , , and . is a universal set for , , and . Similarly, is universal set for and and so on. (2) A CPU consist of hard disk, RAM, ROM, Sound Card etc. It can be treated as a universal set. (i) Venn diagram :- A pictorial representation of a set is called as Venn diagram. Elements of a set are denoted by dots enclosed in a triangle, a square or a circle. 7 For example, (1) A = {a, b, d} (2) B = {5, 6, 7} A a b d 5 6 7 B Fig. 1.1 Fig. 1.2 Check your progress : 1. Identify each of the following as true or false. (a) A = A (b) AA (c) AA (d) A (e) A (f) If A {1} then P(A) = { , A} 2. If A = { , y, 3x }, then find (a) P(A), (b) |A| (c) |P(A)| 3. Which of the following are empty sets? (a) | ,1 2 x x x (b) | , = –1 2x x x (c) | , +1= 1 x x x (d) | , = 3 2x x x 4. Draw the Venn diagram for . 1.3 OPERATION ON SETS 1.3.1 Basic definitions : (a) Union of two sets :- Let A and B be two given sets. Union of A and B is the set consisting of all elements that belong to ‘A’ or ‘B’ and it is denoted by A B . A B = | A or B x x x For example, (1) A = , , B = 2, 5 y z ,x A B = , y, z, 2, 5 x (2) A = B = , A B = = 1, 2, 3, ..... ..... , – 2, –1, 0,1, 2, .... = ....., – 2, –1, 0,1, 2, .... = 10 Check your progress : 1. If A = U ( U – universal set), then (a) cA , (b) A U\ , (c) U A \ , (d) A U 2. If U = | and 17 x x x and A = {1, 3, 5, 6}, B = {3, 4, 7, 5, 8}, then (a) cA , (b) A\B, (c) B\A, (d) A B , (e) cB , (f) A B , (g) A B . 1.3.2 Algebraic Properties of set operations Like Algebraic properties of Real numbers, sets also satisfy some Algebraic Properties with respect to the operations union, intersection etc. (I) Commutative Properties (1) A B = B A (2) A B = B A (II)Associative Properties (3) A B C = A B C (4) A B C A B C = (III) Distributive Properties (5) A B C = A B A C (6) A B C = A B A C (IV) Idempotent Properties (7) A A = A (8) A A = A (V) Properties of Complement (9) A = A (10) A A = U (11) A A = (12) = U (13) U = (14) A B A B = (15) A B A B = (De Morgan’s laws) 11 Properties (1) to (13) can be proved easily. We will prove (14) and (15) here. (14) A B = A B Proof : A B = | A B and U x x x = | A and U and B and U x x x x x = | A and B x x x = A B Similarly, we can prove (15). Example 1: Prove that i) ( ) ( )cA B A B A and ii) ( ) ( )cA B A B A . Solution: L.H.S.= ( ) ( )cA B A B = ( )cA B B ( Distributive law) = A ( cB B complement law) = A = R.H.S Hence ( ) ( )cA B A B A . Similarly, we can prove ( ) ( )cA B A B A . Example 2: If U = {x\x is a natural number less than 20} is the universal set, A = {1, 3, 4, 5, 9}, B = {3, 5, 7, 9, 12}. Verify that De Morgan’s laws. Solution: De Morgan’s laws can be state as i) A B A B = , ii) A B A B = . By listing method, U = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19}, and A = {1, 3, 4, 5, 9}, A = {2, 6, 7, 8, 10, 11, 12, 13,14,15,16,17,18,19}, and B = {3,5,7,9,12}, B = {1, 2, 4, 6, 8, 10, 11, 13, 14, 15, 16, 17, 18,19} A B = {1, 3, 4, 5, 7, 9, 12} ( )A B = {2, 6, 8, 10, 11, 13, 14, 15, 16, 17, 18, 19} Also ( )A B = {2, 6, 8, 10, 11, 13, 14, 15, 16, 17, 18, 19} 12 Hence A B A B = . Now ( )A B = {3, 5, 9}, ( )A B = {1, 2, 4, 6, 7, 8, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19} Also ( )A B = { 1, 2, 4, 6, 7, 8, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19} Hence A B A B = . Example 3: If u={1,2,3,4,5,6,7,8,9,10,11,12} is the universal set. A={2,3,5,8,10}, and B={4,5,7,8,9,11}, find. i). A-B, ii). B-A, iii). ( )A B . Solution:- i). A-B={2,3,10} ii). B-A={4,7,9,11} iii). ( )A B ={1,4,5,6,7,8,9,11,12}. 1.3.3 Principle of Inclusion – Exclusion (The addition Principle) Theorem (1) If A and B be two given finite sets, then we have A B = A + B – A B . (1) Let A = {a, b, c, d} and B = {e, d, p, q} A B = {c, d} i.e. |A| = 4, |B| = 4 and | A B | = 2 By addition principle, A B = 4 + 4 – 2 = 6 Example 4: In a class of 50 students, 25 like Maths and 15 like Physics, 10 like both Maths and Physics. So find (a) How many like Maths or Physics? (b) How many do not like any or the subjects? Solution : Let m be the set of all those students who likes Maths and ‘p’ be the set of all those students who likes Physics. |M| = 25, |P| = 15 and |M P| = 10 (a) No. of students like atleast one subject = M P = M + P – M P (by Addition formula) = 25 + 15 – 10 = 30 (b) No. of students do not like any of the two subject = 50 – M P = 50 – 30 = 20 Above theorem can be extended to three sets, – 15 ii). None of them i.e. │(AUBUC)’│ │(AUBUC)’│=│U│-│AUBUC│ =240-235 =5. iii). Only N.S.S. i.e. =│A│-│A∩B│ -│A∩C│+│A∩B∩C│ =130-40-30+20 =80. iv). Only other activity i.e. =│C│-│A∩C│-│B∩C│+│A∩B∩C│ =80-30-35+20 =35. v). Only N.S.S and N.C.C. but not other activity i.e. =│AUB│-│A∩B∩C│ =40-20 =20. Example 8: Find the number of integers including both from 1 to 500 that are divisible by, i). 2 or 3 or 5. ii). 2 or 3 but not 5. iii). Only by 5. Solution:- Here U={1,2,3,…………,500} A=the set of numbers in U divisible by 2. B= the set of numbers in U divisible by 3. C= the set of numbers in U divisible by 5. │U│=250, │A│= 500 250 2 │B│= 500 166 3 │C│= 500 100 3 │AUB│= 500 500 83 2 3 6 │B∩C│= 500 33 15 │C∩A│= 500 50 2 5 │A∩B∩C│= 500 500 16 2 3 5 30 16 i) AUBUC A B C A B B C A C A B C = 250+166+100-83-33-50+16 = 366. ii). 2 or 3 but not by 5. =│AUB│-│A∩B∩C│ =83-16 =67. iii). Only by 5. =│C│-│A∩C│-│B∩C│+│A∩B∩C│ =100-33-50+16 =33. 1.7 LET US SUM UP This chapter consist of sets and different operations on sets with different examples which helps in better understanding of the concept and able to use in different areas. We saw the principle of inclusion – Exclusion which can be used in different counting problems we saw some concepts of number theory such as division in Integers, sequence etc. which is useful in computer security. At the end we saw definition of a mathematical structure and it is different properties. 1.8 REFERENCES FOR FURTHER READING a) Discrete structures by Liu. b) Discrete mathematics its Application, Keneth H. Rosen TMG. c) Discrete structures by B. Kolman HC Busby, S Ross PHI Pvt. Ltd. d) Discrete mathematics, schaum’s outlines series, seymour Lip Schutz, Marc Lipson, TMG. 1.9 UNIT END EXERCISES 1. Let 2A = | and + 7 = 0x x x , B = | ,x x C = | 0 0.2, < <x x x , | 6 ,D q qx x E = | + 7 = 7,x x x Check whether following are True or False. (i) A is finite, (ii) B A , (iii) E = A , (iv) E A D , (v) C is infinite, (vi) B = , (vii) A E , (viii) B C = A 2. Prove A – B = A – (A B) 17 3. There are 250 students in a computer Institute of these 180 have taken a course in Pascal, 150 have taken a course in C++, 120 have taken a course in Java. Further 80 have taken Pascal and C++, 60 have taken C++ and Java, 40 have taken Pascal and Java and 35 have taken all 3 courses. So find – (a) How many students have not taken any course? (b) How many study atleast one of the languages? (c) How many students study only Java? (d) How many students study Pascal and C++ but not Java? (e) How many study only C++ and Java? 4. The students stay in hostel were asked whether they had a textbook r a digest in their rooms. The results showed that 650 students had a textbook, 150 deed not have a textbook, 175 had a digest and 50 had neither a textbook nor a digest. Find, i). the number of students in hostel , ii).How many have a textbook and digest both, iii). How many have only a digest. 5. Prove that (Bc∩U)∩(AcU )=(AUB)c. 6. Prove that , i).AU(A∩B)=A, ii). A∩(AUB)=A. 7. In a survey of 80 people in Gokuldham 50 of them drink Tea, 40 of them drink Coffee and 20 drink both tea and coffee. Find the number of people who take atleast one of the two drinks also find the number of students who do not take tea or Coffee. 8. In a survey of 60 people, It was found that 25 read magazine. 26 read Times of India and 26 read DNA. Also 9 read both magazine and DNA, 11 read both magazine and times of India , 8 read times of India and DNA and 8 are not reading anything. i). Find the number of people who read all three. ii). Draw a Vann diagram. iii). Determine the number of people who read exactly one magazine. 20 Solution : 1. ~P : It is not the case that it is hot i.e. it is not hot. 2. ~q: 2 is not divisor of 5. Since q is false, q is true. 2.1.3 Conjunction The next operation is conjunction. If p and q are two statement then conjunction of p and q is the compound statement “p and q”. The notation is p q . The operation and is a binary operation on the set of statements. The p q is true whenever both p and q on true, false otherwise. Thus the truth table is given by p q p q T T F F T F T F T F F F Example 2 Form the conjunction of p and q. 1. p: I will drive my car q: I will reach the office in time. 2. p: 2 is even q: 11 is odd. 3. p: 2 + 3 + 1 = 6 q: 2 + 3 > 4 4. p: Delhi is capital of India q: Physics is a science subject. Solution : 1. p q is “I will drive my car and I will reach office in time”. 2. “2 is even and 11 is odd”. 3. “2 + 3 + 1 = 6 and 2 + 3 > 4”. 4. “Delhi is capital of India and Physics a science subject”. 2.1.4 Disjunction The second logical connective used is disjunction. Disjunction of statements p and q is dented by p q ,which means p or q. The statement p q is true where p or q or both are true and is false only when both p and q are false. The truth table for p q is as follows. p q p q T T F F T F T F T T T F 21 Example 3 Form the disjunction of 1. p: Bananaras is on the bank of holy river Ganga. q: Dehra Doon is capital of Uttaranchal. 2. p: Eiffel tower is in London. q: Panama canal connects Atlantic ocean with Pacific ocean. 3. p: Mukesh and Anil are sons of Industrialist Late Dhirubhai Ambani. q: Rajbhavan is official residence of the Governor of Maharashtra. 4. p: 3 is rational. q: -10 is odd integer Solution : The statement p q is given by 1. Banaras is on the bank of holy river Ganga or Dehradoon is capital of Uttaranchal. 2. Eiffel Tower is in London or Panama canal connects Atlantic ocean with Pacific ocean. 3. Mukesh and Anil are sons of late Industrialist Dhirubhai Ambani or Rajbhavan is official residence of the Governor of Maharashtra. 4. 3 is rational or - 10 is odd. The statements 1, 2 and 3 are true whereas 4 is false since p and q are both false. Note that in logic we can join two totally unrelated sentences while in English, we do not combine. In mathematics or in Computer Science, connective or is used in inclusive sense . That is p q is true if true if p is true or q is true or both are true. Consider the statements p: 2 is a prime number and q: 2 is composite. Here the composite statement p q is the statement “2 is prime number or 2 is composite”. Since exactly one of p and q can be true, is used in exclusive sense. A compound statement may have many Components each of which is if self a statement. p q p r involves three prepositions p, q and r. The prepositions p, q and r each may be independently true of false. Hence there are in all 32 = 8 possibilities in the truth table of p q p r . In general, if a statement involves n propositional variable, then there will be 2n rows in its truth table. 22 Example 4 Make a truth table if p q q . p q p q q T T F F T F T F T T T F F T F F F T F F 2.2 CONDITIONAL STATEMENTS Observe the following sentences that we use in day to day life:- 1. If it is very hot in summer then there is a chance of early monsoon. 2. If I see you talking then I will give you a punishment. 3. If I am not in a good mood then I will go for swimming. 4. If I take stress then my blood pressure will increase. Such sentences are called as conditional statements or implication. In logic, a compound statement of the type “If p then q” is called as conditional statement or implication. p is called as hypothesis or antecedent and q is called as conclusion or consequent. The notation for connective if then is denoted by: p q . Example 5 Write implication for each of the following. 1. p: I have headache q: I will take aspirin. 2. p: I take a walk q: I will reach late. 3. p: 2 divides 10 q: Rajiv will go to movie. Solution : p q in each of the case is given by 1. If I have a headache, then I will take Aspirin. 2. If I take a walk then I will be late. 3. If 2 divides 10 then Rajiv will go for a movie. Note than in 1 and 2 given above, we are assuming that p is cause of q. But in logic, p q means that if p is true then q will also be true. Hence it is not possible to have p to be true and q is false. Thus p q is false only when p is true and q is false. In all other possibilities p q is always true. 25 Example 9 Let x and y be any two real numbers. (a) The statement xy x + y = y is true since real number 0 has the property that 0 + y = y for all real numbers y. (b) The statement xy x + y = y is not true since for real number 1 there is no real number y such that 1 + y = y. Let p: x P(x). Then p will be false if there is at least one value of x for which P(x) is false. Thus there is at least one value of x for which P(x) is true. Thus p is false if x P(x) is true. Let q: x Q(x). Then q is false if there does not exists any value of x for which Q(x) is true i.e. for all values of x, Q(x) is true. Thus q is false if x Q(x) is true. Example 10 (a) Let p: For all integers n, 3n-7 a perfect square. Then p is the statement. There exists at least one integer n for which 3n - 7 is not a perfect square. (b) Let q: there exists a real number x such that 2 2 1 2 1 x x . Then q is the statement For all real numbers x , 2 2 1 2 1 x x . 2.2.2 Bi-conditional Bi-conditional or equivalence of two statements p and q means both and andp q q p is denoted by p q . The truth table of p q is given below. p q :r p q :s q p r s T T F F T F T F T F T T T T F T T F F T Note that p q is true if either p, q are both true or both false. Example 11 Compute the truth table of p q q p p q p q p q q p p q q p T T T F F T F F T F T T F T F T F F T T T F T T T T T T 26 Note that last column of the above table indicates that the statement p q q p is always true. Such a statement is called as Tautology. A statement that is always false is called as Contradiction or absurdity. Any other statement is called as contingency. Check Your Progress : 1) Translate each of the following in verbal language. a) p: Teacher is present q: student attend the class. (i) p q , (ii) p q , (iii).p→q, (iv).p↔q, (v). q↔p b) p: 2 is an even number. q: 2 is a prime number. r: 2+2=(2)2. (i). p→q, ii). q→p, (iii). p→q, (iv). p→(q r), (v). ~pq, (vi). p~r, (vii). ~p→(~p~r). 2).Write down the following conditional statements in converse contra positive and inverse. a). If it is a Sunday then it is a holiday. b). If the teacher is present then students are standing. c). If you know mathematics them you know logc. 3) Which of the following statements are Tautology, Contradiction or Contingency? 1. q p q p 2. p q p q 3. p p Similar to the mathematical structure [Sets, , ], one can define a structure on set of proposition with the help of binary operations , and . The operations for propositions have following properties which we list as theorem. The proofs are very simple and hence are left as an exercise to the reader. 2.3 THEOREM A. Commutativity (a) p q q p (b) p q q p B. Associativity 27 (a) p q r p q r (b) p q r p q r C. Distributivity (a) p q r p q p r (b) p q r p q p r D. Idempotent Property (a) p p p (b) p p p E. Properties of negation (a) p p (b) p q p q (c) p q p q F. Properties of implication (a) p q q p (b) p q p q (c) p q p q p q (d) p q p q q r Standard way of proving all the above properties is to construct truth table. In some cases one can also use previous results. 2.4 MATHEMATICAL INDUCTION We now use the ideas developed so far and demonstrate an important technique of proof- Principle of mathematical induction which is an indispensable proof technique, extensively used in mathematics. Suppose P(n) is some statement or property or a formula to be verified where n is an integer. We need to establish the formula P(n) is true for all integers 0n n , where 0n is some fixed integer. This can be achieved as follows. First we establish the validity of ( )P n for n = 0n . This step is called as basis step. Next we show that ( ) ( 1)P k P k is a tautology i.e. assuming the validity of P(k), we establish the validity of P(k + 1) for any integer k ≥ 9n . This step is called as induction step. Usually some efforts are required to prove induction step. We now use the induction principle and prove many formulas, statements. 30 1 1 1 1 1 1 ..... 3.5 5.7 7.9 2 1 2 3 2 3 2 5 3 2 5 k k k k k k Here L.H.S 1 1 1 1 1 ..... 3.5 5.7 7.9 2 1 2 3 2 3 2 5k k k k 1 3 2 3 2 3 2 5 k k k k ……………..………… [by (1)] 21 1 1 2 5 3 . 2 3 3 2 5 2 3 3 2 5 1 2 3 1 . . 3 2 3 2 5 3 2 5 k k k k k k k k k k R H S k k k There for P (k + 1) is true. There for by the principle of mathematical induction, the result P(n) is true for all n N. That is 1 1 1 1 ..... 3.5 5.7 7.9 2 1 2 3 3 2 3 n n n n , for all n N. Example 15. 11 2 3 ..... 3.4.5 4.5.6 5.6.7 2 2 3 6 3 4 n nn n n n n n Solution:- The result P (n) to be proved is that for all n N, 11 2 3 ..... 3.4.5 4.5.6 5.6.7 2 2 3 6 3 4 n nn n n n n n Step.1. for n = 1, L.H.S = 1 3.4.5 ; R.H.S = 1 1 1 1 6 1.3 1.4 3.4.5 There for L.H.S = R.H.S for n=1 there for P(1) is true. Step.2. Let us assume that for some k N , P (k) is true, 31 That is 11 2 3 ..... 3.4.5 4.5.6 5.6.7 2 3 4 6 3 4 k kk k k k k k ……. (I) Then to prove that P (k + 1) is true, That is to prove that 1 21 2 3.4.5 4.5.6 2 3 4 3 4 5 6 4 5 k kk k k k k k k k k k Here L.H.S 1 1 1 3.4.5 4.5.6 2 3 4 3 4 5 k k k k k k k k 1 1 6 3 4 3 4 5 k k k k k k k k …………… [by (1)] 2 1 1 3 4 4 5 1 5 6 6 3 4 5 1 2 3 1 2 6 3 4 5 6 4 5 . . k k k k k k k k k k k k k k k k k k k k k R H S There for P (k + 1) is true. There for by the principle of mathematical induction, the result P(n) is true for all n N That is, 11 2 3 ..... 3.4.5 4.5.6 5.6.7 2 2 3 6 3 4 n nn n n n n n For all n N. Example 15. Show that if P(n) given by 1.6 + 2.9 + 3.12 +……….+ n(3n + 3) = +2n+3 is true for n = k then it is true for n = k + 1. Is P(n) true for all n N? 32 Solution:- Let us assume that P(k) is true. Then 1.6 + 2.9 + 3.12 +………….+ k(3k + 3) = + 2k + 3 Now we have to prove P(k + 1) is true. There for to prove that 1.6 + 2.9 + 3.12 +…………..+ k(3k + 3) + (k + 1)(3k + 6) = (k + 1)3 + 3(k + 1)2 + 2(k + 1) + 3 L.H.S = [1.6 + 2.9 + 3.12 +…..….+ k(3k + 3)] + (k + 1)(3k + 6) =( + 2k + 3) + 3 + 9k + 6 =( + 3k + 1) + 3( ) + 2(k + 1) + 3 = (k + 1)3 + 3(k + 1)2+2(k + 1) + 3 = R.H.S Hence if P (n) is true for n = k, it is also true for n = k + 1. When n = 1, n3 + 3n2 + 2n + 3 = 1 + 3 + 2 + 3 = 9 Which is not the same as L.H.S = 1 (6) = 6. There for P (n) is not true for n = 1. Hence P (n) is not true for all n N. Example 16 Prove that a set containing n elements, n ≥ 1, has 2n subsets. Solution : We will prove the result by induction on the size of the set, n. Let P(n) denotes the statement : Number of subsets of a set containing n elements is 2n . In this problem, 0n = 1. Basis step : Since the only subsets of a singleton set x ={ 1x } are and { 1x }, the formula is true for n = 1. Induction step: Suppose P(k), k ≥ 1, is true, i.e. any set with k elements has 2k subsets, k ≥ 1. Let X = 1 2 1, ,........, kx x x . Any subset S of X can be classified into two types : (A) 1 ;kx S (B) 1 .kx S We will count these subsets separately. If S is any subset of X of type (A) then S' = S −{ 1kx } is a subset of X − { 1kx } and vice-a-versa. Therefore number of subsets S of the set X of type (A) is same as number of subsets of a set X − { 1kx }. Since there are k elements in X−{ 1kx }, by induction there are 2k subsets of X −{ 1kx }. Thus there are 2k subsets of X of type (A). Any subset S of the set X of type (B) is a subset of X − { 1kx } and vice-a-versa. By induction it follows that there are exactly 2k subsets of X of type (B). Thus number of subsets of the set X containing k + 1 elements is 12 2 2k k k . The result now follows by the method of induction. 35 6. Prove that sum of first n terms of an arithmetic progression a, a + d, a + 2d, ……..+ [a(n − 1)d] is given by 2 ( 1) 2 n a n d . 7. 1 1 1 1 ........ . 1.2 2.3 3.4 ( 1) 1 n n n n 8. 2 2 1 2 3 2 ....... 2 . 2 2 2 2 2n n n n 9. Find a formula for 2 2 2 21 3 5 ........ (2 1)n and prove it by induction. 10. Prove that 1 1 1 2 2 n n . 11. Prove that 2 , 1.nn n 12. Let 1 2, ,......., nA A A and B be any sets. Prove by induction the following distributive properties (a) 1 1 , 1. n n i i i i A B A B n (b) 1 1 , 1. n n i i i i A B A B n 13. If A and B are two square matrices of order n such that AB = BA. Prove that , 1. n n nAB A B n . 14. (a) Prove that product of any two consecutive integers is divisible by 2. (b) Prove that product of any three consecutive integers is divisible by 6. 36 3 RELATIONS AND IT’S PROPERTIES Unit Structure 3.0 Objectives 3.1 Introduction 3.2 Product sets and partitions 3.2.1 Product sets 3.2.2 Partitions 3.3 Relations and diagraphs 3.3.1 Definition and examples of relation 3.3.2 Sets related to a relation 3.3.3 The matrix of a relation 3.3.4 The diagraph of a relation 3.4 Paths in relations and diagraphs 3.4.1 Paths in a relation ‘R’ can be used to define new relations 3.4.2 Matrix version 3.5 Properties of relations 3.5.1 Reflexive and Irreflexive relations 3.5.2 Symmetric, Asymmetric and Antisymmetric relations 3.5.3 Transitive relations 3.6 Let us sum up 3.7 References for further reading 3.8 Unit end exercise 3.0 OBJECTIVES: After going through this chapter you will be able to : Understand the concept and definition of product and partition of a set. Understand the different representation of a relation (set theoretical, pictorial and matrix representation). Understand the definition of a path in a relation and able to find paths of different length. Understand the different properties of binary relation. 37 3.1 INTRODUCTION: In day today life we deal with relationships such as an employee and employee number, element and set, a person and his telephone number etc. In mathematics it’s looked in more abstract sense such as division of integers, order property of Real numbers and so on. In computer science, a computer programme and variable, computer language and valid statement and so on Relations are useful in computer databases, networking etc. 3.2 PRODUCT SETS AND PARTITIONS: 3.2.1 Product sets Definition: Let A and B be two non empty sets. The product set or Cartesian product of A and B, (denoted by AB) is the set of all ordered pairs (a, b) where a A and b B . Thus, A B (a,b) / a A and b B [ Note: an order pair (a, b) is the ordered collection that has ‘a’ and ‘b’ in prescribed order, ‘a’ in first position and ‘b’ in second position.] Examples: (1) Let A = 1, 2, 3 and B = x, y then A B (1, x), (1, y), (2, x), (2, y), (3, x), (3, y) Similarly, B×A = (x,1), (y,1), (x, 2), (y, 2), (x, 3), (y, 3) (2) Let A be the set of all 2 divisions in Xth class in some school and B be the set of all 3 courses available. i.e. ++A = X, Y , B = C , Java, VB then ++ ++A × B = (X, C ), (X, Java), (X, VB) (Y, C ), (Y, Java), (Y, VB) so there are total 6 categories possible. Remark: (1) AB and BA may or mayn’t be equal. (2) If A and B are finite sets then A B A . B B A 40 (3) Let A B The set of Real numbers. Let R be a relation on A such that xRy iff 2 2x y 25 5 Fig. 3.1 2 2R (x, y) / x y 25 = The set of all points on the circle centre at origin with radius ‘5’ We can see, (3,4) R 2 2( 3 4 25) but (3, 3) R 2 2( 3 3 18 25) (4) Let A , Let ‘R’ be a relation on ‘A’ defined as xRy iff ‘x’ divides ‘y’. R (1, 2), (2, 4), (5,10), (2, 6),.... We have 1 R 2 but 2 R 1 . 3.3.2 Sets related to a relation Let ‘R’ be relation from A to B. Two important sets related to R are the Domain of ‘R’ [denoted by Dom (R)] and The Range of R [denote by Ran (R)]. We have, Dom (R)= x /(x, y) R A i.e. Dom (R) is a subset of ‘A’ containing first element of the pair (x, y) which belongs to ‘R’. Similarly, Ran (R)= y /(x, y) R B . For Example: (1) Let A 1, 2, 3 and B x, y R (1, x), (3, y) Dom (R)= 1, 3 A and Ran (R)= x, y B (2) Let A and B be only two sets and R = AB. Then Dom (R) = A and Ran (R) =B 41 Check your progress 1. Write down the elements of R form A 0,1, 2, 3 to B 1, 2, 3 , defined as (a,b) R iff (a) a = b (b) a + b is an even number (c) a + b is a multiple of ‘3’ (d) a b 2. Find the domain and Range of the relations defined in Q.1. 3.3.3 The matrix of a Relation A relation between two finite sets can be represented by a Boolean matrix (a matrix which is having entries as ‘0’ or ‘1’) Let ‘R’ be a relation from 1 2 mA a , a , ..., a to 1 2 nB b , b , ..., b . (Here the elements of A and B are listed in a particular order). Then relation ‘R’ can be represented by the m x n matrix R m nM [mij] , which is defined as, 1 if 0 ifij ( a , b ) Ri j m ( a , b ) Ri j The matrix RM is called as the matrix of a Relation ‘R’ Examples: (1) Let A = 1, 2, 3 and B x, y and R (1, x), (2, x), (3, y), (1, y), (3, x) R 3 2 1 1 M 1 0 1 1 (2) Let A B 1, 2, 3, 4 Let ‘R’ be a relation on ‘A’ defined as xRy iff x y . R (1,1), (1, 2), (1, 3), (1, 4), (2, 2), (2, 3), (2, 4), (3, 3), (3, 4), (4, 4) R 4×4 1 1 1 1 0 1 1 1 ∴M = 0 0 1 1 0 0 0 1 Note: Converse process is also possible i.e. given a matrix with enteries ‘0’ or ‘1’ we can write ‘R’ related to that matrix. 42 3.3.4 The Diagraph of a Relation Just we saw that a relation on finite set ‘A’ can be represented by a binary matrix. Similarly there is another way of representing a relation using a pictorial representation. Pictorial representation of ‘R’ is as follows, Draw a small circle for each element of A and label the circle with the corresponding elements of A, (these circles are called as vertices) draw an arrow from vertex ia to ja iff i ja R a . (these arrows are called as edges) The resulting pictorial representation is called as Directed graph or diagraph of ‘R’. For example: (1) Let A B 1, 2, 3, 4 and R (1,1), (1, 2), (2, 3), (3, 4), (2, 4), (3,1) 1 2 3 4 Fig. 3.2 Note: (1) An edge of the form (a, a) is represented using an arc from the vertex ‘a’ back to it self. Such an edge is called a loop. (2) Conversely diagraph can be used to find underlying relation represented by it. (3) There are two important definitions arising from the diagraph. (i) In-degree of = no. of arrows a vertex coming towards that vertex and (ii) Out-degree of = no. of arrows a vertex going away from that vertex 45 2R (x, y) / if a path of length '2 ' from 'x ' to ' y ' . nR (x, y) / if a path of length 'n ' from 'x ' to ' y ' . Now we may define R as, R (x, y) / if some path from 'x ' to ' y ' . i.e. i i 1 R R For example: (1) Consider the following diagraph. 1 2 3 4 Fig. 3.6 So, 1R (2, 2), (2,1), (2, 4), (3, 2), (3, 4), (1, 4), (1, 3) Now for 2R , we have to find all Paths of length ‘2’ 1 : 2, 2, 2 2 : 2, 2,1 3 : 2, 2, 4 4 : 3, 2, 2 5 : 3, 2, 4 6 : 3, 2,1 7 :1, 3, 2 8 :1, 3, 4 9 : 2,1, 3 i.e. 2R (2, 2, ), (2,1), (2, 4), (3, 2), (3, 4), (3,1), (2, 3), (1, 2), (1, 4) similarly we can find 3 4R , R and so on. 46 (2) Consider the diagraph, a b c d Fig. 3.7 Then, 1R (a,b),(b,a), (b,c), (c,d) 2R (a, a), (a, c), (b, b), (b, d) 3R (a, b), (a, d), (b, a), (b, c) R (a, a), (a, b), (a, c), (a, d), (b, a), (b, b), (b, c), (b, d), (c, d) Note: Since ‘n’ is finite the process of finding 1 2 3R , R , R ,... will stop after some finite ‘n’. In fact we can prove that, 1 2 3 nR R R R ..... R , where ‘n’ is number of elements in the given set ‘A’. 3.4.2 Matrix version If R is large, it would be tedious to compute R , or even 2 3R , R etc. from the set representation of R so we have following matrix version of above concepts. First we will see some different operations defined on Boolean matrices. Let ijA a and ijB b be two m x n Boolean matrices. (1) we define ijA B C [C ], the join of A and B by, ij ij ij ij ij 1 if a 1or b 1 C 0 if a & b both are 0 47 (2) We define ijA B E [e ], the meet of A and B ij ij ij ij ij 1 if a 1& b 1 e 0 if a 0 or b 0 (3) Let ij m p A a and ij p n B b be two Boolean matrices. Then Boolean product of A and B, (denoted by A B) is the mn Boolean matrix ijC [C ] defined by 1 if aik = 1 and bkj =1 for some k, 1 k p 0 otherwise for eg: Let 3 3 3 2 1 0 0 1 0 A 0 1 0 & B 1 1 1 1 0 0 1 3 2 1 0 A B 1 1 1 1 Note: a a .... ai1 i2 ip C C C11 12 1nb b b ba a .... a 11 12 ij 1n21 22 2p b2j Cij a a .... ai1 i2 ip b b b bp1 p2 pj pn pxn C C Cm1 m2 mn mxna a .... am1 m2 mp mxp = é ù é ùê ú é ù ê úê ú ê ú ê úê ú ê ú ê úê ú ê ú ê úê ú ê ú ê úê ú ë û ê úë ûê ú ë û L K L M M M M M MM M M M Me M M M M M M L LM M L i1 i2 ip a a a M ij 2 j pj b b b M If any corresponding pair of entries are both equal to 1, then otherwise C ij = 1 ; = 0 ij C ijC 50 (a) List all paths of length ‘2’ (b) List of all paths of length ‘2’ starting from ‘3’ (c) List all cycles (d) All cycles starting at ‘1’ 2. For example (1) find 2R M and 3R M ? 3. Prove that if R and S are two relations then R S R SM M v M 3.5 PROPERTIES OF RELATIONS: 3.5.1 Reflexive and Irreflexive Relations A relation on set ‘A’ is reflexive if (x, x) R x A [or xRx x A] A relation on set ‘A’ is irreflexive if (x, x) R x A [or xRx x A] For e.g. (1) Let A 1, 2, 3, 4 with Relations R,S,T on A. If R (1,1), (1, 2), (2, 2), (3, 3), (4, 4), (4, 2) then ‘R’ is reflexive. If S (1,1), (2,1), (3, 3), (4, 3), (4, 4) then ‘S’ is not reflexive. ( 2 R 2) and also ‘S’ is not irreflexive. (3,3) R or (2, 2) R . if T (1, 2), (2, 3), (3,1) then T is irreflexive. Note: (1) (x, x) / x A is called as an equality relation on ‘A’. (2) ‘R’ is reflexive iff R. (3) ‘R’ is irreflexive iff R O (4) If R O, an empty relation then ‘R’ is not reflexive since (x, x) R x A. However, R is irreflexive. (5) Let ‘R’ be a reflexive relation on set ‘A’ then matrix of relation RM must have diagonal elements as 1. (6) If ‘R’ is irreflexive then RM must have diagonal elements as zero’s. 51 3.5.2 Symmetric, Asymmetric and Antisymmetric relations (1) A relation on set ‘A’ is symmetric if whenever (a, b) R, then (b, a) R . (2) A relation on set ‘A’ is asymmetric if whenever (a, b) R, then (b, a) R . (3) A relation on set A is antisymmetric if whenever (a, b) R, & (b, a) R then a = b. For Examples: (1) Let A , ‘R’ be a relation on ‘A’ such that xRy iff ‘x’ divides ‘y’. (a) If xRy (i.e. ‘x’ divides ‘y’) then yRx or y R x ( ' y ' may or mayn’t divide ‘x’) For eg: 2 R8 (as 2|8) but 8 R 2 ( 8 2) R isn ' t asymmetric (b) If a = b = 2 then aRb as well as bRa R is not asymmetric (c) If ‘a’ and ‘b’ are such that a/b and b/a A / b and b / a gives a = b R is antisymmetric (2) Let A = set of all lines in a xy-plane. (a) If and m are in A such that R m then m R ( R m m m m R ) R is symmetric (b) R is not asymmetric as R m mR (c) R is not antisymmetric as we can have 2 distinct lines | | to each other butn’t equal. Fig. 3.10 R m 52 (3) Let A , ‘R’ is a relation such that x R y iff x < y then R is not symmetric but R is asymmetric. ( x R y x y y x y R x) Notes: 1) The matrix RM of a symmetric relation satisfies the property that t R R M M i.e. if ijm 1 then jim 1 and if ijm 0 then jim 0 2) The matrix RM of an asymmetric relation satisfies the property if ijm 1 then jim 0 and iim 0 i (i.e. diagonal elements are zero) 3) Relation ‘R’ is antisymmetric means x R y and y R x x y contrapositive of this statement is, if x y xRy or yRx i.e. RM of antisymmetric relation satisfied the property that if i j, then ij jiM 0 or M 0 Similarly for diagraphs we have, 4) The diagraph of symmetric relation has the property that if there an edge from i to j, then there is an edge from j to i. 5) If R is an asymmetric relation, then if there an edge from i to j so there can’t be any edge from j to i and there can’t be any cycle of length ‘1’. 6) If ‘R’ is an antisymmetric relation, then for different i and j there can not be an edge from vertex ‘i’ to vertex ‘j’ and an edge from vertex ‘j’ to vertex ‘i’. (we can’t say anything if i = j ) 3.5.3 Transitive Relations A relation ‘R’ on set ‘A’ is said to be transitive if (x, y) R and (y,z) R then (x, z) R. [ i.e. if xRy and yRz xRz] For Example: (1) Let A 1, 2, 3, 4 and let R (1,1), (1, 2), (2, 2), (2, 4), (1, 4) and S (3, 2), (2,1), (1, 4), (4, 2), (1, 2) then we can check ‘R’ is transitive but ‘S’ is not. [ (3, 2) & (2,1) S but (3,1) S ] 55 3.7 REFERENCES FOR FURTHER READING: (1) Discrete structures by B. Kolman HC Busloy, S Ross PHI Pvt. Ltd. (2) Discrete mathematics and its application, Keneth H. Rosen TMG. (3) Discrete structures by Liu. 3.8 UNIT END EXERCISES: 1. Find R for the relation ‘R’ whose diagraph is 1 2 3 4 5 Fig. 3.14 Q.2 Calculate 4R M for a relation R (1,1), (3, 2), (1, 4), (2, 4) on set A 1, 2, 3, 4 Q.3 Determine whether following relations are reflexive, irreflexive, symmetric, asymmetric, antisymmetric or transitive. (a) A , x R y iff x + y is an even number. (b) A , x R y iff 2 2x y 9 (c) A , x R y iff x y (d) A , x R y iff (x y) 3 Q.4 Define a relation on A 1, 2, 3, 4 that is (a) Reflexive butn’t symmetric (b) Transitive butn’t reflexive (c) Antisymmetric and reflexive (d) irreflexive and transitive Q.5 Prove that if ‘R’ is symmetric then 2R is also symmetric. 56 4 EQUIVALENCE RELATION AND CLOSURES Unit Structure 4.0 Objectives 4.1 Introduction 4.2 Equivalence relations 4.2.1 Definition 4.2.2 Equivalence relation and partition 4.3 Operations on relations 4.4 Closures 4.4.1 Reflexive and Symmetric closures 4.4.2 Transitive Closure 4.5 Composition 4.6 Computer representation of relations and diagraphs 4.7 Let us sum up 4.8 References for further reading 4.9 Unit end exercises 4.0 OBJECTIVES : After going through this chapter, students will be able to Understand the definition of an equivalence relation and able to identify an equivalence relation Find the Partition produce by an equivalence relation and vice versa. Understand different operations that can be performed on different relations which is useful in finding the closures of a relation. Use Warshall’s algorithm to find transitive closure. 57 4.1 INTRODUCTION : We have already seen the concept of reflexive, symmetric and transitive etc. If a relation is not transitive then it doesn’t contain all the pairs that can be linked so we want to make it transitive by adding the remaining pairs with the property that resulting set is smallest set containing given relation. Such a set is called as transitive closure. Also we will see important concept of composition of relations and computer representation of relation and diagraph. 4.2 EQUIVALENCE RELATIONS 4.2.1 Definition : Let ‘R’ be a relation on ‘A’, ‘R’ is said to be an equivalence relation on A iff ‘R’ is reflexive, symmetric and transitive. Examples : (1) Let A = {1, 2, 3} and R = {(2, 2), (1, 2), (2, 1), (1, 1), (3, 3)} then it’s easy to check ‘R’ is an equivalence relation. (2) Let A = and ‘R’ be a relation on ‘A’ such that R yx iff x+ y is an even number. To check whether ‘R’ is an equivalence relation or not. (a) Let xA , 2 evenx x x Rx x x A R is reflexive. (b) Let x ,y A such that R yx i.e. evenyx i.e. 2 ,y p px Consider, 2 eveny y px x y x is also an even number. y R x R is symmetric. (c) Let x ,y,z A such that 2 ,R y y p px x -------------- (1) and 2 ,y R z y z q q --------------- (2) 60 We can reverse the above Process, i.e. given a Partition we can produce an equivalence relation on a given set. Let ‘A’ be a given set and let p be a partition of A. define a relation on set ‘A’ as, x R y iff ‘ x ’ and ‘y’ belongs to same block or cell of the given partition. T.P.T. R is an equivalence relation. (a) If Ax , then it’s very obvious x belongs to same block. R Ax x x , R is reflexive. (b) If x ,y A such that, R y & y belongs to same blockx x y & belongs to same blockx y R x R is symmetric. (c) If , y, w Ax such that, R y & y R wx x ( and y belongs to same block) and (y and w belongs to same lock) x and w belongs to same block R wx R is transitive R is an equivalence relation. For example, (1) Let A = {1, 2, 3, 4} and partition p = {{1}, {2, 3}, {4}} R = {(1, 1), (2, 2), (2, 3), (3, 2), (3, 3), (4, 4)} Check your progress 1. Let A = 1, 2, 3, 4, 5, 6, 7, 8 and p = 1 , 2,3 , 4 , 5,6,7 , 8 be a partition of A. Find corresponding equivalence relation. 2. Let A = 1, 2, 3, 4, 5 and R = 1,1 , 2, 2 , 1, 2 , 2,1 , 3,3 , 4,4 , 3, 4 , 4,3 , 5,5 be an equivalence relation on ‘A’. Find the corresponding Partition. 61 4.3 OPERATIONS ON RELATIONS : Let ‘R’ and ‘s’ be two relations from set ‘A’ to set ‘B’. We have following operations defined on Relations. (1) Complementary relation of ‘R’ (denoted as R ) R = , y / , y Rx x (2) Inverse of a relation ‘R’ (denoted as –1R ) –1R y y Rx x = , / , For example, (1) Let A = 1, 2, 3 and R = 2, 2 , 1, 3 , 2, 3 , 3, 3 R = 1,1 , 1, 2 , 2,1 , 3,1 , 3, 2 and –1R = 2, 2 , 3,1 , 3, 2 , 3, 3 (3) R S y y R or y Sx x x = , / , , (4) R S y y R & y Sx x x = , / , , For example, (1) Let A = 1, 2, 3, 4 and R = 1, 2 , 1,1 , 2, 4 , 3, 2 and S = 2, 2 , 1,1 , 3, 2 , 3, 4 R S 1,1 , 1, 2 , 2, 2 , 3, 2 , 3, 4 , 2, 4 = and R S 3, 2 , 1,1 = Note :- (1) R S R SM M M = R S R SM M M = T–1 R RM = M RR M = M [ RM complement is a matrix obtained by replacing every ‘1’ by ‘0’ and every ‘0’ by ‘1’.] 62 Theorem : Suppose ‘R’ and ‘S’ are relations from ‘A’ to ‘B’ (a) If R S , then –1 –1R S (b) If R S , then S R (c) –1 –1 –1R S R S = and –1 –1 –1R S R S = (d) R S R S = and R S R S = (e) R is reflexive iff R is irreflexive. (f) R is symmetric iff –1R = R (g) R is antisymmetric iff –1R R (h) R is asymmetric iff –1R R 0 (i) 2 2 2R S R S Proof : (a) Let –1y Rx , y R Sx , –1y Sx , –1 –1R S (b) Let y Sx , y Sx , y R R Sx , y Rx , S R (c) –1 R S y y R Sx x = , / , = y y R y Sandx x x , / , , = –1 –1y y R y Sandx x x , / , , = –1 –1R S Similarly, other one. 65 2. Let ‘R’ be a relation whose diagraph is 1 2 9 Fig. 4.1 Find the reflexive and symmetric closures of ‘R’. 4.4.2 Transitive Closure Definition : Let ‘R’ be a relation on ‘A’. The transitive closure of ‘R’ is the smallest transitive relation that contains ‘R’. It’s denoted by TR . As compare to reflexive and symmetric closures it’s little bit difficult to find transitive closure because we don’t have a formula for it but we have following results and an algorithm for finding the transitive closure. Result :- (1) Let ‘R’ be a relation on A. Then R is transitive closure of ‘R’. For example, (1) Let A = {1, 2, 3, 4} and R = {(1, 1), (1, 2), (2, 3), (3, 4)} we know that if, |A| = m, then 1 2 mR R R R = .... . 1 2 3 4 Fig. 4.2 66 |A| = 4 1 2 3 4R R R R R = 1R = (1,1), (1, 2), (2, 3), (3, 4) 2R = (1, 2), (1, 3), (1,1), (2, 4) 3R = (1,1), (1, 2), (1, 4), (1, 3) and 4R = (1,1), (1, 2), (1, 4), (1, 3) R = (1,1), (1, 2), (1, 3), (1, 4), (2, 4), (2, 3), (3, 4) Transitive Closure = TR = R The above graphical method is impractical for large sets and relations and it is not systematic and also It would be more time consuming and costly for large set. But we have a more efficient algorithm for computing transitive closure called as ‘Warshall’s Algorithm’. Warshall’s Algorithm :- Let ‘R’ be a relation on a set 1 2 nA = a , a , ....., a . If x x x x1 2 3 n, , , ...., is a Path in R, then any vertices other than x x1 m& are called interior vertices of the Path. Now, for 1 k n , we define a Boolean matrix kW as follows. kW has a ‘1’ in position i, j iff there is a path from i ja to a in ‘R’ whose interior vertices, if any, come from the set 1 2 ka ,a ,....., a . So, it follows that nW has a ‘1’ in position i, j iff some Path in ‘R’ connects ia with a j , i.e. nW = RM . If we define 0W to be R m , then we will have a sequence 0 1 n RW , W ,..., W = M . Now, we will see how to compute matrix kW from the previous matrix k–1W this procedure is called as ‘Warshall’s Algorithm’. Step – I Let 0 RW = M . Step – II Suppose we have calculated k–1W , now to calculate kW . 67 Step – III List the locations 1 2p , p ,... in column ‘k’ of k–1W , where the entry is ‘1’, and the locations 1 2q , q ,... in row k of k–1W , where the entry is ‘1’. Step – IV Put 1’s in all the positions i jp , q of kW (if they are not already there.) For example, (1) Let A = {1, 2, 3, 4} and R = {(1, 1), (1, 2), (2, 3), (3, 4)} as earlier. Now, we will use Warshall’s Algorithm to find R . (1) 0 R 1 1 0 0 0 0 1 0 W = M 0 0 0 1 0 0 0 0 4×4 = (2) To computer 1W consider Ist column and Ist row of 1W where 1’s are present. 1 1 1 0 0 0 0 1 0 W = 0 0 0 1 0 0 0 0 (3) To compute 2W consider IInd column and IInd row of 1W where 1’s are present. 2 1 1 0 0 0 0 1 0 W = 0 0 0 1 0 0 0 0 (4) To compute 3W , consider IIIrd column and IIIrd row of 2W where 1’s are present. Column Row 1 1 2 So fill the positions (1, 1) and (1, 2) by 1’s if not present already. Column Row 1 3 So fill (1, 3) by ‘1’. 70 (1,1) R (1,1) T (1,1) TORand (1, 3) R (3,1) T (1,1) TORand (1, 3) R (3, 3) T (1, 3) TORand (2,1) R (1,1) T (2,1) TORand (2, 2) R (2, 2) T (2, 2) TORand (2, 2) R (2, 3) T (2, 3) TORand (2, 3) R (3,1) T (2,1) TORand (2,3) R (3, 3) T (2, 3) TORand (3, 2) R (2, 2) T (3, 2) TORand (3, 2) R (2, 3) T (3, 3) TORand TOR 1 0 1 M = 1 1 1 0 1 1 We can check that, TOR R TM = M M so this formula gives an easy way to compute ToR (by using TORM ) Note : (1) If R = T then we have ToR = 2R and 2TOR R RR M = M = M M . (2) If we have relation R, T, S such that, A R B T C S D Fig. 4.4 then To (SoR) = (ToS) o R [i.e. composition is associative] (3) In General, RoS SoR (4) –1 –1 –1(SoR) = R o S Check your progress 1. A = B = C , A = { x , y, z, w} and R and T be two relations such that 71 R T 1 0 0 1 1 0 1 0 0 1 0 0 1 0 0 1 M = M = 0 1 0 1 0 0 1 1 1 0 1 0 0 1 0 1 and then compute (ToR) and (RoT) 2. Give an example of relations R and T such that RoT ToR. 4.6 COMPUTER REPRESENTATION OF RELATIONS AND DIAGRAPHS : We know that a Relation ‘R’ on set ‘A’ can be represented by an n X n matrix RM , if |A| = n. The matrix RM has entries that are ‘0’ or ‘1’. Then one of the easier way of representing ‘R’ in a computer is by an n X n array having 0’s and 1’s stored in each location. Thus, if A = {1, 2} and R = {(1, 1), (2, 1), (2, 2)}, then R 1 0 M = 1 1 and these data would be represented by a two dimensional array MR, where MR 1,1 =1, MR 1, 2 = 0, MR 2,1 =1, MR [2, 2] = 1 (MR means matrix related to ‘R’) An another way of storing data for relations and diagraphs is by using the linked list idea of computer programming. A liked list will be constructed that contains all the edges of the diagraph, that is, the ordered pairs of numbers that determine those edges. The data can be represented by two arrays, TAIL and HEAD, giving the beginning vertex and end vertex, respectively for all edges. If we are making these edge data into a linked list, then we need an array NEXT of pointers from each edge to the Next edge. Consider the relation whose diagraph is 1 2 3 6 5 43 10 6 8 9 7 1 4 5 2 Fig. 4.5 72 The vertices are the integers ‘1’ to ‘6’ and we arbitrarily number the edges as shown in above diagraph. If we wish to store the diagraph in liked – list form so that the logical order coincides with the numbering of edges. We can use a scheme mentioned below. START TAIL HEAD NEXT 2 1 2 2 3 5 3 3 6 1 1 3 3 1 5 4 4 6 1 6 2 9 10 4 8 1 3 0 7 6 5 Fig. 4.6 START contains 2, the index of the first data item, the edge (2, 3) [this edge is labeled with a ‘1’ in fig : 5.6]. This edge is stored in the second entries of TAIL and HEAD, respectively. Since NEXT [2] contains 10, the next edge is the one located in position 10 of TAIL and HEAD, that is, (1, 2). NEXT [10] contains 5, so we go to next to data position 5, which contains the edge (5, 4). This process continues until we reach edge (3, 6) in data position 7. This is the last edge, and this fact is indicated by having NEXT [7] contains ‘0’. We use ‘0’ as a pointer, indicating the absence of any more data. If we trace through this process, we will see that we encounter the edges in exactly the order corresponding to their numbering. We can arrange, in a similar way, to pass through the edges in any desired order. But this scheme and the numerous equivalent variations of it have important disadvantages. In many algorithms, it’s efficient to locate a vertex and then immediately begin to investigate the edges that begin or end with this vertex. This is not possible in general with the mechanism shown in fig : 2. So we have modification of it. We use an additional linear array VERT having one position for 75 Compute – (a) R (f) –1S (b) S (g) R SM (c) R S (h) R SM (d) R S (i) –1R M (e) –1R (j) S M Q.4 Find the transitive closure of a relation whose matrix is 1 0 1 1 0 0 1 0 0 1 1 0 1 0 0 0 1 0 1 1 1 1 0 0 0 by (a) computing R (b) using Warshall’s Algorithm Q.5 Let A = {1, 2, 3, 4} and let R and S be the relations on ‘A’ such that R 1 0 0 1 1 0 1 0 M = 1 1 0 0 1 0 0 1 and S 1 0 1 0 1 1 0 0 M = 1 0 0 1 0 0 1 1 use Warshall’s Algorithm to compute the transitive closure of R S . Q.6 If A = {1, 2, 3, 4} and let R and S be the relations on ‘A’ such that R 1 1 0 0 1 0 1 0 M = 1 1 0 1 0 1 1 0 and S 1 0 1 1 0 0 1 0 M = 1 1 0 1 1 0 1 1 Find (a) RoRM , (b) RoSM , (c) SoR , (d) RoS . 76 5 PARTIAL ORDER SETS AND LATTICES Unit Structure 5.0 Objectives 5.1 Introduction 5.2 Definition and examples 5.3 Hasse diagrams 5.4 Isomorphism 5.5 External Elements of partially ordered sets 5.6 Lattices 5.7 Let us sum up 5.8 Unit End Exercise 5.9 References for further reading 5.0 OBJECTIVES: After going through this chapter students will be able to understand: The definition of partially order sets and example based on it. Idea of Hasse diagram and able to represent the diagraph of a poset in more efficient way. The concept of Isomorphism and which is useful in classification of Posets. The concept of maximal, minimal elements, the greatest and least element, upper and lower bound of a subset and finally the concept of LUB and GLB. The concept of Lattices and different properties of a Lattice. 5.1 INTRODUCTION: We use relations to order some or all of the elements of sets. For example we order words using the relation, containing pair of words (x, y) where ‘x’ comes before ‘y’ in the dictionary. We schedule projects using the relation consisting of pairs (x, y) where x and y are tasks in project such that x must be completed before y 77 begins. When we add all the pairs of the form (x, x) to these relations we get partial order. (Practical definition afterwards). These structures are useful in set theory, algebra, sorting and searching, in the construction of logical representations for computer circuits. 5.2 DEFINITION AND EXAMPLES: Definition: Let ‘R’ be a relation on set A. then ‘R’ is said to be partial order if ‘R’ is (a) reflexive (b) antisymmetric and (c) transitive. The set A with partial order ‘R’ is called as partial order set or poset and It’s denoted as (A, R) For example (1) Let A and ‘R’ be a relation on ‘A’ such that x R y iff x y. It’s easy to check ‘R’ is reflexive, ant symmetric and transitive. ∴ R is a partial order. ( , ) is a poset. (2) Let S = 1, 2, 3 and A = P(S) A 0, 1 , 2 , 3 , 1, 2 , 2, 3 , 1, 3 , S Let R be a relation on A defined as x R w iff x w (a) Let x A, x x ∴ xRx ∀ x ∈ A R is reflexive (b) Let x, w A such that x R w and w R x xRw x w (1) and wRx w x (2) w x from and R is antisymmetric (c) Let x, w, z A such that x R w and w R z x R w x w (1) and wRz w z (2) 80 5 20 104 2 1 Fig. 5.2 Diagraph 5 20 104 2 1 Fig. 5.3 Step: 1 Fig. 5.4 Step: 2 5 20 104 2 1 20 10 5 4 2 1 Fig. 5.5 Step: 3 Fig. 5.6 Step: 4 Hasse diagram 5 20 104 2 1 81 (2) Let S 1, 2, 3 andA P(S) 0, 1 , 2 , 3 , 1, 2 , 2, 3 , 1, 3 S with relation of contain { 1, 2, 3 } = S { 1, 3} { 2, 3} { 1 } { 2 } { 1 , 2 } { 3 } O Fig. 5.7 Hasse diagram Check your progress: Draw Hasse diagram of following diagraphs. ba c d 3 4 2 1 5 (a) (b) Fig. 5.8 Fig. 5.9 4 1 2 3 (c) Fig. 5.10 82 5.4 ISOMORPHISM : Let (A, R) and (B, T) be two Posets. Then (A, R) and (B, T) are said to be Isomorphic if F a function ‘f’ from ‘A’ to ‘B’ such that (a) f is bijective (b) ‘f’ preserves partial order. [i.e. for any a, b in ‘A’, we have a R b iff f(a) T f(b)] Note :- If (A, R) and (B, T) are Isomorphic then such a ‘f’ is called as an Isomophism from ‘A’ to ‘B’. For example, (1) Let (A, R) = , (B, T) = (set of all even natural numbers, ) Define f : (A, R) (B, T) as f(m) = 2m (a) Let a, bA such that f(a) = f(b) 2a = 2b a = b f is one one. (b) Let bB b = 2q q Take a = q f(a) = f(q) = 2q = b true b B f is onto. f is bijective. Now, Let a, b A such that a R b a b 2a 2 b f(a) f(b) f preserves partial order. f is an Isomorphism. (A, R) and (B, T) are Isomorphic. 85 Result :- A poset has at most one greatest and at most one least element. Note : (1) Greatest element is denoted by I and it’s also called as unit element (2) Least element is denoted by ‘0’ and it’s also called as zero element. Consider a poset (A, R) and a subset ‘B’ of ‘A’. An element ‘u’ of A is said to be an upper bound of B if bRu b B . An element ‘ l ’ of A is said to be a lower bound of B if R b b B l . For example, (1) Consider the following poset and find the upper and lower bounds of (a) 1B = {2, 5, 7} (b) 2B = {1, 3} (c) 3B = {3, 2, 7, 4} 1 3 6 5 4 2 7 Fig.5.16 For 1B , Upper bounds are 1, 2, 3 Lower bound is 5 For 2B , No upper bounds Lower bounds are 2, 7, 4, 5, 6 For 3B , Upper bound is 3 Lower bounds are 5, 6 Note : 1) A subset ‘B’ of a poset may or mayn’t have upper or lower bounds. 2) It can have more than one upper or lower bounds. 86 3) Upper or lower bound may or mayn’t belong to given subset. Let ‘A’ be a poset and ‘B’ a subset of ‘A’. 1) An element are u ∈ A is called a least upper bound of ‘B’, L B B (a) If ‘u’ is an upper bound of ‘B’. (b) If w is any other upper bound of ‘B’ then u R w, Similarly, 2) An element l ∈ A is called a greatest lower bound of ‘B’, GLB B (a) If ‘l’ is a lower bound of ‘B’. (b) If ‘t’ is any other lower bound of ‘B’ then t R l. For example, (1) Consider the following poset (a) for a subset B = {e, d, h} Upper bounds = a, c, b Lower bounds = h, f, g L B B = h GLB B = does not exist (as ‘a’ and ‘c’ are not comparable) e f d c g a b h Fig. 5.17 (b) For a subset D = {a, d. f. g} Upper bounds = a, b L B = a No lower bounds GLB = does not exist 87 (c) For a subset E = {a, e, d} Upper bounds = a, b L B = a Lower bounds = h, f, g GLB = h Result : Suppose that (A, R) and (B, T) are Isomorphic posets under the Isomorphism f : A B (a) If ‘a’ is a maximal (minimal) element of (A, R), then f(a) is a maximal (minimal) element of (B, T). (b) If ‘a’ is the greatest (least) element of (A, R), then f(a) is the greatest (least) element of (B, T) (c) If ‘a’ is an upper bound (lower bound, least upper, upper bound, greatest lower bound) of a subset ‘D’ of A, then f(a) is an upper bound (lower bound, least upper bound, greatest lower bound) for the subset f(D) of B. [Notation : if D = {1, 2, 3} then f(D) = {f(1), f(2), f(3)}] (d) If every subset of (A, R) has a L B (GLB), then every subset of (B, T) has a L B (GLB). For example, (1) b a d c 32 1 Fig. 5.18 Fig. 5.19 This two posets are not Isomorphic as first one have a greatest element but second one not. (2) Consider the posets, A = {1, 2, 3, 6} with divisibility relation and S = {1, 2} , A = P(S) with contain relation 90 5.6 LATTICES 5.6.1 Definition A lattice is a poset (L, R) in which every subset consisting of two elements has a least upper bound L B and greatest lower bound (GLB). Notation :- If a set is {a, b} then L B({a, b}) is denoted by a b and it’s called as join of ‘a’ and ‘b’. Similarly, GLB ({a, b}) is denoted by a b and it’s called as meet of ‘a’ and ‘b’. For example (1) Consider a poset, Fig. 5.29 a b c d a b c d a a b c d a a a a a b b b d d b a b a b c c d c d c a a c c d d d d d d a b c d So, from the table of join and meet we can see L B and GLB of any subset with two elements exist. it’s a Lattice. (2) Consider a poset, Fig. 5.30 Since L B y({ , }) x doesn’t exist. it’s not a lattice. a b c d yx 91 (3) Let ‘S’ be a given set and L = P(S). Consider ‘L’ with relation contain We know that L ( , ) is a poset. Let x, y L, then x y X Y = and X Y X Y = and which exist in L. (as they are subsets of ‘s’) L ( , ) is a lattice. (4) Consider the poset ( , divisibility relation), Let y,x , then y = L C M ( , y) and y = G C D ( , y)x x x x (5) Let n , Let nD = set of all positive divisors of ‘n’, then it can be proved nD with divisibility relation is a poset. For example, If n = 20, then 20D = {1, 2, 4, 5, 10, 20} 4 2 1 5 1 0 2 0 Fig. 5.31 Hasse diagram of 20D is a Lattice. [it can be proved similarly as in example (1).] 92 Check your progress 1. Check whether following Hasse diagrams are lattice or not? e b a c d f a c d e b Fig. 5.32 Fig. 5.33 (a) (b) 1 2 3 4 5 6 t y w z x Fig. 5.34 Fig. 5.35 (c) (d) 5.6.2 Isomorphic Lattices Let 1 1L , R and 2 2L , R be two given posets. A function 1 2f : L L is said to be an isomorphism if (1) ‘f’ is bijective (2) f preserves the Lattice properties. [i.e. if a, b 1L then f a b = f a f b and f a b = f a f b ] Note : 1 1L , R and 2 2L , R are said to be Isomorphic Lattices. For example, (1) ( 6D , divisibility) and P 1, 2, 3 , are Isomorphic Lattices. 95 5.8 UNIT END EXERCISES 1. Determine whether the following relation ‘R’ is a partial order or not on a given set. (a) A = , a R b iff a + b is even. (b) A = , a R b iff a = b. 2. Determine the Hasse diagram of the relation on {1, 2, 3, 4, 5}A whose matrix is (a) 1 0 1 1 1 0 1 1 1 1 0 0 1 1 1 0 0 0 1 0 0 0 0 0 1 (b) 1 0 0 0 1 1 0 0 1 1 1 0 1 1 0 1 3. Draw the Hasse diagram of Poset with partial order divisibility) and determine which posets are linearly ordered. (a) A = {1, 2, 3, 4, 6, 9, 12, 36} (b) A = {3, 6, 12, 36, 72} 4. A is the set of all 2 X 2 Boolean matrices and the relation ‘R’ is defined as M R N iff ij ijm n , 1 2i , 1 2j . (a) Find maximal and minimal elements of A (b) Find the greatest and least element if exist of A. (c) Find all upper and lower bounds of 1 0 1 0 1 0 B= 0 1 1 1 0 0, , (d) Find GLB and L B of above set ‘B’. 5. Draw the Hasse diagram of 30 36 42D , D , D . 6. Determine whether following Hasse diagram represents a Lattice or not. 96 e b a c d f g 5 4 3 2 1 0 Fig. 5.36 Fig. 5.37 a d b c n mp w y x z Fig. 5.38 Fig. 5.39 5.9 REFERENCES FOR FURTHER READING (1) Discrete structure by B. Kolman, Hc Busby, S. Ross PHI Pvt. Ltd. (2) Discrete structures by Liu. (3) Discrete mathematics and it’s Apprlications Keneth H. Rosen TMG. (i) (ii) (iii) (iv) 97 6 FUNCTION Unit Structure 6.0 Objectives 6.1 Introduction 6.2 Functions 6.3 Types of function 6.4 Identity functions 6.5 Composite function 6.6 Inverse function 6.7 Binary operation 6.8 Properties of binary operation 6.9 Review 6.10 Unit End Exercise 6.0 OBJECTIVES: A function is the central to the study of physics and enumeration. In computer implementation of any program output of any program can be considered as a function of the input. Binary operations have applications in the study algebraic structures. 6.1 INTRODUCTION: A function was the heart of the scientific revolution of the seventeenth century. To understand the general use of function we must study their properties in the general, which is what we do in this chapter. The reader is no doubt familiar with function of the form ( )y f x for instance, if 2( ) 2f x x , 2x and (2)y f then the value of y is 4.