main menu main menu (click on the topics below) combinatorics introduction equally likely...

58
Main Menu Main Menu (Click on the topics below) Combinatorics Introduction Equally likely Probability Formula Counting elements of a list Counting elements of a sublist Sum of numbers from 1 to n Pairs of numbers Possibility Trees & The Multiplication Rule Cartesian Product Subsets of A= {a 1 , a 2 ,…, a n } 3 digit numbers with distinct digits Relations from A to B 3 digit +ve odd integers with distinct digits Symmetric Relations Simple Graphs Click on the picture

Upload: neal-harrison

Post on 21-Jan-2016

216 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Main Menu Main Menu (Click on the topics below) Combinatorics Introduction Equally likely Probability Formula Counting elements of a list Counting elements

Main Menu Main Menu (Click on the topics below)

Combinatorics

Introduction

Equally likely Probability Formula

Counting elements of a list

Counting elements of a sublist

Sum of numbers from 1 to n

Pairs of numbersPossibility Trees & The Multiplication Rule

Cartesian Product

Subsets of A= {a1, a2,…, an}

3 digit numbers with distinct digits

Relations from A to B

3 digit +ve odd integers with distinct digits

Symmetric Relations

Simple Graphs

Click on the picture

Page 2: Main Menu Main Menu (Click on the topics below) Combinatorics Introduction Equally likely Probability Formula Counting elements of a list Counting elements

CombinatoricsCombinatoricsCounting the number of possible outcomes.Counting the number of ways a task can be done.

Sanjay Jain, Lecturer, Sanjay Jain, Lecturer,

School of ComputingSchool of Computing

Page 3: Main Menu Main Menu (Click on the topics below) Combinatorics Introduction Equally likely Probability Formula Counting elements of a list Counting elements

Introduction Introduction

Sanjay Jain, Lecturer, Sanjay Jain, Lecturer,

School of ComputingSchool of Computing

Multiplication Rule Examples

Click on the picture

Page 4: Main Menu Main Menu (Click on the topics below) Combinatorics Introduction Equally likely Probability Formula Counting elements of a list Counting elements

CombinatoricsCombinatorics

Counting

Probability To say that a process is random means that when it

takes place, one out of a possible set of outcomes will occur. However it is in general impossible to predict with certainty which of the possible outcomes will occur.

A sample space is the set of all possible outcomes of a random experiment.

An event is a subset of a sample space..

Page 5: Main Menu Main Menu (Click on the topics below) Combinatorics Introduction Equally likely Probability Formula Counting elements of a list Counting elements

ExampleExample

Tossing two coins.Sample Space: {HH, HT, TH, TT}Event: At least one head: {HH, HT, TH}

Page 6: Main Menu Main Menu (Click on the topics below) Combinatorics Introduction Equally likely Probability Formula Counting elements of a list Counting elements

END OF SEGMENT

Page 7: Main Menu Main Menu (Click on the topics below) Combinatorics Introduction Equally likely Probability Formula Counting elements of a list Counting elements

Equally Likely Probability FormulaEqually Likely Probability Formula

Suppose S is a sample space in which all outcomes are equally likely. Suppose E is an event in S. Then the probability of E, denoted by Pr(E) is

Notation: For a set A, #(A) denotes the number of elements in A. Sometimes n(A) or || A || is also used for #(A).Sometimes Prob(E) or P(E) is also used for Pr(E).

)(#

)(#)Pr(

S

EE

Page 8: Main Menu Main Menu (Click on the topics below) Combinatorics Introduction Equally likely Probability Formula Counting elements of a list Counting elements

ExampleExample

Consider the process of drawing a card from a pack of cards.

What is the probability of drawing an Ace? Assume drawing any card is equally likely.Sample Space: S={SA, S2, S3, …., HA, H2,….}.Event: E={SA, HA, DA, CA}#(S)=52#(E)=4Pr(E)=4/52

Page 9: Main Menu Main Menu (Click on the topics below) Combinatorics Introduction Equally likely Probability Formula Counting elements of a list Counting elements

END OF SEGMENT

Page 10: Main Menu Main Menu (Click on the topics below) Combinatorics Introduction Equally likely Probability Formula Counting elements of a list Counting elements

Counting The Elements of A ListCounting The Elements of A List

How many integers are there from 8 through 15?

8 9 10 11 12 13 14 15

1 2 3 4 5 6 7 8

Page 11: Main Menu Main Menu (Click on the topics below) Combinatorics Introduction Equally likely Probability Formula Counting elements of a list Counting elements

TheoremTheorem

If m and n are integers and m n then there are n-m+1 integers from m to n (both inclusive).

Proof: m m+1 m+2 ………………… nm+0 m+1 m+2 …………………m+(n-m)1 2 3 ……………… (n-m)+1

Page 12: Main Menu Main Menu (Click on the topics below) Combinatorics Introduction Equally likely Probability Formula Counting elements of a list Counting elements

END OF SEGMENT

Page 13: Main Menu Main Menu (Click on the topics below) Combinatorics Introduction Equally likely Probability Formula Counting elements of a list Counting elements

Counting Elements of a SublistCounting Elements of a Sublist

How many 3 digit positive integers are divisible by 5?100 105 ………. 99520*5 21*5 ……… 199*520 21 ……….. 199199 -20+1=180

Page 14: Main Menu Main Menu (Click on the topics below) Combinatorics Introduction Equally likely Probability Formula Counting elements of a list Counting elements

END OF SEGMENT

Page 15: Main Menu Main Menu (Click on the topics below) Combinatorics Introduction Equally likely Probability Formula Counting elements of a list Counting elements

Floors and CeilingsFloors and Ceilings

w denotes the largest integer w.For example: 6.9 = 6; -9.2 = -10; 9 = 9

w denotes the smallest integer w.For example: 6.9 =7; -9.2 = -9; 9 = 9

Page 16: Main Menu Main Menu (Click on the topics below) Combinatorics Introduction Equally likely Probability Formula Counting elements of a list Counting elements

END OF SEGMENT

Page 17: Main Menu Main Menu (Click on the topics below) Combinatorics Introduction Equally likely Probability Formula Counting elements of a list Counting elements

Sum of numbers from 1 to nSum of numbers from 1 to nTheorem: 1+2+….+n = n(n+1)/2ProofWe show this by induction on n.For n=1, the above is clearly true.Suppose the theorem holds for n = k.We show the theorem for n = k+1.

1 + 2 + … + k + (k+1)

= [k (k + 1) / 2] + (k+1)

= (k + 2) ( k + 1) / 2

= (k + 1) (k + 2) / 2

Page 18: Main Menu Main Menu (Click on the topics below) Combinatorics Introduction Equally likely Probability Formula Counting elements of a list Counting elements

END OF SEGMENT

Page 19: Main Menu Main Menu (Click on the topics below) Combinatorics Introduction Equally likely Probability Formula Counting elements of a list Counting elements

Pairs of numbers:Pairs of numbers:

How many distinct pairs of numbers (i,j) satisfy the property 1 i < j n?

For any i, 1 i < n, the number of j’s which satisfy 1 i < j n, is n - i.Thus, the number of distinct pairs of numbers (i,j) that

satisfy the property 1 i < j n is

1

1

n

i

in

1

1

*)1(n

i

inn=

2

)1(*)1(

nnnn

=

2

)1( nn

=

Page 20: Main Menu Main Menu (Click on the topics below) Combinatorics Introduction Equally likely Probability Formula Counting elements of a list Counting elements

END OF SEGMENT

Page 21: Main Menu Main Menu (Click on the topics below) Combinatorics Introduction Equally likely Probability Formula Counting elements of a list Counting elements

Possibility TreesPossibility Trees

Coin Toss:

2 ways

TossToss

2 x 2 ways

H T

THH T

Page 22: Main Menu Main Menu (Click on the topics below) Combinatorics Introduction Equally likely Probability Formula Counting elements of a list Counting elements

END OF SEGMENT

Page 23: Main Menu Main Menu (Click on the topics below) Combinatorics Introduction Equally likely Probability Formula Counting elements of a list Counting elements

The Multiplication RuleThe Multiplication RuleTheorem: If an operation (or job) consists of k tasks

(or steps), T1, T2,…, Tk, performed one after another and

T1 can be done in n1 waysT2 can be done in n2 ways (irrespective of how T1 is done)….Tk can be done in nk ways (irrespective of how T1 ... Tk-1 are done)

Then, the entire operation can be done in n1* n2* ….* nk ways.

Page 24: Main Menu Main Menu (Click on the topics below) Combinatorics Introduction Equally likely Probability Formula Counting elements of a list Counting elements

The Multiplication RuleThe Multiplication RuleTheorem: If an operation (or job) consists of k tasks

(or steps), T1, T2,…, Tk, performed one after another and

Ti can be done in ni ways (irrespective of how T1 ... Ti-1 are done)

Caution: Note the independence assumption. One cannot use the multiplication rule unless the independence assumption holds.

Page 25: Main Menu Main Menu (Click on the topics below) Combinatorics Introduction Equally likely Probability Formula Counting elements of a list Counting elements

END OF SEGMENT

Page 26: Main Menu Main Menu (Click on the topics below) Combinatorics Introduction Equally likely Probability Formula Counting elements of a list Counting elements

Cartesian ProductCartesian Product

How many elements are there in A x B?

A= {a1, a2,…., an}

B= {b1, b2,…., bm}

Recall: A X B = {(a,b) : a A and b B}.

Page 27: Main Menu Main Menu (Click on the topics below) Combinatorics Introduction Equally likely Probability Formula Counting elements of a list Counting elements

Cartesian ProductCartesian Product

Job: select an element of A X B. T1: Select an element a of A

T2: Select an element b of B (this gives us an element (a,b) of A X B)

T1 can be done in n ways

T2 can be done in m ways (irrespective of how T1 is done)

by the multiplication rule, the job can be done in n*m ways.

The number of elements of A x B is n*m

Page 28: Main Menu Main Menu (Click on the topics below) Combinatorics Introduction Equally likely Probability Formula Counting elements of a list Counting elements

END OF SEGMENT

Page 29: Main Menu Main Menu (Click on the topics below) Combinatorics Introduction Equally likely Probability Formula Counting elements of a list Counting elements

Subsets of A= {aSubsets of A= {a11, a, a22,…, a,…, ann}}

How many subsets of A={a1, a2,…, an} are there?Job: select a subset of A.

T1: either select or not select a1

T2: either select or not select a2

….

Tn: either select or not select an

Each of these tasks can be done in two ways (irrespective of how the earlier tasks are done).

Thus the number of ways of doing the job is 2n. Therefore, the number of subsets of A is 2n.

Page 30: Main Menu Main Menu (Click on the topics below) Combinatorics Introduction Equally likely Probability Formula Counting elements of a list Counting elements

END OF SEGMENT

Page 31: Main Menu Main Menu (Click on the topics below) Combinatorics Introduction Equally likely Probability Formula Counting elements of a list Counting elements

3 digit numbers with distinct digits3 digit numbers with distinct digits

How many 3 digit numbers with distinct digits are there?

Page 32: Main Menu Main Menu (Click on the topics below) Combinatorics Introduction Equally likely Probability Formula Counting elements of a list Counting elements

3 digit numbers with distinct digits3 digit numbers with distinct digits

How many 3 digit numbers with distinct digits are there? T1: Select the hundred’s digit

T2: Select the ten’s digit

T3: Select the unit’s digit

Page 33: Main Menu Main Menu (Click on the topics below) Combinatorics Introduction Equally likely Probability Formula Counting elements of a list Counting elements

3 digit numbers with distinct digits3 digit numbers with distinct digits

How many 3 digit numbers with distinct digits are there?

T1: Select the hundred’s digit

T1 can be done in 9 ways (digit 0 cannot be selected)

Page 34: Main Menu Main Menu (Click on the topics below) Combinatorics Introduction Equally likely Probability Formula Counting elements of a list Counting elements

3 digit numbers with distinct digits3 digit numbers with distinct digits

How many 3 digit numbers with distinct digits are there?

T2: Select the ten’s digit

T2 can be done in 9 ways (irrespective of how T1 was done). You cannot select the digit chosen in T1

Page 35: Main Menu Main Menu (Click on the topics below) Combinatorics Introduction Equally likely Probability Formula Counting elements of a list Counting elements

3 digit numbers with distinct digits3 digit numbers with distinct digits

How many 3 digit numbers with distinct digits are there?

T3: Select the unit’s digit

T3 can be done in 8 ways (irrespective of how earlier tasks were done). You cannot select the digit chosen in T1 and T2

Page 36: Main Menu Main Menu (Click on the topics below) Combinatorics Introduction Equally likely Probability Formula Counting elements of a list Counting elements

3 digit numbers with distinct digits3 digit numbers with distinct digits

How many 3 digit numbers with distinct digits are there? T1 can be done in 9 ways

T2 can be done in 9 ways

T3 can be done in 8 ways

Therefore, the total number of 3 digit numbers with distinct digits are 9*9*8

Page 37: Main Menu Main Menu (Click on the topics below) Combinatorics Introduction Equally likely Probability Formula Counting elements of a list Counting elements

END OF SEGMENT

Page 38: Main Menu Main Menu (Click on the topics below) Combinatorics Introduction Equally likely Probability Formula Counting elements of a list Counting elements

Relations From A to BRelations From A to BHow many different relations are there from A to B?

A={a1, a2,…., an}, B={b1, b2,…., bm}

T(i,j) : select or not select (ai,aj) as a member of R.

(1 i n and 1 j m)

Note that the total number of tasks is n*m.

Each T(i,j) can be done in 2 ways.

Thus all the tasks can be done in 2n*m waysTotal number of relations is: 2n*m

Page 39: Main Menu Main Menu (Click on the topics below) Combinatorics Introduction Equally likely Probability Formula Counting elements of a list Counting elements

Relations From A to BRelations From A to B

Another Method: A relation is a subset of A X B.Number of elements in A X B = n*mnumber of subsets of A X B = 2n*m

How many different relations are there from A to B?A={a1, a2,…., an}, B={b1, b2,…., bm}

Page 40: Main Menu Main Menu (Click on the topics below) Combinatorics Introduction Equally likely Probability Formula Counting elements of a list Counting elements

END OF SEGMENT

Page 41: Main Menu Main Menu (Click on the topics below) Combinatorics Introduction Equally likely Probability Formula Counting elements of a list Counting elements

Be careful in using the Multiplication RuleBe careful in using the Multiplication Rule

How many 3 digit +ve odd integers have distinct digits? T1: Select the hundred’s digit

T2: Select the ten’s digit

T3: Select the unit’s digit

Page 42: Main Menu Main Menu (Click on the topics below) Combinatorics Introduction Equally likely Probability Formula Counting elements of a list Counting elements

3 digit +ve odd integers3 digit +ve odd integers

How many 3 digit +ve odd integers have distinct digits? T1: Select the hundred’s digit

T1 can be done in 9 ways

Page 43: Main Menu Main Menu (Click on the topics below) Combinatorics Introduction Equally likely Probability Formula Counting elements of a list Counting elements

3 digit +ve odd integers3 digit +ve odd integers

How many 3 digit +ve odd integers have distinct digits? T2: Select the ten’s digit

T2 can be done in 9 ways (irrespective of how T1 was done). You cannot select the digit chosen in T1

Page 44: Main Menu Main Menu (Click on the topics below) Combinatorics Introduction Equally likely Probability Formula Counting elements of a list Counting elements

3 digit +ve odd integers3 digit +ve odd integers

How many 3 digit +ve odd integers have distinct digits? T3: Select the unit’s digit

T3 can be done in ? ways (the number of ways is either 3 or 4 or 5 depending on how exactly T1 and T2 were done).

Page 45: Main Menu Main Menu (Click on the topics below) Combinatorics Introduction Equally likely Probability Formula Counting elements of a list Counting elements

3 digit +ve odd integers3 digit +ve odd integers

How many 3 digit +ve odd integers have distinct digits? T1 can be done in 9 ways

T2 can be done in 9 ways

T3 can be done in ? ways

Therefore, the Multiplication Rule may not always be applicable.

However, for this problem one can use the Multiplication Rule by reordering tasks.

Page 46: Main Menu Main Menu (Click on the topics below) Combinatorics Introduction Equally likely Probability Formula Counting elements of a list Counting elements

3 digit +ve odd integers3 digit +ve odd integers

How many 3 digit +ve odd integers have distinct digits? (reordering tasks) T1: Select the unit’s digit

T2: Select the hundred’s digit

T3: Select the ten’s digit

Page 47: Main Menu Main Menu (Click on the topics below) Combinatorics Introduction Equally likely Probability Formula Counting elements of a list Counting elements

3 digit +ve odd integers3 digit +ve odd integers

How many 3 digit +ve odd integers have distinct digits? (reordering tasks) T1: Select the unit’s digit

T1 can be done in 5 ways

Page 48: Main Menu Main Menu (Click on the topics below) Combinatorics Introduction Equally likely Probability Formula Counting elements of a list Counting elements

3 digit +ve odd integers3 digit +ve odd integers

How many 3 digit +ve odd integers have distinct digits? (reordering tasks) T2: Select the hundred’s digit

T2 can be done in 8 ways (irrespective of how T1 was done).

Page 49: Main Menu Main Menu (Click on the topics below) Combinatorics Introduction Equally likely Probability Formula Counting elements of a list Counting elements

3 digit +ve odd integers3 digit +ve odd integers

How many 3 digit +ve odd integers have distinct digits? (reordering tasks) T3: Select the ten’s digit

T3 can be done in 8 ways (irrespective of how T1

and T2 are done).

Page 50: Main Menu Main Menu (Click on the topics below) Combinatorics Introduction Equally likely Probability Formula Counting elements of a list Counting elements

3 digit +ve odd integers3 digit +ve odd integers

How many 3 digit +ve odd integers have distinct digits? (reordering tasks) T1 can be done in 5 ways

T2 can be done in 8 ways

T3 can be done in 8 ways

Therefore, the total number of 3 digit +ve odd integers with distinct digits is 5*8*8

Page 51: Main Menu Main Menu (Click on the topics below) Combinatorics Introduction Equally likely Probability Formula Counting elements of a list Counting elements

END OF SEGMENT

Page 52: Main Menu Main Menu (Click on the topics below) Combinatorics Introduction Equally likely Probability Formula Counting elements of a list Counting elements

Symmetric RelationsSymmetric RelationsSuppose A ={a1,a2,…,an}.How many symmetric relations can be defined on A?We will show that it is 2n(n+1)/2

Recall: for a relation to be symmetric, for each i, j, either both (ai,aj) and (aj,ai) are in R or both are not in R.

Divide the job of selecting a symmetric relation R into the following tasks.

Si (for 1 i n)

Either select or not select (ai,ai) in R

T(i,j) (for 1 i < j n)

Either select or not select both (ai,aj) and (aj,ai) in R

Note that the number of different T(i,j) 's are (n-1)n/2

Page 53: Main Menu Main Menu (Click on the topics below) Combinatorics Introduction Equally likely Probability Formula Counting elements of a list Counting elements

Symmetric RelationsSymmetric Relations

Si (for 1i n)

Either select or not select (ai,ai) in R

T(i,j) (for 1i<j n)

Either select or not select both (ai,aj) and (aj,ai) in R

Each Si and T(i,j) can be done in exactly 2 ways.Thus the total number of symmetric relations on A are(2*2*…*2) * (2*2*….*2)

(there are n 2’s in the first group, and ((n-1)n/2) 2’s in the second group)

=2n*2n(n-1)/2

=2n(n+1)/2

Page 54: Main Menu Main Menu (Click on the topics below) Combinatorics Introduction Equally likely Probability Formula Counting elements of a list Counting elements

END OF SEGMENT

Page 55: Main Menu Main Menu (Click on the topics below) Combinatorics Introduction Equally likely Probability Formula Counting elements of a list Counting elements

Simple GraphsSimple GraphsHow many simple undirected graphs are there with n vertices?

This is similar to symmetric relations except that Si’s are not there.

T(i,j) (for 1 i < j n)

Either select or not select the edge {vi,vj} (= {vj,vi})

Note that the number of different T(i,j) 's are (n-1)n/2

Each T(i,j) can be done in exactly 2 ways.Thus the total number of simple graphs is2*2*….*2

(there are ((n-1)n/2) 2’s )=2n(n-1)/2

Page 56: Main Menu Main Menu (Click on the topics below) Combinatorics Introduction Equally likely Probability Formula Counting elements of a list Counting elements

END OF SEGMENT

Page 57: Main Menu Main Menu (Click on the topics below) Combinatorics Introduction Equally likely Probability Formula Counting elements of a list Counting elements

SummarySummary

Multiplication Rule Remember the conditions under which multiplication

rule is applicable, specially note the independence assumption

Click on the picture

Page 58: Main Menu Main Menu (Click on the topics below) Combinatorics Introduction Equally likely Probability Formula Counting elements of a list Counting elements

Follow-UpFollow-Up

Explain assignments. List books, articles, electronic sources. If appropriate, give an introduction to the next lecture in

the series.

Click on the picture