Discrete Mathematics Bharati Vidyapeeths Institute of Computer Applications
Discrete Mathematics © Bharati Vidyapeeth’s Institute of Computer Applications and Management , New Delhi-63, by Parul arora
Study Mannual • • It is assumed that you have studied basics of mathematics before. The slides in this section are for your review. They will not all be covered in class. If you need extra help in this area, a special help session will be scheduled. A small test based on multiple choice questions will help you to analyse yourself © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Learning Objectives • • • Introduction Sets Logic & Boolean Algebra Proof Techniques Counting Principles Relations and Functions Partial Ordered Sets Group Theory Graphs and Trees © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Introduction © Bharati Vidyapeeth’s Institute of Computer Applications and Management , New Delhi-63, by Parul arora
Introduction • • What it isn’t continuous Discrete: consisting of distinct or unconnected elements Countably Infinite Definition Discrete Mathematics is a collection of mathematical topics that examine and use finite or countably infinite mathematical objects. © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Sets © Bharati Vidyapeeth’s Institute of Computer Applications and Management , New Delhi-63, by Parul arora
Sets Members or Elements: part of the collection Roster Method: Description of a set by listing the elements, enclosed with braces § Examples: ü Vowels = {a, e, i, o, u} ü Primary colors = {red, blue, yellow} Membership examples § “a belongs to the set of Vowels” is written as: a Vowels § “j does not belong to the set of Vowels: j Vowels ver model involves requests and replies. © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Sets Set-builder method § A = { x | x S, P(x) } or A = { x S | P(x) } ü A is the set of all elements x of S, such that x satisfies the property P ü Example: If X = {2, 4, 6, 8, 10}, then in set-builder notation, X can be described as X = {n Z | n is even and 2 n 10} © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Sets Standard Symbols which denote sets of numbers • N : The set of all natural numbers (i. e. , all positive integers) • Z : The set of all integers • Z+ : The set of all positive integers • Z* : The set of all nonzero integers • E : The set of all even integers • Q : The set of all rational numbers • Q+ : R : The set of all real numbers © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Sets Subsets § “X is a subset of Y” is written as X Y § “X is not a subset of Y” is written as X Y § Example: ü X = {a, e, i, o, u}, Y = {a, i, u} and Z={b, c, d, f, g} Y X, since every element of Y is an element of X Y Z, since a Y, but a Z © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Sets Superset § X and Y are sets. If X Y, then “X is contained in Y” or “Y contains X” or Y is a superset of X, written Y X Proper Subset § X and Y are sets. X is a proper subset of Y if X Y and there exists at least one element in Y that is not in X. This is written X Y. § Example: ü X = {a, e, i, o, u}, Y = {a, e, i, o, u, y} X Y , since y Y, but y X © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Sets Set Equality § X and Y are sets. They are said to be equal if every element of X is an element of Y and every element of Y is an element of X, i. e. X Y and Y X § Examples: ü{1, 2, 3} = {2, 3, 1} üX = {red, blue, yellow} and Y = {c | c is a primary color} Therefore, X=Y Empty (Null) Set § A Set is Empty (Null) if it contains no elements. § The Empty Set is written as § The Empty Set is a subset of every set © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Sets Finite and Infinite Sets § X is a set. If there exists a nonnegative integer n such that X has n elements, then X is called a finite set with n elements. § If a set is not finite, then it is an infinite set. § Examples: ü Y = {1, 2, 3} is a finite set ü P = {red, blue, yellow} is a finite set ü E , the set of all even integers, is an infinite set ü , the Empty Set, is a finite set with 0 elements © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Sets Cardinality of Sets § Let S be a finite set with n distinct elements, where n ≥ 0. Then |S| = n , where the cardinality (number of elements) of S is n § Example: üIf P = {red, blue, yellow}, then |P| = 3 § Singleton ü A set with only one element is a singleton üExample: H = { 4 }, |H| = 1, H is a singleton © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Sets Power Set § For any set X , the power set of X , written P(X), is the set of all subsets of X § Example: üIf X = {red, blue, yellow}, then P(X) = { , {red}, {blue}, {yellow}, {red, blue}, {red, yellow}, {blue, yellow}, {red, blue, yellow} } Universal Set § An arbitrarily chosen, but fixed set © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Sets Venn Diagrams § Abstract visualization of a Universal set, U as a rectangle, with all subsets of U shown as circles. § Shaded portion represents the corresponding set § Example: üIn Figure 1, Set X, shaded, is a subset of the Universal set, U © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Union Of Sets Example: If X = {1, 2, 3, 4, 5} and Y = {5, 6, 7, 8, 9}, then XUY = {1, 2, 3, 4, 5, 6, 7, 8, 9 © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Intersection Of Sets Example: If X = {1, 2, 3, 4, 5} and Y = {5, 6, 7, 8, 9}, then X ∩ Y = {5} © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Disjoint sets Example: If X = {1, 2, 3, 4, } and Y = {6, 7, 8, 9}, then X ∩ Y = © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Difference of Sets Example: If X = {a, b, c, d} and Y = {c, d, e, f}, then X – Y = {a, b} and Y – X = {e, f} © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Compliment of a Set The complement of a set X with respect to a universal set U, denoted by , is defined to be = {x |x U, but x X} Example: If U = {a, b, c, d, e, f} and X = {c, d, e, f}, then ~X = {a, b} © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Sets Ordered Pair § X and Y are sets. If x X and y Y, then an ordered pair is written (x, y) § Order of elements is important. (x, y) is not necessarily equal to (y, x) Cartesian Product § The Cartesian product of two sets X and Y , written X × Y , is the set § X × Y ={(x, y)|x ∈ X , y ∈ Y} üFor any set X, X × = = × X § Example: ü X = {a, b}, Y = {c, d} X × Y = {(a, c), (a, d), (b, c), (b, d)} Y × X = {(c, a), (d, a), (c, b), (d, b)} © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Logic & Boolean Algebra © Bharati Vidyapeeth’s Institute of Computer Applications and Management , New Delhi-63, by Parul arora
Mathematical Logic Definition: Methods of reasoning, provides rules and techniques to determine whether an argument is valid Theorem: a statement that can be shown to be true (under certain conditions) § Example: If x is an even integer, then x + 1 is an odd integer üThis statement is true under the condition that x is an integer is true © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Mathematical Logic A statement, or a proposition, is a declarative sentence that is either true or false, but not both Uppercase letters denote propositions § Examples: üP: 2 is an even number (true) üQ: 7 is an even number (false) üR: A is a vowel (true) § The following are not propositions: üP: My cat is beautiful üQ: My house is big © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Mathematical Logic Negation § The negation of p, written ∼p, is the statement obtained by negating statement p üTruth values of p and ∼p are opposite üSymbol ~ is called “not” ~p is read as as “not p” üExample: p: A is a consonant ~p: it is the case that A is not a consonant © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Mathematical Logic Conjunction § Let p and q be statements. The conjunction of p and q, written p ^ q , is the statement formed by joining statements p and q using the word “and” § The statement p∧q is true if both p and q are true; otherwise p ^ q is false © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Mathematical Logic Disjunction § Let p and q be statements. The disjunction of p and q, written p v q , is the statement formed by joining statements p and q using the word “or” § The statement p v q is true if at least one of the statements p or q is true; otherwise p v q is false § The symbol v is read “or” © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Mathematical Logic Implication § Let p and q be statements. The statement “if p then q” is called an implication or condition. § The implication “if p then q” is written p q § p q is read: ü“If p, then q” ü“p is sufficient for q” üq if p üq whenever p © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Mathematical Logic Implication § Truth Table for Implication: § p is called the hypothesis, q is called the conclusion © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Mathematical Logic Implication § Let p: Today is Sunday and q: I will wash the car. The conjunction p q is the statement: üp q : If today is Sunday, then I will wash the car § The converse of this implication is written q p üIf I wash the car, then today is Sunday § The inverse of this implication is ~p ~q üIf today is not Sunday, then I will not wash the car § The contrapositive of this implication is ~q ~p üIf I do not wash the car, then today is not Sunday © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Mathematical Logic Biimplication § Let p and q be statements. The statement “p if and only if q” is called the biimplication or biconditional of p and q § The biconditional “p if and only if q” is written p q § p q is read: ü“p if and only if q” ü“p is necessary and sufficient for q” ü“q if and only if p” ü“q when and only when p” © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Mathematical Logic Biconditional § Truth Table for the Biconditional: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Boolean Algebra Boolean algebra provides the operations and the rules for working with the set {0, 1}. We are going to focus on three operations: • Boolean complementation, • Boolean sum, and • Boolean product © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Boolean Algebra The complement is denoted by a bar (on the slides, we will use a minus sign). It is defined by -0 = 1 and -1 = 0. The Boolean sum, denoted by + or by OR, has the following values: 1 + 1 = 1, 1 + 0 = 1, 0 + 1 = 1, 0 + 0 = 0 The Boolean product, denoted by or by AND, has the following values: 1 1 = 1, 1 0 = 0, 0 1 = 0, 0 0 = 0 © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Boolean Algebra • Definition: Let B = {0, 1}. The variable x is called a Boolean variable if it assumes values only from B. • A function from Bn, the set {(x 1, x 2, …, xn) |xi B, 1 i n}, to B is called a Boolean function of degree n. • Boolean functions can be represented using expressions made up from the variables and Boolean operations © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Boolean Algebra The Boolean expressions in the variables x 1, x 2, …, xn are defined recursively as follows: • 0, 1, x 2, …, xn are Boolean expressions. • If E 1 and E 2 are Boolean expressions, then (-E 1), (E 1. E 2), and (E 1 + E 2) are Boolean expressions. Each Boolean expression represents a Boolean function. The values of this function are obtained by substituting 0 and 1 for the variables in the expression. © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Boolean Functions and Expressions • For example, we can create Boolean expression in the variables x, y, and z using the “building blocks” 0, 1, x, y, and z, and the construction rules: • Since x and y are Boolean expressions, so is xy. • Since z is a Boolean expression, so is (-z). • Since xy and (-z) are expressions, so is xy + (-z). © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Boolean Functions and Expressions Example: Give a Boolean expression for the Boolean function F(x, y) as defined by the following table: x y F(x, y) 0 1 1 1 0 0 1 1 0 Possible solution: F(x, y) = (-x) y © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Basic Identities of Boolean Algebra (1) x + 0 = x (2) x · 0 = 0 (3) x + 1 = 1 (4) x · 1 = 1 (5) x + x = x (6) x · x = x (7) x + x’ = x (8) x · x’ = 0 (9) x + y = y + x (10) xy = yx © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Duality Principle – every valid Boolean expression (equality) remains valid if the operators and identity elements are interchanged, as follows: + . 1 0 Example: Given the expression a + (b. c) = (a+b). (a+c) then its dual expression is a. (b+c) = (a. b) + (a. c) © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Standard Forms Certain types of Boolean expressions lead to gating networks which are desirable from implementation viewpoint. Two Standard Forms: Sum-of-Products and Product-of-Sums Literals: a variable on its own or in its complemented form. Examples: x, x' , y, y' Product Term: a single literal or a logical product (AND) of several literals. Examples: x, x. y. z', A'. B, A. B, e. g'. w. v © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Standard Forms Sum Term: a single literal or a logical sum (OR) of several literals. Examples: x, x+y+z', A'+B, A+B, c+d+h'+j Sum-of-Products (SOP) Expression: a product term or a logical sum (OR) of several product terms. Examples: x, x+y. z', x. y'+x'. y. z, A. B+A'. B', A + B'. C + A. C' + C. D Product-of-Sums (POS) Expression: a sum term or a logical product (AND) of several sum terms. Examples: x, x. (y+z'), (x+y'). (x'+y+z), (A+B). (A'+B'), (A+B+C). D'. (B'+D+E') © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Proof Techniques © Bharati Vidyapeeth’s Institute of Computer Applications and Management , New Delhi-63, by Parul arora
Proof Techniques Learn various proof techniques § Direct § Indirect § Contradiction § Induction © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Proof Techniques Theorem § Statement that can be shown to be true (under certain conditions) § Typically Stated in one of three ways üAs Facts üAs Implications üAs Biimplications © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Proof Techniques Direct Proof or Proof by Direct Method § Proof of those theorems that can be expressed in the form ∀x (P(x) → Q(x)), D is the domain of discourse § Select a particular, but arbitrarily chosen, member a of the domain D § Show that the statement P(a) → Q(a) is true. (Assume that P(a) is true § Show that Q(a) is true § By the rule of Choose Method (Universal Generalization), ∀x (P(x) → Q(x)) is true © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Proof Techniques Indirect Proof § The implication P → Q is equivalent to the implication ( Q → P) § Therefore, in order to show that P → Q is true, one can also show that the implication ( Q → P) is true § To show that ( Q → P) is true, assume that the negation of Q is true and prove that the negation of P is true © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Proof Techniques Proof by Contradiction § Assume that the conclusion is not true and then arrive at a contradiction § Example: Prove that there are infinitely many prime numbers § Proof: üAssume there are not infinitely many prime numbers, therefore they are listable, i. e. p 1, p 2, …, pn üConsider the number q = p 1 p 2…pn+1. q is not divisible by any of the listed primes üTherefore, q is a prime. However, it was not listed. üContradiction! Therefore, there are infinitely many © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Proof Techniques Proof of Biimplications § To prove a theorem of the form ∀x (P(x) ↔ Q(x )), where D is the domain of the discourse, consider an arbitrary but fixed element a from D. For this a, prove that the biimplication P(a) ↔ Q(a) is true § The biimplication P ↔ Q is equivalent to (P → Q) ∧ (Q → P) § Prove that the implications P → Q and Q → P are true üAssume that P is true and show that Q is true üAssume that Q is true and show that P is true © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Proof Techniques Proof of Equivalent Statements § Consider theorem that says that statements P, Q and r are equivalent § Show that P → Q, Q → R and R → P üAssume P and prove Q. Then assume Q and prove R Finally, assume R and prove P § What other methods are possible? © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Mathematical Induction • Assume that when a domino is knocked over, the next domino is knocked over by it • Show that if the first domino is knocked over, then all the dominoes will be knocked over © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Mathematical Induction Let P(n) denote the statement that then nth domino is knocked over Base Step: Show that P(1) is true Inductive Hypothesis: Assume some P(i) is true, i. e. the ith domino is knocked over for some Inductive Step: Prove that P(i+1) is true, i. e. © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Relations And Functions © Bharati Vidyapeeth’s Institute of Computer Applications and Management , New Delhi-63, by Parul arora
Relation • Let A and B be sets. A binary relation or simply relation from A to B is a subset of A X B • Suppose R is a relation from A to B. Then R is a set of ordered pairs where each first element comes from A and each second element comes from B. That is , for each pair a A and b B exactly one of the following is true (a, b) R: a is R-related to b (a, b) ∉ R : a is not R-related to b. © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Domain And Range Of A Relation Let R be a Relation from A to B DOMAIN: - Set of all first co-ordinates of the members of the relation set R. Domain R={x : (x , y) R} RANGE: - Set of all second co-ordinates of the members of relation set R. Range R={y : (x, y) R} © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Total Number Of Relations Let A and B be two non-empty sets consisting m and n elements respectively. Then A X B has mn ordered pair. Total no of subset of AX B is 2 mn Since each subset of A X B defines a relation so total no of relation from A to B is 2 mn © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Inverse Relation Let R be any relation from set A to set B. The inverse of R, denoted by R-1, is the relation from B to A which consist of those ordered pairs which when reversed belong to R : that is R-1= {(b, a): (a, b) R } DOMAIN (R-1) = RANGE (R) RANGE (R-1) = DOMAIN (R) Is R is any relation then (R-1) – 1 is equal to R © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Composition Of Relation Let A , B and C be sets and Let R be a relation from A to B and S be a relation from B to C. That is R is a subset of AXB and S is a subset of BXC. Then R and S give rise to a relation from A to C denoted by Ro. S and defined by Ro. S = {(a, c): there exists b B for which (a, b) R and (b, c) S} This relation is called composition of R and S. Sometime denoted by RS also. Suppose R is a relation from a set A to itself then R • R the composition of R with itself is defined by R 2. © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Function In layman terms A function is nothing but a relationship between two sets. It maps element of one set to another set on the basis of some logical relation. But in terms of mathematics A binary relation R from A to B is said to be a function, if for every element a in A, there is a unique element b in B so that (a, b) is in R. We use the notation R(a)=b, where b is called the image of a. © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Diagrammatic Representation Of Function A={2, 3, 4, 5} and B={4, 9, 16, 25} f : A--->B f(x) = x^2 2 3 4 5 4 16 9 25 © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Rules For Function 1) There may be some element of set B which are not associated to any element of Set A but each element of set A must be associated to only one element of set B. For each a A, (a, b) f, for some b B 2) Two or more element of set A may be associated to same element of set B but association of one element of A to more then one element in B is not possible if (a, b) f and (a, b’) f then b=b’ © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Domain Co-domain And Range Suppose f be a function from A to B Domain: - A is called the domain of the function f. CO-Domain: - B is called the co-domain of function. Range: - it consist of all those elements in B which appear as image of at least one element in A. © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Type Of Functions One-to-one function (injection): - if different elements of A have different images in B. For f: -A B f(a) # f(b) for all a, b A Many-to-one function: - if two or more elements of Set A has same images in B. For f: -A B there exists x, y A such that x # y but f(x)=f(y). Onto function (Surjection): -if every element of B is the image of some element of A. In this case range of f is codomain of f. Into function: -if there exists an element in B which is not the image of any element of A. Bijection (one-to-one onto function): -if function is oneto-one as well as onto then it is bijection. © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Inverse Image Of An Element Let f : X Y then inverse image of an element b Y under f is denoted by ƒ– 1 (b) to be read as f-image b and ƒ– 1 (b)={x: x X and f(x)=b} INVERSE IMAGE OF A SUBSET Let f : X Y and B be a subset of Y means B Y then the inverse of B under f is given by ƒ– 1 (b)= { x: x X and f(x) b} © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Partial Ordered Sets © Bharati Vidyapeeth’s Institute of Computer Applications and Management , New Delhi-63, by Parul arora
Poset Suppose R is a relation on set S which satisfy the following properties (Reflexive) for any a S we have a. Ra (Antisymmetric) if a. Rb and b. Ra then a=b (Transitive) if a. Rb and b. Rc then a. Rc. Then this relation R is called partial order relation and the set S is called partially ordered set or POSET. A partial order relation is usually denoted by the symbol ≤ Means (S , ≤ ) is a partially ordered set. © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Comparable elements Two elements x, y in a partially ordered set (A, ≤ ) are said to be comparable if either x ≤ y or y ≤ x Uncomparable elements Two elements x, y in a partially ordered set (A, ≤ ) are said to be uncomparable if x ≤ y or y ≤ x both do not hold Ex in the poset (z+ , /) are the integers 3 and 9 comparable? Are 5 and 7 comparable Yes 3 and 9 are comparable but 5 and 7 and 5 are not © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Totally Ordered Set If (S , ≤ ) is a poset and every two element of a set are comparable then S Is called totally ordered set or linearly ordered set. Totally ordered set is also known as chain. Ex the poset (Z , ≤) is a totally ordered set © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Basic Counting Technique © Bharati Vidyapeeth’s Institute of Computer Applications and Management , New Delhi-63, by Parul arora
Sum Rule principle Sum Rule Principle: Suppose an event E can occur in n 1 ways and a second event F can occur in n 2 ways and if both event can not occur simultaneously. Then E or F can occur in n 1+n 2 ways. General Format: suppose an event E 1 can occur in n 1 ways , a second event E 2 can occur in n 2 ways , a third event E 3 can occur in n 3 ways …. . And suppose no two of the event can occur at the same time. Then one of the event can occur in n 1+n 2+n 3…. Ways. Ex: - suppose there are 8 male professor and 5 female professor teaching a calculus class. A student can choose a calculus professor in 8+5 =13 ways. Ex: - Suppose E is the event of choosing a prime no les then 10, and suppose F is the event of choosing an even number less then 10. By how many ways E or F can occur. © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Product Rule Principle If an event E can occur in m ways and, independent of this event there is a second event F which can occur in n ways. Then combination of E and F can occur in m. n ways. (the product rule applies when a procedure is made up of separate task). General Format Suppose an Event E 1 can occur in n 1 ways and following E 1 event E 2 can occur in n 2 ways and following E 2 a third event E 3 can occur in n 3 ways and so on. Then all the event can occur in n 1. n 2. n 3…. ways OR Suppose that a procedure can be broken in to a sequence of two tasks. If there are n 1 ways to do the first task and n 2 ways to do the second task after the first task has been done then there are n 1 n 2 ways to do the procedure. Ex Suppose a license plate contain two letters followed by three digit with the first digit not zero . How many diff license plates can be printed. © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Counting Technique Suppose there are 5 different optional papers to select in third semester and 4 different optional papers to select in 4 th semester by the MCA students. By product rule: - there will be 5*4 choices for students who want to select one paper in third semester and one in 4 th semester. By sum rule: - student will have 5+4 choices to select only one paper © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Group Theory © Bharati Vidyapeeth’s Institute of Computer Applications and Management , New Delhi-63, by Parul arora
Algebraic System If there exists a system such that it consist of a non-empty set and one or more operations on that set, then that system is called an algebraic system. It is generally denoted by (A, o 1, o 2, ……. . on) Where A is a non-empty set and o 1, o 2, ……. . on are operations on A. An algebraic system is also called an algebraic structure because the operations on the set A define a structure on the elements of A. Ex. (N, +), (Q, -), (R. +) etc. . all are the example of algebraic system or structure © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Operations On Set Operations are functions which are use to assign a unique element to any given pair of elements. EX. A+B=C A∩B=C A * B=C Binary Operation Let S be a nonempty set. An operation on S is a function from S X S into S and it will be written by a*b or sometimes ab In this case the algebraic system is denoted by (S, *) Unary Operation A function from S into S is called unary operation. For example, the absolute value |n| of an integer n is a unary operation on Z. Ternary Operation A function from S X S into S is called ternary operation N-ary Operation A function from S X S…. . X S (up to n factors) in to S is called n-ary operation. © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Closed Operation Suppose we have a non-empty set A. A function from A X A in to A is said to be a binary operation that is closed if a and b belongs to A then a * b must also belongs to A. Ex. Let A and B denote, respectively the set of even and odd positive integers. Then A is closed under addition and multiplication since the sum and product of any even numbers are even. But, B is closed under multiplication only not for addition because sum of two odd numbers can be even also 3+5=8 © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Closed Operation Example. Addition(+) and multiplication (*) are closed operation on N. However subtraction(-) and division(/) are not operations on N. 2 -9 and 7/3 are not positive integers. Example: Let S = {0, 1, -1}. Then addition + is not an operation on S since the sum 1+1 is not an element of S. On the other hand, multiplication is an operation on S. © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Properties Of Operation Suppose I is a set of integers. consider the algebraic system (I, +, *) where + and * are the operation of addition and multiplication on I. 1) Associative For any a, b, c I (a + b ) + c = a + (b + c) (a * b ) * c = a * (b * c) 2) Commutative For any a, b I a + b = b + a a * b = b * a 3) Identity Element For 0, a I, a + 0 = 0 + a =a (0 is the identity element for + ) For 1, a I , a * 1=1 * a =a (1 is the identity element for s * ) © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
4) Inverse element For each a I there exists an element in I denoted by –a and called inverse of a a + (-a)=0 5) Distributive For any a, b, c I a * (b + c)=(a * b) + (a * C) 6) Cancellation Property For any a, b, c I and a # 0 a * b=a * c b=c © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Inverse Element Suppose (A, *) be an algebraic system with an identity e and a be an element in A. An element b is said to be a left inverse of a if b * a = e An element b is said to be a right inverse of a if a * b = e An element b which is both a left and right inverse of a is called an inverse of a and is said to be invertible or regular. Properties Of Inverse Element 1)The inverse of the identity element e is e e * e = e, e-1= e 2) The inverse of the inverse of any element is the element itself. (a-1)-1 = a © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Groups For a nonempty set G, a Group (G, *) is an algebraic system in which the binary operation * on G satisfies the below four conditions— 1) Operation * must be closed. 2) For all x, y, z G X * (Y * Z) = (X * Y) * Z (ASSOCIATIVITY) 3) There exists an element e G such that for any x g X * e = e * X = X (IDENTITY) 4) For every x G there exists an element denoted by x-1 G such that X-1 * X = X * X-1 = e (INVERSE) Ex. For algebraic system (I, +) where I is the set of all integers and + is the ordinary addition operation of integers, (I, +) is a group with 0 being the identity and the inverse of n being –n. © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Abelian Group A group (A, *) is called commutative or abelian group if * is a commutative operation. means a * b= b * a for all a, b G Ex. Group (I, +) is a example of abelian group. © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Finite And Infinite Group • If a group contains a finite number of distinct elements then it is called finite group • If a group contains an infinite no of elements then it is called infinite group. • The no of elements in a finite group is called order of group • An infinite group is said to be of infinite order. © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Graphs and Trees © Bharati Vidyapeeth’s Institute of Computer Applications and Management , New Delhi-63, by Parul arora
What is a Graph? • • Informally a graph is a set of nodes joined by a set of lines or arrows. A graph, written as G= {V, E} consists of two components. 1 2 3 4 5 6 The finite set of vertices V , also called points or nodes The finite set of (directed/undirected) edges E also called lines or arcs connecting pair of vertices. © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Graph An undirected graph G = ( V , E ) , but unlike a digraph the edge set E consist of unordered pairs. We use the notation (a, b ) to refer to a directed edge, and { a, b } for an undirected edge. A D B E C V = { A, B, C, D, E, F } |V | = 6 F E = { {A, B}, {A, E}, {B, E}, {C, F} } |E | = 4 Some texts use (a, b) also for undirected edges. So ( a, b ) and ( b, a ) refers to the same edge. © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Diagraph A directed graph (or digraph) G = (V, E ) consists of a non-empty set V of vertices (or nodes) and a set E of edges with E V V. The edge (a, b) is also denoted by a b and a is called the source of the edge while b is called the target of the edge. 3 6 V = { 3, 6 } | V | = 2 E = { (6, 3) } | E | = 1 © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Degree of a Vertex • Degree of a Vertex in an undirected graph is the number of edges incident on it. • Degree is denoted by deg(v). • In a directed graph , the out degree of a vertex is the number of edges leaving it and the in degree is the number of edges entering it. • A vertex of degree zero is called isolated vertex • A vertex with degree only is called pendant vertex. © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Degree of a Vertex The degree of B is 2. A D B E C Self-loop F The in degree of 2 is 2 and the out degree of 2 is 3. 1 2 4 5 © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Type Of Graphs Simple Graph : - A simple graph G=(V, E) consists of V, a nonempty set of vertices and E, a set of unordered pair of distinct elements of V called edges. it has no self loop and parallel edges. Multi Graph : -If in a directed or undirected graph there exists a certain pair of nodes that are joined by more then one edges such edges are called multiple edges or parallel edges and such graphs are called multigraph. © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Graph Terminology Adjacent vertex: - Two vertices are said to be adjacent if they are join by an edge. If e={u, v} the edge e is called incident with the vertices u and v. The vertices u and v are called endpoints of the edge {u, v} Loop: - An edge that is incident from and in to the same vertex is called loop. © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Path And Circuit A path is a walk through sequence , V 0, V 1, V 2…. Vn of vertice , each adjacent to the next , without any repetition of vertices. if there exists a pth V 0 to Vn in an undirected graph, then there always exists a path from Vn to V 0 too. But in directed graph it is not necessary. number of edges in a path is called length of the path. A circuit is a closed walk in which the terminal vertex coincides with the initial vertex and it contains no repeated edges. Simple circuit: - A circuit is said to be simple if it does not include the same edge twice. Elementary Circuit: - if it does not meet the same vertex twice. © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Trees A tree is a collection of nodes § The collection can be empty § (recursive definition) If not empty, a tree consists of a distinguished node r (the root), and zero or more nonempty subtrees T 1, T 2, . . , Tk, each of whose roots are connected by a directed edge from r © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Path And Circuit Trees Child and parent § Every node except the root has one parent § A node can have an arbitrary number of children Leaves § Nodes with no children Sibling § nodes with same parent © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
Trees Length § number of edges on the path Depth of a node § length of the unique path from the root to that node § The depth of a tree is equal to the depth of the deepest leaf Height of a node § length of the longest path from that node to a leaf § all leaves are at height 0 § The height of a tree is equal to the height of the root © Bharati Vidyapeeth’s Institute of Computer Applications and Management, , New Delhi-63, by Parul Arora.
- Slides: 96