Download Discrete Mathematics and more Study notes Discrete Mathematics in PDF only on Docsity! www.rejinpaul.com DISCRETE MATHEMATICAL STRUCTURES 10CS34 DISCRETE MATHEMATICAL STRUCTURES (Common to CSE & ISE) Subject Code: 10CS34 LA. Marks : 25 Hours/Week : 04 Exam Hours: 03 Total Hours : 52 Exam Marks: 100 PART-A UNIT -1 6 Hours Set Theory: Sets and Subsets, Set Operations and the Laws of Set Theory, Counting and Venn Diagrams, A First Word on Probability, Countable and Uncountable Sets UNIT —2 7 Hours Fundamentals of Logic: Basic Connectives and Truth Tables, Logic Equivalence — The Laws of Logic, Logical Implication — Rules of Inference UNIT -3 6 Hours Fundamentals of Logic contd.: The Use of Quantifiers, Quantifiers, Definitions and the Proofs of Theorems UNIT -4 7 Hours Properties of the Integers: Mathematical Induction, The Well Ordering Principle — Mathematical Induction, Recursive Definitions PART -B UNIT -5 7 Hours Relations and Functions: Cartesian Products and Relations, Functions — Plain and One-to- One, Onto Functions — Stirling Numbers of the Second Kind, Special Functions, The Pigeon-hole Principle, Function Composition and Inverse Functions UNIT -6 7 Hours Relations contd.: Properties of Relations, Computer Recognition — Zero-One Matrices and Directed Graphs, Partial Orders — Hasse Diagrams, Equivalence Relations and Partitions UNIT -—7 6 Hours Groups: Definitions, Examples, and Elementary Properties, Homomorphisms, Isomorphisms, and Cyclic Groups, Cosets, and Lagrange’s Theorem. Coding Theory and Rings: Elements of Coding Theory, The Hamming Metric, The Parity Check, and Generator Matrices DEPT. OF CSE, SJBIT Page 1 www.rejinpaul.com www.rejinpaul.com DISCRETE MATHEMATICAL STRUCTURES 10CS34 UNIT -8 6 Hours Group Codes: Decoding with Coset Leaders, Hamming Matrices Rings and Modular Arithmetic: The Ring Structure — Definition and Examples, Ring Properties and Substructures, The Integers Modulo n Text Book: 1. Ralph P. Grimaldi: Discrete and Combinatorial Mathematics,5 Edition, Pearson Education, 2004. (Chapter 3.1, 3.2, 3.3, 3.4, Appendix 3, Chapter 2, Chapter 4.1, 4.2, Chapter 5.1 to 5.6, Chapter 7.1 to 7.4, Chapter 16.1, 16.2, 16.3, 16.5 to 16.9, and Chapter 14.1, 14.2, 14.3). Reference Books: 1. Kenneth H. Rosen: Discrete Mathematics and its Applications, 7 Edition, McGraw Hill, 2010. 2. Jayant Ganguly: A Treatise on Discrete Mathematical Structures, Sanguine-Pearson, 2010. 3. D.S. Malik and MLK. Sen: Discrete Mathematical Structures: Theory and Applications, Cengage Learning, 2004. 4. Thomas Koshy: Discrete Mathematics with Applications, Elsevier, 2005, Reprint 2008. DEPT. OF CSE, SJBIT Page 2 www.rejinpaul.com www.rejinpaul.com DISCRETE MATHEMATICAL STRUCTURES 10CS34 DISRETE MATHEMATICAL STRUCTURES UNIT I 6 Hours Set Theory Sets: A set is a collection of objects, called elements of the set. A set can be presented by listing its elements between braces: A = {1,2,3, 4,5}. The symbol e is used to express that an element is (or belongs to) a set. For instance 3 e A. Its negation is represented by /e, eg. 7 /e A. If the set Is finite, its number of elements is represented |A|, e.g. if A= {1, 2,3, 4,5} then |AJ=5 Some important sets are the following: 1. N={0, 1, 2,3,:+:} =the set ofnatural numbers. 2. Z={-,-3, -2,-1, 0, 1, 2,3,-+-} =the set of integers. 3. Q =the set of rational numbers. 4. R= the set ofreal numbers. 5. C =the set of complex numbers. IfS is one of those sets then we also use the following notations : 1. S* =set of positive elements in S, for instance Z* ={1, 2,3, -+ } = the set of positive integers. 2.S° =set of negative elements in S, for instance Z =({-1,-2,-3,++-}= the set of negative integers. 3. S* =set of elements in S excluding zero, for instance R* =the set of non zero real numbers. Set-builder notation: An alternative way to define a set, called set- builder notation, is by stating a property (predicate) P(x) verified by exactly its elements, for instance A={xeZ|1<x<5}= “set ofintegers x such that 1 <x <5’—41e: A = {1,2,3, 4,5}. In general: A = {x e U | p(x)}, where U is the universe of discourse in which the predicate P(x) must be interpreted, or A = {x |P(x)} if the universe of discourse for P(x) is implicitly understood. In set theory the term universal set is often used in place of “universe of discourse” for a given predicate. DEPT. OF CSE, SJBIT Page 5 www.rejinpaul.com www.rejinpaul.com DISCRETE MATHEMATICAL STRUCTURES 10CS34 Principle__of Extension: Two sets are equal if and only if they have the same elements, ie: A=B =Vx(KKeAexeB). Subset: We say that A is a subset of set B, or A is contained in B, and we represent it “A CB”, ifall elements of A are in B, eg., if A= {a, b, c} and B = {a, b, c,d, e} then A CB. Proper subset: A is a proper subset of B, represented “A CB”, ifA © B but A=B, ie., there is some element in B which is not in A. Empty Set: A set with no elements is called empty set (or null set, or void set), and is represented by © or {}. Note that nothing prevents a set from possibly being an element of another set (which is not the same as being a subset!). Forin stance if A = {1,a, (3, t}, {1, 2,3}} and B= {3, t}, then obviously B is an “ment of A: ie, BeA. Power Set: The collection of all subsets of a set A is called the power set of A, and is represented P(A). For instance, if A = {1, 2, 3}, then P(A) ={©, {1}, {2}, {3}, (1, 2}, (1, 3}, {2,3}, A}. Multisets: Two ordinary sets are identical if they have the same elements, so for instance, {a,a, b} and {a,b} are the same set because they have exactly the same elements, namely a and b. However, in some applications it might be useful to allow repeated elements in a set. In that case we use multisets, which are mathematical entities similar to sets, but with possibly repeated elements. So, as multisets, {a, a, b} and {a, b} would be considered different, since in the first one the element a occurs twice and in the second one it occurs only once. Set Operations: 1. Intersection : The common elements of two sets: ANB ={x|(k eA)A (KeB}. IfAMB=9, the sets are said to be disjoint. DEPT. OF CSE, SJBIT Page 6 www.rejinpaul.com www.rejinpaul.com DISCRETE MATHEMATICAL STRUCTURES 10CS34 2. Union: The set of elements that belong to either of two sets: AUB ={x|(x e A) V (xe B)}. 3. Complement: The set of elements (in the universal set) that do not belong to a given set: A={xeUtx/e A}. 4. Difference or Relative Complement: The set of elements that belong to a set but not to another: A-B={x|eA)A(/e BI} =ANB. 5. Symmetric Difference: Given two sets, their symmetric differ- ence is the set of elements that belong to either one or the other set but not both. A®B ={x|(x eA) 6 (xe B)}. It can be expressed also in the following way: A ®B=A UB-ANB=(A-B)U(B-A). Counting with Venn Diagrams: A Venn diagram with n sets intersecting in the most general way divides the plane into 2" regions. If we have information about the number of elements of some portions of the diagram, then we can find the number of elements in each of the regions and use that information for obtaining the number of elements in other portions of the plane. Example: Let M, P and C be the sets of students taking Mathe- matics courses, Physics courses and Computer Science courses respec- tively in a university. Assume |M| = 300, [P| = 350, |C| = 450, IM NP |= 100, [MN C|=150, |P N C|=75, IM PN C|=10. How many students are taking exactly one of those courses? (fig. 2.7) We see that |((M MP )-(M MP NC )| = 100-10 = 90, (M NC )-M PNC)|=150-10 = 140 and (P NC) -(M NP NC)|=75 -10 =65. Then the region corresponding to students taking Mathematics courses only has cardinality 300-(90+10+140) = 60. Analogously we compute the number of students taking Physics courses only (185) and taking Computer Science courses only (235). DEPT. OF CSE, SJBIT Page 7 www.rejinpaul.com www.rejinpaul.com DISCRETE MATHEMATICAL STRUCTURES 10CS34 L. Associative Laws: AU(BUC)=(AUB)UC An(BNC)=(ANB)NC 2. Commutative Laws: AUB=BUA ANB=BnA 3. Distributive Laws. Au(Bnc) AU B)nN(AUC) An(BuC) AN B)U(ANC) 1. Identity Laws: A A 5. Complement Laws AUA=U AnA=0 6. [dempotent Laws: AUA=A ANA=A 7. Bound Laws AUU=U An®=@ 8. Absorption Laws AU(ANB)=A AnN(AUB)=A 9. Involution Law: Timi 10. 0/1 Laws. B=u U=0 IL. DeMorgan’s Laws: AUB ={AnNB ANB=AvuB Generalized Union and Intersection: Given a collec- tion of sets A,,A:,..., An, their union is defined as the set of elements that belong to at least one of the sets (here n represents an integer inthe range from 1 to N): DEPT. OF CSE, SJBIT Page 10 www.rejinpaul.com www.rejinpaul.com DISCRETE MATHEMATICAL STRUCTURES 10CS34 N U Ay = Ay U Ag U+++U Ay = {x | dn (x € An)}. n=1 Analogously, their intersection is the set of elements that belong to all the sets simultaneously: N ()) An = A170 4g Ay = {ar | Vn (a € A}. n=1 These definitions can be applied to infinite collections of sets as well. For instance assume that Sm = {kn|k =2, 3, 4,...} =set of multiples ofn greater than n. Then U n= = Sy U SgU SyU--- = {4,6,8,9, 10, 12, 14, 15,...} x n=2 = set of composite positive integers. Partitions: A partition of a set X is a collection S of non overlapping non empty subsets of X whose union is the whole X. For instance a partition of X = {1, 2,3, 4,5, 6, 7, 8, 9, 10} could be S={({1,2, 4,8}, (3, 6}, (5, 7.9, 10}}. Given a partition S ofa set X, every element of X belongs to exactly one member of Ss. Example: The division of the integers Z into even and odd numbers is a partition: S = {E, O}, where E = {2n|ne Z}, O = {2n+1|ne Z}. Example: The divisions of Z in negative integers, positive integers and zero is a partition: S = {Z",Z, {O}}. Ordered _ Pairs, Cartesian Product: An ordinary pair {a, b} is a set with two elements. In a set the order of the elements is irrelevant, so {a,b} = {b,a}. If the order of the elements is relevant, then we use a different object called ordered pair, represented (a, b). Now (a, b) = (b, a) (unless a =b). In general (a, b) = (a', b’) iffa =a' and b=b'. DEPT. OF CSE, SJBIT Page 11 www.rejinpaul.com www.rejinpaul.com DISCRETE MATHEMATICAL STRUCTURES 10CS34 Given two sets A, B, their Cartesian product A = B is the set ofall ordered pairs (a, b) such that a e A and be B: Ax B= {(a,b)|(aeA) A (be B)}. Analogously we can define triples or 3-tuples (a, b, c), 4-tuples (a, b, c, d), ..., netuples (a1, a2,...,am), and the corresponding 3-fold, 4-fold,..., n-fold Cartesian products: Ay x Ay XX Am = {(a1, a2, -.., Am) | (a1 e@ Ar) A (az € Ar) Av A (me Am)} - Ifall the sets in a Cartesian product are the same, then we can use an exponent: A? = Ax A,A*? =AxAA, etc. In general: (am times) M =AxAx™xA. A First Word on Probability: Introduction: Assume that we perform an experiment such as tossing a coin or rolling a die. The set of possible outcomes is called the sample space of the experiment. An event is a subset of the sample space. For instance, if we toss a coin three times, the sample space is S — (HHH, HHT, HTH,HTT,THH,THT,TTH,TTT}. The event “at least two heads in a row” would be the subset E — {HHH, HHT, THB}. If all possible outcomes of an experiment have the same likelihood of occurrence, then the probability ofan event A C S is given by Laplace’s rule: |E 3 P(E) = For instance, the probability of getting at least two heads in a row in the above experiment is 3/8. DEPT. OF CSE, SJBIT Page 12 www.rejinpaul.com www.rejinpaul.com DISCRETE MATHEMATICAL STRUCTURES 10CS34 This is known as the product rule or the multiplication theorem for mutually independent events . A generalization of expression is if Al,A2,A3...........An are mutually independent events in a sample space S then Pr(AlN A2N ...............0 An)=Pr(A1).Pr(A2)...........Pr(An) Example: Assume that the probability that a shooter hits a target is p — 0.7, and that hitting the target in different shots are independent events. Find: 1. The probability that the shooter does not hit the target in one shot. 2. The probability that the shooter does not hit the target three times in a row. 3. The probability that the shooter hits the target at least once after shooting three times. Answer: 1. P(not hitting the target in one shot) — 1— 0.7 — 0.3. 2. P(not hitting the target three times in a row) — 0.3° — 0.027. 3. P (hitting the target at least once in three shots) — 1—0.027 — 0.973. COUNTABLE AND UNCOUNTABLE SETS A set A is said to be the countable if A is a finite set . A set which is not countable is called an uncountable set. THE ADDITION PRINCIPLE: . |AUB|=|A/}+|[B/-[AN Bj is the addition principle rule or the principle of inclusion — exclusion. : |A-BIALAN BI : IAN BRUFIALB) +AN Bi . |AUBUCFIA|BIIC|-|[A NBI-[B 9 Cl--A MN CHIA 1 BN C| is extended addition principle . NOTE: |A 1 B 0 CI}AUBUC| =|U|-/AUBUC| =|UAl-[B] CHB NCHA NBI+A NC|- |A AB NC| |A-B-CFIA-IA 9 BEA N CHAN BN C| DEPT. OF CSE, SJBIT Page 15 www.rejinpaul.com www.rejinpaul.com DISCRETE MATHEMATICAL STRUCTURES 10CS34 UNIT - II Fundamentals of Logic: 7 Hours Basic Connectives and Truth Tables, Logic Equivalence The Laws of Logic, Logical Implication VvvVvV Vv Rules of Inference DEPT. OF CSE, SJBIT Page 16 www.rejinpaul.com www.rejinpaul.com DISCRETE MATHEMATICAL STRUCTURES 10CS34 UNIT II 7 Hours Fundamentals of Logic Introduction: Propositions: A proposition is a declarative sentence that is either true or false (but not both). For instance, the following are propositions: “Paris is in France” (true), “London is in Denmark” (false), “2 < 4” (true), “4 = 7 (false)”. However the following are not propositions: “what is your name?” (this is a question), “do your homework” (this is a command), “this sentence is false” (neither true nor false), “x is an even number” (it depends on what x represents), “Socrates” (it is not even a sentence). The truth or falsehood of a proposition is called its truth value. Basic Connectives and Truth Tables: Connectives are used formaking compound propositions. The main ones are the following (pand q represent given propositions): [Name [Represented (Meaning Negation rp ‘not p” (Conjunction a “p and q” Disjunction ao “p or q (or both)” Exclusive Or | ea “either p or q, but not both” Implication => q “if p then q” [Biconditional poq “p if and only if q” The truth value of a compound proposition depends only on the value of its components. Writing F for “false” and T for “true”, wecan summarize the meaning of the connectives in the following way: Note that v represents a non-exclusive or, i.e, p Vqis true when any of p, q is true DEPT. OF CSE, SJBIT Page 17 www.rejinpaul.com www.rejinpaul.com DISCRETE MATHEMATICAL STRUCTURES 10CS34 Example : The following propositions are logically equivalent: p-q=@-qQg Aap) Again, this can be checked with the truth tables: Exercise : Check the following logical equivalences: ~® > 4g) =pAa p>q="q—>-p “Poa =P%q Converse, Contrapositive: The converse ofa conditional proposition p — q is the proposition q — p. As we have seen, the bi- conditional proposition is equivalent to the conjunction of a conditional proposition an its converse. p-q=@-qQg Aap) So, for instance, saying that “John is married if and only if he has a spouse” is the same as saying “if John is married then he has a spouse” and “if he has a spouse then he is married”. DEPT. OF CSE, SJBIT Page 20 www.rejinpaul.com www.rejinpaul.com DISCRETE MATHEMATICAL STRUCTURES 10CS34 Note that the converse is not equivalent to the given conditional proposition, for instance “if John is from Chicago then John is from Ilinois” is true, but the converse “if John is from Dlinois then John is from Chicago” may be false. The contrapositive of a conditional proposition p —q is the propo- sition —q — —p. They are logically equivalent. For instance the con- trapositive of “if John is from Chicago then John is from Illinois” is “if John is not from Illinois then John is not from Chicago”. LOGICAL CONNECTIVES: New propositions are obtained with the aid of word or phrases like “not”,”and”,if....then”,and “if and only if’. Such words or phrases are called logical connectives. The new propositions obtained by the use of connectives are called compound propositions. The original propositions from which a compound proposition is obtained are called the components or the primitives of the compound proposition. Propositions which do not contain any logical connective are called simple propositions NEGATION: A Proposition obtained by inserting the word “not” at an appropriate place in a given proposition is called the negation of the given proposition. The negation of a proposition p is denoted by ~p(read “not p”’) Ex: p: 3 is a prime number ~p: 3 is not a prime number Truth Table: p ~p 0 1 1 0 CONJUNCTION: A compound proposition obtained by combining two given propositions by inserting the word “and” in between them is called the conjunction of the given proposition.The conjunction of two proposition p and q is denoted by p*q(read “p and q”). . The conjunction p’q is true only when p is true and q is true; in all other cases it is false. . Ex: p:\2 is an irational number q: 9 is a prime number p’q: V2 is an irational number and 9 is a prime number . Truth table) p q pq 0 0 0 ool 0 DEPT. OF CSE, SJBIT Page 21 www.rejinpaul.com www.rejinpaul.com DISCRETE MATHEMATICAL STRUCTURES 10CS34 1 0 0 11 1 DISJUNCTION: A compound proposition obtained by combining two given propositions by inserting the word “or” in between them is called the disjunction of the given proposition.The disjunction of two proposition p and q is denoted by pl q(read “p or q”). . The disjunction pq is false only when p is false and q is false ; in all other cases it is true. . Ex: p:\2 is an irational number q: 9 is a prime number pq: V2 is an irational number or 9 is a prime number Truth table: : Pp q_ plq 0 0 0 ol 1 10 1 11 1 EXCLUSIVE DISJUNCTION: . The compound proposition “p or q” to be true only when either p is true or q is true but not both. The exclusive or is denoted by symbol v. . Ex: p:V2 is an irrational number q: 2+3=5 Pyq: Either V2 is an irrational number or 2+3=5 but not both. . Truth Table: Pp q pyq 0 0 0 0 1 1 1 0 1 1 1 0 CONDITIONAL(or IMPLICATION): . A compound proposition obtained by combining two given propositions by using the words “if” and “then” at appropriate places is called a conditional or an implication.. DEPT. OF CSE, SJBIT Page 22 www.rejinpaul.com www.rejinpaul.com DISCRETE MATHEMATICAL STRUCTURES 10CS34 . Associative Laws : For any proposition p ,q and r, 1) p 0 (q 0 r) O@ Og) Or 2) pO(qOr)O(pUq) Or . Distributive Laws: For any proposition p ,q and r, 1) p 0 (q 01) O @ Og) 0 (P Or) 2) pO(q0r)O (pq) U (pO) . Law for the negation of a conditional : Given a conditional p—q, its negation is obtained by using the following law: 0(p—q) O[p0(q)] NOTE: : ~ @Og= Opotq : O(p0q) = Op OOq : D@>q) = [poGg)] : @>@ =00 @>q) = O[p0Gq)] =Op Oa TRANSITIVE AND SUBSTITUTION RULES If u,v,w are propositions such that uv and v Ow, then u Ow. (this is transitive rule) . Suppose that a compound proposition uis a tautology and p is a component of u, we replace each occurrence of p in u by a proposition q, then the resulting compound proposition v is also a tautology(This is called a substitution rule). . Suppose that u is a compound proposition which contains a proposition p. Let q be a proposition such that q Lp , suppose we replace one or more occurrences of p by q and obtain a compound proposition v. Then u Dv (This is also substitution rule) APPLICATION TO SWITCHING NETWORKS . If a switch p is open, we assign the symbol o to it and if p is closed we assign the symbol 1 to it. . Ex: current flows from the terminal A to the terminal B if the switch is closed i.e if p is assigned the symbol 1. This network is represented by the symbol p A P B DEPT. OF CSE, SJBIT Page 25 www.rejinpaul.com www.rejinpaul.com DISCRETE MATHEMATICAL STRUCTURES 10CS34 . Ex: parallel network consists of 2 switches p and q in which the current flows from the terminal A to the terminal B , if p or q or both are closed i.e if p or q (or both) are assigned the symbol 1. This network is represent by p0q Ex: Series network consists of 2 switches p and q in which the current flows from the terminal A to the terminal B if both of p and q are closed; that is if both p and q are assigned the symbol 1. This network is represented by p0q DUALITY: Suppose u is a compound proposition that contains the connectives 0 and 0. Suppose we replace each occurrence of 0 and 0 inuby J and D respectively. Also if u contains To and Fo as components, suppose we replace each occurrence of To and Fo by Fo and To respectively, then the resulting compound proposition is called the dual of u and is denoted by u’. Ex:upO(q00)0(0To) wu pO(@qd01) 00 Fo) NOTE: . (u’)* Cu. The dual of the dual of u is logically equivalent to u. . For any two propositions u and v if u Cv, then u’ Div’. This is known as the principle of duality. The connectives NAND and NOR @ta=0@0q)O0podg @la=0@0q)OUpotq CONVERSE, INVERSE AND CONTRAPOSITIVE Consider a conditional (p—q) , Then : 1) q-p is called the converse of p>q 2) Op—QOq is called the inverse of p>q 3) Oq- Op is called the contrapositive of p>q DEPT. OF CSE, SJBIT Page 26 www.rejinpaul.com www.rejinpaul.com DISCRETE MATHEMATICAL STRUCTURES 10CS34 RULES OF INFERENCE: There exist rules of logic which can be employed for establishing the validity of arguments . These rules are called the Rules of Inference. 1) Rule of conjunctive simplification: This rule states that for any two propositions p and q if pq is true, then p is true i.e (pq )Op. 2) Rule of Disjunctive amplification: This rule states that for any two proposition p and q if p is true then pq is true i.e pO(p Oq) 3) 3) Rule of Syllogism: This rule states that for any three propositions p,q rif pq is true and q->r is true then p—>r is true. i.e {((p—>q)0(q—)} O@ 1) In tabular form: pq qor O@-1 4) 4) Modus pones(Rule of Detachment): This rule states that if p is true and p>q is true, then q is true, ie {p 0(p—q )} Og. Tabular form P pq Oq 5) Modus Tollens: This rule states that if p—q is true and q is false, then p is false. {@—q)00q}Oq Tabular form: p>q Oq oop 6) Rule of Disjunctive Syllogism: This rule states that if pq is true and p is false, then q is tue i.e. {(pOq)00p}Oq Tabular Form pq Op Oq QUANTIFIERS: 1. The words “ALL”,”"EVERY”,’SOME”,” THERE EXISTS” are called quantifiers in the proposition 2. The symbol CO is used to denote the phrases “FOR ALL”,"FOR EVERY”,”FOR EACH” and “FOR ANY” .this is called as universal quantifier. 3. O is used to denote the phrases “FOR SOME”and “THERE EXISTS”and “FOR ATLEAST ONE” .this symbol is called existential quantifier. A proposition involving the universal or the existential quantifier is called a quantified statement LOGICAL EQUIVALENCE: DEPT. OF CSE, SJBIT Page 27 www.rejinpaul.com www.rejinpaul.com DISCRETE MATHEMATICAL STRUCTURES 10CS34 UNIT - Ill Fundamentals of Logic contd.: 6 Hours The Use of Quantifiers Quantifiers Definitions and Vvv Vv Proofs of Theorems DEPT. OF CSE, SJBIT Page 30 www.rejinpaul.com www.rejinpaul.com DISCRETE MATHEMATICAL STRUCTURES 10CS34 Unit III 6 Hours Fundamentals of Logic contd.: Predicates, Quantifiers Predicates: A predicate or propositional function is a state- ment containing variables. For instance “x +2 = 7”, “X is American”, “x < y”, “p is a prime number” are predicates. The truth value of the predicate depends on the value assigned to its variables. For instance if we replace x with 1 in the predicate “x+2=7” we obtain “1 +2=7”, which is false, but if we replace it with 5 we get “5 + 2 = 7”, which is true. We represent a predicate by a letter followed by the variables enclosed between parenthesis: P (x), Q(x, y), etc. An example for P (x) is a value of x for which P (x) is tue. A counterexample is a value ofx for which P(x) is false. So, 5 is an example for “x +2 =7”, while 1 is a counterexample. Each variable in a predicate is assumed to belong to a universe (or domain) of discourse, for instance in the predicate “n is an odd integer” ’n’ represents an integer, so the universe of discourse of n is the set ofall integers. In “X is American” we may assume that X is a human being, so in this case the universe of discourse is the set of all human beings.’ Quantifiers: Given a predicate P(x), the statement “for some x, P(x)” (or “there is some x such that p(x)”, represented “4x P(x)”, has a definite truth value, so it is a proposition in the usual sense. For instance if P(x) is “x + 2 = 7” with the integers as universe of discourse, then Jx P(x) is true, since there is indeed an integer, namely 5, such that P(5) is a true statement. However, if Q(x) is “2x = 7” and the universe of discourse is still the integers, then 4x Q(x) is false. On the other hand, 4x Q(x) would be true if we extend the universe of discourse to the rational numbers. The symbol dis called the existential quantifier. DEPT. OF CSE, SJBIT Page 31 www.rejinpaul.com www.rejinpaul.com DISCRETE MATHEMATICAL STRUCTURES 10CS34 Analogously, the sentence “for all x, P (x)”—also “for any x, P (x)”, “for every x, P(x)”, “for each x, P (x)’—, represented “Vx P(x)”, has a definite truth value. For instance, if P(x) is‘“x+2=7” and the universe of discourse is the integers, then Vx P(x) is false. However if Q(x) represents 2 “(x +1)? =x? +2x+1” then Vx Q(x) is true. The symbol Y is called the universal quantifier. In predicates with more than one variable it is possible to use several quantifiers at the same time, for instance VxVydzP (x,y,z), meaning “for all x and all y there is some z such that P (x, y, z)”. Note that in general the existential and universal quantifiers cannot be swapped, i.e. in general Vxdy P(x, y) means something different from JyVx P (x, y). For instance if x and y represent human beings and P (x, y) represents “x is a friend of y”, then Vxdy P(x, y) means that everybody is a friend of someone, but dyVx P (x,y) means that there is someone such that everybody is his or her friend. A predicate can be partially quantified, e.g. Vxdy P (x, y, z, t). The variables quantified (x and y in the example) are called bound variables, and the rest (z and t in the example) are called free variables. A partially quantified predicate is still a predicate, but depending on fewer variables. Generalized _De Morgan Laws _ for Logic: If 4x P (x) is false then there is no value of x for which P(x) is true, or in other words, P(x) is always false. Hence dx P (x) = Vx 7P(x). On the other hand, if Yx P(x) is false then it is not true that for every x, P(x) holds, hence for some x, P(x) must be false. Thus: “Vx P(x) = 4dx7P(x). DEPT. OF CSE, SJBIT Page 32 www.rejinpaul.com www.rejinpaul.com DISCRETE MATHEMATICAL STRUCTURES 10CS34 even, soa =2a'. Hence: 2b? =4a”, and simplifying b? =2a'. This implies that bis even, so b is even: b = 2b'. Consequently a/b = 2a'/2b' = a’/b', contradicting the hypothesis that a/b was in least terms. Arguments, Rules of Inference: An argument is a se- quence of propositions p),p2,...,Pn called hypotheses (or premises ) followed by a proposition q called conclusion. An argument is usually written: Pi P2 Pa q or Pi, P2,-..5Pn/ Aq The argument is called valid ifq is tue whenever pi,p2,...,Pn are true; otherwise it is called invalid. Rules of inference are certain simple arguments known to be validand used to make a proof step by step. For instance the following argument is called modus ponens or tule of detachment : p> 4p aq In order to check whether it is valid we must examine the following truth table: If we look now at the rows in which both p — q and p are true (just the first row) we DEPT. OF CSE, SJBIT Page 35 www.rejinpaul.com www.rejinpaul.com DISCRETE MATHEMATICAL STRUCTURES 10CS34 see that also q is true, so the argument is valid. Other rules of inference are the following: 1. Modus Ponens or Rule of Detachment: 28 P q 2. Modus Tollens: P—4q aq =p 3. Addition: —P ". PVG 4. Simplification: pAq Pp 5. Conjunction: p a pag 6. Hypothetical Syllogism: eee q->r por 7. Disjunctive Syllogism: pvq —_— og 8. Resolution: pvq Ae qvr Arguments are usually written using three columns. Each row con- tains a label, a statement and the reason that justifies the introduction of that statement in the argument. That justification can be one of the following: DEPT. OF CSE, SJBIT Page 36 www.rejinpaul.com www.rejinpaul.com DISCRETE MATHEMATICAL STRUCTURES 10CS34 1. The statement is a premise. 2. The statement can be derived from statements occurring earlier in the argument by using a rule of inference. Example: Consider the following statements: “I take the bus or! walk. If I walk I get tired. I do not get tired. Therefore I take the bus.” We can formalize this by calling B = “I take the bus”, W =“I walk” and T = “J get tired”. The premises are B 2W,W-T and —T , and the conclusion is B. The argument can be described in the following steps: step statement reason WT yy -T Premise 3) -W 1,2, Modus Tollens 4) Baw Premise 5) @B 4,3, Disjunctive Syllogism Rules of Inference for Quantified Statements: We state the rules for predicates with one variable, but they can be gener- alized to predicates with two or more variables. 1. Universal Instantiation. If fx p(x) is true, then p(a) is true foreach specific element a in the universe of discourse; i.e.: Ox p(x) 2 p@ For instance, from ix (x+1=1+x) we can derive 7+1=1+7. 2. Existential Instantiation. If p(x) is true, then p(a) is true for some specific element a in the universe of discourse, i-e.: Bx p@) @ pla) The difference respect to the previous rule is the restriction in the meaning of a, which now represents some (not any) element of the universe of discourse. So, for instance, from Mx (x? =2) (the universe of discourse is the real numbers) we derive the existence of some element, which we may represent + 2, such that @ 2)? =2 DEPT. OF CSE, SJBIT Page 37 www.rejinpaul.com www.rejinpaul.com DISCRETE MATHEMATICAL STRUCTURES 10CS34 UNIT IV 6 Hours Properties of the Integers MATHEMATICAL INDUCTION: The method of mathematical induction is based on a principle called the induction principle . INDUCTION PRINCIPLE: The induction principle states as follows : let S(n) denote an open statement that involves a positive integer n .suppose that the following conditions hold ; 1. S(1) is true 2. If whenever S(k) is true for some particular , but arbitrarily chosen k €Z” , then S(K+]) is true. Then S(n) is true for alln € Z+ .Z+ denotes the set of all positive integers . METHOD OFMATHEMATICAL INDUCTION Suppose we wish to prove that a certain statement S(n) is true for all integers n >1 , the method of proving such a statement on the basis of the induction principle is calledd the method of mathematical induction. This method consist of the following two steps, respectively called the basis step and the induction step 1) Basis step: verify that the statement S(1) is true; i.e. verify that S(m) is true for n=1. 2) Induction step: assuming that S(k) is true , where k is an integer>1, show that S(k+]) is true. Many properties of positive integers can be proved by mathematical induction. Principle of Mathematical Induction: Let P beaprop- erty of positive integers such that: 1. Basis Step: P(1) is true, and 2. Inductive Step: if P(m) is true, then P(n + 1) is true. DEPT. OF CSE, SJBIT Page 40 www.rejinpaul.com www.rejinpaul.com DISCRETE MATHEMATICAL STRUCTURES 10CS34 Then P(n) is true for all positive integers. Remark : The premise P (n) in the inductive step is called Induction Hypothesis. The validity ofthe Principle of Mathematical Induction is obvious. The basis step states that P (1) is true. Then the inductive step implies that P(2) is also true. By the inductive step again we see that P (3) is true, and so on. Consequently the property is true for all positive integers. Remark : In the basis step we may replace 1 with some other integer m. Then the conclusion is that the property is true for every integer n greater than or equal to m. Example: Prove that the sum ofthe n first odd positive integers is wie, 1+3+5+ee+(2n—1) ‘nr’. Answer: Let S(n) ‘1+3+5+¢**+(2n — 1). We want to prove by induction that for every positive integer n, S(m) <n’. 1. Basis Step: If n ‘ 1 we have S(1) ‘ 1‘ 17, so the property is true for 1. 2. Inductive Step: Assume (Induction Hypothesis ) that the prop- erty is true for some positive integer n, ie.: S(n) ‘n?. We must prove that it is also true forn+l,ie, Sm +1) ‘(+1)’. In fact: S@+D‘1+3+5t+ee+Q@n+1)‘S@)+2n+1. But by induction hypothesis, S(n) ‘n’, hence: S@+1)‘n?+2n4+1‘m+1. This completes the induction, and shows that the property is true for all positive integers. DEPT. OF CSE, SJBIT Page 41 www.rejinpaul.com www.rejinpaul.com DISCRETE MATHEMATICAL STRUCTURES 10CS34 Example : Prove that 2n+ 1 <2" forn >3. Answer: This is an example in which the property is not true for all positive integers but only for integers greater than or equal to 3. 1. Basis Step: Ifn ‘ 3 we have 2n+1‘ 2*3+1 ‘ 7 and 2™ <©93 ©8 so the property is true in this case. . Inductive Step: Assume (Induction Hypothesis) that the prop- erty is i) true for some positive integer n, ie: 2n+1<2™". We must prove that it is also tue for n+l, ie, 2n+1)+1 < 2™!. By the induction hypothesis we know that 2n <2", and we also have that 3<2™ ifn > 3, hence an +1) +16 2n+3<2™ +2" © gm, This completes the induction, and shows that the property is true forall n > 3. Exercise : Prove the following identities by induction: n(m+1) eo 14+2+3+ee+n* n(m+1)(@n+ 1) oP +2 +3? teeetn? § 6 oP HBr treet “1 +2+3teretn) Strong Form of Mathematical Induction: Let P be a property of positive integers such that: DEPT. OF CSE, SJBIT Page 42 www.rejinpaul.com www.rejinpaul.com DISCRETE MATHEMATICAL STRUCTURES 10CS34 One way to solve some recurrence relations is by iteration, i., by using the recurrence repeatedly until obtaining a explicit close-form formula. For instance consider the following recurrence relation: Xm ° I Xm-1 (@>O),; Xo SA. By using the recurrence repeatedly we get: am « « 2 3 “eee Sym Xm T Xm-1 r Xm-2 Xm-3 r “Ar Xo r hence the solution isXm ‘Az1™. In the following we assume that the coefficients Co, Ci,..., Cx are constant. First Order Recurrence Relations. The homogeneous case can be written in the following way: Xn {TX (@>O); x ‘A. Its general solution is X ‘Ar, which is a geometric sequence with ratio r. The non-homogeneous case can be written in the following way: Xn {0X1 + Cp (@>O); x0 ‘A. Using the summation notation, its solution can be expressed like this: n x xX ‘A+ qi *. k=1 We examine two particular cases. The first one is DEPT. OF CSE, SJBIT Page 45 www.rejinpaul.com www.rejinpaul.com DISCRETE MATHEMATICAL STRUCTURES 10CS34 BX {EX ate (a> Oy, x0 SA. where cis a constant. The solution is n x 1 ifr‘l, X, ‘Ar+e mkcay +c 1 k=1 and X, ‘Aten ifr‘l. Example: Assume that a country with currently 100 million people has a population growth rate (birth rate minus death rate) of 1% per year, and it also receives 100 thousand immigrants per year (which are quickly assimilated and reproduce at the same rate as the native population). Find its population in 10 years from now. (Assume that all the immigrants arrive in a single batch at the end of the year.) Answer : If we call x, ‘population in year n from now, we have: Xa ‘ 1.O1 X,—1 +100, O00 (a >0),; x9‘ 100, 000, 000. This is the equation above with r ‘ 1.01, c ‘ 100, OOO and A ‘ 100, OOO, OO, hence: Lol —1 ¥, ‘100, OOO, 000 + 1.01" + 100, CCO 1.01—1 © 100, 4109000 1.01" — 1). 000, So: 000 462, 317. Lor The second particular case is for r ‘1 and cn ‘c+dn, where c and d are constant (so cm is an arithmetic sequence): Xm ‘Xm +e+dn(Mm>O); xo SA. DEPT. OF CSE, SJBIT Page 46 www.rejinpaul.com www.rejinpaul.com DISCRETE MATHEMATICAL STRUCTURES 10CS34 The solution is now 7x dn(+1) Xm ‘At (c+dk‘A+ent+ k=1 bw Second Order Recurrence Relations. Now we look at the recurrence relation CoXm + C1 Xm—1 + C2 Xm—2 © O. First we will look for solutions of the form xm ‘cr™. By plugging in the equation we get: Cocer™+Cyer™1+C,er™7? +O, hence r must be a solution of the following equation, called the char- acteristic equation of the recurrence: Corr +Cyrt+C, ‘Oo. Let 1, 12 be the two (Gn general complex) roots of the above equation. They are called characteristic roots. We distinguish three cases: 1. Distinct Real Roots. In this case the general solution of the recurrence relation is Xm 6e:r™ + e.r™, 1 2 where c;, c, are arbitrary constants. 2. Double Real Root. If m ‘ ~m ‘1, the general solution of the recurrence relation is DEPT. OF CSE, SJBIT Page 47 www.rejinpaul.com www.rejinpaul.com DISCRETE MATHEMATICAL STRUCTURES 10CS34 UNIT -V PART -B Relations and Functions: 7 Hours VVVV VV VV Vv Cartesian Products and Relations Functions Plain and One-to-One Onto Functions Stirling Numbers of the Second Kind Special Functions The Pigeon-hole Principle Function Composition and Inverse Functions DEPT. OF CSE, SJBIT Page 50 www.rejinpaul.com www.rejinpaul.com DISCRETE MATHEMATICAL STRUCTURES 10CS34 UNIT V 7 Hours Relations Introduction Product set: If A and B are any 2 non-empty sets then the product set of A and B are the Cartesian product or product of A and B. AXB={(a,b)/(a€A, bE B)} AXB#BXA Example: (a) Let, A= {1,2,3} B= {a,b} Then, A X B= {(1, a), (1, b), 2, a), 2, b), (3, a), (3, b)} BXA={(a, )), @ 2), (a, 3), ©, 1), &, 2), (b, 3)} AXB#BxA (b) Let, A = {1, 2} B={a,b} C={x,y} BXC={@,x), (a y), ©, x), ©, y)} AX@®XO)={(, (a,x), 0, @ y)), Gd. ©, x), Gd. &. y), (2, (a, x)) (2, (@ y)), (2; (b, x), (2; (b, y))} AXB={(1,a), (1, b), 2, a), 2, b)} (A XB) XC={G., a), x), (I, a), y), (1, b), x), (1, b), y), (2, a), x), (2, a), y), (2, b).x).(2.b),y),} *Remarks: a AX(BXC)=(AXB)XC vb. AXA=A’ c. If Ris the set of all real numbers then R x R= R®, set of all points in plane. d. (a, b) =(c, d)ifa=c and b=d DEPT. OF CSE, SJBIT Page 51 www.rejinpaul.com www.rejinpaul.com DISCRETE MATHEMATICAL STRUCTURES 10CS34 Partition set: Let 'A' be a non-empty set. A partition of 'A’ or quotient set of 'A' is a collection P of subsets of 'A' such that. (a) Every element of A belongs to some set in P (b) If A; and A; are any two distinct members of P, then Aj n A; = @. (c) The members of P are called 'blocks' or 'cells'. Example: Let, A=({1, 2,3, 4, 5} then, Pi = {{1, 2, 3}, {4}, {5}} Po = {{1, 5}, {4, 3}, {2}} Ps = {{1}, {2}, {3}, (4), 53} Relations: Let A and B be any two non-empty sets. A relation R from a set A to the set B is a subset of A x B. If (a, b) € R then we write a R b, otherwise we write a R b (ie. a not related to b). Example: Let. A= {1, 2, 3, 4,5}, Let R bea relation on A defined as a R b if a<b. R= {(1, 2), (1, 3), (1, 4), 1,5) 2, 3), 2, 4), 2; 5), 3, 4), 3; 5), (4; 5)} =ROAXA. Domain of R: Dom (R) = {1, 2,3, 4} OA Range of R: Ran (R) = {2, 3, 4,5} OB Dom (R) = {x €A/x Ry for some x € A} Ran (R) = {y € B/x Ry for some y € B} DEPT. OF CSE, SJBIT Page 52 www.rejinpaul.com www.rejinpaul.com DISCRETE MATHEMATICAL STRUCTURES 10CS34 R={d, 0, C, 3), @ D, @ 3), G2), 4, 3)} Diagram: (@) G)__.@) The "indegree" of a €A is the number of elements b € A such that b Ra. The "outdegree" of a € A is the number of elements b € A such that a R b Elements Indegree Outdegree 1 2 2 2 1 2 3 3 1 4 0 1 (b) IfA = {1, 2, 3, 4} and B= {1, 4, 6, 8, 9} and R: A —B defined by aR bif b =a’ Find the domain, Range, and Mr A= (1, 2, 3, 4} B= {1, 4, 6, 8, 9} R= {(x, y)/x A, y Band y = X°} R={d, D, @, 4), G, 9)} DEPT. OF CSE, SJBIT Page 55 www.rejinpaul.com www.rejinpaul.com DISCRETE MATHEMATICAL STRUCTURES 10CS34 Domain: Dom (R) = {1, 2, 3} Range: Ran (R) = {1, 4, 9} 9100000 Jo10004 1000019 jooooo! Properties of a relation: 1. Reflexive: Let R be a relation ona set A. The "R is reflexive" if (a,a)E RM a€A oraRa,¥a€A. Example: A = {I, 2,3} R={G, D), @, 2) C, 2), G, 2) GB, 3)} Therefore, R is reflexive. A relation R on a set A is "non-reflexive" if ‘a’ is not relation to ‘a’ for some a €A or (a, a) OR for somea€ A A={I,2,3} R={(, 1), (2, D, GB, 2), G, 3} =>, 2) OR Therefore, R is not-reflexive. 2. Irreflexive: A relation R on a set A is irreflexiveifaRa,Va€A. Example: R = {(1, 2) (2, 1) 3,2) 3, D} d, D, 2, 2) B, 3) OR hence R is irreflexive. A relation R ona set A is “not irreflexive” if ‘a’ is not Relation to ‘a’ for some a € A. Example: R= {(1, 1) (1, 2) 2, D G, 2) B, D} (1, 1D € Rhence R is “not irreflexive”. DEPT. OF CSE, SJBIT Page 56 www.rejinpaul.com www.rejinpaul.com DISCRETE MATHEMATICAL STRUCTURES 10CS34 3. Symmetric Relation: Let R be a relation on a set A, then R is “symmetric” if whenevera Rb, thenbRa,¥a€A,bEA. Example: Let A = {1, 2, 3} and R= {(1, J (1, 2) 2, 1) @, 2) 2, 3)} Therefore, R is symmetric. A relation R ona set A is said to be "not symmetric" ifa R b and b Ra for some a, bE A. Example: A = {1, 2, 3} and R= {(1, 2) G, 2) G, 3) 2, 1) (2, 3)} Therefore, R is not symmetric. 4. Asymmetric: Let R be a relation on a set A then R is “Asymmetric”, if whenever a R bthenbRa,¥a,bEA. R= {(G, 2), CL, 3) G, 2)} Therefore, R is asymmetric. A relation R on a set A is said to be "not Asymmetric" if a R b and b R a for some a, b €A R= {(, 1) 1,2), 3) G, 2)} Ris not symmetric. 5. Anti— symmetric: Let R be a relation on a set A, then R is anti symmetric if whenever aR band b Ra then a =b (for some a, b € A) Example: Let, A= {1, 2, 3} and R= {(1, D, (1, 2), G, 2)} Ris anti-symmetric € 1R1 and 1=1. Example: R= {C1 2) 2, D} 1R2, 2R1 but 2 = 1 hence R is not anti symmetric. 6. Transitive Property: Let R be a relation on a set A, then R is transitive if whenever a Rbandb Re, thenaRc¥a,b,c€,A. Example: Let, A = {1, 2, 3} and R= {(1, D, (1, 3), 2,3), 3, D @, 1, GB, 3)} (all should satisfy) Equivalence relation: A Relation R is said to be an equivalence relation if it is, (a) Reflexive DEPT. OF CSE, SJBIT Page 57 www.rejinpaul.com www.rejinpaul.com DISCRETE MATHEMATICAL STRUCTURES 10CS34 =>aRxandxRb (since R is symmetric) =aRb (since R is transitive) =R (a)=R (0b) (by theorem) Therefore, If R (a) =R (b), then R (a)n R(b) =O. Therefore, from the above, P is a partition of the set A. This partition determines the relation R in the sense that a R b if a and b belong to the same block of the partition. Hence proved..... *NOTE: The partition of a set A determined by an equivalence relation R is called the partition induced by R and is denoted by A/R. Manipulation of relations: 1. Complement: Let R be a relation from A to B. The complement of R is a relation defined as a R b ifa R™ b, where R is the complement of R. => (a, b) Rif (a, b) R” 2. Union: Let R and S be 2 relations from A to B. The union R U S is a relation from A to B defined as, a(RUS) bifeitheraRboraSb That is (a, b) € RUS if either (a, b) € Ror(a, b)ES. 3. Intersection: Let Rand S be relations from A to B. The intersection Rn S is a relation from A to B defined as, a(RnS) bifaRbandaS b That is (a, b) € RnS if (a, b) € Rand (a,b) ES. 4. Inverse: Let R be a relation from A to B. The inverse R” is a relation from B to A defined as, aRbifbR'a ie. (a,b) Rif(b, a)ER! DEPT. OF CSE, SJBIT Page 60 www.rejinpaul.com www.rejinpaul.com DISCRETE MATHEMATICAL STRUCTURES 10CS34 Composition of relations: Let Rand S be relations from A to Band B to C respectively. The composition of Rand § is the relation S o R from A to C defined as, a(S o R) cif there-exist b E B/a RR b and b Sc. R? =R o R= {(a, a), (a, ©) (a, b) (b, a) (b,c) (, b) (c, a) (¢, b) (, &)} S?=S 0S = {(@,a) ©, b) &, ¢) (b, a) (@, a) (@, 0)} Reflexive closure: Let R be a relation on a set' A’. Suppose R lacks a particular property, the smallest relation that contain R and which, processes the desired property is called the closure of R with respective a property in question. Given a relation R on a set’ A' the relation RI =4A U R) is the "reflexive closure of R”. Example: A={I,2,3} R= {d, Dd.2)(2, DC1.3)G, 2)} find the reflexive closure of R. Solution: We know that, R is not reflexive because (2, 2) € Rand (3, 3) ER. Now, A= {(1, 1) @, 2) (3, 3)} Therefore, Ri =R U A= {(1, 1) (1, 2) 2, 1) @, 2) G, 3) G, 2) GB, 3)} R, is the reflexive closure of R. Symmetric closure : If R is not symmetric then there exists (x, y) A such that (x, y) € R, but (y,x) € R. To make R symmetric we need to add the ordered pairs of R™. Ry =RUR ‘is the "symmetric closure of R". A={I,2,3} R={d,) 1, 2) @, 1) C, 3) @, 2)} find the symmetric closure of R. Solution: We know that, R is not symmetric because (1, 3) € R but (3, 1) € R and (3, 2) ER but (2, 3)ER. Example: — R®={0,D 200,26, 2,39} DEPT. OF CSE, SJBIT Page 61 www.rejinpaul.com www.rejinpaul.com DISCRETE MATHEMATICAL STRUCTURES 10CS34 Therefore, Ri =RUR"= ((1, 1) 1,2) 2 DG, 3), B22 3)} R; is called the symmetric closure of R. Transitive closure: Let R be a relation on a set A the smallest transition relation containing R is called the "Transitive closure of R". DEPT. OF CSE, SJBIT Page 62 www.rejinpaul.com www.rejinpaul.com DISCRETE MATHEMATICAL STRUCTURES 10CS34 RL s Ac “a B AB > — A ‘i (2 ™~. lap e 3, Se] \y WSS Therefore, R is a function and S is not a function. Since the element lhas two images band d, S is not a function. Example: Let A = {1, 2, 3, 4} determine whether or not the following relations on A are functions. ~ 1. & {@, 3), (1, 4), @, 1), G12), (4, 4} (Since element 2 has 2 images 3 and 1, fis not a function.) 2. =={GB,1),4,2),C_,)} gis a function 3. h={(2,1),,4),(1.4),(2,1),(4,4)} his a function 4. Let A= {0, +1, +2, 3}. Consider the function F: A— R, where R is the set of all real numbers, defined by f(x) =x* -2x?+3x+1 for xDA. Find the range of f. £(0)=1 £(1) =1-24341=3 (1) =1-2-341=5 DEPT. OF CSE, SJBIT Page 65 www.rejinpaul.com www.rejinpaul.com DISCRETE MATHEMATICAL STRUCTURES 10CS34 f (2) =8-8-6+1=7 f (-2) =8-8-6+1=-21 £ (3) =27-18+9+1=19 O Range = {1, 3,-5, 7,-21, 19} 5. If A= {0, +1, +2} and f A> R is defined by f(x) =x’-x+1, x0A find the range. f£@)=1 f(1)=1-1+1=1 f(-) =14+14153 f (2) =4-24153 f (-2) =4+2+1=7 O Range = {1, 3,7} Types of functions: 1. Everywhere defined -2 A function f: A ~ B is everywhere defined if domain of f equal to A (dom f Example: Y =f(x) =x+1 Here, dom f=A 2. Onto or surjection function DEPT. OF CSE, SJBIT Page 66 www.rejinpaul.com www.rejinpaul.com DISCRETE MATHEMATICAL STRUCTURES 10CS34 A function f: A > B is onto or surjection if Range of f= B. In other words, a function fis surjection or onto if for any value / in B, there is at least one element x in A for which fix) =y. 3. Many to one function A function F is said to be a many-to-one function ifa :f= b, f(a) = f(b), where (a, b) EA. Example: f a ie (\ O\ fi fo =e 1 \e 2 ep hy) Here, J: f=2 but f(1) =f (2), where 1,2 EA 4. One-to-one function or injection A function f: A B is one-to-one or injection if (a) =f (b) then a =b, where a, b EA. In other words if a: f=b then f (a): f= f (b). 5. Bijection function A function f: A> B is Bijection if it is both onto and one-to-one. 6. Invertible function f AmB P [+ —>fa)\ fe “(i }——¥ * x bo mae ( escangs lean. | | | gis f{c) | fate) iG } =f ——__ =a) } \rutay-——> 7 dy el Ue A function f: A ---+ B is said to be an invertible function if its inverse relation, f-I is a function from BA. If f: A— B is Bijection, then [-I: B ---+A exists, fis said to be invertible. DEPT. OF CSE, SJBIT Page 67 www.rejinpaul.com www.rejinpaul.com DISCRETE MATHEMATICAL STRUCTURES 10CS34 Ran (f -1) =Dom (f) and (f-1)-1 =f Definition A function f: A (B is invertible if it is inverse relation f -1 is a function from B to A. Then, f -1 is called the inverse function of f. Ex: let A = {a, b, c, d} and B= {e, f, g, hh} and f: A (B be a function defined by f@ =e, f0)=e, f©@=hf@=g Then, as a relation from A to B, freads f= {@, e), b, e), (c,h), , )} And f7 isarelation from B to A, given by f1={(e, a), @, b), (hc), (g, d)} Now, Dom (f)= [e, h, g} = Ran(f) and Ran (f') = {a, b, c, d} =A = Dom (f) Also, (f") 7 =f Although f*! is a relation from B to A, it is not function from B to A, because e is related to two elements ‘a’ and ‘b’ under f -1. Let A = {1,2,3,4} and B = {5,6,7,8} and the function f: A ( B defined by f(1) =6, f(2) ==8, £3) =5, f(4) =7 Then, f= {(1, 6), (2, 8), (3, 5), 4, 7)} o f-1={@6, 1), &, 2),G,5),(7,4)} In this case, f -1 is not only a relation from B to A but a function as well. Characteristic function Introduction DEPT. OF CSE, SJBIT Page 70 www.rejinpaul.com www.rejinpaul.com DISCRETE MATHEMATICAL STRUCTURES 10CS34 Characteristic function is a special type of function. It is very useful in the field of computer science. Through this function one can tell whether an element present in the set or not. If the function has the value 1 then the particular element belongs to the set and if it has value 0 then the element is not present in the set. Definition Associated with the subset a of 0 we can define a characteristic function of A over 0 as f O—{0, 1} where fa (xy 1 ifxOA 0 ifxOA Properties of the characteristics function 1 fy n(x) =f a). fa) Proof: i if xQOAnB thenxOAandxOB O fa(x)=1 and fg @)=l oO fans) =1=fa(). a(x) i. if xO AnB then f anp(x) =0. butifxO AnB then xO AandxO0B O fa(@)=0 and fg 4%) oO fans) =O=fa(x). fa(x) O From case 1 and 2 fanp (x) =fa(x). fa) 2. faun(s) =f a(x) + fp(x)- fa). f a) DEPT. OF CSE, SJBIT Page 71 www.rejinpaul.com www.rejinpaul.com DISCRETE MATHEMATICAL STRUCTURES 10CS34 Proof: i Let xO AUB then f aus (x)= 1. Butifx 0 AUB then there are three cases casel: let x 0A butnotin Bthen fy (x)=1 and fg (x)=0 O faup(%)=1=fa(s) +f, ()-fa@ .fa@) [Because 1+0+0] case2: let xO BbutnotinA Then fg (x)= 1 and fa (x) =0 Oo faup (x)=1=fa (x) +f @&)-fa (x) . fa @) [Because 0+1-0] case3: let xO AandxOB Then f, (x)=1land fp(x)=1 Oo faup (x)=1=fa (x) +f @&)-fa (x) . fa @) [Because 1+1-1] o faun®) =fa @) +f @)-fa () . fa &) i. Let xOAUB then fyup (x) =0 If xOAUBthen xOA andxOBthen O fa()=Oand fp (x) =0 Oo f aus (&) = 0 = fa (x) + fa (X) - fa (&) . fe (&) [because 0+0-1] o From case i and ii. oO f aus (x) = fa (x) + fe () - fa (X) - fa (&) DEPT. OF CSE, SJBIT Page 72 www.rejinpaul.com www.rejinpaul.com DISCRETE MATHEMATICAL STRUCTURES 10CS34 Transposition A cycle of length 2 is called a “transposition” if A = {al, a2, a3, ---- an} then P = (ai, aj), i#j isa transposition of A. Example: A= {1, 2, 3, 4, 5, 6} compute 1. (4, 1,3, 5) 0 G, 6, 3) and 2. (5, 6, 3) 0 (4, 1,3, 5) P= 123 4 5 6 3.2 514 6 P2 = (5, 6, 3)= 123 45 6 12546 3 P,OP,= 123 45 6 123 45 6 3.2514 6 2546 3 2. P20 Pi=(5, 6, 3) 0 (4, 1,3, 5)= 123 45 6 5 261 4 3 Even and odd permutations Example: A= {1, 2,3, 4,5, 6, 7, 8} find whether the following permutation are even or odd DEPT. OF CSE, SJBIT Page 75 www.rejinpaul.com www.rejinpaul.com DISCRETE MATHEMATICAL STRUCTURES 10CS34 P= (1,3) 0 C, 8)o (1,6) 0 (1, 4) O Pis an even permutation. a. P=(4, 8) 0 (3, 5, 2, 1) 02, 4,7, 1) P=(4,8)0 3, 1)0G,5)0(2,1)0 2,7) 02,4) O P is an odd permutation because gn per is expressed as a composition of odd number of transportation. Note: Product of even-even permutation is even Product of even-odd permutation is odd Product of odd-odd permutation is odd Even permutation cannot be expressed in terms of odd Odd permutation cannot be expressed in terms of even. Hashing function Introduction Suppose we want to store the mail address of all voters of a large city in n number of files, numbered from 0 to n-1 , in such a way that the file containing the address any chosen voter can be located almost instantly. The following is one way of doing this task First, to each voter let us assign a unique positive integer as an identification number. Next, to each identification number, let us assign a unique positive integer called a key. The keys can be such that two identification numbers can have the same key but two different keys are not assigned to the same identification number. Therefore the number of identification number will be equal to the number of voters , but the number, of keys can be less than the no. of identification number. Definition Let A denote the set of all keys and B = {0, 1, 2, ------- (n-1)} , the set of all files. DEPT. OF CSE, SJBIT Page 76 www.rejinpaul.com www.rejinpaul.com DISCRETE MATHEMATICAL STRUCTURES 10CS34 Consider an everywhere defined function ‘h, ;h,: A — B specified by h, (a) =1, where r is the remainder, = a/n and a 0 A . This function determines a unique r. for any specified a 0 A_, this r will be one and only one of the numbers from 0 to n-1 , (both inclusive). The function h,is called hashing function. For this function a set of all keys is domain. NOTE: The key need not be different from the identification number. If the keys are identical with the identification number, then the domain of the hashing function is the set of all identification number. DEPT. OF CSE, SJBIT Page 77 www.rejinpaul.com www.rejinpaul.com DISCRETE MATHEMATICAL STRUCTURES 10CS34 Since the only Hausdorff topology on a finite set is the discrete one, a finite Hausdorff topological group must necessarily be discrete. It follows that every finite subgroup of a Hausdorff group is discrete. A discrete subgroup H of G is co compact if there is a compact subset K of G such that HK=G. Discrete normal subgroups play an important role in the theory of covering groups and locally isomorphic groups. A discrete normal subgroup of a connected group G necessarily lies in the center of G and is therefore abelian. Other properties: + every discrete group is totally disconnected + every subgroup of a discrete group is discrete. + every quotient of a discrete group is discrete. + the product ofa finite number of discrete groups is discrete. + a discrete group is compact if and only if it is finite. + every discrete group is locally compact. + every discrete subgroup of a Hausdorff group is closed. + every discrete subgroup of a compact Hausdorff group is finite. Examples: + Frieze groups and wallpaper groups are discrete subgroups of the isometry group of the Euclidean plane. Wallpaper groups are cocompact, but Frieze groups are not. + A gspace group is a discrete subgroup of the isometry group of Euclidean space of some dimension. - A crystallographic group usually means a cocompact, discrete subgroup of the isometries of some Euclidean space. Sometimes, however, a crystallographic group can be a cocompact discrete subgroup of a nilpotent or solvable Lie group. + Every triangle group 7 is a discrete subgroup of the isometry group of the sphere (when 7 is finite), the Euclidean plane (when T has a Z+ Z subgroup of finite index), or the hyperbolic plane. + Fuchsian groups are, by definition, discrete subgroups of the isometry group of the hyperbolic plane. o A Fuchsian group that preserves orientation and acts on the upper half- plane model of the hyperbolic plane is a discrete subgroup of the Lie DEPT. OF CSE, SJBIT Page 80 www.rejinpaul.com www.rejinpaul.com DISCRETE MATHEMATICAL STRUCTURES 10CS34 group PSL(2,R), the group of orientation preserving isometries of the upper half-plane model of the hyperbolic plane. o A Fuchsian group is sometimes considered as a special case of a Kleinian group, by embedding the hyperbolic plane isometrically into three dimensional hyperbolic space and extending the group action on the plane to the whole space. o The modular group is PSL(2,Z), thought of as a discrete subgroup of PSL(2,R). The modular group is a lattice in PSL(2,R), but it is not cocompact. + Kleinian groups are, by definition, discrete subgroups of the isometry group of hyperbolic 3-space. These include quasi-Fuchsian groups. o A Kleinian group that preserves orientation and acts on the upper half space model of hyperbolic 3-space is a discrete subgroup of the Lie group PSL(2,C), the group of orientation preserving isometries of the upper half- space model of hyperbolic 3-space. + A lattice in a Lie group is a discrete subgroup such that the Haar measure of the quotient space is finite. Group homomorphism: Image of a Group homomorphism(h) from G(left) to H(ight). The smaller oval inside H is the image of h. N is the kernel of h and aN is a coset of h. In mathematics, given two groups (G, *) and (H, :), a group homomorphism from (G, *) to (H, -) is a function h: G > H such that for all w and v in G it holds that h(w*v) = h{u) - h(v) DEPT. OF CSE, SJBIT Page 81 www.rejinpaul.com www.rejinpaul.com DISCRETE MATHEMATICAL STRUCTURES 10CS34 where the group operation on the left hand side of the equation is that of G and on the right hand side that of H. From this property, one can deduce that 4 maps the identity element eg of G to the identity element ey of H, and it also maps inverses to inverses in the sense that hu ')=hw). Hence one can say that / "is compatible with the group structure". Older notations for the homomorphism A(x) may be x;, though this may be confused as an index or a general subscript. A more recent trend is to write group homomorphisms on the right of their arguments, omitting brackets, so that h(x) becomes simply x h. This approach is especially prevalent in areas of group theory where automata play a role, since it accords better with the convention that automata read words from left to right. In areas of mathematics where one considers groups endowed with additional structure, a homomorphism sometimes means a map which respects not only the group structure (as above) but also the extra structure. For example, a homomorphism of topological groups is often required to be continuous. The category of groups Ifh: G— Hand k: H > K are group homomorphisms, then so is k oh: G — K. This shows that the class of all groups, together with group homomorphisms as morphisms, forms a category. Types of homomorphic maps If the homomorphism /h is a bijection, then one can show that its inverse is also a group homomorphism, and h is called a group isomorphism, in this case, the groups G and H are called isomorphic: they differ only in the notation of their elements and are identical for all practical purposes. If h: G > G isa group homomorphism, we call it an endomorphism of G. If furthermore it is bijective and hence an isomorphism, it is called an automorphism. The set of all automorphisms of a group G, with functional composition as operation, forms itself a group, the automorphism group of G. It is denoted by Aut(G). As an example, the DEPT. OF CSE, SJBIT Page 82 www.rejinpaul.com www.rejinpaul.com DISCRETE MATHEMATICAL STRUCTURES 10CS34 the usual notation for p-adic number rings or localization at a prime ideal. The quotient notations Z/nZ, Z/n, and Z/(n) are standard alternatives. We adopt the first of these here to avoid the collision of notation. See also the section Subgroups and notation below. One may write the group multiplicatively, and denote it by C,,, where m is the order (which can be «). For example, g’¢* = g’ in Cs, whereas 3 + 4 =2 in Z/5Z. Properties The fundamental theorem of cyclic groups states that if G is a cyclic group of order n then every subgroup of G is cyclic. Moreover, the order of any subgroup of G is a divisor of n and for each positive divisor k of n the group G has exactly one subgroup of order k. This property characterizes finite cyclic groups: a group of order 7 is cyclic if and only if for every divisor d of n the group has at most one subgroup of order d. Sometimes the equivalent statement is used: a group of order nis cyclic if and only if for every divisor d of n the group has exactly one subgroup of order d. Every finite cyclic group is isomorphic to the group { [0], [1], [2]. ..., [7 - 1] } of integers modulo n under addition, and any infinite cyclic group is isomorphic to Z (the set of all integers) under addition. Thus, one only needs to look at such groups to understand the properties of cyclic groups in general. Hence, cyclic groups are one of the simplest groups to study and a number of nice properties are known. Given a cyclic group G of order (n may be infinity) and for every gin G, + Gis abelian; that is, their group operation is commutative: gh = hg (for all h in G). This is so since g+ hmodn=h+ gmodn. + If nis finite, then g” = g° is the identity element of the group, since kn mod n = 0 for any integer k. + Ifn=o, then there are exactly two elements that generate the group on their own: namely 1 and -1 for Z + Ifmis finite, then there are exactly p(n) elements that generate the group on their own, where is the Euler totient function + Every subgroup of G is cyclic. Indeed, each finite subgroup of G is a group of { 0, 1, 2, 3, ... m - 1} with addition modulo m. And each infinite subgroup of G is mZ for some m, which is bijective to (so isomorphic to) Z. + G, is isomorphic to Z/nZ (factor group of Z over nZ) since Z/nZ = {0 + nZ, 1 + nZ,2+nZ,3+nZ,4+nZ,..,.n- 1+ nZ} ={ 0,1, 2,3, 4,..,2- 1} under addition modulo n. DEPT. OF CSE, SJBIT Page 85 www.rejinpaul.com www.rejinpaul.com DISCRETE MATHEMATICAL STRUCTURES 10CS34 More generally, if d is a divisor of n, then the number of elements in Z/n which have order d is e(d). The order of the residue class of m is n / gcd(n,m). If p is a prime number, then the only group (up_to isomorphism) with p elements is the cyclic group Cy or Z/pZ. The direct product of two cyclic groups Z/nZ and Z/mZ is cyclic if and only if m and m are coprime. Thus e.g. Z/12Z is the direct product of Z/3Z and Z/4Z, but not the direct product of Z/6Z and Z/2Z. The definition immediately implies that cyclic groups have very simple group presentation C.. =< x | >and C,, =<x |x" > for finite n. A primary cyclic group is a group of the form Z/p" where p is a prime number. The fundamental theorem of abelian groups states that every finitely generated abelian group is the direct product of finitely many finite primary cyclic and infinite cyclic groups. Z/nZ and Z are also commutative rings. If p is a prime, then Z/pZ is a finite field, also denoted by F, or GF(p). Every field with p elements is isomorphic to this one. The units of the nng Z/nZ are the numbers coprime to n. They form a group under multiplication modulo_n with (7) elements (see above). It is written as (Z/nZ)°. For example, when n= 6, we get (Z/nZ)° = {1,5}. When n=8, we get (Z/nZ)" = {1,3,5,7}. In fact, it is known that (Z/nZ)" is cyclic if and only if nis 1 or 2 or 4 or p* or 2 p* for an odd prime number p and k > 1, in which case every generator of (Z/nZ)” is called a primitive root modulo n. Thus, (Z/nZ)" is cyclic for n = 6, but not for n = 8, where it is instead isomorphic to the Klein four-group. The group (Z/pZ)* is cyclic with p-1 elements for every prime p, and is also written (Z/pZ)" because it consists of the non-zero elements. More generally, every finite subgroup of the multiplicative group of any field is cyclic. Examples In 2D and 3D the symmetry group for n-fold rotational symmetry is C,,, of abstract group type Zn. In 3D there are also other symmetry groups which are algebraically the same, see Symmetry groups in 3D that are cyclic as abstract group. DEPT. OF CSE, SJBIT Page 86 www.rejinpaul.com www.rejinpaul.com DISCRETE MATHEMATICAL STRUCTURES 10CS34 Note that the group S' of all rotations of a circle (the circle group) is not cyclic, since it is not even countable. The n™ roots of unity form a cyclic group of order n under multiplication. e.g., 0 =z° - 1 =(c - s°\(c - s')\G - s*) where s' = e™ > and a group of {5°,s!,s°} under multiplication is cyclic. The Galois group of every finite field extension of a finite field is finite and cyclic; conversely, given a finite field F and a finite cyclic group G, there is a finite field extension of F whose Galois group is G. Representation The cycle graphs of finite cyclic groups are all n-sided polygons with the elements at the vertices. The dark vertex in the cycle graphs below stand for the identity element, and the other vertices are the other elements of the group. A cycle consists of successive powers of either of the elements connected to the identity element. The representation theory of the cyclic group is a critical base case for the representation theory of more general finite groups. In the complex case, a representation of a cyclic group decomposes into a direct sum of linear characters, making the connection between character theory and representation theory transparent. In the positive characteristic case, the indecomposable representations of the cyclic group form a model and inductive basis for the representation theory of groups with cyclic Sylow subgroups and more generally the representation theory of blocks of cyclic defect. Subgroups and notation All subgroups and quotient groups of cyclic groups are cyclic. Specifically, all subgroups of Z are of the form mZ, with m an integer >0. All of these subgroups are different, and apart from the trivial group (for m=0) all are isomorphic to Z. The lattice of subgroups of Z is isomorphic to the dual of the lattice of natural numbers ordered by divisibility. All factor groups of Z are finite, except for the trivial exception Z/{0} = Z/0Z. For every DEPT. OF CSE, SJBIT Page 87 www.rejinpaul.com www.rejinpaul.com DISCRETE MATHEMATICAL STRUCTURES 10CS34 If H=G and ©* * then the bijection is an automorphism (¢.v.) Intuitively, group theorists view two isomorphic groups as follows: For every element g of a group G, there exists an element / of H such that h 'behaves in the same way' as g (operates with other elements of the group in the same way as g). For instance, if g generates G, then so does h. This implies in particular that G and H are in bijective correspondence. So the definition of an isomorphism is quite natural. An isomorphism of groups may equivalently be defined as an invertible morphism in the category of groups. Examples + The group of all real numbers with addition, (IR, is isomorphic to the group of all positive real numbers with multiplication (R*,*): (B+) = (Rt x) via the isomorphism Sa =e (see exponential function). + The group Gof integers (with addition) is a subgroup of RR, and the factor group RY @ is isomorphic to the group S' of complex numbers of absolute value 1 (with multiplication): R/Z2 3s! An isomorphism is given by fla | Z) _ e2ttt for everyxin DEPT. OF CSE, SJBIT Page 90 www.rejinpaul.com www.rejinpaul.com DISCRETE MATHEMATICAL STRUCTURES 10CS34 + The Klein four-group is isomorphic to the direct_product of two copies of Zo = Z/2Z (06 modular arithmetic), and can therefore be written By x By Another notation is Dihs, because it is a dihedral group. + Generalizing this, for all odd n, Dihj, is isomorphic with the direct product of Dih,, and Z,. - IfG, *)is an infinite cyclic group, then (G, *) is isomorphic to the integers (with the addition operation). From an algebraic point of view, this means that the set of all integers (with the addition operation) is the 'only' infinite cyclic group. Some groups can be proven to be isomorphic, relying on the axiom of choice, while it is even theoretically impossible to construct concrete isomorphisms. Examples: + The group (, +) is isomorphic to the group ((C, +) of all complex numbers with addition. + The group cc’, +) of non-zero complex numbers with multiplication as operation is isomorphic to the group S' mentioned above. Properties + The kemel of an isomorphism from (G, *) to (H, ‘D), is always {eg} where eg is the identity of the group (G, *) + IfG, *)is isomorphic to (H, ©), and if G is abelian then so is H. - If G, *) is a group that is isomorphic to (H, ©) [where f is the isomorphism], then if a belongs to G and has order n, then so does f(a). + If(G, *) is a locally finite group that is isomorphic to (H, “), then (H, ©) is also locally finite. + The previous examples illustrate that 'group properties’ are always preserved by isomorphisms. Cyclic groups All cyclic groups of a given order are isomorphic to En, +n. DEPT. OF CSE, SJBIT Page 91 www.rejinpaul.com www.rejinpaul.com DISCRETE MATHEMATICAL STRUCTURES 10CS34 Let G be a cyclic group and 7 be the order of G. Gis then the group generated by <x >= {e,x,...x"" 1}. We will show that G = 2,4 Define pe Gad, = 10, 1, ray Th 1} so that p(2") = Clearly, Yis bijective. Then pla . a”) = v(x") =at+b= p(x") tn v(x" \which proves that G™ Ens +n. Consequences From the definition, it follows that any isomorphism f :G— Awin map the identity element of G to the identity element of H, Kea) = en that it will map inverses to inverses, flu") = [fw] and more generally, mth powers to nth powers, n nt Fu") = [F(u)] -1, for all w in G, and that the inverse map f :H Gis also a group isomorphism. The relation "being isomorphic" satisfies all the axioms of an equivalence relation. If fis an isomorphism between two groups G and H, then everything that is true about G that is only related to the group structure can be translated via finto a true ditto statement about H, and vice versa. DEPT. OF CSE, SJBIT Page 92 www.rejinpaul.com www.rejinpaul.com DISCRETE MATHEMATICAL STRUCTURES 10CS34 data more robust to disturbances present on the transmission channel. The ordinary user may not be aware of many applications using channel coding. A typical music CD uses the Reed-Solomon code to correct for scratches and dust. In this application the transmission channel is the CD itself. Cell phones also use coding techniques to correct for the fading and noise of high frequency radio transmission. Data modems, telephone transmissions, and NASA all employ channel coding techniques to get the bits through, for example the turbo code and LDPC codes. The hamming metric: DEPT. OF CSE, SJBIT Page 95 www.rejinpaul.com www.rejinpaul.com DISCRETE MATHEMATICAL STRUCTURES 10CS34 1 11 1 11 . 5 1m 11 1 n 3-bit binary cube for finding Two example distances: 100->011 has distance 3 (red Hamming distance path), 010->111 has distance 2 (blue path) Two example distances: 0100->1001 has distance 3 (red path), 0110->1110 has distance 1 (blue path) In information theory, the Hamming distance between two strings of equal length is the number of positions at which the corresponding symbols are different. Put another way, it DEPT. OF CSE, SJBIT Page 96 www.rejinpaul.com www.rejinpaul.com DISCRETE MATHEMATICAL STRUCTURES 10CS34 measures the minimum number of substitutions required to change one string into the other, or the number of errors that transformed one string into the other. Examples The Hamming distance between: + "toned" and "roses" is 3. + 1011101 and 1001001 is 2. + 2173896 and 2233796 is 3. Special properties For a fixed length n, the Hamming distance is a metric on the vector space of the words of that length, as it obviously fulfills the conditions of non-negativity, identity of indiscernibles and symmetry, and it can be shown easily by complete induction that it satisfies the triangle inequality as well. The Hamming distance between two words a and b can also be seen as the Hamming weight of a-b for an appropriate choice of the - operator. For binary strings a and b the Hamming distance is equal to the number of ones in a XOR b. The metric space of length-n binary strings, with the Hamming distance, is known as the Hamming cube, it is equivalent as a metric space to the set of distances between vertices in a hypercube graph. One can also view a binary string of length n as a vector in R” by treating each symbol in the string as a real coordinate, with this embedding, the strings form the vertices of an n-dimensional hypercube, and the Hamming distance of the strings is equivalent to the Manhattan distance between the vertices. History and applications The Hamming distance is named after Richard Hamming, who introduced it in his fundamental paper on Hamming codes Error detecting and error correcting codes in 1950.4 It is used in telecommunication to count the number of flipped bits in a fixed- length binary word as an estimate of error, and therefore is sometimes called the signal distance. Hamming weight analysis of bits is used in several disciplines including information theory, coding theory, and cryptography. However, for comparing strings of different lengths, or strings where not just substitutions but also insertions or deletions have to be expected, a more sophisticated metric like the Levenshtein distance is more DEPT. OF CSE, SJBIT Page 97 www.rejinpaul.com