© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul...

96
© Bharati Vidyapeeth’s Institute of Computer Applications and Management , New Delhi-63, by Parul arora Discrete Mathematics Discrete Mathematics

Transcript of © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul...

Page 1: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© Bharati Vidyapeeth’s Institute of Computer Applications and Management , New Delhi-63, by Parul arora

Discrete MathematicsDiscrete Mathematics

Page 2: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© Bharati Vidyapeeth’s Institute of Computer Applications and Management,, New Delhi-63, by Parul Arora.

• 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

Page 3: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© 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

Page 4: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© Bharati Vidyapeeth’s Institute of Computer Applications and Management , New Delhi-63, by Parul arora

IntroductionIntroduction

Page 5: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© 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.

Page 6: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© Bharati Vidyapeeth’s Institute of Computer Applications and Management , New Delhi-63, by Parul arora

SetsSets

Page 7: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© Bharati Vidyapeeth’s Institute of Computer Applications and Management,, New Delhi-63, by Parul Arora.

Sets

Members or Elements: part of the collectionRoster 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.

Page 8: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© Bharati Vidyapeeth’s Institute of Computer Applications and Management,, New Delhi-63, by Parul Arora.

SetsSet-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}

Page 9: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© 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

Page 10: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© Bharati Vidyapeeth’s Institute of Computer Applications and Management,, New Delhi-63, by Parul Arora.

SetsSubsets

“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

Page 11: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© Bharati Vidyapeeth’s Institute of Computer Applications and Management,, New Delhi-63, by Parul Arora.

SetsSuperset

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

Page 12: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© Bharati Vidyapeeth’s Institute of Computer Applications and Management,, New Delhi-63, by Parul Arora.

SetsSet 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

Page 13: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© Bharati Vidyapeeth’s Institute of Computer Applications and Management,, New Delhi-63, by Parul Arora.

SetsFinite 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

Page 14: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© Bharati Vidyapeeth’s Institute of Computer Applications and Management,, New Delhi-63, by Parul Arora.

SetsCardinality 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

Page 15: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© 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

Page 16: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© Bharati Vidyapeeth’s Institute of Computer Applications and Management,, New Delhi-63, by Parul Arora.

SetsVenn 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

Page 17: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© 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

Page 18: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© 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}

Page 19: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© 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 =

Page 20: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© 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}

Page 21: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© Bharati Vidyapeeth’s Institute of Computer Applications and Management,, New Delhi-63, by Parul Arora.

ComplimentCompliment 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}

Page 22: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© Bharati Vidyapeeth’s Institute of Computer Applications and Management,, New Delhi-63, by Parul Arora.

SetsOrdered 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)}

Page 23: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© Bharati Vidyapeeth’s Institute of Computer Applications and Management , New Delhi-63, by Parul arora

Logic & Boolean AlgebraLogic & Boolean Algebra

Page 24: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© 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

Page 25: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© 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

Page 26: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© 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 oppositeSymbol ~ 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

Page 27: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© 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

Page 28: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© Bharati Vidyapeeth’s Institute of Computer Applications and Management,, New Delhi-63, by Parul Arora.

Mathematical LogicDisjunction

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”

Page 29: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© Bharati Vidyapeeth’s Institute of Computer Applications and Management,, New Delhi-63, by Parul Arora.

Mathematical LogicImplication

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

Page 30: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© 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

Page 31: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© 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 pIf I wash the car, then today is Sunday

The inverse of this implication is ~p ~qIf today is not Sunday, then I will not wash the car

The contrapositive of this implication is ~q ~pIf I do not wash the car, then today is not Sunday

Page 32: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© Bharati Vidyapeeth’s Institute of Computer Applications and Management,, New Delhi-63, by Parul Arora.

Mathematical LogicBiimplication

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”

Page 33: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© Bharati Vidyapeeth’s Institute of Computer Applications and Management,, New Delhi-63, by Parul Arora.

Mathematical Logic

Biconditional Truth Table for the Biconditional:

Page 34: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© 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

Page 35: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© 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

Page 36: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© 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 {(x1, x2, …, xn) |xiB, 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

Page 37: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© Bharati Vidyapeeth’s Institute of Computer Applications and Management,, New Delhi-63, by Parul Arora.

Boolean Algebra

The Boolean expressions in the variables x1, x2, …, xn are defined recursively as follows:

• 0, 1, x1, x2, …, xn are Boolean expressions.

• If E1 and E2 are Boolean expressions, then (-E1),

(E1. E2), and (E1 + E2) 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.

Page 38: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© 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).

Page 39: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© 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:Possible solution: F(x, y) = (-x) F(x, y) = (-x)yy

Page 40: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© 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

Page 41: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© Bharati Vidyapeeth’s Institute of Computer Applications and Management,, New Delhi-63, by Parul Arora.

Duality

Duality Principle – every valid Boolean expression (equality) remains valid if the operators and identity elements are interchanged, as follows:

+ .1 0

Example: Given the expressiona + (b.c) = (a+b).(a+c)

then its dual expression isa . (b+c) = (a.b) + (a.c)

Page 42: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© 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

Page 43: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© 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')

Page 44: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© Bharati Vidyapeeth’s Institute of Computer Applications and Management , New Delhi-63, by Parul arora

Proof TechniquesProof Techniques

Page 45: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© Bharati Vidyapeeth’s Institute of Computer Applications and Management,, New Delhi-63, by Parul Arora.

Proof TechniquesProof Techniques

Learn various proof techniques

Direct

Indirect

Contradiction

Induction

Page 46: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© Bharati Vidyapeeth’s Institute of Computer Applications and Management,, New Delhi-63, by Parul Arora.

Proof TechniquesProof 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

Page 47: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© Bharati Vidyapeeth’s Institute of Computer Applications and Management,, New Delhi-63, by Parul Arora.

Proof TechniquesProof 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

Page 48: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© Bharati Vidyapeeth’s Institute of Computer Applications and Management,, New Delhi-63, by Parul Arora.

Proof TechniquesProof 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

Page 49: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© Bharati Vidyapeeth’s Institute of Computer Applications and Management,, New Delhi-63, by Parul Arora.

Proof TechniquesProof TechniquesProof 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. p1,p2,…,pn

Consider the number q = p1p2…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 primes.

Page 50: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© Bharati Vidyapeeth’s Institute of Computer Applications and Management,, New Delhi-63, by Parul Arora.

Proof TechniquesProof 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 trueAssume that P is true and show that Q is trueAssume that Q is true and show that P is true

Page 51: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© Bharati Vidyapeeth’s Institute of Computer Applications and Management,, New Delhi-63, by Parul Arora.

Proof TechniquesProof Techniques

Proof of Equivalent Statements

Consider the 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?

Page 52: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© 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

Page 53: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© 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.

)1()( iPiP

Page 54: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© Bharati Vidyapeeth’s Institute of Computer Applications and Management , New Delhi-63, by Parul arora

Relations And Functions

Page 55: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© 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.∉

Page 56: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© 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}

Page 57: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© 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 2mn

Since each subset of A X B defines a relation so total no of relation from A to B is 2mn

Page 58: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© 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

Page 59: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© 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 RoS and defined by

RoS = {(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 R2 .

Page 60: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© 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.

Page 61: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© 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

Page 62: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© 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’

Page 63: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© Bharati Vidyapeeth’s Institute of Computer Applications and Management,, New Delhi-63, by Parul Arora.

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.

Domain Co-domain And Range

Page 64: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© Bharati Vidyapeeth’s Institute of Computer Applications and Management,, New Delhi-63, by Parul Arora.

One-to-one function (injection):- if different elements of A have different images in B. For f:-AB f(a) # f(b) for all a,b AMany-to-one function:- if two or more elements of Set A has same images in B.For f:-AB 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 co-domain 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 one-to-one as well as onto then it is bijection.

Type Of Functions

Page 65: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© Bharati Vidyapeeth’s Institute of Computer Applications and Management,, New Delhi-63, by Parul Arora.

Inverse Image Of An Element

Let f : XY 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 : XY 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}

Page 66: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© Bharati Vidyapeeth’s Institute of Computer Applications and Management , New Delhi-63, by Parul arora

Partial Ordered Sets

Page 67: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© 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 aRa (Antisymmetric) if aRb and bRa then a=b (Transitive) if aRb and bRc then aRc.

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.

Page 68: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© 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 7 and 5 are not

Page 69: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© Bharati Vidyapeeth’s Institute of Computer Applications and Management,, New Delhi-63, by Parul Arora.

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

Totally Ordered Set

Page 70: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© Bharati Vidyapeeth’s Institute of Computer Applications and Management , New Delhi-63, by Parul arora

Basic Counting Technique

Page 71: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© 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 n1 ways and a second event F can occur in n2 ways and if both event can not occur simultaneously . Then E or F can occur in n1+n2 ways.

•General Format: suppose an event E1 can occur in n1 ways , a second event E2 can occur in n2 ways , a third event E3 can occur in n3 ways ….. And suppose no two of the event can occur at the same time. Then one of the event can occur in n1+n2+n3…. 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.

Page 72: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© 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 E1 can occur in n1 ways and following E1 event E2

can occur in n2 ways and following E2 a third event E3 can occur in n3 ways and so on. Then all the event can occur in n1.n2.n3….ways

OR Suppose that a procedure can be broken in to a sequence of two

tasks . If there are n1 ways to do the first task and n2 ways to do the second task after the first task has been done then there are n1n2 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.

Page 73: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© Bharati Vidyapeeth’s Institute of Computer Applications and Management,, New Delhi-63, by Parul Arora.

Suppose there are 5 different optional papers to select in third semester and 4 different optional papers to select in 4th 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 4th semester.

By sum rule:- student will have 5+4 choices to select only one paper

Counting Technique

Page 74: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© Bharati Vidyapeeth’s Institute of Computer Applications and Management , New Delhi-63, by Parul arora

Group Theory

Page 75: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© 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, o1,o2,……..on) Where A is a non-empty set and o1,o2,……..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

Page 76: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© Bharati Vidyapeeth’s Institute of Computer Applications and Management,, New Delhi-63, by Parul Arora.

Operations On SetOperations 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 X S into S is called ternary operation

N-ary Operation A function from S X S X S…..X S (up to n factors) in to S is called n-ary operation.

Page 77: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© 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

Page 78: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© 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.

Page 79: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© Bharati Vidyapeeth’s Institute of Computer Applications and Management,, New Delhi-63, by Parul Arora.

Properties Of OperationSuppose 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 * a3) 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 * )

Page 80: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© 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

Page 81: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© 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

Page 82: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© 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.

Page 83: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© 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.

Page 84: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© 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.

Page 85: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© Bharati Vidyapeeth’s Institute of Computer Applications and Management , New Delhi-63, by Parul arora

Graphs and TreesGraphs and Trees

Page 86: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© 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 12 3

4 45 56 6

2 3

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.

Page 87: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© 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 E F

B C V = { A, B, C, D, E, F } |V | = 6

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.

Page 88: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© 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

Page 89: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© 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 one only is called pendant

vertex.

Page 90: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© Bharati Vidyapeeth’s Institute of Computer Applications and Management,, New Delhi-63, by Parul Arora.

A

D E F

B C

The degree of B is 2.

1 2

4 5

The in degree of 2 is 2 andthe out degree of 2 is 3.

Self-loop

Degree of a Vertex

Page 91: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© 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.

Page 92: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© 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.

Page 93: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© Bharati Vidyapeeth’s Institute of Computer Applications and Management,, New Delhi-63, by Parul Arora.

A path is a walk through sequence ,V0,V1,V2….Vn of vertice ,each adjacent to the next ,without any repetition of vertices.if there exists a pth V0 to Vn in an undirected graph, then there always exists a path from Vn to V0 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.

Path And Circuit

Page 94: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© Bharati Vidyapeeth’s Institute of Computer Applications and Management,, New Delhi-63, by Parul Arora.

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 T1, T2, ...., Tk, each of whose roots are connected by a directed edge from r

Trees

Page 95: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© Bharati Vidyapeeth’s Institute of Computer Applications and Management,, New Delhi-63, by Parul Arora.

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

Path And CircuitTrees

Page 96: © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Parul arora Discrete Mathematics.

© Bharati Vidyapeeth’s Institute of Computer Applications and Management,, New Delhi-63, by Parul Arora.

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 leafHeight 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

Trees