sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

408
Lecture 14 What’s to come?

Upload: others

Post on 19-Oct-2019

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Lecture 14

What’s to come?

Probability.

A bag contains:

What is the chance that a ball taken from the bag is blue?

Count blue. Count total. Divide.

Today: Counting!

Later: Probability. Professor Walrand.

Page 2: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Lecture 14

What’s to come? Probability.

A bag contains:

What is the chance that a ball taken from the bag is blue?

Count blue. Count total. Divide.

Today: Counting!

Later: Probability. Professor Walrand.

Page 3: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Lecture 14

What’s to come? Probability.

A bag contains:

What is the chance that a ball taken from the bag is blue?

Count blue. Count total. Divide.

Today: Counting!

Later: Probability. Professor Walrand.

Page 4: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Lecture 14

What’s to come? Probability.

A bag contains:

What is the chance that a ball taken from the bag is blue?

Count blue. Count total. Divide.

Today: Counting!

Later: Probability. Professor Walrand.

Page 5: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Lecture 14

What’s to come? Probability.

A bag contains:

What is the chance that a ball taken from the bag is blue?

Count blue. Count total. Divide.

Today: Counting!

Later: Probability. Professor Walrand.

Page 6: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Lecture 14

What’s to come? Probability.

A bag contains:

What is the chance that a ball taken from the bag is blue?

Count blue.

Count total. Divide.

Today: Counting!

Later: Probability. Professor Walrand.

Page 7: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Lecture 14

What’s to come? Probability.

A bag contains:

What is the chance that a ball taken from the bag is blue?

Count blue. Count total.

Divide.

Today: Counting!

Later: Probability. Professor Walrand.

Page 8: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Lecture 14

What’s to come? Probability.

A bag contains:

What is the chance that a ball taken from the bag is blue?

Count blue. Count total. Divide.

Today: Counting!

Later: Probability. Professor Walrand.

Page 9: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Lecture 14

What’s to come? Probability.

A bag contains:

What is the chance that a ball taken from the bag is blue?

Count blue. Count total. Divide.

Today:

Counting!

Later: Probability. Professor Walrand.

Page 10: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Lecture 14

What’s to come? Probability.

A bag contains:

What is the chance that a ball taken from the bag is blue?

Count blue. Count total. Divide.

Today: Counting!

Later: Probability. Professor Walrand.

Page 11: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Lecture 14

What’s to come? Probability.

A bag contains:

What is the chance that a ball taken from the bag is blue?

Count blue. Count total. Divide.

Today: Counting!

Later: Probability.

Professor Walrand.

Page 12: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Lecture 14

What’s to come? Probability.

A bag contains:

What is the chance that a ball taken from the bag is blue?

Count blue. Count total. Divide.

Today: Counting!

Later: Probability. Professor Walrand.

Page 13: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Outline: basics

1. Counting.

2. Tree

3. Rules of Counting

4. Sample with/without replacement where order does/doesn’tmatter.

Page 14: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Probability is soon..but first let’s count.

Page 15: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Count?

How many outcomes possible for k coin tosses?How many poker hands?How many handshakes for n people?How many diagonals in a convex polygon?How many 10 digit numbers?How many 10 digit numbers without repetition?

Page 16: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Using a tree..

How many 3-bit strings?

How many different sequences of three bits from {0,1}?How would you make one sequence?How many different ways to do that making?

000

0

001

1

0

010

0

011

1

1

0

100

0

101

1

0

110

0

111

1

1

1

8 leaves which is 2×2×2. One leaf for each string.8 3-bit srings!

Page 17: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Using a tree..

How many 3-bit strings?How many different sequences of three bits from {0,1}?

How would you make one sequence?How many different ways to do that making?

000

0

001

1

0

010

0

011

1

1

0

100

0

101

1

0

110

0

111

1

1

1

8 leaves which is 2×2×2. One leaf for each string.8 3-bit srings!

Page 18: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Using a tree..

How many 3-bit strings?How many different sequences of three bits from {0,1}?How would you make one sequence?

How many different ways to do that making?

000

0

001

1

0

010

0

011

1

1

0

100

0

101

1

0

110

0

111

1

1

1

8 leaves which is 2×2×2. One leaf for each string.8 3-bit srings!

Page 19: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Using a tree..

How many 3-bit strings?How many different sequences of three bits from {0,1}?How would you make one sequence?How many different ways to do that making?

000

0

001

1

0

010

0

011

1

1

0

100

0

101

1

0

110

0

111

1

1

1

8 leaves which is 2×2×2. One leaf for each string.8 3-bit srings!

Page 20: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Using a tree..

How many 3-bit strings?How many different sequences of three bits from {0,1}?How would you make one sequence?How many different ways to do that making?

000

0

001

1

0

010

0

011

1

1

0

100

0

101

1

0

110

0

111

1

1

1

8 leaves which is 2×2×2. One leaf for each string.8 3-bit srings!

Page 21: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Using a tree..

How many 3-bit strings?How many different sequences of three bits from {0,1}?How would you make one sequence?How many different ways to do that making?

000

0

001

1

0

010

0

011

1

1

0

100

0

101

1

0

110

0

111

1

1

1

8 leaves which is 2×2×2. One leaf for each string.8 3-bit srings!

Page 22: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Using a tree..

How many 3-bit strings?How many different sequences of three bits from {0,1}?How would you make one sequence?How many different ways to do that making?

000

0

001

1

0

010

0

011

1

1

0

100

0

101

1

0

110

0

111

1

1

1

8 leaves which is 2×2×2. One leaf for each string.8 3-bit srings!

Page 23: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Using a tree..

How many 3-bit strings?How many different sequences of three bits from {0,1}?How would you make one sequence?How many different ways to do that making?

000

0

001

1

0

010

0

011

1

1

0

100

0

101

1

0

110

0

111

1

1

1

8 leaves which is 2×2×2. One leaf for each string.8 3-bit srings!

Page 24: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Using a tree..

How many 3-bit strings?How many different sequences of three bits from {0,1}?How would you make one sequence?How many different ways to do that making?

000

0

001

1

0

010

0

011

1

1

0

100

0

101

1

0

110

0

111

1

1

1

8 leaves which is 2×2×2. One leaf for each string.8 3-bit srings!

Page 25: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Using a tree..

How many 3-bit strings?How many different sequences of three bits from {0,1}?How would you make one sequence?How many different ways to do that making?

000

0

001

1

0

010

0

011

1

1

0

100

0

101

1

0

110

0

111

1

1

1

8 leaves which is 2×2×2.

One leaf for each string.8 3-bit srings!

Page 26: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Using a tree..

How many 3-bit strings?How many different sequences of three bits from {0,1}?How would you make one sequence?How many different ways to do that making?

000

0

001

1

0

010

0

011

1

1

0

100

0

101

1

0

110

0

111

1

1

1

8 leaves which is 2×2×2. One leaf for each string.

8 3-bit srings!

Page 27: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Using a tree..

How many 3-bit strings?How many different sequences of three bits from {0,1}?How would you make one sequence?How many different ways to do that making?

000

0

001

1

0

010

0

011

1

1

0

100

0

101

1

0

110

0

111

1

1

1

8 leaves which is 2×2×2. One leaf for each string.

8 3-bit srings!

Page 28: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Using a tree..

How many 3-bit strings?How many different sequences of three bits from {0,1}?How would you make one sequence?How many different ways to do that making?

000

0

001

1

0

010

0

011

1

1

0

100

0

101

1

0

110

0

111

1

1

1

8 leaves which is 2×2×2. One leaf for each string.8 3-bit srings!

Page 29: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

First Rule of Counting: Product Rule

Objects made by choosing from n1, then n2, . . ., then nkthe number of objects is n1×n2 · · ·×nk .

n1

×n2

×n3

· · · · · · · · · · · ·In picture, 2×2×3 = 12!

Page 30: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

First Rule of Counting: Product Rule

Objects made by choosing from n1, then n2, . . ., then nkthe number of objects is n1×n2 · · ·×nk .

n1

×n2

×n3

· · · · · · · · · · · ·

In picture, 2×2×3 = 12!

Page 31: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

First Rule of Counting: Product Rule

Objects made by choosing from n1, then n2, . . ., then nkthe number of objects is n1×n2 · · ·×nk .

n1

×n2

×n3

· · · · · · · · · · · ·

In picture, 2×2×3 = 12!

Page 32: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

First Rule of Counting: Product Rule

Objects made by choosing from n1, then n2, . . ., then nkthe number of objects is n1×n2 · · ·×nk .

n1

×n2

×n3

· · · · · · · · · · · ·

In picture, 2×2×3 = 12!

Page 33: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

First Rule of Counting: Product Rule

Objects made by choosing from n1, then n2, . . ., then nkthe number of objects is n1×n2 · · ·×nk .

n1

×n2

×n3

· · · · · · · · · · · ·

In picture, 2×2×3 = 12!

Page 34: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

First Rule of Counting: Product Rule

Objects made by choosing from n1, then n2, . . ., then nkthe number of objects is n1×n2 · · ·×nk .

n1

×n2

×n3

· · · · · · · · · · · ·In picture, 2×2×3 = 12!

Page 35: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

First Rule of Counting: Product Rule

Objects made by choosing from n1, then n2, . . ., then nkthe number of objects is n1×n2 · · ·×nk .

n1

×n2

×n3

· · · · · · · · · · · ·In picture, 2×2×3 = 12!

Page 36: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Using the first rule..

How many outcomes possible for k coin tosses?

2 ways for first choice, 2 ways for second choice, ...2×2 · · · ×2 = 2k

How many 10 digit numbers?

10 ways for first choice, 10 ways for second choice, ...10×10 · · · ×10 = 10k

How many n digit base m numbers?

m ways for first, m ways for second, ...mn

Page 37: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Using the first rule..

How many outcomes possible for k coin tosses?

2 ways for first choice,

2 ways for second choice, ...2×2 · · · ×2 = 2k

How many 10 digit numbers?

10 ways for first choice, 10 ways for second choice, ...10×10 · · · ×10 = 10k

How many n digit base m numbers?

m ways for first, m ways for second, ...mn

Page 38: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Using the first rule..

How many outcomes possible for k coin tosses?

2 ways for first choice, 2 ways for second choice, ...

2×2 · · · ×2 = 2k

How many 10 digit numbers?

10 ways for first choice, 10 ways for second choice, ...10×10 · · · ×10 = 10k

How many n digit base m numbers?

m ways for first, m ways for second, ...mn

Page 39: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Using the first rule..

How many outcomes possible for k coin tosses?

2 ways for first choice, 2 ways for second choice, ...2

×2 · · · ×2 = 2k

How many 10 digit numbers?

10 ways for first choice, 10 ways for second choice, ...10×10 · · · ×10 = 10k

How many n digit base m numbers?

m ways for first, m ways for second, ...mn

Page 40: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Using the first rule..

How many outcomes possible for k coin tosses?

2 ways for first choice, 2 ways for second choice, ...2×2

· · · ×2 = 2k

How many 10 digit numbers?

10 ways for first choice, 10 ways for second choice, ...10×10 · · · ×10 = 10k

How many n digit base m numbers?

m ways for first, m ways for second, ...mn

Page 41: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Using the first rule..

How many outcomes possible for k coin tosses?

2 ways for first choice, 2 ways for second choice, ...2×2 · · ·

×2 = 2k

How many 10 digit numbers?

10 ways for first choice, 10 ways for second choice, ...10×10 · · · ×10 = 10k

How many n digit base m numbers?

m ways for first, m ways for second, ...mn

Page 42: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Using the first rule..

How many outcomes possible for k coin tosses?

2 ways for first choice, 2 ways for second choice, ...2×2 · · · ×2

= 2k

How many 10 digit numbers?

10 ways for first choice, 10 ways for second choice, ...10×10 · · · ×10 = 10k

How many n digit base m numbers?

m ways for first, m ways for second, ...mn

Page 43: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Using the first rule..

How many outcomes possible for k coin tosses?

2 ways for first choice, 2 ways for second choice, ...2×2 · · · ×2 = 2k

How many 10 digit numbers?

10 ways for first choice, 10 ways for second choice, ...10×10 · · · ×10 = 10k

How many n digit base m numbers?

m ways for first, m ways for second, ...mn

Page 44: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Using the first rule..

How many outcomes possible for k coin tosses?

2 ways for first choice, 2 ways for second choice, ...2×2 · · · ×2 = 2k

How many 10 digit numbers?

10 ways for first choice, 10 ways for second choice, ...10×10 · · · ×10 = 10k

How many n digit base m numbers?

m ways for first, m ways for second, ...mn

Page 45: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Using the first rule..

How many outcomes possible for k coin tosses?

2 ways for first choice, 2 ways for second choice, ...2×2 · · · ×2 = 2k

How many 10 digit numbers?

10 ways for first choice,

10 ways for second choice, ...10×10 · · · ×10 = 10k

How many n digit base m numbers?

m ways for first, m ways for second, ...mn

Page 46: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Using the first rule..

How many outcomes possible for k coin tosses?

2 ways for first choice, 2 ways for second choice, ...2×2 · · · ×2 = 2k

How many 10 digit numbers?

10 ways for first choice, 10 ways for second choice, ...

10×10 · · · ×10 = 10k

How many n digit base m numbers?

m ways for first, m ways for second, ...mn

Page 47: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Using the first rule..

How many outcomes possible for k coin tosses?

2 ways for first choice, 2 ways for second choice, ...2×2 · · · ×2 = 2k

How many 10 digit numbers?

10 ways for first choice, 10 ways for second choice, ...10

×10 · · · ×10 = 10k

How many n digit base m numbers?

m ways for first, m ways for second, ...mn

Page 48: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Using the first rule..

How many outcomes possible for k coin tosses?

2 ways for first choice, 2 ways for second choice, ...2×2 · · · ×2 = 2k

How many 10 digit numbers?

10 ways for first choice, 10 ways for second choice, ...10×

10 · · · ×10 = 10k

How many n digit base m numbers?

m ways for first, m ways for second, ...mn

Page 49: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Using the first rule..

How many outcomes possible for k coin tosses?

2 ways for first choice, 2 ways for second choice, ...2×2 · · · ×2 = 2k

How many 10 digit numbers?

10 ways for first choice, 10 ways for second choice, ...10×10 · · ·

×10 = 10k

How many n digit base m numbers?

m ways for first, m ways for second, ...mn

Page 50: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Using the first rule..

How many outcomes possible for k coin tosses?

2 ways for first choice, 2 ways for second choice, ...2×2 · · · ×2 = 2k

How many 10 digit numbers?

10 ways for first choice, 10 ways for second choice, ...10×10 · · · ×10

= 10k

How many n digit base m numbers?

m ways for first, m ways for second, ...mn

Page 51: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Using the first rule..

How many outcomes possible for k coin tosses?

2 ways for first choice, 2 ways for second choice, ...2×2 · · · ×2 = 2k

How many 10 digit numbers?

10 ways for first choice, 10 ways for second choice, ...10×10 · · · ×10 = 10k

How many n digit base m numbers?

m ways for first, m ways for second, ...mn

Page 52: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Using the first rule..

How many outcomes possible for k coin tosses?

2 ways for first choice, 2 ways for second choice, ...2×2 · · · ×2 = 2k

How many 10 digit numbers?

10 ways for first choice, 10 ways for second choice, ...10×10 · · · ×10 = 10k

How many n digit base m numbers?

m ways for first, m ways for second, ...mn

Page 53: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Using the first rule..

How many outcomes possible for k coin tosses?

2 ways for first choice, 2 ways for second choice, ...2×2 · · · ×2 = 2k

How many 10 digit numbers?

10 ways for first choice, 10 ways for second choice, ...10×10 · · · ×10 = 10k

How many n digit base m numbers?

m ways for first,

m ways for second, ...mn

Page 54: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Using the first rule..

How many outcomes possible for k coin tosses?

2 ways for first choice, 2 ways for second choice, ...2×2 · · · ×2 = 2k

How many 10 digit numbers?

10 ways for first choice, 10 ways for second choice, ...10×10 · · · ×10 = 10k

How many n digit base m numbers?

m ways for first, m ways for second, ...

mn

Page 55: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Using the first rule..

How many outcomes possible for k coin tosses?

2 ways for first choice, 2 ways for second choice, ...2×2 · · · ×2 = 2k

How many 10 digit numbers?

10 ways for first choice, 10 ways for second choice, ...10×10 · · · ×10 = 10k

How many n digit base m numbers?

m ways for first, m ways for second, ...mn

Page 56: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Functions, polynomials.

How many functions f mapping S to T ?

|T | ways to choose for f (s1), |T | ways to choose for f (s2), ...

....|T ||S|

How many polynomials of degree d modulo p?

p ways to choose for first coefficient, p ways for second, ......pd+1

p values for first point, p values for second, ......pd+1

Questions?

Page 57: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Functions, polynomials.

How many functions f mapping S to T ?

|T | ways to choose for f (s1),

|T | ways to choose for f (s2), ...

....|T ||S|

How many polynomials of degree d modulo p?

p ways to choose for first coefficient, p ways for second, ......pd+1

p values for first point, p values for second, ......pd+1

Questions?

Page 58: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Functions, polynomials.

How many functions f mapping S to T ?

|T | ways to choose for f (s1), |T | ways to choose for f (s2), ...

....|T ||S|

How many polynomials of degree d modulo p?

p ways to choose for first coefficient, p ways for second, ......pd+1

p values for first point, p values for second, ......pd+1

Questions?

Page 59: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Functions, polynomials.

How many functions f mapping S to T ?

|T | ways to choose for f (s1), |T | ways to choose for f (s2), ...

....|T ||S|

How many polynomials of degree d modulo p?

p ways to choose for first coefficient, p ways for second, ......pd+1

p values for first point, p values for second, ......pd+1

Questions?

Page 60: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Functions, polynomials.

How many functions f mapping S to T ?

|T | ways to choose for f (s1), |T | ways to choose for f (s2), ...

....|T ||S|

How many polynomials of degree d modulo p?

p ways to choose for first coefficient, p ways for second, ......pd+1

p values for first point, p values for second, ......pd+1

Questions?

Page 61: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Functions, polynomials.

How many functions f mapping S to T ?

|T | ways to choose for f (s1), |T | ways to choose for f (s2), ...

....|T ||S|

How many polynomials of degree d modulo p?

p ways to choose for first coefficient,

p ways for second, ......pd+1

p values for first point, p values for second, ......pd+1

Questions?

Page 62: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Functions, polynomials.

How many functions f mapping S to T ?

|T | ways to choose for f (s1), |T | ways to choose for f (s2), ...

....|T ||S|

How many polynomials of degree d modulo p?

p ways to choose for first coefficient, p ways for second, ...

...pd+1

p values for first point, p values for second, ......pd+1

Questions?

Page 63: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Functions, polynomials.

How many functions f mapping S to T ?

|T | ways to choose for f (s1), |T | ways to choose for f (s2), ...

....|T ||S|

How many polynomials of degree d modulo p?

p ways to choose for first coefficient, p ways for second, ......pd+1

p values for first point, p values for second, ......pd+1

Questions?

Page 64: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Functions, polynomials.

How many functions f mapping S to T ?

|T | ways to choose for f (s1), |T | ways to choose for f (s2), ...

....|T ||S|

How many polynomials of degree d modulo p?

p ways to choose for first coefficient, p ways for second, ......pd+1

p values for first point,

p values for second, ......pd+1

Questions?

Page 65: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Functions, polynomials.

How many functions f mapping S to T ?

|T | ways to choose for f (s1), |T | ways to choose for f (s2), ...

....|T ||S|

How many polynomials of degree d modulo p?

p ways to choose for first coefficient, p ways for second, ......pd+1

p values for first point, p values for second, ...

...pd+1

Questions?

Page 66: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Functions, polynomials.

How many functions f mapping S to T ?

|T | ways to choose for f (s1), |T | ways to choose for f (s2), ...

....|T ||S|

How many polynomials of degree d modulo p?

p ways to choose for first coefficient, p ways for second, ......pd+1

p values for first point, p values for second, ......pd+1

Questions?

Page 67: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Functions, polynomials.

How many functions f mapping S to T ?

|T | ways to choose for f (s1), |T | ways to choose for f (s2), ...

....|T ||S|

How many polynomials of degree d modulo p?

p ways to choose for first coefficient, p ways for second, ......pd+1

p values for first point, p values for second, ......pd+1

Questions?

Page 68: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Permutations.

How many 10 digit numbers without repeating a digit?

10 ways for first, 9 ways for second, 8 ways for third, ...

... 10∗9∗8 · · · ∗1 = 10!.1

How many different samples of size k from n numbers withoutreplacement.

n ways for first choice, n−1 ways for second,n−2 choices for third, ...

... n ∗ (n−1)∗ (n−2) · ∗(n−k + 1) = n!(n−k)! .

How many orderings of n objects are there?Permutations of n objects.

n ways for first, n−1 ways for second,n−2 ways for third, ...

... n ∗ (n−1)∗ (n−2) · ∗1 = n!.

1By definition: 0! = 1.

Page 69: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Permutations.

How many 10 digit numbers without repeating a digit?

10 ways for first, 9 ways for second, 8 ways for third, ...

... 10∗9∗8 · · · ∗1 = 10!.1

How many different samples of size k from n numbers withoutreplacement.

n ways for first choice, n−1 ways for second,n−2 choices for third, ...

... n ∗ (n−1)∗ (n−2) · ∗(n−k + 1) = n!(n−k)! .

How many orderings of n objects are there?Permutations of n objects.

n ways for first, n−1 ways for second,n−2 ways for third, ...

... n ∗ (n−1)∗ (n−2) · ∗1 = n!.

1By definition: 0! = 1.

Page 70: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Permutations.

How many 10 digit numbers without repeating a digit?

10 ways for first,

9 ways for second, 8 ways for third, ...

... 10∗9∗8 · · · ∗1 = 10!.1

How many different samples of size k from n numbers withoutreplacement.

n ways for first choice, n−1 ways for second,n−2 choices for third, ...

... n ∗ (n−1)∗ (n−2) · ∗(n−k + 1) = n!(n−k)! .

How many orderings of n objects are there?Permutations of n objects.

n ways for first, n−1 ways for second,n−2 ways for third, ...

... n ∗ (n−1)∗ (n−2) · ∗1 = n!.

1By definition: 0! = 1.

Page 71: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Permutations.

How many 10 digit numbers without repeating a digit?

10 ways for first, 9 ways for second,

8 ways for third, ...

... 10∗9∗8 · · · ∗1 = 10!.1

How many different samples of size k from n numbers withoutreplacement.

n ways for first choice, n−1 ways for second,n−2 choices for third, ...

... n ∗ (n−1)∗ (n−2) · ∗(n−k + 1) = n!(n−k)! .

How many orderings of n objects are there?Permutations of n objects.

n ways for first, n−1 ways for second,n−2 ways for third, ...

... n ∗ (n−1)∗ (n−2) · ∗1 = n!.

1By definition: 0! = 1.

Page 72: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Permutations.

How many 10 digit numbers without repeating a digit?

10 ways for first, 9 ways for second, 8 ways for third,

...

... 10∗9∗8 · · · ∗1 = 10!.1

How many different samples of size k from n numbers withoutreplacement.

n ways for first choice, n−1 ways for second,n−2 choices for third, ...

... n ∗ (n−1)∗ (n−2) · ∗(n−k + 1) = n!(n−k)! .

How many orderings of n objects are there?Permutations of n objects.

n ways for first, n−1 ways for second,n−2 ways for third, ...

... n ∗ (n−1)∗ (n−2) · ∗1 = n!.

1By definition: 0! = 1.

Page 73: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Permutations.

How many 10 digit numbers without repeating a digit?

10 ways for first, 9 ways for second, 8 ways for third, ...

... 10∗9∗8 · · · ∗1 = 10!.1

How many different samples of size k from n numbers withoutreplacement.

n ways for first choice, n−1 ways for second,n−2 choices for third, ...

... n ∗ (n−1)∗ (n−2) · ∗(n−k + 1) = n!(n−k)! .

How many orderings of n objects are there?Permutations of n objects.

n ways for first, n−1 ways for second,n−2 ways for third, ...

... n ∗ (n−1)∗ (n−2) · ∗1 = n!.

1By definition: 0! = 1.

Page 74: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Permutations.

How many 10 digit numbers without repeating a digit?

10 ways for first, 9 ways for second, 8 ways for third, ...

... 10∗9∗8 · · · ∗1 = 10!.1

How many different samples of size k from n numbers withoutreplacement.

n ways for first choice, n−1 ways for second,n−2 choices for third, ...

... n ∗ (n−1)∗ (n−2) · ∗(n−k + 1) = n!(n−k)! .

How many orderings of n objects are there?Permutations of n objects.

n ways for first, n−1 ways for second,n−2 ways for third, ...

... n ∗ (n−1)∗ (n−2) · ∗1 = n!.

1By definition: 0! = 1.

Page 75: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Permutations.

How many 10 digit numbers without repeating a digit?

10 ways for first, 9 ways for second, 8 ways for third, ...

... 10∗9∗8 · · · ∗1 = 10!.1

How many different samples of size k from n numbers withoutreplacement.

n ways for first choice, n−1 ways for second,n−2 choices for third, ...

... n ∗ (n−1)∗ (n−2) · ∗(n−k + 1) = n!(n−k)! .

How many orderings of n objects are there?Permutations of n objects.

n ways for first, n−1 ways for second,n−2 ways for third, ...

... n ∗ (n−1)∗ (n−2) · ∗1 = n!.

1By definition: 0! = 1.

Page 76: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Permutations.

How many 10 digit numbers without repeating a digit?

10 ways for first, 9 ways for second, 8 ways for third, ...

... 10∗9∗8 · · · ∗1 = 10!.1

How many different samples of size k from n numbers withoutreplacement.

n ways for first choice,

n−1 ways for second,n−2 choices for third, ...

... n ∗ (n−1)∗ (n−2) · ∗(n−k + 1) = n!(n−k)! .

How many orderings of n objects are there?Permutations of n objects.

n ways for first, n−1 ways for second,n−2 ways for third, ...

... n ∗ (n−1)∗ (n−2) · ∗1 = n!.

1By definition: 0! = 1.

Page 77: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Permutations.

How many 10 digit numbers without repeating a digit?

10 ways for first, 9 ways for second, 8 ways for third, ...

... 10∗9∗8 · · · ∗1 = 10!.1

How many different samples of size k from n numbers withoutreplacement.

n ways for first choice, n−1 ways for second,

n−2 choices for third, ...

... n ∗ (n−1)∗ (n−2) · ∗(n−k + 1) = n!(n−k)! .

How many orderings of n objects are there?Permutations of n objects.

n ways for first, n−1 ways for second,n−2 ways for third, ...

... n ∗ (n−1)∗ (n−2) · ∗1 = n!.

1By definition: 0! = 1.

Page 78: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Permutations.

How many 10 digit numbers without repeating a digit?

10 ways for first, 9 ways for second, 8 ways for third, ...

... 10∗9∗8 · · · ∗1 = 10!.1

How many different samples of size k from n numbers withoutreplacement.

n ways for first choice, n−1 ways for second,n−2 choices for third,

...

... n ∗ (n−1)∗ (n−2) · ∗(n−k + 1) = n!(n−k)! .

How many orderings of n objects are there?Permutations of n objects.

n ways for first, n−1 ways for second,n−2 ways for third, ...

... n ∗ (n−1)∗ (n−2) · ∗1 = n!.

1By definition: 0! = 1.

Page 79: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Permutations.

How many 10 digit numbers without repeating a digit?

10 ways for first, 9 ways for second, 8 ways for third, ...

... 10∗9∗8 · · · ∗1 = 10!.1

How many different samples of size k from n numbers withoutreplacement.

n ways for first choice, n−1 ways for second,n−2 choices for third, ...

... n ∗ (n−1)∗ (n−2) · ∗(n−k + 1) = n!(n−k)! .

How many orderings of n objects are there?Permutations of n objects.

n ways for first, n−1 ways for second,n−2 ways for third, ...

... n ∗ (n−1)∗ (n−2) · ∗1 = n!.

1By definition: 0! = 1.

Page 80: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Permutations.

How many 10 digit numbers without repeating a digit?

10 ways for first, 9 ways for second, 8 ways for third, ...

... 10∗9∗8 · · · ∗1 = 10!.1

How many different samples of size k from n numbers withoutreplacement.

n ways for first choice, n−1 ways for second,n−2 choices for third, ...

... n ∗ (n−1)∗ (n−2) · ∗(n−k + 1) = n!(n−k)! .

How many orderings of n objects are there?Permutations of n objects.

n ways for first, n−1 ways for second,n−2 ways for third, ...

... n ∗ (n−1)∗ (n−2) · ∗1 = n!.

1By definition: 0! = 1.

Page 81: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Permutations.

How many 10 digit numbers without repeating a digit?

10 ways for first, 9 ways for second, 8 ways for third, ...

... 10∗9∗8 · · · ∗1 = 10!.1

How many different samples of size k from n numbers withoutreplacement.

n ways for first choice, n−1 ways for second,n−2 choices for third, ...

... n ∗ (n−1)∗ (n−2) · ∗(n−k + 1) = n!(n−k)! .

How many orderings of n objects are there?Permutations of n objects.

n ways for first, n−1 ways for second,n−2 ways for third, ...

... n ∗ (n−1)∗ (n−2) · ∗1 = n!.

1By definition: 0! = 1.

Page 82: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Permutations.

How many 10 digit numbers without repeating a digit?

10 ways for first, 9 ways for second, 8 ways for third, ...

... 10∗9∗8 · · · ∗1 = 10!.1

How many different samples of size k from n numbers withoutreplacement.

n ways for first choice, n−1 ways for second,n−2 choices for third, ...

... n ∗ (n−1)∗ (n−2) · ∗(n−k + 1) = n!(n−k)! .

How many orderings of n objects are there?Permutations of n objects.

n ways for first,

n−1 ways for second,n−2 ways for third, ...

... n ∗ (n−1)∗ (n−2) · ∗1 = n!.

1By definition: 0! = 1.

Page 83: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Permutations.

How many 10 digit numbers without repeating a digit?

10 ways for first, 9 ways for second, 8 ways for third, ...

... 10∗9∗8 · · · ∗1 = 10!.1

How many different samples of size k from n numbers withoutreplacement.

n ways for first choice, n−1 ways for second,n−2 choices for third, ...

... n ∗ (n−1)∗ (n−2) · ∗(n−k + 1) = n!(n−k)! .

How many orderings of n objects are there?Permutations of n objects.

n ways for first, n−1 ways for second,

n−2 ways for third, ...

... n ∗ (n−1)∗ (n−2) · ∗1 = n!.

1By definition: 0! = 1.

Page 84: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Permutations.

How many 10 digit numbers without repeating a digit?

10 ways for first, 9 ways for second, 8 ways for third, ...

... 10∗9∗8 · · · ∗1 = 10!.1

How many different samples of size k from n numbers withoutreplacement.

n ways for first choice, n−1 ways for second,n−2 choices for third, ...

... n ∗ (n−1)∗ (n−2) · ∗(n−k + 1) = n!(n−k)! .

How many orderings of n objects are there?Permutations of n objects.

n ways for first, n−1 ways for second,n−2 ways for third,

...

... n ∗ (n−1)∗ (n−2) · ∗1 = n!.

1By definition: 0! = 1.

Page 85: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Permutations.

How many 10 digit numbers without repeating a digit?

10 ways for first, 9 ways for second, 8 ways for third, ...

... 10∗9∗8 · · · ∗1 = 10!.1

How many different samples of size k from n numbers withoutreplacement.

n ways for first choice, n−1 ways for second,n−2 choices for third, ...

... n ∗ (n−1)∗ (n−2) · ∗(n−k + 1) = n!(n−k)! .

How many orderings of n objects are there?Permutations of n objects.

n ways for first, n−1 ways for second,n−2 ways for third, ...

... n ∗ (n−1)∗ (n−2) · ∗1 = n!.

1By definition: 0! = 1.

Page 86: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Permutations.

How many 10 digit numbers without repeating a digit?

10 ways for first, 9 ways for second, 8 ways for third, ...

... 10∗9∗8 · · · ∗1 = 10!.1

How many different samples of size k from n numbers withoutreplacement.

n ways for first choice, n−1 ways for second,n−2 choices for third, ...

... n ∗ (n−1)∗ (n−2) · ∗(n−k + 1) = n!(n−k)! .

How many orderings of n objects are there?Permutations of n objects.

n ways for first, n−1 ways for second,n−2 ways for third, ...

... n ∗ (n−1)∗ (n−2) · ∗1 = n!.

1By definition: 0! = 1.

Page 87: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

One-to-One Functions.

How many one-to-one functions from |S| to |S|.|S| choices for f (s1), |S|−1 choices for f (s2), ...

So total number is |S|× |S|−1 · · ·1 = |S|!A one-to-one function is a permutation!

Page 88: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

One-to-One Functions.

How many one-to-one functions from |S| to |S|.

|S| choices for f (s1), |S|−1 choices for f (s2), ...

So total number is |S|× |S|−1 · · ·1 = |S|!A one-to-one function is a permutation!

Page 89: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

One-to-One Functions.

How many one-to-one functions from |S| to |S|.|S| choices for f (s1),

|S|−1 choices for f (s2), ...

So total number is |S|× |S|−1 · · ·1 = |S|!A one-to-one function is a permutation!

Page 90: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

One-to-One Functions.

How many one-to-one functions from |S| to |S|.|S| choices for f (s1), |S|−1 choices for f (s2), ...

So total number is |S|× |S|−1 · · ·1 = |S|!A one-to-one function is a permutation!

Page 91: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

One-to-One Functions.

How many one-to-one functions from |S| to |S|.|S| choices for f (s1), |S|−1 choices for f (s2), ...

So total number is |S|× |S|−1 · · ·1 = |S|!A one-to-one function is a permutation!

Page 92: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

One-to-One Functions.

How many one-to-one functions from |S| to |S|.|S| choices for f (s1), |S|−1 choices for f (s2), ...

So total number is |S|× |S|−1 · · ·1 = |S|!

A one-to-one function is a permutation!

Page 93: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

One-to-One Functions.

How many one-to-one functions from |S| to |S|.|S| choices for f (s1), |S|−1 choices for f (s2), ...

So total number is |S|× |S|−1 · · ·1 = |S|!A one-to-one function is a permutation!

Page 94: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Counting sets..when order doesn’t matter.

How many poker hands?

52×51×50×49×48 ???

Are A,K ,Q,10,J of spadesand 10,J,Q,K ,A of spades the same?Second Rule of Counting: If order doesn’t matter count orderedobjects and then divide by number of orderings.2

Number of orderings for a poker hand: “5!”

(The “!” means factorial, not Exclamation.)

52×51×50×49×485!Can write as...

52!

5!×47!

Generic: ways to choose 5 out of 52 possibilities.

2When each unordered object corresponds equal numbers of orderedobjects.

Page 95: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Counting sets..when order doesn’t matter.

How many poker hands?

52×51×50×49×48

???

Are A,K ,Q,10,J of spadesand 10,J,Q,K ,A of spades the same?Second Rule of Counting: If order doesn’t matter count orderedobjects and then divide by number of orderings.2

Number of orderings for a poker hand: “5!”

(The “!” means factorial, not Exclamation.)

52×51×50×49×485!Can write as...

52!

5!×47!

Generic: ways to choose 5 out of 52 possibilities.

2When each unordered object corresponds equal numbers of orderedobjects.

Page 96: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Counting sets..when order doesn’t matter.

How many poker hands?

52×51×50×49×48 ???

Are A,K ,Q,10,J of spadesand 10,J,Q,K ,A of spades the same?Second Rule of Counting: If order doesn’t matter count orderedobjects and then divide by number of orderings.2

Number of orderings for a poker hand: “5!”

(The “!” means factorial, not Exclamation.)

52×51×50×49×485!Can write as...

52!

5!×47!

Generic: ways to choose 5 out of 52 possibilities.

2When each unordered object corresponds equal numbers of orderedobjects.

Page 97: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Counting sets..when order doesn’t matter.

How many poker hands?

52×51×50×49×48 ???

Are A,K ,Q,10,J of spadesand 10,J,Q,K ,A of spades the same?

Second Rule of Counting: If order doesn’t matter count orderedobjects and then divide by number of orderings.2

Number of orderings for a poker hand: “5!”

(The “!” means factorial, not Exclamation.)

52×51×50×49×485!Can write as...

52!

5!×47!

Generic: ways to choose 5 out of 52 possibilities.

2When each unordered object corresponds equal numbers of orderedobjects.

Page 98: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Counting sets..when order doesn’t matter.

How many poker hands?

52×51×50×49×48 ???

Are A,K ,Q,10,J of spadesand 10,J,Q,K ,A of spades the same?Second Rule of Counting: If order doesn’t matter count orderedobjects and then divide by number of orderings.2

Number of orderings for a poker hand: “5!”

(The “!” means factorial, not Exclamation.)

52×51×50×49×485!Can write as...

52!

5!×47!

Generic: ways to choose 5 out of 52 possibilities.

2When each unordered object corresponds equal numbers of orderedobjects.

Page 99: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Counting sets..when order doesn’t matter.

How many poker hands?

52×51×50×49×48 ???

Are A,K ,Q,10,J of spadesand 10,J,Q,K ,A of spades the same?Second Rule of Counting: If order doesn’t matter count orderedobjects and then divide by number of orderings.2

Number of orderings for a poker hand: “5!”

(The “!” means factorial, not Exclamation.)

52×51×50×49×485!Can write as...

52!

5!×47!

Generic: ways to choose 5 out of 52 possibilities.

2When each unordered object corresponds equal numbers of orderedobjects.

Page 100: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Counting sets..when order doesn’t matter.

How many poker hands?

52×51×50×49×48 ???

Are A,K ,Q,10,J of spadesand 10,J,Q,K ,A of spades the same?Second Rule of Counting: If order doesn’t matter count orderedobjects and then divide by number of orderings.2

Number of orderings for a poker hand: “5!”(The “!” means factorial, not Exclamation.)

52×51×50×49×485!Can write as...

52!

5!×47!

Generic: ways to choose 5 out of 52 possibilities.

2When each unordered object corresponds equal numbers of orderedobjects.

Page 101: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Counting sets..when order doesn’t matter.

How many poker hands?

52×51×50×49×48 ???

Are A,K ,Q,10,J of spadesand 10,J,Q,K ,A of spades the same?Second Rule of Counting: If order doesn’t matter count orderedobjects and then divide by number of orderings.2

Number of orderings for a poker hand: “5!”

(The “!” means factorial, not Exclamation.)

52×51×50×49×485!

Can write as...52!

5!×47!

Generic: ways to choose 5 out of 52 possibilities.

2When each unordered object corresponds equal numbers of orderedobjects.

Page 102: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Counting sets..when order doesn’t matter.

How many poker hands?

52×51×50×49×48 ???

Are A,K ,Q,10,J of spadesand 10,J,Q,K ,A of spades the same?Second Rule of Counting: If order doesn’t matter count orderedobjects and then divide by number of orderings.2

Number of orderings for a poker hand: “5!”

(The “!” means factorial, not Exclamation.)

52×51×50×49×485!Can write as...

52!

5!×47!

Generic: ways to choose 5 out of 52 possibilities.

2When each unordered object corresponds equal numbers of orderedobjects.

Page 103: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Counting sets..when order doesn’t matter.

How many poker hands?

52×51×50×49×48 ???

Are A,K ,Q,10,J of spadesand 10,J,Q,K ,A of spades the same?Second Rule of Counting: If order doesn’t matter count orderedobjects and then divide by number of orderings.2

Number of orderings for a poker hand: “5!”

(The “!” means factorial, not Exclamation.)

52×51×50×49×485!Can write as...

52!

5!×47!

Generic: ways to choose 5 out of 52 possibilities.

2When each unordered object corresponds equal numbers of orderedobjects.

Page 104: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Ordered to unordered.

Second Rule of Counting: If order doesn’t matter count orderedobjects and then divide by number of orderings.

How many red nodes (ordered objects)? 9.

How many red nodes mapped to one blue node? 3.

How many blue nodes (unordered objects)? 93 = 3.

How many poker deals? 52 ·51 ·50 ·49 ·48.

How many poker deals per hand?Map each deal to ordered deal: 5!

How many poker hands? 52·51·50·49·485!

Questions?

Page 105: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Ordered to unordered.

Second Rule of Counting: If order doesn’t matter count orderedobjects and then divide by number of orderings.

How many red nodes (ordered objects)? 9.

How many red nodes mapped to one blue node? 3.

How many blue nodes (unordered objects)? 93 = 3.

How many poker deals? 52 ·51 ·50 ·49 ·48.

How many poker deals per hand?Map each deal to ordered deal: 5!

How many poker hands? 52·51·50·49·485!

Questions?

Page 106: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Ordered to unordered.

Second Rule of Counting: If order doesn’t matter count orderedobjects and then divide by number of orderings.

How many red nodes (ordered objects)?

9.

How many red nodes mapped to one blue node? 3.

How many blue nodes (unordered objects)? 93 = 3.

How many poker deals? 52 ·51 ·50 ·49 ·48.

How many poker deals per hand?Map each deal to ordered deal: 5!

How many poker hands? 52·51·50·49·485!

Questions?

Page 107: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Ordered to unordered.

Second Rule of Counting: If order doesn’t matter count orderedobjects and then divide by number of orderings.

How many red nodes (ordered objects)? 9.

How many red nodes mapped to one blue node? 3.

How many blue nodes (unordered objects)? 93 = 3.

How many poker deals? 52 ·51 ·50 ·49 ·48.

How many poker deals per hand?Map each deal to ordered deal: 5!

How many poker hands? 52·51·50·49·485!

Questions?

Page 108: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Ordered to unordered.

Second Rule of Counting: If order doesn’t matter count orderedobjects and then divide by number of orderings.

How many red nodes (ordered objects)? 9.

How many red nodes mapped to one blue node?

3.

How many blue nodes (unordered objects)? 93 = 3.

How many poker deals? 52 ·51 ·50 ·49 ·48.

How many poker deals per hand?Map each deal to ordered deal: 5!

How many poker hands? 52·51·50·49·485!

Questions?

Page 109: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Ordered to unordered.

Second Rule of Counting: If order doesn’t matter count orderedobjects and then divide by number of orderings.

How many red nodes (ordered objects)? 9.

How many red nodes mapped to one blue node? 3.

How many blue nodes (unordered objects)? 93 = 3.

How many poker deals? 52 ·51 ·50 ·49 ·48.

How many poker deals per hand?Map each deal to ordered deal: 5!

How many poker hands? 52·51·50·49·485!

Questions?

Page 110: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Ordered to unordered.

Second Rule of Counting: If order doesn’t matter count orderedobjects and then divide by number of orderings.

How many red nodes (ordered objects)? 9.

How many red nodes mapped to one blue node? 3.

How many blue nodes (unordered objects)?

93 = 3.

How many poker deals? 52 ·51 ·50 ·49 ·48.

How many poker deals per hand?Map each deal to ordered deal: 5!

How many poker hands? 52·51·50·49·485!

Questions?

Page 111: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Ordered to unordered.

Second Rule of Counting: If order doesn’t matter count orderedobjects and then divide by number of orderings.

How many red nodes (ordered objects)? 9.

How many red nodes mapped to one blue node? 3.

How many blue nodes (unordered objects)? 93

= 3.

How many poker deals? 52 ·51 ·50 ·49 ·48.

How many poker deals per hand?Map each deal to ordered deal: 5!

How many poker hands? 52·51·50·49·485!

Questions?

Page 112: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Ordered to unordered.

Second Rule of Counting: If order doesn’t matter count orderedobjects and then divide by number of orderings.

How many red nodes (ordered objects)? 9.

How many red nodes mapped to one blue node? 3.

How many blue nodes (unordered objects)? 93 = 3.

How many poker deals? 52 ·51 ·50 ·49 ·48.

How many poker deals per hand?Map each deal to ordered deal: 5!

How many poker hands? 52·51·50·49·485!

Questions?

Page 113: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Ordered to unordered.

Second Rule of Counting: If order doesn’t matter count orderedobjects and then divide by number of orderings.

How many red nodes (ordered objects)? 9.

How many red nodes mapped to one blue node? 3.

How many blue nodes (unordered objects)? 93 = 3.

How many poker deals?

52 ·51 ·50 ·49 ·48.

How many poker deals per hand?Map each deal to ordered deal: 5!

How many poker hands? 52·51·50·49·485!

Questions?

Page 114: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Ordered to unordered.

Second Rule of Counting: If order doesn’t matter count orderedobjects and then divide by number of orderings.

How many red nodes (ordered objects)? 9.

How many red nodes mapped to one blue node? 3.

How many blue nodes (unordered objects)? 93 = 3.

How many poker deals? 52 ·51 ·50 ·49 ·48.

How many poker deals per hand?Map each deal to ordered deal: 5!

How many poker hands? 52·51·50·49·485!

Questions?

Page 115: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Ordered to unordered.

Second Rule of Counting: If order doesn’t matter count orderedobjects and then divide by number of orderings.

How many red nodes (ordered objects)? 9.

How many red nodes mapped to one blue node? 3.

How many blue nodes (unordered objects)? 93 = 3.

How many poker deals? 52 ·51 ·50 ·49 ·48.

How many poker deals per hand?

Map each deal to ordered deal: 5!

How many poker hands? 52·51·50·49·485!

Questions?

Page 116: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Ordered to unordered.

Second Rule of Counting: If order doesn’t matter count orderedobjects and then divide by number of orderings.

How many red nodes (ordered objects)? 9.

How many red nodes mapped to one blue node? 3.

How many blue nodes (unordered objects)? 93 = 3.

How many poker deals? 52 ·51 ·50 ·49 ·48.

How many poker deals per hand?Map each deal to ordered deal:

5!

How many poker hands? 52·51·50·49·485!

Questions?

Page 117: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Ordered to unordered.

Second Rule of Counting: If order doesn’t matter count orderedobjects and then divide by number of orderings.

How many red nodes (ordered objects)? 9.

How many red nodes mapped to one blue node? 3.

How many blue nodes (unordered objects)? 93 = 3.

How many poker deals? 52 ·51 ·50 ·49 ·48.

How many poker deals per hand?Map each deal to ordered deal: 5!

How many poker hands? 52·51·50·49·485!

Questions?

Page 118: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Ordered to unordered.

Second Rule of Counting: If order doesn’t matter count orderedobjects and then divide by number of orderings.

How many red nodes (ordered objects)? 9.

How many red nodes mapped to one blue node? 3.

How many blue nodes (unordered objects)? 93 = 3.

How many poker deals? 52 ·51 ·50 ·49 ·48.

How many poker deals per hand?Map each deal to ordered deal: 5!

How many poker hands?

52·51·50·49·485!

Questions?

Page 119: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Ordered to unordered.

Second Rule of Counting: If order doesn’t matter count orderedobjects and then divide by number of orderings.

How many red nodes (ordered objects)? 9.

How many red nodes mapped to one blue node? 3.

How many blue nodes (unordered objects)? 93 = 3.

How many poker deals? 52 ·51 ·50 ·49 ·48.

How many poker deals per hand?Map each deal to ordered deal: 5!

How many poker hands? 52·51·50·49·485!

Questions?

Page 120: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Ordered to unordered.

Second Rule of Counting: If order doesn’t matter count orderedobjects and then divide by number of orderings.

How many red nodes (ordered objects)? 9.

How many red nodes mapped to one blue node? 3.

How many blue nodes (unordered objects)? 93 = 3.

How many poker deals? 52 ·51 ·50 ·49 ·48.

How many poker deals per hand?Map each deal to ordered deal: 5!

How many poker hands? 52·51·50·49·485!

Questions?

Page 121: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

..order doesn’t matter.

Choose 2 out of n?

n× (n−1)

2

=n!

(n−2)!×2

Choose 3 out of n?

n× (n−1)× (n−2)

3!

=n!

(n−3)!×3!

Choose k out of n?

n!

(n−k)!

×k !

Notation:(n

k

)and pronounced “n choose k .”

Familiar? Questions?

Page 122: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

..order doesn’t matter.

Choose 2 out of n?

n× (n−1)

2

=n!

(n−2)!×2

Choose 3 out of n?

n× (n−1)× (n−2)

3!

=n!

(n−3)!×3!

Choose k out of n?

n!

(n−k)!

×k !

Notation:(n

k

)and pronounced “n choose k .”

Familiar? Questions?

Page 123: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

..order doesn’t matter.

Choose 2 out of n?

n× (n−1)

2=

n!

(n−2)!×2

Choose 3 out of n?

n× (n−1)× (n−2)

3!

=n!

(n−3)!×3!

Choose k out of n?

n!

(n−k)!

×k !

Notation:(n

k

)and pronounced “n choose k .”

Familiar? Questions?

Page 124: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

..order doesn’t matter.

Choose 2 out of n?

n× (n−1)

2

=n!

(n−2)!×2

Choose 3 out of n?

n× (n−1)× (n−2)

3!

=n!

(n−3)!×3!

Choose k out of n?

n!

(n−k)!

×k !

Notation:(n

k

)and pronounced “n choose k .”

Familiar? Questions?

Page 125: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

..order doesn’t matter.

Choose 2 out of n?

n× (n−1)

2=

n!

(n−2)!×2

Choose 3 out of n?

n× (n−1)× (n−2)

3!

=n!

(n−3)!×3!

Choose k out of n?

n!

(n−k)!

×k !

Notation:(n

k

)and pronounced “n choose k .”

Familiar? Questions?

Page 126: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

..order doesn’t matter.

Choose 2 out of n?

n× (n−1)

2=

n!

(n−2)!×2

Choose 3 out of n?

n× (n−1)× (n−2)

3!

=n!

(n−3)!×3!

Choose k out of n?

n!

(n−k)!

×k !

Notation:(n

k

)and pronounced “n choose k .”

Familiar? Questions?

Page 127: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

..order doesn’t matter.

Choose 2 out of n?

n× (n−1)

2=

n!

(n−2)!×2

Choose 3 out of n?

n× (n−1)× (n−2)

3!=

n!

(n−3)!×3!

Choose k out of n?

n!

(n−k)!

×k !

Notation:(n

k

)and pronounced “n choose k .”

Familiar? Questions?

Page 128: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

..order doesn’t matter.

Choose 2 out of n?

n× (n−1)

2=

n!

(n−2)!×2

Choose 3 out of n?

n× (n−1)× (n−2)

3!

=n!

(n−3)!×3!

Choose k out of n?

n!

(n−k)!

×k !

Notation:(n

k

)and pronounced “n choose k .”

Familiar? Questions?

Page 129: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

..order doesn’t matter.

Choose 2 out of n?

n× (n−1)

2=

n!

(n−2)!×2

Choose 3 out of n?

n× (n−1)× (n−2)

3!=

n!

(n−3)!×3!

Choose k out of n?

n!

(n−k)!

×k !

Notation:(n

k

)and pronounced “n choose k .”

Familiar? Questions?

Page 130: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

..order doesn’t matter.

Choose 2 out of n?

n× (n−1)

2=

n!

(n−2)!×2

Choose 3 out of n?

n× (n−1)× (n−2)

3!=

n!

(n−3)!×3!

Choose k out of n?

n!

(n−k)!

×k !

Notation:(n

k

)and pronounced “n choose k .”

Familiar? Questions?

Page 131: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

..order doesn’t matter.

Choose 2 out of n?

n× (n−1)

2=

n!

(n−2)!×2

Choose 3 out of n?

n× (n−1)× (n−2)

3!=

n!

(n−3)!×3!

Choose k out of n?

n!

(n−k)!

×k !

Notation:(n

k

)and pronounced “n choose k .”

Familiar? Questions?

Page 132: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

..order doesn’t matter.

Choose 2 out of n?

n× (n−1)

2=

n!

(n−2)!×2

Choose 3 out of n?

n× (n−1)× (n−2)

3!=

n!

(n−3)!×3!

Choose k out of n?

n!

(n−k)!×k !

Notation:(n

k

)and pronounced “n choose k .”

Familiar? Questions?

Page 133: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

..order doesn’t matter.

Choose 2 out of n?

n× (n−1)

2=

n!

(n−2)!×2

Choose 3 out of n?

n× (n−1)× (n−2)

3!=

n!

(n−3)!×3!

Choose k out of n?

n!

(n−k)!×k !

Notation:(n

k

)and pronounced “n choose k .”

Familiar? Questions?

Page 134: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

..order doesn’t matter.

Choose 2 out of n?

n× (n−1)

2=

n!

(n−2)!×2

Choose 3 out of n?

n× (n−1)× (n−2)

3!=

n!

(n−3)!×3!

Choose k out of n?

n!

(n−k)!×k !

Notation:(n

k

)and pronounced “n choose k .”

Familiar?

Questions?

Page 135: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

..order doesn’t matter.

Choose 2 out of n?

n× (n−1)

2=

n!

(n−2)!×2

Choose 3 out of n?

n× (n−1)× (n−2)

3!=

n!

(n−3)!×3!

Choose k out of n?

n!

(n−k)!×k !

Notation:(n

k

)and pronounced “n choose k .”

Familiar? Questions?

Page 136: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Example: Visualize the proof..

First rule: n1×n2 · · ·×n3. Product Rule.Second rule: when order doesn’t matter divide...

. . .. . .

. . .. . . ∆

3 card Poker deals: 52×51×50 = 52!49! . First rule.

Poker hands: ∆?Hand: Q,K ,A.Deals: Q,K ,A : Q,A,K : K ,A,Q : K ,A,Q : A,K ,Q : A,Q,K .

∆ = 3×2×1 First rule again.Total: 52!

49!3! Second Rule!

Choose k out of n.Ordered set: n!

(n−k)! Orderings of one hand? k ! (By first rule!)=⇒ Total: n!

(n−k)!k ! Second rule.

Page 137: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Example: Visualize the proof..

First rule: n1×n2 · · ·×n3. Product Rule.Second rule: when order doesn’t matter divide...

. . .. . .

. . .. . . ∆

3 card Poker deals: 52

×51×50 = 52!49! . First rule.

Poker hands: ∆?Hand: Q,K ,A.Deals: Q,K ,A : Q,A,K : K ,A,Q : K ,A,Q : A,K ,Q : A,Q,K .

∆ = 3×2×1 First rule again.Total: 52!

49!3! Second Rule!

Choose k out of n.Ordered set: n!

(n−k)! Orderings of one hand? k ! (By first rule!)=⇒ Total: n!

(n−k)!k ! Second rule.

Page 138: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Example: Visualize the proof..

First rule: n1×n2 · · ·×n3. Product Rule.Second rule: when order doesn’t matter divide...

. . .. . .

. . .. . . ∆

3 card Poker deals: 52×51

×50 = 52!49! . First rule.

Poker hands: ∆?Hand: Q,K ,A.Deals: Q,K ,A : Q,A,K : K ,A,Q : K ,A,Q : A,K ,Q : A,Q,K .

∆ = 3×2×1 First rule again.Total: 52!

49!3! Second Rule!

Choose k out of n.Ordered set: n!

(n−k)! Orderings of one hand? k ! (By first rule!)=⇒ Total: n!

(n−k)!k ! Second rule.

Page 139: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Example: Visualize the proof..

First rule: n1×n2 · · ·×n3. Product Rule.Second rule: when order doesn’t matter divide...

. . .. . .

. . .. . . ∆

3 card Poker deals: 52×51×50

= 52!49! . First rule.

Poker hands: ∆?Hand: Q,K ,A.Deals: Q,K ,A : Q,A,K : K ,A,Q : K ,A,Q : A,K ,Q : A,Q,K .

∆ = 3×2×1 First rule again.Total: 52!

49!3! Second Rule!

Choose k out of n.Ordered set: n!

(n−k)! Orderings of one hand? k ! (By first rule!)=⇒ Total: n!

(n−k)!k ! Second rule.

Page 140: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Example: Visualize the proof..

First rule: n1×n2 · · ·×n3. Product Rule.Second rule: when order doesn’t matter divide...

. . .. . .

. . .. . . ∆

3 card Poker deals: 52×51×50 = 52!49! .

First rule.Poker hands: ∆?

Hand: Q,K ,A.Deals: Q,K ,A : Q,A,K : K ,A,Q : K ,A,Q : A,K ,Q : A,Q,K .

∆ = 3×2×1 First rule again.Total: 52!

49!3! Second Rule!

Choose k out of n.Ordered set: n!

(n−k)! Orderings of one hand? k ! (By first rule!)=⇒ Total: n!

(n−k)!k ! Second rule.

Page 141: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Example: Visualize the proof..

First rule: n1×n2 · · ·×n3. Product Rule.Second rule: when order doesn’t matter divide...

. . .. . .

. . .. . . ∆

3 card Poker deals: 52×51×50 = 52!49! . First rule.

Poker hands: ∆?Hand: Q,K ,A.Deals: Q,K ,A : Q,A,K : K ,A,Q : K ,A,Q : A,K ,Q : A,Q,K .

∆ = 3×2×1 First rule again.Total: 52!

49!3! Second Rule!

Choose k out of n.Ordered set: n!

(n−k)! Orderings of one hand? k ! (By first rule!)=⇒ Total: n!

(n−k)!k ! Second rule.

Page 142: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Example: Visualize the proof..

First rule: n1×n2 · · ·×n3. Product Rule.Second rule: when order doesn’t matter divide...

. . .. . .

. . .. . . ∆

3 card Poker deals: 52×51×50 = 52!49! . First rule.

Poker hands: ∆?

Hand: Q,K ,A.Deals: Q,K ,A : Q,A,K : K ,A,Q : K ,A,Q : A,K ,Q : A,Q,K .

∆ = 3×2×1 First rule again.Total: 52!

49!3! Second Rule!

Choose k out of n.Ordered set: n!

(n−k)! Orderings of one hand? k ! (By first rule!)=⇒ Total: n!

(n−k)!k ! Second rule.

Page 143: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Example: Visualize the proof..

First rule: n1×n2 · · ·×n3. Product Rule.Second rule: when order doesn’t matter divide...

. . .. . .

. . .. . . ∆

3 card Poker deals: 52×51×50 = 52!49! . First rule.

Poker hands: ∆?Hand: Q,K ,A.

Deals: Q,K ,A : Q,A,K : K ,A,Q : K ,A,Q : A,K ,Q : A,Q,K .∆ = 3×2×1 First rule again.Total: 52!

49!3! Second Rule!

Choose k out of n.Ordered set: n!

(n−k)! Orderings of one hand? k ! (By first rule!)=⇒ Total: n!

(n−k)!k ! Second rule.

Page 144: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Example: Visualize the proof..

First rule: n1×n2 · · ·×n3. Product Rule.Second rule: when order doesn’t matter divide...

. . .. . .

. . .. . . ∆

3 card Poker deals: 52×51×50 = 52!49! . First rule.

Poker hands: ∆?Hand: Q,K ,A.Deals: Q,K ,A :

Q,A,K : K ,A,Q : K ,A,Q : A,K ,Q : A,Q,K .∆ = 3×2×1 First rule again.Total: 52!

49!3! Second Rule!

Choose k out of n.Ordered set: n!

(n−k)! Orderings of one hand? k ! (By first rule!)=⇒ Total: n!

(n−k)!k ! Second rule.

Page 145: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Example: Visualize the proof..

First rule: n1×n2 · · ·×n3. Product Rule.Second rule: when order doesn’t matter divide...

. . .. . .

. . .. . . ∆

3 card Poker deals: 52×51×50 = 52!49! . First rule.

Poker hands: ∆?Hand: Q,K ,A.Deals: Q,K ,A : Q,A,K :

K ,A,Q : K ,A,Q : A,K ,Q : A,Q,K .∆ = 3×2×1 First rule again.Total: 52!

49!3! Second Rule!

Choose k out of n.Ordered set: n!

(n−k)! Orderings of one hand? k ! (By first rule!)=⇒ Total: n!

(n−k)!k ! Second rule.

Page 146: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Example: Visualize the proof..

First rule: n1×n2 · · ·×n3. Product Rule.Second rule: when order doesn’t matter divide...

. . .. . .

. . .. . . ∆

3 card Poker deals: 52×51×50 = 52!49! . First rule.

Poker hands: ∆?Hand: Q,K ,A.Deals: Q,K ,A : Q,A,K : K ,A,Q : K ,A,Q : A,K ,Q : A,Q,K .

∆ = 3×2×1 First rule again.Total: 52!

49!3! Second Rule!

Choose k out of n.Ordered set: n!

(n−k)! Orderings of one hand? k ! (By first rule!)=⇒ Total: n!

(n−k)!k ! Second rule.

Page 147: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Example: Visualize the proof..

First rule: n1×n2 · · ·×n3. Product Rule.Second rule: when order doesn’t matter divide...

. . .. . .

. . .. . . ∆

3 card Poker deals: 52×51×50 = 52!49! . First rule.

Poker hands: ∆?Hand: Q,K ,A.Deals: Q,K ,A : Q,A,K : K ,A,Q : K ,A,Q : A,K ,Q : A,Q,K .

∆ = 3×2×1

First rule again.Total: 52!

49!3! Second Rule!

Choose k out of n.Ordered set: n!

(n−k)! Orderings of one hand? k ! (By first rule!)=⇒ Total: n!

(n−k)!k ! Second rule.

Page 148: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Example: Visualize the proof..

First rule: n1×n2 · · ·×n3. Product Rule.Second rule: when order doesn’t matter divide...

. . .. . .

. . .. . . ∆

3 card Poker deals: 52×51×50 = 52!49! . First rule.

Poker hands: ∆?Hand: Q,K ,A.Deals: Q,K ,A : Q,A,K : K ,A,Q : K ,A,Q : A,K ,Q : A,Q,K .

∆ = 3×2×1 First rule again.

Total: 52!49!3! Second Rule!

Choose k out of n.Ordered set: n!

(n−k)! Orderings of one hand? k ! (By first rule!)=⇒ Total: n!

(n−k)!k ! Second rule.

Page 149: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Example: Visualize the proof..

First rule: n1×n2 · · ·×n3. Product Rule.Second rule: when order doesn’t matter divide...

. . .. . .

. . .. . . ∆

3 card Poker deals: 52×51×50 = 52!49! . First rule.

Poker hands: ∆?Hand: Q,K ,A.Deals: Q,K ,A : Q,A,K : K ,A,Q : K ,A,Q : A,K ,Q : A,Q,K .

∆ = 3×2×1 First rule again.Total:

52!49!3! Second Rule!

Choose k out of n.Ordered set: n!

(n−k)! Orderings of one hand? k ! (By first rule!)=⇒ Total: n!

(n−k)!k ! Second rule.

Page 150: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Example: Visualize the proof..

First rule: n1×n2 · · ·×n3. Product Rule.Second rule: when order doesn’t matter divide...

. . .. . .

. . .. . . ∆

3 card Poker deals: 52×51×50 = 52!49! . First rule.

Poker hands: ∆?Hand: Q,K ,A.Deals: Q,K ,A : Q,A,K : K ,A,Q : K ,A,Q : A,K ,Q : A,Q,K .

∆ = 3×2×1 First rule again.Total: 52!

49!3!

Second Rule!

Choose k out of n.Ordered set: n!

(n−k)! Orderings of one hand? k ! (By first rule!)=⇒ Total: n!

(n−k)!k ! Second rule.

Page 151: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Example: Visualize the proof..

First rule: n1×n2 · · ·×n3. Product Rule.Second rule: when order doesn’t matter divide...

. . .. . .

. . .. . . ∆

3 card Poker deals: 52×51×50 = 52!49! . First rule.

Poker hands: ∆?Hand: Q,K ,A.Deals: Q,K ,A : Q,A,K : K ,A,Q : K ,A,Q : A,K ,Q : A,Q,K .

∆ = 3×2×1 First rule again.Total: 52!

49!3! Second Rule!

Choose k out of n.Ordered set: n!

(n−k)! Orderings of one hand? k ! (By first rule!)=⇒ Total: n!

(n−k)!k ! Second rule.

Page 152: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Example: Visualize the proof..

First rule: n1×n2 · · ·×n3. Product Rule.Second rule: when order doesn’t matter divide...

. . .. . .

. . .. . . ∆

3 card Poker deals: 52×51×50 = 52!49! . First rule.

Poker hands: ∆?Hand: Q,K ,A.Deals: Q,K ,A : Q,A,K : K ,A,Q : K ,A,Q : A,K ,Q : A,Q,K .

∆ = 3×2×1 First rule again.Total: 52!

49!3! Second Rule!

Choose k out of n.

Ordered set: n!(n−k)! Orderings of one hand? k ! (By first rule!)

=⇒ Total: n!(n−k)!k ! Second rule.

Page 153: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Example: Visualize the proof..

First rule: n1×n2 · · ·×n3. Product Rule.Second rule: when order doesn’t matter divide...

. . .. . .

. . .. . . ∆

3 card Poker deals: 52×51×50 = 52!49! . First rule.

Poker hands: ∆?Hand: Q,K ,A.Deals: Q,K ,A : Q,A,K : K ,A,Q : K ,A,Q : A,K ,Q : A,Q,K .

∆ = 3×2×1 First rule again.Total: 52!

49!3! Second Rule!

Choose k out of n.Ordered set: n!

(n−k)!

Orderings of one hand? k ! (By first rule!)=⇒ Total: n!

(n−k)!k ! Second rule.

Page 154: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Example: Visualize the proof..

First rule: n1×n2 · · ·×n3. Product Rule.Second rule: when order doesn’t matter divide...

. . .. . .

. . .. . . ∆

3 card Poker deals: 52×51×50 = 52!49! . First rule.

Poker hands: ∆?Hand: Q,K ,A.Deals: Q,K ,A : Q,A,K : K ,A,Q : K ,A,Q : A,K ,Q : A,Q,K .

∆ = 3×2×1 First rule again.Total: 52!

49!3! Second Rule!

Choose k out of n.Ordered set: n!

(n−k)! Orderings of one hand?

k ! (By first rule!)=⇒ Total: n!

(n−k)!k ! Second rule.

Page 155: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Example: Visualize the proof..

First rule: n1×n2 · · ·×n3. Product Rule.Second rule: when order doesn’t matter divide...

. . .. . .

. . .. . . ∆

3 card Poker deals: 52×51×50 = 52!49! . First rule.

Poker hands: ∆?Hand: Q,K ,A.Deals: Q,K ,A : Q,A,K : K ,A,Q : K ,A,Q : A,K ,Q : A,Q,K .

∆ = 3×2×1 First rule again.Total: 52!

49!3! Second Rule!

Choose k out of n.Ordered set: n!

(n−k)! Orderings of one hand? k !

(By first rule!)=⇒ Total: n!

(n−k)!k ! Second rule.

Page 156: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Example: Visualize the proof..

First rule: n1×n2 · · ·×n3. Product Rule.Second rule: when order doesn’t matter divide...

. . .. . .

. . .. . . ∆

3 card Poker deals: 52×51×50 = 52!49! . First rule.

Poker hands: ∆?Hand: Q,K ,A.Deals: Q,K ,A : Q,A,K : K ,A,Q : K ,A,Q : A,K ,Q : A,Q,K .

∆ = 3×2×1 First rule again.Total: 52!

49!3! Second Rule!

Choose k out of n.Ordered set: n!

(n−k)! Orderings of one hand? k ! (By first rule!)

=⇒ Total: n!(n−k)!k ! Second rule.

Page 157: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Example: Visualize the proof..

First rule: n1×n2 · · ·×n3. Product Rule.Second rule: when order doesn’t matter divide...

. . .. . .

. . .. . . ∆

3 card Poker deals: 52×51×50 = 52!49! . First rule.

Poker hands: ∆?Hand: Q,K ,A.Deals: Q,K ,A : Q,A,K : K ,A,Q : K ,A,Q : A,K ,Q : A,Q,K .

∆ = 3×2×1 First rule again.Total: 52!

49!3! Second Rule!

Choose k out of n.Ordered set: n!

(n−k)! Orderings of one hand? k ! (By first rule!)=⇒ Total: n!

(n−k)!k !

Second rule.

Page 158: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Example: Visualize the proof..

First rule: n1×n2 · · ·×n3. Product Rule.Second rule: when order doesn’t matter divide...

. . .. . .

. . .. . . ∆

3 card Poker deals: 52×51×50 = 52!49! . First rule.

Poker hands: ∆?Hand: Q,K ,A.Deals: Q,K ,A : Q,A,K : K ,A,Q : K ,A,Q : A,K ,Q : A,Q,K .

∆ = 3×2×1 First rule again.Total: 52!

49!3! Second Rule!

Choose k out of n.Ordered set: n!

(n−k)! Orderings of one hand? k ! (By first rule!)=⇒ Total: n!

(n−k)!k ! Second rule.

Page 159: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Example: Visualize the proof..

First rule: n1×n2 · · ·×n3. Product Rule.Second rule: when order doesn’t matter divide...

. . .. . .

. . .. . . ∆

3 card Poker deals: 52×51×50 = 52!49! . First rule.

Poker hands: ∆?Hand: Q,K ,A.Deals: Q,K ,A : Q,A,K : K ,A,Q : K ,A,Q : A,K ,Q : A,Q,K .

∆ = 3×2×1 First rule again.Total: 52!

49!3! Second Rule!

Choose k out of n.Ordered set: n!

(n−k)! Orderings of one hand? k ! (By first rule!)=⇒ Total: n!

(n−k)!k ! Second rule.

Page 160: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Example: Anagram

First rule: n1×n2 · · ·×n3. Product Rule.Second rule: when order doesn’t matter divide...

. . .. . .

. . .. . . ∆

Orderings of ANAGRAM?Ordered Set: 7! First rule.A’s are the same!What is ∆?ANAGRAMA1NA2GRA3M , A2NA1GRA3M , ...

∆ = 3×2×1 = 3! First rule!=⇒ 7!

3! Second rule!

Page 161: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Example: Anagram

First rule: n1×n2 · · ·×n3. Product Rule.Second rule: when order doesn’t matter divide...

. . .. . .

. . .. . . ∆

Orderings of ANAGRAM?

Ordered Set: 7! First rule.A’s are the same!What is ∆?ANAGRAMA1NA2GRA3M , A2NA1GRA3M , ...

∆ = 3×2×1 = 3! First rule!=⇒ 7!

3! Second rule!

Page 162: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Example: Anagram

First rule: n1×n2 · · ·×n3. Product Rule.Second rule: when order doesn’t matter divide...

. . .. . .

. . .. . . ∆

Orderings of ANAGRAM?Ordered Set: 7!

First rule.A’s are the same!What is ∆?ANAGRAMA1NA2GRA3M , A2NA1GRA3M , ...

∆ = 3×2×1 = 3! First rule!=⇒ 7!

3! Second rule!

Page 163: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Example: Anagram

First rule: n1×n2 · · ·×n3. Product Rule.Second rule: when order doesn’t matter divide...

. . .. . .

. . .. . . ∆

Orderings of ANAGRAM?Ordered Set: 7! First rule.

A’s are the same!What is ∆?ANAGRAMA1NA2GRA3M , A2NA1GRA3M , ...

∆ = 3×2×1 = 3! First rule!=⇒ 7!

3! Second rule!

Page 164: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Example: Anagram

First rule: n1×n2 · · ·×n3. Product Rule.Second rule: when order doesn’t matter divide...

. . .. . .

. . .. . . ∆

Orderings of ANAGRAM?Ordered Set: 7! First rule.A’s are the same!

What is ∆?ANAGRAMA1NA2GRA3M , A2NA1GRA3M , ...

∆ = 3×2×1 = 3! First rule!=⇒ 7!

3! Second rule!

Page 165: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Example: Anagram

First rule: n1×n2 · · ·×n3. Product Rule.Second rule: when order doesn’t matter divide...

. . .. . .

. . .. . . ∆

Orderings of ANAGRAM?Ordered Set: 7! First rule.A’s are the same!What is ∆?

ANAGRAMA1NA2GRA3M , A2NA1GRA3M , ...

∆ = 3×2×1 = 3! First rule!=⇒ 7!

3! Second rule!

Page 166: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Example: Anagram

First rule: n1×n2 · · ·×n3. Product Rule.Second rule: when order doesn’t matter divide...

. . .. . .

. . .. . . ∆

Orderings of ANAGRAM?Ordered Set: 7! First rule.A’s are the same!What is ∆?ANAGRAM

A1NA2GRA3M , A2NA1GRA3M , ...∆ = 3×2×1 = 3! First rule!

=⇒ 7!3! Second rule!

Page 167: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Example: Anagram

First rule: n1×n2 · · ·×n3. Product Rule.Second rule: when order doesn’t matter divide...

. . .. . .

. . .. . . ∆

Orderings of ANAGRAM?Ordered Set: 7! First rule.A’s are the same!What is ∆?ANAGRAMA1NA2GRA3M ,

A2NA1GRA3M , ...∆ = 3×2×1 = 3! First rule!

=⇒ 7!3! Second rule!

Page 168: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Example: Anagram

First rule: n1×n2 · · ·×n3. Product Rule.Second rule: when order doesn’t matter divide...

. . .. . .

. . .. . . ∆

Orderings of ANAGRAM?Ordered Set: 7! First rule.A’s are the same!What is ∆?ANAGRAMA1NA2GRA3M , A2NA1GRA3M ,

...∆ = 3×2×1 = 3! First rule!

=⇒ 7!3! Second rule!

Page 169: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Example: Anagram

First rule: n1×n2 · · ·×n3. Product Rule.Second rule: when order doesn’t matter divide...

. . .. . .

. . .. . . ∆

Orderings of ANAGRAM?Ordered Set: 7! First rule.A’s are the same!What is ∆?ANAGRAMA1NA2GRA3M , A2NA1GRA3M , ...

∆ = 3×2×1 = 3! First rule!=⇒ 7!

3! Second rule!

Page 170: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Example: Anagram

First rule: n1×n2 · · ·×n3. Product Rule.Second rule: when order doesn’t matter divide...

. . .. . .

. . .. . . ∆

Orderings of ANAGRAM?Ordered Set: 7! First rule.A’s are the same!What is ∆?ANAGRAMA1NA2GRA3M , A2NA1GRA3M , ...

∆ = 3×2×1

= 3! First rule!=⇒ 7!

3! Second rule!

Page 171: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Example: Anagram

First rule: n1×n2 · · ·×n3. Product Rule.Second rule: when order doesn’t matter divide...

. . .. . .

. . .. . . ∆

Orderings of ANAGRAM?Ordered Set: 7! First rule.A’s are the same!What is ∆?ANAGRAMA1NA2GRA3M , A2NA1GRA3M , ...

∆ = 3×2×1 = 3!

First rule!=⇒ 7!

3! Second rule!

Page 172: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Example: Anagram

First rule: n1×n2 · · ·×n3. Product Rule.Second rule: when order doesn’t matter divide...

. . .. . .

. . .. . . ∆

Orderings of ANAGRAM?Ordered Set: 7! First rule.A’s are the same!What is ∆?ANAGRAMA1NA2GRA3M , A2NA1GRA3M , ...

∆ = 3×2×1 = 3! First rule!

=⇒ 7!3! Second rule!

Page 173: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Example: Anagram

First rule: n1×n2 · · ·×n3. Product Rule.Second rule: when order doesn’t matter divide...

. . .. . .

. . .. . . ∆

Orderings of ANAGRAM?Ordered Set: 7! First rule.A’s are the same!What is ∆?ANAGRAMA1NA2GRA3M , A2NA1GRA3M , ...

∆ = 3×2×1 = 3! First rule!=⇒ 7!

3!

Second rule!

Page 174: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Example: Anagram

First rule: n1×n2 · · ·×n3. Product Rule.Second rule: when order doesn’t matter divide...

. . .. . .

. . .. . . ∆

Orderings of ANAGRAM?Ordered Set: 7! First rule.A’s are the same!What is ∆?ANAGRAMA1NA2GRA3M , A2NA1GRA3M , ...

∆ = 3×2×1 = 3! First rule!=⇒ 7!

3! Second rule!

Page 175: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Some Practice.

How many orderings of letters of CAT?

3 ways to choose first letter, 2 ways for second, 1 for last.

=⇒ 3×2×1 = 3! orderings

How many orderings of the letters in ANAGRAM?

Ordered, except for A!

total orderings of 7 letters. 7!total “extra counts” or orderings of three A’s? 3!

Total orderings? 7!3!

How many orderings of MISSISSIPPI?

4 S’s, 4 I’s, 2 P’s.11 letters total.

11! ordered objects.4!×4!×2! ordered objects per “unordered object”

=⇒ 11!4!4!2! .

Page 176: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Some Practice.

How many orderings of letters of CAT?

3 ways to choose first letter, 2 ways for second, 1 for last.

=⇒ 3×2×1 = 3! orderings

How many orderings of the letters in ANAGRAM?

Ordered, except for A!

total orderings of 7 letters. 7!total “extra counts” or orderings of three A’s? 3!

Total orderings? 7!3!

How many orderings of MISSISSIPPI?

4 S’s, 4 I’s, 2 P’s.11 letters total.

11! ordered objects.4!×4!×2! ordered objects per “unordered object”

=⇒ 11!4!4!2! .

Page 177: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Some Practice.

How many orderings of letters of CAT?

3 ways to choose first letter, 2 ways for second, 1 for last.

=⇒ 3×2×1

= 3! orderings

How many orderings of the letters in ANAGRAM?

Ordered, except for A!

total orderings of 7 letters. 7!total “extra counts” or orderings of three A’s? 3!

Total orderings? 7!3!

How many orderings of MISSISSIPPI?

4 S’s, 4 I’s, 2 P’s.11 letters total.

11! ordered objects.4!×4!×2! ordered objects per “unordered object”

=⇒ 11!4!4!2! .

Page 178: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Some Practice.

How many orderings of letters of CAT?

3 ways to choose first letter, 2 ways for second, 1 for last.

=⇒ 3×2×1 = 3! orderings

How many orderings of the letters in ANAGRAM?

Ordered, except for A!

total orderings of 7 letters. 7!total “extra counts” or orderings of three A’s? 3!

Total orderings? 7!3!

How many orderings of MISSISSIPPI?

4 S’s, 4 I’s, 2 P’s.11 letters total.

11! ordered objects.4!×4!×2! ordered objects per “unordered object”

=⇒ 11!4!4!2! .

Page 179: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Some Practice.

How many orderings of letters of CAT?

3 ways to choose first letter, 2 ways for second, 1 for last.

=⇒ 3×2×1 = 3! orderings

How many orderings of the letters in ANAGRAM?

Ordered, except for A!

total orderings of 7 letters. 7!total “extra counts” or orderings of three A’s? 3!

Total orderings? 7!3!

How many orderings of MISSISSIPPI?

4 S’s, 4 I’s, 2 P’s.11 letters total.

11! ordered objects.4!×4!×2! ordered objects per “unordered object”

=⇒ 11!4!4!2! .

Page 180: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Some Practice.

How many orderings of letters of CAT?

3 ways to choose first letter, 2 ways for second, 1 for last.

=⇒ 3×2×1 = 3! orderings

How many orderings of the letters in ANAGRAM?

Ordered,

except for A!

total orderings of 7 letters. 7!total “extra counts” or orderings of three A’s? 3!

Total orderings? 7!3!

How many orderings of MISSISSIPPI?

4 S’s, 4 I’s, 2 P’s.11 letters total.

11! ordered objects.4!×4!×2! ordered objects per “unordered object”

=⇒ 11!4!4!2! .

Page 181: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Some Practice.

How many orderings of letters of CAT?

3 ways to choose first letter, 2 ways for second, 1 for last.

=⇒ 3×2×1 = 3! orderings

How many orderings of the letters in ANAGRAM?

Ordered, except for A!

total orderings of 7 letters. 7!total “extra counts” or orderings of three A’s? 3!

Total orderings? 7!3!

How many orderings of MISSISSIPPI?

4 S’s, 4 I’s, 2 P’s.11 letters total.

11! ordered objects.4!×4!×2! ordered objects per “unordered object”

=⇒ 11!4!4!2! .

Page 182: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Some Practice.

How many orderings of letters of CAT?

3 ways to choose first letter, 2 ways for second, 1 for last.

=⇒ 3×2×1 = 3! orderings

How many orderings of the letters in ANAGRAM?

Ordered, except for A!

total orderings of 7 letters.

7!total “extra counts” or orderings of three A’s? 3!

Total orderings? 7!3!

How many orderings of MISSISSIPPI?

4 S’s, 4 I’s, 2 P’s.11 letters total.

11! ordered objects.4!×4!×2! ordered objects per “unordered object”

=⇒ 11!4!4!2! .

Page 183: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Some Practice.

How many orderings of letters of CAT?

3 ways to choose first letter, 2 ways for second, 1 for last.

=⇒ 3×2×1 = 3! orderings

How many orderings of the letters in ANAGRAM?

Ordered, except for A!

total orderings of 7 letters. 7!

total “extra counts” or orderings of three A’s? 3!

Total orderings? 7!3!

How many orderings of MISSISSIPPI?

4 S’s, 4 I’s, 2 P’s.11 letters total.

11! ordered objects.4!×4!×2! ordered objects per “unordered object”

=⇒ 11!4!4!2! .

Page 184: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Some Practice.

How many orderings of letters of CAT?

3 ways to choose first letter, 2 ways for second, 1 for last.

=⇒ 3×2×1 = 3! orderings

How many orderings of the letters in ANAGRAM?

Ordered, except for A!

total orderings of 7 letters. 7!total “extra counts” or orderings of three A’s?

3!

Total orderings? 7!3!

How many orderings of MISSISSIPPI?

4 S’s, 4 I’s, 2 P’s.11 letters total.

11! ordered objects.4!×4!×2! ordered objects per “unordered object”

=⇒ 11!4!4!2! .

Page 185: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Some Practice.

How many orderings of letters of CAT?

3 ways to choose first letter, 2 ways for second, 1 for last.

=⇒ 3×2×1 = 3! orderings

How many orderings of the letters in ANAGRAM?

Ordered, except for A!

total orderings of 7 letters. 7!total “extra counts” or orderings of three A’s? 3!

Total orderings? 7!3!

How many orderings of MISSISSIPPI?

4 S’s, 4 I’s, 2 P’s.11 letters total.

11! ordered objects.4!×4!×2! ordered objects per “unordered object”

=⇒ 11!4!4!2! .

Page 186: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Some Practice.

How many orderings of letters of CAT?

3 ways to choose first letter, 2 ways for second, 1 for last.

=⇒ 3×2×1 = 3! orderings

How many orderings of the letters in ANAGRAM?

Ordered, except for A!

total orderings of 7 letters. 7!total “extra counts” or orderings of three A’s? 3!

Total orderings?

7!3!

How many orderings of MISSISSIPPI?

4 S’s, 4 I’s, 2 P’s.11 letters total.

11! ordered objects.4!×4!×2! ordered objects per “unordered object”

=⇒ 11!4!4!2! .

Page 187: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Some Practice.

How many orderings of letters of CAT?

3 ways to choose first letter, 2 ways for second, 1 for last.

=⇒ 3×2×1 = 3! orderings

How many orderings of the letters in ANAGRAM?

Ordered, except for A!

total orderings of 7 letters. 7!total “extra counts” or orderings of three A’s? 3!

Total orderings? 7!3!

How many orderings of MISSISSIPPI?

4 S’s, 4 I’s, 2 P’s.11 letters total.

11! ordered objects.4!×4!×2! ordered objects per “unordered object”

=⇒ 11!4!4!2! .

Page 188: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Some Practice.

How many orderings of letters of CAT?

3 ways to choose first letter, 2 ways for second, 1 for last.

=⇒ 3×2×1 = 3! orderings

How many orderings of the letters in ANAGRAM?

Ordered, except for A!

total orderings of 7 letters. 7!total “extra counts” or orderings of three A’s? 3!

Total orderings? 7!3!

How many orderings of MISSISSIPPI?

4 S’s, 4 I’s, 2 P’s.11 letters total.

11! ordered objects.4!×4!×2! ordered objects per “unordered object”

=⇒ 11!4!4!2! .

Page 189: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Some Practice.

How many orderings of letters of CAT?

3 ways to choose first letter, 2 ways for second, 1 for last.

=⇒ 3×2×1 = 3! orderings

How many orderings of the letters in ANAGRAM?

Ordered, except for A!

total orderings of 7 letters. 7!total “extra counts” or orderings of three A’s? 3!

Total orderings? 7!3!

How many orderings of MISSISSIPPI?

4 S’s, 4 I’s, 2 P’s.

11 letters total.11! ordered objects.4!×4!×2! ordered objects per “unordered object”

=⇒ 11!4!4!2! .

Page 190: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Some Practice.

How many orderings of letters of CAT?

3 ways to choose first letter, 2 ways for second, 1 for last.

=⇒ 3×2×1 = 3! orderings

How many orderings of the letters in ANAGRAM?

Ordered, except for A!

total orderings of 7 letters. 7!total “extra counts” or orderings of three A’s? 3!

Total orderings? 7!3!

How many orderings of MISSISSIPPI?

4 S’s, 4 I’s, 2 P’s.11 letters total.

11! ordered objects.4!×4!×2! ordered objects per “unordered object”

=⇒ 11!4!4!2! .

Page 191: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Some Practice.

How many orderings of letters of CAT?

3 ways to choose first letter, 2 ways for second, 1 for last.

=⇒ 3×2×1 = 3! orderings

How many orderings of the letters in ANAGRAM?

Ordered, except for A!

total orderings of 7 letters. 7!total “extra counts” or orderings of three A’s? 3!

Total orderings? 7!3!

How many orderings of MISSISSIPPI?

4 S’s, 4 I’s, 2 P’s.11 letters total.11! ordered objects.

4!×4!×2! ordered objects per “unordered object”

=⇒ 11!4!4!2! .

Page 192: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Some Practice.

How many orderings of letters of CAT?

3 ways to choose first letter, 2 ways for second, 1 for last.

=⇒ 3×2×1 = 3! orderings

How many orderings of the letters in ANAGRAM?

Ordered, except for A!

total orderings of 7 letters. 7!total “extra counts” or orderings of three A’s? 3!

Total orderings? 7!3!

How many orderings of MISSISSIPPI?

4 S’s, 4 I’s, 2 P’s.11 letters total.11! ordered objects.4!×4!×2! ordered objects per “unordered object”

=⇒ 11!4!4!2! .

Page 193: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Some Practice.

How many orderings of letters of CAT?

3 ways to choose first letter, 2 ways for second, 1 for last.

=⇒ 3×2×1 = 3! orderings

How many orderings of the letters in ANAGRAM?

Ordered, except for A!

total orderings of 7 letters. 7!total “extra counts” or orderings of three A’s? 3!

Total orderings? 7!3!

How many orderings of MISSISSIPPI?

4 S’s, 4 I’s, 2 P’s.11 letters total.11! ordered objects.4!×4!×2! ordered objects per “unordered object”

=⇒ 11!4!4!2! .

Page 194: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Sampling...

Sample k items out of n

Without replacement:Order matters: n×n−1×n−2 . . . ×n−k + 1 = n!

(n−k)!Order does not matter:

Second Rule: divide by number of orders – “k !”=⇒ n!

(n−k)!k ! .“n choose k ”

With Replacement.Order matters: n×n× . . .n = nk

Order does not matter: Second rule ???

Problem: depends on how many of each item we chose!Different number of unordered elts map to each unordered elt.

Unordered elt: 1,2,3 3! ordered elts map to it.Unordered elt: 1,2,2 3!

2! ordered elts map to it.

How do we deal with this mess??

Page 195: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Sampling...

Sample k items out of n

Without replacement:

Order matters: n×n−1×n−2 . . . ×n−k + 1 = n!(n−k)!

Order does not matter:Second Rule: divide by number of orders – “k !”

=⇒ n!(n−k)!k ! .

“n choose k ”

With Replacement.Order matters: n×n× . . .n = nk

Order does not matter: Second rule ???

Problem: depends on how many of each item we chose!Different number of unordered elts map to each unordered elt.

Unordered elt: 1,2,3 3! ordered elts map to it.Unordered elt: 1,2,2 3!

2! ordered elts map to it.

How do we deal with this mess??

Page 196: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Sampling...

Sample k items out of n

Without replacement:Order matters:

n×n−1×n−2 . . . ×n−k + 1 = n!(n−k)!

Order does not matter:Second Rule: divide by number of orders – “k !”

=⇒ n!(n−k)!k ! .

“n choose k ”

With Replacement.Order matters: n×n× . . .n = nk

Order does not matter: Second rule ???

Problem: depends on how many of each item we chose!Different number of unordered elts map to each unordered elt.

Unordered elt: 1,2,3 3! ordered elts map to it.Unordered elt: 1,2,2 3!

2! ordered elts map to it.

How do we deal with this mess??

Page 197: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Sampling...

Sample k items out of n

Without replacement:Order matters: n×

n−1×n−2 . . . ×n−k + 1 = n!(n−k)!

Order does not matter:Second Rule: divide by number of orders – “k !”

=⇒ n!(n−k)!k ! .

“n choose k ”

With Replacement.Order matters: n×n× . . .n = nk

Order does not matter: Second rule ???

Problem: depends on how many of each item we chose!Different number of unordered elts map to each unordered elt.

Unordered elt: 1,2,3 3! ordered elts map to it.Unordered elt: 1,2,2 3!

2! ordered elts map to it.

How do we deal with this mess??

Page 198: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Sampling...

Sample k items out of n

Without replacement:Order matters: n×n−1×n−2 . . .

×n−k + 1 = n!(n−k)!

Order does not matter:Second Rule: divide by number of orders – “k !”

=⇒ n!(n−k)!k ! .

“n choose k ”

With Replacement.Order matters: n×n× . . .n = nk

Order does not matter: Second rule ???

Problem: depends on how many of each item we chose!Different number of unordered elts map to each unordered elt.

Unordered elt: 1,2,3 3! ordered elts map to it.Unordered elt: 1,2,2 3!

2! ordered elts map to it.

How do we deal with this mess??

Page 199: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Sampling...

Sample k items out of n

Without replacement:Order matters: n×n−1×n−2 . . . ×n−k + 1

= n!(n−k)!

Order does not matter:Second Rule: divide by number of orders – “k !”

=⇒ n!(n−k)!k ! .

“n choose k ”

With Replacement.Order matters: n×n× . . .n = nk

Order does not matter: Second rule ???

Problem: depends on how many of each item we chose!Different number of unordered elts map to each unordered elt.

Unordered elt: 1,2,3 3! ordered elts map to it.Unordered elt: 1,2,2 3!

2! ordered elts map to it.

How do we deal with this mess??

Page 200: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Sampling...

Sample k items out of n

Without replacement:Order matters: n×n−1×n−2 . . . ×n−k + 1 = n!

(n−k)!Order does not matter:

Second Rule: divide by number of orders – “k !”=⇒ n!

(n−k)!k ! .“n choose k ”

With Replacement.Order matters: n×n× . . .n = nk

Order does not matter: Second rule ???

Problem: depends on how many of each item we chose!Different number of unordered elts map to each unordered elt.

Unordered elt: 1,2,3 3! ordered elts map to it.Unordered elt: 1,2,2 3!

2! ordered elts map to it.

How do we deal with this mess??

Page 201: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Sampling...

Sample k items out of n

Without replacement:Order matters: n×n−1×n−2 . . . ×n−k + 1 = n!

(n−k)!Order does not matter:

Second Rule: divide by number of orders

– “k !”=⇒ n!

(n−k)!k ! .“n choose k ”

With Replacement.Order matters: n×n× . . .n = nk

Order does not matter: Second rule ???

Problem: depends on how many of each item we chose!Different number of unordered elts map to each unordered elt.

Unordered elt: 1,2,3 3! ordered elts map to it.Unordered elt: 1,2,2 3!

2! ordered elts map to it.

How do we deal with this mess??

Page 202: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Sampling...

Sample k items out of n

Without replacement:Order matters: n×n−1×n−2 . . . ×n−k + 1 = n!

(n−k)!Order does not matter:

Second Rule: divide by number of orders – “k !”

=⇒ n!(n−k)!k ! .

“n choose k ”

With Replacement.Order matters: n×n× . . .n = nk

Order does not matter: Second rule ???

Problem: depends on how many of each item we chose!Different number of unordered elts map to each unordered elt.

Unordered elt: 1,2,3 3! ordered elts map to it.Unordered elt: 1,2,2 3!

2! ordered elts map to it.

How do we deal with this mess??

Page 203: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Sampling...

Sample k items out of n

Without replacement:Order matters: n×n−1×n−2 . . . ×n−k + 1 = n!

(n−k)!Order does not matter:

Second Rule: divide by number of orders – “k !”=⇒ n!

(n−k)!k ! .

“n choose k ”

With Replacement.Order matters: n×n× . . .n = nk

Order does not matter: Second rule ???

Problem: depends on how many of each item we chose!Different number of unordered elts map to each unordered elt.

Unordered elt: 1,2,3 3! ordered elts map to it.Unordered elt: 1,2,2 3!

2! ordered elts map to it.

How do we deal with this mess??

Page 204: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Sampling...

Sample k items out of n

Without replacement:Order matters: n×n−1×n−2 . . . ×n−k + 1 = n!

(n−k)!Order does not matter:

Second Rule: divide by number of orders – “k !”=⇒ n!

(n−k)!k ! .“n choose k ”

With Replacement.Order matters: n×n× . . .n = nk

Order does not matter: Second rule ???

Problem: depends on how many of each item we chose!Different number of unordered elts map to each unordered elt.

Unordered elt: 1,2,3 3! ordered elts map to it.Unordered elt: 1,2,2 3!

2! ordered elts map to it.

How do we deal with this mess??

Page 205: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Sampling...

Sample k items out of n

Without replacement:Order matters: n×n−1×n−2 . . . ×n−k + 1 = n!

(n−k)!Order does not matter:

Second Rule: divide by number of orders – “k !”=⇒ n!

(n−k)!k ! .“n choose k ”

With Replacement.

Order matters: n×n× . . .n = nk

Order does not matter: Second rule ???

Problem: depends on how many of each item we chose!Different number of unordered elts map to each unordered elt.

Unordered elt: 1,2,3 3! ordered elts map to it.Unordered elt: 1,2,2 3!

2! ordered elts map to it.

How do we deal with this mess??

Page 206: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Sampling...

Sample k items out of n

Without replacement:Order matters: n×n−1×n−2 . . . ×n−k + 1 = n!

(n−k)!Order does not matter:

Second Rule: divide by number of orders – “k !”=⇒ n!

(n−k)!k ! .“n choose k ”

With Replacement.Order matters: n

×n× . . .n = nk

Order does not matter: Second rule ???

Problem: depends on how many of each item we chose!Different number of unordered elts map to each unordered elt.

Unordered elt: 1,2,3 3! ordered elts map to it.Unordered elt: 1,2,2 3!

2! ordered elts map to it.

How do we deal with this mess??

Page 207: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Sampling...

Sample k items out of n

Without replacement:Order matters: n×n−1×n−2 . . . ×n−k + 1 = n!

(n−k)!Order does not matter:

Second Rule: divide by number of orders – “k !”=⇒ n!

(n−k)!k ! .“n choose k ”

With Replacement.Order matters: n×n

× . . .n = nk

Order does not matter: Second rule ???

Problem: depends on how many of each item we chose!Different number of unordered elts map to each unordered elt.

Unordered elt: 1,2,3 3! ordered elts map to it.Unordered elt: 1,2,2 3!

2! ordered elts map to it.

How do we deal with this mess??

Page 208: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Sampling...

Sample k items out of n

Without replacement:Order matters: n×n−1×n−2 . . . ×n−k + 1 = n!

(n−k)!Order does not matter:

Second Rule: divide by number of orders – “k !”=⇒ n!

(n−k)!k ! .“n choose k ”

With Replacement.Order matters: n×n× . . .n

= nk

Order does not matter: Second rule ???

Problem: depends on how many of each item we chose!Different number of unordered elts map to each unordered elt.

Unordered elt: 1,2,3 3! ordered elts map to it.Unordered elt: 1,2,2 3!

2! ordered elts map to it.

How do we deal with this mess??

Page 209: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Sampling...

Sample k items out of n

Without replacement:Order matters: n×n−1×n−2 . . . ×n−k + 1 = n!

(n−k)!Order does not matter:

Second Rule: divide by number of orders – “k !”=⇒ n!

(n−k)!k ! .“n choose k ”

With Replacement.Order matters: n×n× . . .n = nk

Order does not matter: Second rule ???

Problem: depends on how many of each item we chose!Different number of unordered elts map to each unordered elt.

Unordered elt: 1,2,3 3! ordered elts map to it.Unordered elt: 1,2,2 3!

2! ordered elts map to it.

How do we deal with this mess??

Page 210: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Sampling...

Sample k items out of n

Without replacement:Order matters: n×n−1×n−2 . . . ×n−k + 1 = n!

(n−k)!Order does not matter:

Second Rule: divide by number of orders – “k !”=⇒ n!

(n−k)!k ! .“n choose k ”

With Replacement.Order matters: n×n× . . .n = nk

Order does not matter:

Second rule ???

Problem: depends on how many of each item we chose!Different number of unordered elts map to each unordered elt.

Unordered elt: 1,2,3 3! ordered elts map to it.Unordered elt: 1,2,2 3!

2! ordered elts map to it.

How do we deal with this mess??

Page 211: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Sampling...

Sample k items out of n

Without replacement:Order matters: n×n−1×n−2 . . . ×n−k + 1 = n!

(n−k)!Order does not matter:

Second Rule: divide by number of orders – “k !”=⇒ n!

(n−k)!k ! .“n choose k ”

With Replacement.Order matters: n×n× . . .n = nk

Order does not matter: Second rule

???

Problem: depends on how many of each item we chose!Different number of unordered elts map to each unordered elt.

Unordered elt: 1,2,3 3! ordered elts map to it.Unordered elt: 1,2,2 3!

2! ordered elts map to it.

How do we deal with this mess??

Page 212: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Sampling...

Sample k items out of n

Without replacement:Order matters: n×n−1×n−2 . . . ×n−k + 1 = n!

(n−k)!Order does not matter:

Second Rule: divide by number of orders – “k !”=⇒ n!

(n−k)!k ! .“n choose k ”

With Replacement.Order matters: n×n× . . .n = nk

Order does not matter: Second rule ???

Problem: depends on how many of each item we chose!Different number of unordered elts map to each unordered elt.

Unordered elt: 1,2,3 3! ordered elts map to it.Unordered elt: 1,2,2 3!

2! ordered elts map to it.

How do we deal with this mess??

Page 213: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Sampling...

Sample k items out of n

Without replacement:Order matters: n×n−1×n−2 . . . ×n−k + 1 = n!

(n−k)!Order does not matter:

Second Rule: divide by number of orders – “k !”=⇒ n!

(n−k)!k ! .“n choose k ”

With Replacement.Order matters: n×n× . . .n = nk

Order does not matter: Second rule ???

Problem: depends on how many of each item we chose!Different number of unordered elts map to each unordered elt.

Unordered elt: 1,2,3 3! ordered elts map to it.Unordered elt: 1,2,2 3!

2! ordered elts map to it.

How do we deal with this mess??

Page 214: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Sampling...

Sample k items out of n

Without replacement:Order matters: n×n−1×n−2 . . . ×n−k + 1 = n!

(n−k)!Order does not matter:

Second Rule: divide by number of orders – “k !”=⇒ n!

(n−k)!k ! .“n choose k ”

With Replacement.Order matters: n×n× . . .n = nk

Order does not matter: Second rule ???

Problem: depends on how many of each item we chose!

Different number of unordered elts map to each unordered elt.

Unordered elt: 1,2,3 3! ordered elts map to it.Unordered elt: 1,2,2 3!

2! ordered elts map to it.

How do we deal with this mess??

Page 215: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Sampling...

Sample k items out of n

Without replacement:Order matters: n×n−1×n−2 . . . ×n−k + 1 = n!

(n−k)!Order does not matter:

Second Rule: divide by number of orders – “k !”=⇒ n!

(n−k)!k ! .“n choose k ”

With Replacement.Order matters: n×n× . . .n = nk

Order does not matter: Second rule ???

Problem: depends on how many of each item we chose!Different number of unordered elts map to each unordered elt.

Unordered elt: 1,2,3 3! ordered elts map to it.Unordered elt: 1,2,2 3!

2! ordered elts map to it.

How do we deal with this mess??

Page 216: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Sampling...

Sample k items out of n

Without replacement:Order matters: n×n−1×n−2 . . . ×n−k + 1 = n!

(n−k)!Order does not matter:

Second Rule: divide by number of orders – “k !”=⇒ n!

(n−k)!k ! .“n choose k ”

With Replacement.Order matters: n×n× . . .n = nk

Order does not matter: Second rule ???

Problem: depends on how many of each item we chose!Different number of unordered elts map to each unordered elt.

Unordered elt: 1,2,3 3! ordered elts map to it.Unordered elt: 1,2,2 3!

2! ordered elts map to it.

How do we deal with this mess??

Page 217: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Sampling...

Sample k items out of n

Without replacement:Order matters: n×n−1×n−2 . . . ×n−k + 1 = n!

(n−k)!Order does not matter:

Second Rule: divide by number of orders – “k !”=⇒ n!

(n−k)!k ! .“n choose k ”

With Replacement.Order matters: n×n× . . .n = nk

Order does not matter: Second rule ???

Problem: depends on how many of each item we chose!Different number of unordered elts map to each unordered elt.

Unordered elt: 1,2,3

3! ordered elts map to it.Unordered elt: 1,2,2 3!

2! ordered elts map to it.

How do we deal with this mess??

Page 218: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Sampling...

Sample k items out of n

Without replacement:Order matters: n×n−1×n−2 . . . ×n−k + 1 = n!

(n−k)!Order does not matter:

Second Rule: divide by number of orders – “k !”=⇒ n!

(n−k)!k ! .“n choose k ”

With Replacement.Order matters: n×n× . . .n = nk

Order does not matter: Second rule ???

Problem: depends on how many of each item we chose!Different number of unordered elts map to each unordered elt.

Unordered elt: 1,2,3 3! ordered elts map to it.

Unordered elt: 1,2,2 3!2! ordered elts map to it.

How do we deal with this mess??

Page 219: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Sampling...

Sample k items out of n

Without replacement:Order matters: n×n−1×n−2 . . . ×n−k + 1 = n!

(n−k)!Order does not matter:

Second Rule: divide by number of orders – “k !”=⇒ n!

(n−k)!k ! .“n choose k ”

With Replacement.Order matters: n×n× . . .n = nk

Order does not matter: Second rule ???

Problem: depends on how many of each item we chose!Different number of unordered elts map to each unordered elt.

Unordered elt: 1,2,3 3! ordered elts map to it.Unordered elt: 1,2,2

3!2! ordered elts map to it.

How do we deal with this mess??

Page 220: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Sampling...

Sample k items out of n

Without replacement:Order matters: n×n−1×n−2 . . . ×n−k + 1 = n!

(n−k)!Order does not matter:

Second Rule: divide by number of orders – “k !”=⇒ n!

(n−k)!k ! .“n choose k ”

With Replacement.Order matters: n×n× . . .n = nk

Order does not matter: Second rule ???

Problem: depends on how many of each item we chose!Different number of unordered elts map to each unordered elt.

Unordered elt: 1,2,3 3! ordered elts map to it.Unordered elt: 1,2,2 3!

2! ordered elts map to it.

How do we deal with this mess??

Page 221: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Sampling...

Sample k items out of n

Without replacement:Order matters: n×n−1×n−2 . . . ×n−k + 1 = n!

(n−k)!Order does not matter:

Second Rule: divide by number of orders – “k !”=⇒ n!

(n−k)!k ! .“n choose k ”

With Replacement.Order matters: n×n× . . .n = nk

Order does not matter: Second rule ???

Problem: depends on how many of each item we chose!Different number of unordered elts map to each unordered elt.

Unordered elt: 1,2,3 3! ordered elts map to it.Unordered elt: 1,2,2 3!

2! ordered elts map to it.

How do we deal with this mess??

Page 222: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Sampling...

Sample k items out of n

Without replacement:Order matters: n×n−1×n−2 . . . ×n−k + 1 = n!

(n−k)!Order does not matter:

Second Rule: divide by number of orders – “k !”=⇒ n!

(n−k)!k ! .“n choose k ”

With Replacement.Order matters: n×n× . . .n = nk

Order does not matter: Second rule ???

Problem: depends on how many of each item we chose!Different number of unordered elts map to each unordered elt.

Unordered elt: 1,2,3 3! ordered elts map to it.Unordered elt: 1,2,2 3!

2! ordered elts map to it.

How do we deal with this

mess??

Page 223: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Sampling...

Sample k items out of n

Without replacement:Order matters: n×n−1×n−2 . . . ×n−k + 1 = n!

(n−k)!Order does not matter:

Second Rule: divide by number of orders – “k !”=⇒ n!

(n−k)!k ! .“n choose k ”

With Replacement.Order matters: n×n× . . .n = nk

Order does not matter: Second rule ???

Problem: depends on how many of each item we chose!Different number of unordered elts map to each unordered elt.

Unordered elt: 1,2,3 3! ordered elts map to it.Unordered elt: 1,2,2 3!

2! ordered elts map to it.

How do we deal with this mess??

Page 224: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Splitting up some money....

How many ways can Bob and Alice split 5 dollars?

For each of 5 dollars pick Bob or Alice(25), divide out order ???

5 dollars for Bob and 0 for Alice:one ordered set: (B,B,B,B,B).

4 for Bob and 1 for Alice:5 ordered sets: (A,B,B,B,B) ; (B,A,B,B,B); ...

“Sorted” way to specify, first Alice’s dollars, then Bob’s.(B,B,B,B,B):

1: (B,B,B,B,B)

(A,B,B,B,B):

5: (A,B,B,B,B),(B,A,B,B,B),(B,B,A,B,B),...

(A,A,B,B,B):

(52

);(A,A,B,B,B),(A,B,A,B,B),(A,B,B,A,B),...

and so on.

. . .. . .

. . .. . . ∆ ??

Second rule of counting is no good here!

Page 225: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Splitting up some money....

How many ways can Bob and Alice split 5 dollars?For each of 5 dollars pick Bob or Alice(25), divide out order

???

5 dollars for Bob and 0 for Alice:one ordered set: (B,B,B,B,B).

4 for Bob and 1 for Alice:5 ordered sets: (A,B,B,B,B) ; (B,A,B,B,B); ...

“Sorted” way to specify, first Alice’s dollars, then Bob’s.(B,B,B,B,B):

1: (B,B,B,B,B)

(A,B,B,B,B):

5: (A,B,B,B,B),(B,A,B,B,B),(B,B,A,B,B),...

(A,A,B,B,B):

(52

);(A,A,B,B,B),(A,B,A,B,B),(A,B,B,A,B),...

and so on.

. . .. . .

. . .. . . ∆ ??

Second rule of counting is no good here!

Page 226: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Splitting up some money....

How many ways can Bob and Alice split 5 dollars?For each of 5 dollars pick Bob or Alice(25), divide out order ???

5 dollars for Bob and 0 for Alice:one ordered set: (B,B,B,B,B).

4 for Bob and 1 for Alice:5 ordered sets: (A,B,B,B,B) ; (B,A,B,B,B); ...

“Sorted” way to specify, first Alice’s dollars, then Bob’s.(B,B,B,B,B):

1: (B,B,B,B,B)

(A,B,B,B,B):

5: (A,B,B,B,B),(B,A,B,B,B),(B,B,A,B,B),...

(A,A,B,B,B):

(52

);(A,A,B,B,B),(A,B,A,B,B),(A,B,B,A,B),...

and so on.

. . .. . .

. . .. . . ∆ ??

Second rule of counting is no good here!

Page 227: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Splitting up some money....

How many ways can Bob and Alice split 5 dollars?For each of 5 dollars pick Bob or Alice(25), divide out order ???

5 dollars for Bob and 0 for Alice:

one ordered set: (B,B,B,B,B).

4 for Bob and 1 for Alice:5 ordered sets: (A,B,B,B,B) ; (B,A,B,B,B); ...

“Sorted” way to specify, first Alice’s dollars, then Bob’s.(B,B,B,B,B):

1: (B,B,B,B,B)

(A,B,B,B,B):

5: (A,B,B,B,B),(B,A,B,B,B),(B,B,A,B,B),...

(A,A,B,B,B):

(52

);(A,A,B,B,B),(A,B,A,B,B),(A,B,B,A,B),...

and so on.

. . .. . .

. . .. . . ∆ ??

Second rule of counting is no good here!

Page 228: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Splitting up some money....

How many ways can Bob and Alice split 5 dollars?For each of 5 dollars pick Bob or Alice(25), divide out order ???

5 dollars for Bob and 0 for Alice:one ordered set: (B,B,B,B,B).

4 for Bob and 1 for Alice:5 ordered sets: (A,B,B,B,B) ; (B,A,B,B,B); ...

“Sorted” way to specify, first Alice’s dollars, then Bob’s.(B,B,B,B,B):

1: (B,B,B,B,B)

(A,B,B,B,B):

5: (A,B,B,B,B),(B,A,B,B,B),(B,B,A,B,B),...

(A,A,B,B,B):

(52

);(A,A,B,B,B),(A,B,A,B,B),(A,B,B,A,B),...

and so on.

. . .. . .

. . .. . . ∆ ??

Second rule of counting is no good here!

Page 229: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Splitting up some money....

How many ways can Bob and Alice split 5 dollars?For each of 5 dollars pick Bob or Alice(25), divide out order ???

5 dollars for Bob and 0 for Alice:one ordered set: (B,B,B,B,B).

4 for Bob and 1 for Alice:

5 ordered sets: (A,B,B,B,B) ; (B,A,B,B,B); ...

“Sorted” way to specify, first Alice’s dollars, then Bob’s.(B,B,B,B,B):

1: (B,B,B,B,B)

(A,B,B,B,B):

5: (A,B,B,B,B),(B,A,B,B,B),(B,B,A,B,B),...

(A,A,B,B,B):

(52

);(A,A,B,B,B),(A,B,A,B,B),(A,B,B,A,B),...

and so on.

. . .. . .

. . .. . . ∆ ??

Second rule of counting is no good here!

Page 230: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Splitting up some money....

How many ways can Bob and Alice split 5 dollars?For each of 5 dollars pick Bob or Alice(25), divide out order ???

5 dollars for Bob and 0 for Alice:one ordered set: (B,B,B,B,B).

4 for Bob and 1 for Alice:5 ordered sets: (A,B,B,B,B) ; (B,A,B,B,B); ...

“Sorted” way to specify, first Alice’s dollars, then Bob’s.(B,B,B,B,B):

1: (B,B,B,B,B)

(A,B,B,B,B):

5: (A,B,B,B,B),(B,A,B,B,B),(B,B,A,B,B),...

(A,A,B,B,B):

(52

);(A,A,B,B,B),(A,B,A,B,B),(A,B,B,A,B),...

and so on.

. . .. . .

. . .. . . ∆ ??

Second rule of counting is no good here!

Page 231: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Splitting up some money....

How many ways can Bob and Alice split 5 dollars?For each of 5 dollars pick Bob or Alice(25), divide out order ???

5 dollars for Bob and 0 for Alice:one ordered set: (B,B,B,B,B).

4 for Bob and 1 for Alice:5 ordered sets: (A,B,B,B,B) ; (B,A,B,B,B); ...

“Sorted” way to specify, first Alice’s dollars, then Bob’s.

(B,B,B,B,B):

1: (B,B,B,B,B)

(A,B,B,B,B):

5: (A,B,B,B,B),(B,A,B,B,B),(B,B,A,B,B),...

(A,A,B,B,B):

(52

);(A,A,B,B,B),(A,B,A,B,B),(A,B,B,A,B),...

and so on.

. . .. . .

. . .. . . ∆ ??

Second rule of counting is no good here!

Page 232: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Splitting up some money....

How many ways can Bob and Alice split 5 dollars?For each of 5 dollars pick Bob or Alice(25), divide out order ???

5 dollars for Bob and 0 for Alice:one ordered set: (B,B,B,B,B).

4 for Bob and 1 for Alice:5 ordered sets: (A,B,B,B,B) ; (B,A,B,B,B); ...

“Sorted” way to specify, first Alice’s dollars, then Bob’s.(B,B,B,B,B):

1: (B,B,B,B,B)

(A,B,B,B,B):

5: (A,B,B,B,B),(B,A,B,B,B),(B,B,A,B,B),...

(A,A,B,B,B):

(52

);(A,A,B,B,B),(A,B,A,B,B),(A,B,B,A,B),...

and so on.

. . .. . .

. . .. . . ∆ ??

Second rule of counting is no good here!

Page 233: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Splitting up some money....

How many ways can Bob and Alice split 5 dollars?For each of 5 dollars pick Bob or Alice(25), divide out order ???

5 dollars for Bob and 0 for Alice:one ordered set: (B,B,B,B,B).

4 for Bob and 1 for Alice:5 ordered sets: (A,B,B,B,B) ; (B,A,B,B,B); ...

“Sorted” way to specify, first Alice’s dollars, then Bob’s.(B,B,B,B,B):

1: (B,B,B,B,B)

(A,B,B,B,B):

5: (A,B,B,B,B),(B,A,B,B,B),(B,B,A,B,B),...

(A,A,B,B,B):

(52

);(A,A,B,B,B),(A,B,A,B,B),(A,B,B,A,B),...

and so on.

. . .. . .

. . .. . . ∆ ??

Second rule of counting is no good here!

Page 234: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Splitting up some money....

How many ways can Bob and Alice split 5 dollars?For each of 5 dollars pick Bob or Alice(25), divide out order ???

5 dollars for Bob and 0 for Alice:one ordered set: (B,B,B,B,B).

4 for Bob and 1 for Alice:5 ordered sets: (A,B,B,B,B) ; (B,A,B,B,B); ...

“Sorted” way to specify, first Alice’s dollars, then Bob’s.(B,B,B,B,B):

1: (B,B,B,B,B)

(A,B,B,B,B):

5: (A,B,B,B,B),(B,A,B,B,B),(B,B,A,B,B),...

(A,A,B,B,B):

(52

);(A,A,B,B,B),(A,B,A,B,B),(A,B,B,A,B),...

and so on.

. . .. . .

. . .. . . ∆ ??

Second rule of counting is no good here!

Page 235: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Splitting up some money....

How many ways can Bob and Alice split 5 dollars?For each of 5 dollars pick Bob or Alice(25), divide out order ???

5 dollars for Bob and 0 for Alice:one ordered set: (B,B,B,B,B).

4 for Bob and 1 for Alice:5 ordered sets: (A,B,B,B,B) ; (B,A,B,B,B); ...

“Sorted” way to specify, first Alice’s dollars, then Bob’s.(B,B,B,B,B): 1: (B,B,B,B,B)(A,B,B,B,B):

5: (A,B,B,B,B),(B,A,B,B,B),(B,B,A,B,B),...

(A,A,B,B,B):

(52

);(A,A,B,B,B),(A,B,A,B,B),(A,B,B,A,B),...

and so on.

. . .. . .

. . .. . . ∆ ??

Second rule of counting is no good here!

Page 236: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Splitting up some money....

How many ways can Bob and Alice split 5 dollars?For each of 5 dollars pick Bob or Alice(25), divide out order ???

5 dollars for Bob and 0 for Alice:one ordered set: (B,B,B,B,B).

4 for Bob and 1 for Alice:5 ordered sets: (A,B,B,B,B) ; (B,A,B,B,B); ...

“Sorted” way to specify, first Alice’s dollars, then Bob’s.(B,B,B,B,B): 1: (B,B,B,B,B)(A,B,B,B,B): 5: (A,B,B,B,B),(B,A,B,B,B),(B,B,A,B,B),...(A,A,B,B,B):

(52

);(A,A,B,B,B),(A,B,A,B,B),(A,B,B,A,B),...

and so on.

. . .. . .

. . .. . . ∆ ??

Second rule of counting is no good here!

Page 237: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Splitting up some money....

How many ways can Bob and Alice split 5 dollars?For each of 5 dollars pick Bob or Alice(25), divide out order ???

5 dollars for Bob and 0 for Alice:one ordered set: (B,B,B,B,B).

4 for Bob and 1 for Alice:5 ordered sets: (A,B,B,B,B) ; (B,A,B,B,B); ...

“Sorted” way to specify, first Alice’s dollars, then Bob’s.(B,B,B,B,B): 1: (B,B,B,B,B)(A,B,B,B,B): 5: (A,B,B,B,B),(B,A,B,B,B),(B,B,A,B,B),...(A,A,B,B,B):

(52

);(A,A,B,B,B),(A,B,A,B,B),(A,B,B,A,B),...

and so on.

. . .. . .

. . .. . . ∆ ??

Second rule of counting is no good here!

Page 238: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Splitting 5 dollars..

How many ways can Alice, Bob, and Eve split 5 dollars.

Alice gets 3, Bob gets 1, Eve gets 1: (A,A,A,B,E).

Separate Alice’s dollars from Bob’s and then Bob’s from Eve’s.

Five dollars are five stars: ?????.

Alice: 2, Bob: 1, Eve: 2.Stars and Bars: ?? |? |??.

Alice: 0, Bob: 1, Eve: 4.Stars and Bars: |? |????.

Each split “is” a sequence of stars and bars.Each sequence of stars and bars “is” a split.

Counting Rule: if there is a one-to-one mapping between twosets they have the same size!

Page 239: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Splitting 5 dollars..

How many ways can Alice, Bob, and Eve split 5 dollars.

Alice gets 3, Bob gets 1, Eve gets 1: (A,A,A,B,E).

Separate Alice’s dollars from Bob’s and then Bob’s from Eve’s.

Five dollars are five stars: ?????.

Alice: 2, Bob: 1, Eve: 2.Stars and Bars: ?? |? |??.

Alice: 0, Bob: 1, Eve: 4.Stars and Bars: |? |????.

Each split “is” a sequence of stars and bars.Each sequence of stars and bars “is” a split.

Counting Rule: if there is a one-to-one mapping between twosets they have the same size!

Page 240: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Splitting 5 dollars..

How many ways can Alice, Bob, and Eve split 5 dollars.

Alice gets 3, Bob gets 1, Eve gets 1: (A,A,A,B,E).

Separate Alice’s dollars from Bob’s and then Bob’s from Eve’s.

Five dollars are five stars: ?????.

Alice: 2, Bob: 1, Eve: 2.Stars and Bars: ?? |? |??.

Alice: 0, Bob: 1, Eve: 4.Stars and Bars: |? |????.

Each split “is” a sequence of stars and bars.Each sequence of stars and bars “is” a split.

Counting Rule: if there is a one-to-one mapping between twosets they have the same size!

Page 241: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Splitting 5 dollars..

How many ways can Alice, Bob, and Eve split 5 dollars.

Alice gets 3, Bob gets 1, Eve gets 1: (A,A,A,B,E).

Separate Alice’s dollars from Bob’s and then Bob’s from Eve’s.

Five dollars are five stars: ?????.

Alice: 2, Bob: 1, Eve: 2.Stars and Bars: ?? |? |??.

Alice: 0, Bob: 1, Eve: 4.Stars and Bars: |? |????.

Each split “is” a sequence of stars and bars.Each sequence of stars and bars “is” a split.

Counting Rule: if there is a one-to-one mapping between twosets they have the same size!

Page 242: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Splitting 5 dollars..

How many ways can Alice, Bob, and Eve split 5 dollars.

Alice gets 3, Bob gets 1, Eve gets 1: (A,A,A,B,E).

Separate Alice’s dollars from Bob’s and then Bob’s from Eve’s.

Five dollars are five stars: ?????.

Alice: 2, Bob: 1, Eve: 2.

Stars and Bars: ?? |? |??.

Alice: 0, Bob: 1, Eve: 4.Stars and Bars: |? |????.

Each split “is” a sequence of stars and bars.Each sequence of stars and bars “is” a split.

Counting Rule: if there is a one-to-one mapping between twosets they have the same size!

Page 243: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Splitting 5 dollars..

How many ways can Alice, Bob, and Eve split 5 dollars.

Alice gets 3, Bob gets 1, Eve gets 1: (A,A,A,B,E).

Separate Alice’s dollars from Bob’s and then Bob’s from Eve’s.

Five dollars are five stars: ?????.

Alice: 2, Bob: 1, Eve: 2.Stars and Bars: ?? |? |??.

Alice: 0, Bob: 1, Eve: 4.Stars and Bars: |? |????.

Each split “is” a sequence of stars and bars.Each sequence of stars and bars “is” a split.

Counting Rule: if there is a one-to-one mapping between twosets they have the same size!

Page 244: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Splitting 5 dollars..

How many ways can Alice, Bob, and Eve split 5 dollars.

Alice gets 3, Bob gets 1, Eve gets 1: (A,A,A,B,E).

Separate Alice’s dollars from Bob’s and then Bob’s from Eve’s.

Five dollars are five stars: ?????.

Alice: 2, Bob: 1, Eve: 2.Stars and Bars: ?? |? |??.

Alice: 0, Bob: 1, Eve: 4.

Stars and Bars: |? |????.

Each split “is” a sequence of stars and bars.Each sequence of stars and bars “is” a split.

Counting Rule: if there is a one-to-one mapping between twosets they have the same size!

Page 245: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Splitting 5 dollars..

How many ways can Alice, Bob, and Eve split 5 dollars.

Alice gets 3, Bob gets 1, Eve gets 1: (A,A,A,B,E).

Separate Alice’s dollars from Bob’s and then Bob’s from Eve’s.

Five dollars are five stars: ?????.

Alice: 2, Bob: 1, Eve: 2.Stars and Bars: ?? |? |??.

Alice: 0, Bob: 1, Eve: 4.Stars and Bars: |? |????.

Each split “is” a sequence of stars and bars.Each sequence of stars and bars “is” a split.

Counting Rule: if there is a one-to-one mapping between twosets they have the same size!

Page 246: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Splitting 5 dollars..

How many ways can Alice, Bob, and Eve split 5 dollars.

Alice gets 3, Bob gets 1, Eve gets 1: (A,A,A,B,E).

Separate Alice’s dollars from Bob’s and then Bob’s from Eve’s.

Five dollars are five stars: ?????.

Alice: 2, Bob: 1, Eve: 2.Stars and Bars: ?? |? |??.

Alice: 0, Bob: 1, Eve: 4.Stars and Bars: |? |????.

Each split “is” a sequence of stars and bars.

Each sequence of stars and bars “is” a split.

Counting Rule: if there is a one-to-one mapping between twosets they have the same size!

Page 247: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Splitting 5 dollars..

How many ways can Alice, Bob, and Eve split 5 dollars.

Alice gets 3, Bob gets 1, Eve gets 1: (A,A,A,B,E).

Separate Alice’s dollars from Bob’s and then Bob’s from Eve’s.

Five dollars are five stars: ?????.

Alice: 2, Bob: 1, Eve: 2.Stars and Bars: ?? |? |??.

Alice: 0, Bob: 1, Eve: 4.Stars and Bars: |? |????.

Each split “is” a sequence of stars and bars.Each sequence of stars and bars “is” a split.

Counting Rule: if there is a one-to-one mapping between twosets they have the same size!

Page 248: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Splitting 5 dollars..

How many ways can Alice, Bob, and Eve split 5 dollars.

Alice gets 3, Bob gets 1, Eve gets 1: (A,A,A,B,E).

Separate Alice’s dollars from Bob’s and then Bob’s from Eve’s.

Five dollars are five stars: ?????.

Alice: 2, Bob: 1, Eve: 2.Stars and Bars: ?? |? |??.

Alice: 0, Bob: 1, Eve: 4.Stars and Bars: |? |????.

Each split “is” a sequence of stars and bars.Each sequence of stars and bars “is” a split.

Counting Rule: if there is a one-to-one mapping between twosets they have the same size!

Page 249: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Splitting 5 dollars..

How many ways can Alice, Bob, and Eve split 5 dollars.

Alice gets 3, Bob gets 1, Eve gets 1: (A,A,A,B,E).

Separate Alice’s dollars from Bob’s and then Bob’s from Eve’s.

Five dollars are five stars: ?????.

Alice: 2, Bob: 1, Eve: 2.Stars and Bars: ?? |? |??.

Alice: 0, Bob: 1, Eve: 4.Stars and Bars: |? |????.

Each split “is” a sequence of stars and bars.Each sequence of stars and bars “is” a split.

Counting Rule: if there is a one-to-one mapping between twosets they have the same size!

Page 250: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Stars and Bars.

How many different 5 star and 2 bar diagrams?

| ? | ? ? ? ?.

7 positions in which to place the 2 bars.

Alice: 0; Bob 1; Eve: 4| ? | ? ? ? ?.Bars in first and third position.

Alice: 1; Bob 4; Eve: 0? | ? ? ? ? |.Bars in second and seventh position.(7

2

)ways to do so and(7

2

)ways to split 5 dollars among 3 people.

Page 251: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Stars and Bars.

How many different 5 star and 2 bar diagrams?

| ? | ? ? ? ?.

7 positions in which to place the 2 bars.

Alice: 0; Bob 1; Eve: 4| ? | ? ? ? ?.Bars in first and third position.

Alice: 1; Bob 4; Eve: 0? | ? ? ? ? |.Bars in second and seventh position.(7

2

)ways to do so and(7

2

)ways to split 5 dollars among 3 people.

Page 252: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Stars and Bars.

How many different 5 star and 2 bar diagrams?

| ? | ? ? ? ?.

7 positions in which to place the 2 bars.

Alice: 0; Bob 1; Eve: 4| ? | ? ? ? ?.Bars in first and third position.

Alice: 1; Bob 4; Eve: 0? | ? ? ? ? |.Bars in second and seventh position.(7

2

)ways to do so and(7

2

)ways to split 5 dollars among 3 people.

Page 253: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Stars and Bars.

How many different 5 star and 2 bar diagrams?

| ? | ? ? ? ?.

7 positions in which to place the 2 bars.

Alice: 0; Bob 1; Eve: 4

| ? | ? ? ? ?.Bars in first and third position.

Alice: 1; Bob 4; Eve: 0? | ? ? ? ? |.Bars in second and seventh position.(7

2

)ways to do so and(7

2

)ways to split 5 dollars among 3 people.

Page 254: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Stars and Bars.

How many different 5 star and 2 bar diagrams?

| ? | ? ? ? ?.

7 positions in which to place the 2 bars.

Alice: 0; Bob 1; Eve: 4| ? | ? ? ? ?.

Bars in first and third position.

Alice: 1; Bob 4; Eve: 0? | ? ? ? ? |.Bars in second and seventh position.(7

2

)ways to do so and(7

2

)ways to split 5 dollars among 3 people.

Page 255: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Stars and Bars.

How many different 5 star and 2 bar diagrams?

| ? | ? ? ? ?.

7 positions in which to place the 2 bars.

Alice: 0; Bob 1; Eve: 4| ? | ? ? ? ?.Bars in first and third position.

Alice: 1; Bob 4; Eve: 0? | ? ? ? ? |.Bars in second and seventh position.(7

2

)ways to do so and(7

2

)ways to split 5 dollars among 3 people.

Page 256: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Stars and Bars.

How many different 5 star and 2 bar diagrams?

| ? | ? ? ? ?.

7 positions in which to place the 2 bars.

Alice: 0; Bob 1; Eve: 4| ? | ? ? ? ?.Bars in first and third position.

Alice: 1; Bob 4; Eve: 0

? | ? ? ? ? |.Bars in second and seventh position.(7

2

)ways to do so and(7

2

)ways to split 5 dollars among 3 people.

Page 257: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Stars and Bars.

How many different 5 star and 2 bar diagrams?

| ? | ? ? ? ?.

7 positions in which to place the 2 bars.

Alice: 0; Bob 1; Eve: 4| ? | ? ? ? ?.Bars in first and third position.

Alice: 1; Bob 4; Eve: 0? | ? ? ? ? |.

Bars in second and seventh position.(72

)ways to do so and(7

2

)ways to split 5 dollars among 3 people.

Page 258: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Stars and Bars.

How many different 5 star and 2 bar diagrams?

| ? | ? ? ? ?.

7 positions in which to place the 2 bars.

Alice: 0; Bob 1; Eve: 4| ? | ? ? ? ?.Bars in first and third position.

Alice: 1; Bob 4; Eve: 0? | ? ? ? ? |.Bars in second and seventh position.

(72

)ways to do so and(7

2

)ways to split 5 dollars among 3 people.

Page 259: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Stars and Bars.

How many different 5 star and 2 bar diagrams?

| ? | ? ? ? ?.

7 positions in which to place the 2 bars.

Alice: 0; Bob 1; Eve: 4| ? | ? ? ? ?.Bars in first and third position.

Alice: 1; Bob 4; Eve: 0? | ? ? ? ? |.Bars in second and seventh position.(7

2

)ways to do so and

(72

)ways to split 5 dollars among 3 people.

Page 260: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Stars and Bars.

How many different 5 star and 2 bar diagrams?

| ? | ? ? ? ?.

7 positions in which to place the 2 bars.

Alice: 0; Bob 1; Eve: 4| ? | ? ? ? ?.Bars in first and third position.

Alice: 1; Bob 4; Eve: 0? | ? ? ? ? |.Bars in second and seventh position.(7

2

)ways to do so and(7

2

)ways to split 5 dollars among 3 people.

Page 261: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Stars and Bars.

Ways to add up n numbers to sum to k?

or

“ k from n with replacement where order doesn’t matter.”

In general, k stars n−1 bars.

?? |? | · · · |??.

n + k −1 positions from which to choose n−1 bar positions.(n + k −1

n−1

)

Or: k unordered choices from set of n possibilities with replacement.Sample with replacement where order doesn’t matter.

Page 262: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Stars and Bars.

Ways to add up n numbers to sum to k? or

“ k from n with replacement where order doesn’t matter.”

In general, k stars n−1 bars.

?? |? | · · · |??.

n + k −1 positions from which to choose n−1 bar positions.(n + k −1

n−1

)

Or: k unordered choices from set of n possibilities with replacement.Sample with replacement where order doesn’t matter.

Page 263: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Stars and Bars.

Ways to add up n numbers to sum to k? or

“ k from n with replacement where order doesn’t matter.”

In general, k stars n−1 bars.

?? |? | · · · |??.

n + k −1 positions from which to choose n−1 bar positions.(n + k −1

n−1

)

Or: k unordered choices from set of n possibilities with replacement.Sample with replacement where order doesn’t matter.

Page 264: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Stars and Bars.

Ways to add up n numbers to sum to k? or

“ k from n with replacement where order doesn’t matter.”

In general, k stars n−1 bars.

?? |? | · · · |??.

n + k −1 positions from which to choose n−1 bar positions.

(n + k −1

n−1

)

Or: k unordered choices from set of n possibilities with replacement.Sample with replacement where order doesn’t matter.

Page 265: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Stars and Bars.

Ways to add up n numbers to sum to k? or

“ k from n with replacement where order doesn’t matter.”

In general, k stars n−1 bars.

?? |? | · · · |??.

n + k −1 positions from which to choose n−1 bar positions.(n + k −1

n−1

)

Or: k unordered choices from set of n possibilities with replacement.Sample with replacement where order doesn’t matter.

Page 266: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Stars and Bars.

Ways to add up n numbers to sum to k? or

“ k from n with replacement where order doesn’t matter.”

In general, k stars n−1 bars.

?? |? | · · · |??.

n + k −1 positions from which to choose n−1 bar positions.(n + k −1

n−1

)

Or: k unordered choices from set of n possibilities with replacement.Sample with replacement where order doesn’t matter.

Page 267: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Summary.

First rule: n1×n2 · · ·×n3.

k Samples with replacement from n items: nk .Sample without replacement: n!

(n−k)!

Second rule: when order doesn’t matter (sometimes) candivide...

Sample without replacement and order doesn’t matter:(n

k

)= n!

(n−k)!k ! .“n choose k ”

One-to-one rule: equal in number if one-to-one correspondence.pause Bijection!

Sample k times from n objects with replacement and order doesn’tmatter:

(k+n−1n−1

).

Page 268: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Summary.

First rule: n1×n2 · · ·×n3.

k Samples with replacement from n items: nk .

Sample without replacement: n!(n−k)!

Second rule: when order doesn’t matter (sometimes) candivide...

Sample without replacement and order doesn’t matter:(n

k

)= n!

(n−k)!k ! .“n choose k ”

One-to-one rule: equal in number if one-to-one correspondence.pause Bijection!

Sample k times from n objects with replacement and order doesn’tmatter:

(k+n−1n−1

).

Page 269: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Summary.

First rule: n1×n2 · · ·×n3.

k Samples with replacement from n items: nk .Sample without replacement: n!

(n−k)!

Second rule: when order doesn’t matter (sometimes) candivide...

Sample without replacement and order doesn’t matter:(n

k

)= n!

(n−k)!k ! .“n choose k ”

One-to-one rule: equal in number if one-to-one correspondence.pause Bijection!

Sample k times from n objects with replacement and order doesn’tmatter:

(k+n−1n−1

).

Page 270: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Summary.

First rule: n1×n2 · · ·×n3.

k Samples with replacement from n items: nk .Sample without replacement: n!

(n−k)!

Second rule: when order doesn’t matter (sometimes) candivide...

Sample without replacement and order doesn’t matter:(n

k

)= n!

(n−k)!k ! .“n choose k ”

One-to-one rule: equal in number if one-to-one correspondence.pause Bijection!

Sample k times from n objects with replacement and order doesn’tmatter:

(k+n−1n−1

).

Page 271: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Summary.

First rule: n1×n2 · · ·×n3.

k Samples with replacement from n items: nk .Sample without replacement: n!

(n−k)!

Second rule: when order doesn’t matter (sometimes) candivide...

Sample without replacement and order doesn’t matter:(n

k

)= n!

(n−k)!k ! .“n choose k ”

One-to-one rule: equal in number if one-to-one correspondence.pause Bijection!

Sample k times from n objects with replacement and order doesn’tmatter:

(k+n−1n−1

).

Page 272: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Summary.

First rule: n1×n2 · · ·×n3.

k Samples with replacement from n items: nk .Sample without replacement: n!

(n−k)!

Second rule: when order doesn’t matter (sometimes) candivide...

Sample without replacement and order doesn’t matter:(n

k

)= n!

(n−k)!k ! .“n choose k ”

One-to-one rule: equal in number if one-to-one correspondence.pause Bijection!

Sample k times from n objects with replacement and order doesn’tmatter:

(k+n−1n−1

).

Page 273: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Summary.

First rule: n1×n2 · · ·×n3.

k Samples with replacement from n items: nk .Sample without replacement: n!

(n−k)!

Second rule: when order doesn’t matter (sometimes) candivide...

Sample without replacement and order doesn’t matter:(n

k

)= n!

(n−k)!k ! .“n choose k ”

One-to-one rule: equal in number if one-to-one correspondence.pause Bijection!

Sample k times from n objects with replacement and order doesn’tmatter:

(k+n−1n−1

).

Page 274: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Quick review of the basics.

First rule: n1×n2 · · ·×n3.

k Samples with replacement from n items: nk .Sample without replacement: n!

(n−k)!

Second rule: when order doesn’t matter divide..when possible.

Sample without replacement and order doesn’t matter:(n

k

)= n!

(n−k)!k ! .“n choose k ”

One-to-one rule: equal in number if one-to-one correspondence.

Sample with replacement and order doesn’t matter:(k+n−1

n−1

).

Page 275: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Quick review of the basics.

First rule: n1×n2 · · ·×n3.

k Samples with replacement from n items: nk .

Sample without replacement: n!(n−k)!

Second rule: when order doesn’t matter divide..when possible.

Sample without replacement and order doesn’t matter:(n

k

)= n!

(n−k)!k ! .“n choose k ”

One-to-one rule: equal in number if one-to-one correspondence.

Sample with replacement and order doesn’t matter:(k+n−1

n−1

).

Page 276: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Quick review of the basics.

First rule: n1×n2 · · ·×n3.

k Samples with replacement from n items: nk .Sample without replacement: n!

(n−k)!

Second rule: when order doesn’t matter divide..when possible.

Sample without replacement and order doesn’t matter:(n

k

)= n!

(n−k)!k ! .“n choose k ”

One-to-one rule: equal in number if one-to-one correspondence.

Sample with replacement and order doesn’t matter:(k+n−1

n−1

).

Page 277: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Quick review of the basics.

First rule: n1×n2 · · ·×n3.

k Samples with replacement from n items: nk .Sample without replacement: n!

(n−k)!

Second rule: when order doesn’t matter divide..when possible.

Sample without replacement and order doesn’t matter:(n

k

)= n!

(n−k)!k ! .“n choose k ”

One-to-one rule: equal in number if one-to-one correspondence.

Sample with replacement and order doesn’t matter:(k+n−1

n−1

).

Page 278: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Quick review of the basics.

First rule: n1×n2 · · ·×n3.

k Samples with replacement from n items: nk .Sample without replacement: n!

(n−k)!

Second rule: when order doesn’t matter divide..when possible.

Sample without replacement and order doesn’t matter:(n

k

)= n!

(n−k)!k ! .“n choose k ”

One-to-one rule: equal in number if one-to-one correspondence.

Sample with replacement and order doesn’t matter:(k+n−1

n−1

).

Page 279: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Quick review of the basics.

First rule: n1×n2 · · ·×n3.

k Samples with replacement from n items: nk .Sample without replacement: n!

(n−k)!

Second rule: when order doesn’t matter divide..when possible.

Sample without replacement and order doesn’t matter:(n

k

)= n!

(n−k)!k ! .“n choose k ”

One-to-one rule: equal in number if one-to-one correspondence.

Sample with replacement and order doesn’t matter:(k+n−1

n−1

).

Page 280: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Quick review of the basics.

First rule: n1×n2 · · ·×n3.

k Samples with replacement from n items: nk .Sample without replacement: n!

(n−k)!

Second rule: when order doesn’t matter divide..when possible.

Sample without replacement and order doesn’t matter:(n

k

)= n!

(n−k)!k ! .“n choose k ”

One-to-one rule: equal in number if one-to-one correspondence.

Sample with replacement and order doesn’t matter:(k+n−1

n−1

).

Page 281: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Balls in bins.

“k Balls in n bins” ≡ “k samples from n possibilities.”

“indistinguishable balls” ≡ “order doesn’t matter”

“only one ball in each bin” ≡ “without replacement”

5 balls into 10 bins5 samples from 10 possibilities with replacement

Example: 5 digit numbers.

5 indistinguishable balls into 52 bins only one ball in each bin5 samples from 52 possibilities without replacement

Example: Poker hands.

5 indistinguishable balls into 3 bins5 samples from 3 possibilities with replacement and no order

Dividing 5 dollars among Alice, Bob and Eve.

Page 282: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Balls in bins.

“k Balls in n bins” ≡ “k samples from n possibilities.”

“indistinguishable balls” ≡ “order doesn’t matter”

“only one ball in each bin” ≡ “without replacement”

5 balls into 10 bins5 samples from 10 possibilities with replacement

Example: 5 digit numbers.

5 indistinguishable balls into 52 bins only one ball in each bin5 samples from 52 possibilities without replacement

Example: Poker hands.

5 indistinguishable balls into 3 bins5 samples from 3 possibilities with replacement and no order

Dividing 5 dollars among Alice, Bob and Eve.

Page 283: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Balls in bins.

“k Balls in n bins” ≡ “k samples from n possibilities.”

“indistinguishable balls” ≡ “order doesn’t matter”

“only one ball in each bin” ≡ “without replacement”

5 balls into 10 bins5 samples from 10 possibilities with replacement

Example: 5 digit numbers.

5 indistinguishable balls into 52 bins only one ball in each bin5 samples from 52 possibilities without replacement

Example: Poker hands.

5 indistinguishable balls into 3 bins5 samples from 3 possibilities with replacement and no order

Dividing 5 dollars among Alice, Bob and Eve.

Page 284: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Balls in bins.

“k Balls in n bins” ≡ “k samples from n possibilities.”

“indistinguishable balls” ≡ “order doesn’t matter”

“only one ball in each bin” ≡ “without replacement”

5 balls into 10 bins

5 samples from 10 possibilities with replacementExample: 5 digit numbers.

5 indistinguishable balls into 52 bins only one ball in each bin5 samples from 52 possibilities without replacement

Example: Poker hands.

5 indistinguishable balls into 3 bins5 samples from 3 possibilities with replacement and no order

Dividing 5 dollars among Alice, Bob and Eve.

Page 285: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Balls in bins.

“k Balls in n bins” ≡ “k samples from n possibilities.”

“indistinguishable balls” ≡ “order doesn’t matter”

“only one ball in each bin” ≡ “without replacement”

5 balls into 10 bins5 samples from 10 possibilities with replacement

Example: 5 digit numbers.

5 indistinguishable balls into 52 bins only one ball in each bin5 samples from 52 possibilities without replacement

Example: Poker hands.

5 indistinguishable balls into 3 bins5 samples from 3 possibilities with replacement and no order

Dividing 5 dollars among Alice, Bob and Eve.

Page 286: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Balls in bins.

“k Balls in n bins” ≡ “k samples from n possibilities.”

“indistinguishable balls” ≡ “order doesn’t matter”

“only one ball in each bin” ≡ “without replacement”

5 balls into 10 bins5 samples from 10 possibilities with replacementExample: 5 digit numbers.

5 indistinguishable balls into 52 bins only one ball in each bin5 samples from 52 possibilities without replacement

Example: Poker hands.

5 indistinguishable balls into 3 bins5 samples from 3 possibilities with replacement and no order

Dividing 5 dollars among Alice, Bob and Eve.

Page 287: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Balls in bins.

“k Balls in n bins” ≡ “k samples from n possibilities.”

“indistinguishable balls” ≡ “order doesn’t matter”

“only one ball in each bin” ≡ “without replacement”

5 balls into 10 bins5 samples from 10 possibilities with replacementExample: 5 digit numbers.

5 indistinguishable balls into 52 bins only one ball in each bin

5 samples from 52 possibilities without replacementExample: Poker hands.

5 indistinguishable balls into 3 bins5 samples from 3 possibilities with replacement and no order

Dividing 5 dollars among Alice, Bob and Eve.

Page 288: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Balls in bins.

“k Balls in n bins” ≡ “k samples from n possibilities.”

“indistinguishable balls” ≡ “order doesn’t matter”

“only one ball in each bin” ≡ “without replacement”

5 balls into 10 bins5 samples from 10 possibilities with replacementExample: 5 digit numbers.

5 indistinguishable balls into 52 bins only one ball in each bin5 samples from 52 possibilities without replacement

Example: Poker hands.

5 indistinguishable balls into 3 bins5 samples from 3 possibilities with replacement and no order

Dividing 5 dollars among Alice, Bob and Eve.

Page 289: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Balls in bins.

“k Balls in n bins” ≡ “k samples from n possibilities.”

“indistinguishable balls” ≡ “order doesn’t matter”

“only one ball in each bin” ≡ “without replacement”

5 balls into 10 bins5 samples from 10 possibilities with replacementExample: 5 digit numbers.

5 indistinguishable balls into 52 bins only one ball in each bin5 samples from 52 possibilities without replacementExample: Poker hands.

5 indistinguishable balls into 3 bins5 samples from 3 possibilities with replacement and no order

Dividing 5 dollars among Alice, Bob and Eve.

Page 290: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Balls in bins.

“k Balls in n bins” ≡ “k samples from n possibilities.”

“indistinguishable balls” ≡ “order doesn’t matter”

“only one ball in each bin” ≡ “without replacement”

5 balls into 10 bins5 samples from 10 possibilities with replacementExample: 5 digit numbers.

5 indistinguishable balls into 52 bins only one ball in each bin5 samples from 52 possibilities without replacementExample: Poker hands.

5 indistinguishable balls into 3 bins

5 samples from 3 possibilities with replacement and no orderDividing 5 dollars among Alice, Bob and Eve.

Page 291: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Balls in bins.

“k Balls in n bins” ≡ “k samples from n possibilities.”

“indistinguishable balls” ≡ “order doesn’t matter”

“only one ball in each bin” ≡ “without replacement”

5 balls into 10 bins5 samples from 10 possibilities with replacementExample: 5 digit numbers.

5 indistinguishable balls into 52 bins only one ball in each bin5 samples from 52 possibilities without replacementExample: Poker hands.

5 indistinguishable balls into 3 bins5 samples from 3 possibilities with replacement and no order

Dividing 5 dollars among Alice, Bob and Eve.

Page 292: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Balls in bins.

“k Balls in n bins” ≡ “k samples from n possibilities.”

“indistinguishable balls” ≡ “order doesn’t matter”

“only one ball in each bin” ≡ “without replacement”

5 balls into 10 bins5 samples from 10 possibilities with replacementExample: 5 digit numbers.

5 indistinguishable balls into 52 bins only one ball in each bin5 samples from 52 possibilities without replacementExample: Poker hands.

5 indistinguishable balls into 3 bins5 samples from 3 possibilities with replacement and no order

Dividing 5 dollars among Alice, Bob and Eve.

Page 293: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Sum RuleTwo indistinguishable jokers in 54 card deck.How many 5 card poker hands?

Sum rule: Can sum over disjoint sets.

No jokers “exclusive” or One Joker

“exclusive” or Two Jokers(525

)+(52

4

)+(52

3

).

Two distinguishable jokers in 54 card deck.How many 5 card poker hands?

Choose 4 cards plus one of 2 jokers!

(525

)+ 2∗

(524

)+(52

3

)Wait a minute! Same as choosing 5 cards from 54 or(54

5

)Theorem:

(545

)=(52

5

)+ 2∗

(524

)+(52

3

).

Algebraic Proof: Why? Just why? Especially on Thursday!Above is combinatorial proof.

Page 294: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Sum RuleTwo indistinguishable jokers in 54 card deck.How many 5 card poker hands?Sum rule: Can sum over disjoint sets.

No jokers “exclusive” or One Joker

“exclusive” or Two Jokers(525

)+(52

4

)+(52

3

).

Two distinguishable jokers in 54 card deck.How many 5 card poker hands?

Choose 4 cards plus one of 2 jokers!

(525

)+ 2∗

(524

)+(52

3

)Wait a minute! Same as choosing 5 cards from 54 or(54

5

)Theorem:

(545

)=(52

5

)+ 2∗

(524

)+(52

3

).

Algebraic Proof: Why? Just why? Especially on Thursday!Above is combinatorial proof.

Page 295: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Sum RuleTwo indistinguishable jokers in 54 card deck.How many 5 card poker hands?Sum rule: Can sum over disjoint sets.

No jokers “exclusive” or One Joker

“exclusive” or Two Jokers

(525

)+(52

4

)+(52

3

).

Two distinguishable jokers in 54 card deck.How many 5 card poker hands?

Choose 4 cards plus one of 2 jokers!

(525

)+ 2∗

(524

)+(52

3

)Wait a minute! Same as choosing 5 cards from 54 or(54

5

)Theorem:

(545

)=(52

5

)+ 2∗

(524

)+(52

3

).

Algebraic Proof: Why? Just why? Especially on Thursday!Above is combinatorial proof.

Page 296: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Sum RuleTwo indistinguishable jokers in 54 card deck.How many 5 card poker hands?Sum rule: Can sum over disjoint sets.No jokers

“exclusive” or One Joker

“exclusive” or Two Jokers(525

)

+(52

4

)+(52

3

).

Two distinguishable jokers in 54 card deck.How many 5 card poker hands?

Choose 4 cards plus one of 2 jokers!

(525

)+ 2∗

(524

)+(52

3

)Wait a minute! Same as choosing 5 cards from 54 or(54

5

)Theorem:

(545

)=(52

5

)+ 2∗

(524

)+(52

3

).

Algebraic Proof: Why? Just why? Especially on Thursday!Above is combinatorial proof.

Page 297: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Sum RuleTwo indistinguishable jokers in 54 card deck.How many 5 card poker hands?Sum rule: Can sum over disjoint sets.No jokers “exclusive” or One Joker “exclusive” or Two Jokers(52

5

)+(52

4

)

+(52

3

).

Two distinguishable jokers in 54 card deck.How many 5 card poker hands?

Choose 4 cards plus one of 2 jokers!

(525

)+ 2∗

(524

)+(52

3

)Wait a minute! Same as choosing 5 cards from 54 or(54

5

)Theorem:

(545

)=(52

5

)+ 2∗

(524

)+(52

3

).

Algebraic Proof: Why? Just why? Especially on Thursday!Above is combinatorial proof.

Page 298: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Sum RuleTwo indistinguishable jokers in 54 card deck.How many 5 card poker hands?Sum rule: Can sum over disjoint sets.No jokers “exclusive” or One Joker “exclusive” or Two Jokers(52

5

)+(52

4

)+(52

3

).

Two distinguishable jokers in 54 card deck.How many 5 card poker hands?

Choose 4 cards plus one of 2 jokers!

(525

)+ 2∗

(524

)+(52

3

)Wait a minute! Same as choosing 5 cards from 54 or(54

5

)Theorem:

(545

)=(52

5

)+ 2∗

(524

)+(52

3

).

Algebraic Proof: Why? Just why? Especially on Thursday!Above is combinatorial proof.

Page 299: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Sum RuleTwo indistinguishable jokers in 54 card deck.How many 5 card poker hands?Sum rule: Can sum over disjoint sets.No jokers “exclusive” or One Joker “exclusive” or Two Jokers(52

5

)+(52

4

)+(52

3

).

Two distinguishable jokers in 54 card deck.

How many 5 card poker hands?

Choose 4 cards plus one of 2 jokers!

(525

)+ 2∗

(524

)+(52

3

)Wait a minute! Same as choosing 5 cards from 54 or(54

5

)Theorem:

(545

)=(52

5

)+ 2∗

(524

)+(52

3

).

Algebraic Proof: Why? Just why? Especially on Thursday!Above is combinatorial proof.

Page 300: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Sum RuleTwo indistinguishable jokers in 54 card deck.How many 5 card poker hands?Sum rule: Can sum over disjoint sets.No jokers “exclusive” or One Joker “exclusive” or Two Jokers(52

5

)+(52

4

)+(52

3

).

Two distinguishable jokers in 54 card deck.How many 5 card poker hands?

Choose 4 cards plus one of 2 jokers!

(525

)+ 2∗

(524

)+(52

3

)Wait a minute! Same as choosing 5 cards from 54 or(54

5

)Theorem:

(545

)=(52

5

)+ 2∗

(524

)+(52

3

).

Algebraic Proof: Why? Just why? Especially on Thursday!Above is combinatorial proof.

Page 301: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Sum RuleTwo indistinguishable jokers in 54 card deck.How many 5 card poker hands?Sum rule: Can sum over disjoint sets.No jokers “exclusive” or One Joker “exclusive” or Two Jokers(52

5

)+(52

4

)+(52

3

).

Two distinguishable jokers in 54 card deck.How many 5 card poker hands?

Choose 4 cards plus one of 2 jokers!

(525

)+

2∗(52

4

)+(52

3

)Wait a minute! Same as choosing 5 cards from 54 or(54

5

)Theorem:

(545

)=(52

5

)+ 2∗

(524

)+(52

3

).

Algebraic Proof: Why? Just why? Especially on Thursday!Above is combinatorial proof.

Page 302: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Sum RuleTwo indistinguishable jokers in 54 card deck.How many 5 card poker hands?Sum rule: Can sum over disjoint sets.No jokers “exclusive” or One Joker “exclusive” or Two Jokers(52

5

)+(52

4

)+(52

3

).

Two distinguishable jokers in 54 card deck.How many 5 card poker hands? Choose 4 cards plus one of 2 jokers!(52

5

)+ 2∗

(524

)+

(523

)Wait a minute! Same as choosing 5 cards from 54 or(54

5

)Theorem:

(545

)=(52

5

)+ 2∗

(524

)+(52

3

).

Algebraic Proof: Why? Just why? Especially on Thursday!Above is combinatorial proof.

Page 303: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Sum RuleTwo indistinguishable jokers in 54 card deck.How many 5 card poker hands?Sum rule: Can sum over disjoint sets.No jokers “exclusive” or One Joker “exclusive” or Two Jokers(52

5

)+(52

4

)+(52

3

).

Two distinguishable jokers in 54 card deck.How many 5 card poker hands? Choose 4 cards plus one of 2 jokers!(52

5

)+ 2∗

(524

)+(52

3

)

Wait a minute! Same as choosing 5 cards from 54 or(545

)Theorem:

(545

)=(52

5

)+ 2∗

(524

)+(52

3

).

Algebraic Proof: Why? Just why? Especially on Thursday!Above is combinatorial proof.

Page 304: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Sum RuleTwo indistinguishable jokers in 54 card deck.How many 5 card poker hands?Sum rule: Can sum over disjoint sets.No jokers “exclusive” or One Joker “exclusive” or Two Jokers(52

5

)+(52

4

)+(52

3

).

Two distinguishable jokers in 54 card deck.How many 5 card poker hands? Choose 4 cards plus one of 2 jokers!(52

5

)+ 2∗

(524

)+(52

3

)Wait a minute!

Same as choosing 5 cards from 54 or(545

)Theorem:

(545

)=(52

5

)+ 2∗

(524

)+(52

3

).

Algebraic Proof: Why? Just why? Especially on Thursday!Above is combinatorial proof.

Page 305: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Sum RuleTwo indistinguishable jokers in 54 card deck.How many 5 card poker hands?Sum rule: Can sum over disjoint sets.No jokers “exclusive” or One Joker “exclusive” or Two Jokers(52

5

)+(52

4

)+(52

3

).

Two distinguishable jokers in 54 card deck.How many 5 card poker hands? Choose 4 cards plus one of 2 jokers!(52

5

)+ 2∗

(524

)+(52

3

)Wait a minute! Same as

choosing 5 cards from 54 or(545

)Theorem:

(545

)=(52

5

)+ 2∗

(524

)+(52

3

).

Algebraic Proof: Why? Just why? Especially on Thursday!Above is combinatorial proof.

Page 306: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Sum RuleTwo indistinguishable jokers in 54 card deck.How many 5 card poker hands?Sum rule: Can sum over disjoint sets.No jokers “exclusive” or One Joker “exclusive” or Two Jokers(52

5

)+(52

4

)+(52

3

).

Two distinguishable jokers in 54 card deck.How many 5 card poker hands? Choose 4 cards plus one of 2 jokers!(52

5

)+ 2∗

(524

)+(52

3

)Wait a minute! Same as choosing 5 cards from 54

or(545

)Theorem:

(545

)=(52

5

)+ 2∗

(524

)+(52

3

).

Algebraic Proof: Why? Just why? Especially on Thursday!Above is combinatorial proof.

Page 307: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Sum RuleTwo indistinguishable jokers in 54 card deck.How many 5 card poker hands?Sum rule: Can sum over disjoint sets.No jokers “exclusive” or One Joker “exclusive” or Two Jokers(52

5

)+(52

4

)+(52

3

).

Two distinguishable jokers in 54 card deck.How many 5 card poker hands? Choose 4 cards plus one of 2 jokers!(52

5

)+ 2∗

(524

)+(52

3

)Wait a minute! Same as choosing 5 cards from 54 or

(545

)Theorem:

(545

)=(52

5

)+ 2∗

(524

)+(52

3

).

Algebraic Proof: Why? Just why? Especially on Thursday!Above is combinatorial proof.

Page 308: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Sum RuleTwo indistinguishable jokers in 54 card deck.How many 5 card poker hands?Sum rule: Can sum over disjoint sets.No jokers “exclusive” or One Joker “exclusive” or Two Jokers(52

5

)+(52

4

)+(52

3

).

Two distinguishable jokers in 54 card deck.How many 5 card poker hands? Choose 4 cards plus one of 2 jokers!(52

5

)+ 2∗

(524

)+(52

3

)Wait a minute! Same as choosing 5 cards from 54 or(54

5

)Theorem:

(545

)

=(52

5

)+ 2∗

(524

)+(52

3

).

Algebraic Proof: Why? Just why? Especially on Thursday!Above is combinatorial proof.

Page 309: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Sum RuleTwo indistinguishable jokers in 54 card deck.How many 5 card poker hands?Sum rule: Can sum over disjoint sets.No jokers “exclusive” or One Joker “exclusive” or Two Jokers(52

5

)+(52

4

)+(52

3

).

Two distinguishable jokers in 54 card deck.How many 5 card poker hands? Choose 4 cards plus one of 2 jokers!(52

5

)+ 2∗

(524

)+(52

3

)Wait a minute! Same as choosing 5 cards from 54 or(54

5

)Theorem:

(545

)=(52

5

)+ 2∗

(524

)+(52

3

).

Algebraic Proof: Why? Just why? Especially on Thursday!Above is combinatorial proof.

Page 310: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Sum RuleTwo indistinguishable jokers in 54 card deck.How many 5 card poker hands?Sum rule: Can sum over disjoint sets.No jokers “exclusive” or One Joker “exclusive” or Two Jokers(52

5

)+(52

4

)+(52

3

).

Two distinguishable jokers in 54 card deck.How many 5 card poker hands? Choose 4 cards plus one of 2 jokers!(52

5

)+ 2∗

(524

)+(52

3

)Wait a minute! Same as choosing 5 cards from 54 or(54

5

)Theorem:

(545

)=(52

5

)+ 2∗

(524

)+(52

3

).

Algebraic Proof:

Why? Just why? Especially on Thursday!Above is combinatorial proof.

Page 311: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Sum RuleTwo indistinguishable jokers in 54 card deck.How many 5 card poker hands?Sum rule: Can sum over disjoint sets.No jokers “exclusive” or One Joker “exclusive” or Two Jokers(52

5

)+(52

4

)+(52

3

).

Two distinguishable jokers in 54 card deck.How many 5 card poker hands? Choose 4 cards plus one of 2 jokers!(52

5

)+ 2∗

(524

)+(52

3

)Wait a minute! Same as choosing 5 cards from 54 or(54

5

)Theorem:

(545

)=(52

5

)+ 2∗

(524

)+(52

3

).

Algebraic Proof: Why?

Just why? Especially on Thursday!Above is combinatorial proof.

Page 312: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Sum RuleTwo indistinguishable jokers in 54 card deck.How many 5 card poker hands?Sum rule: Can sum over disjoint sets.No jokers “exclusive” or One Joker “exclusive” or Two Jokers(52

5

)+(52

4

)+(52

3

).

Two distinguishable jokers in 54 card deck.How many 5 card poker hands? Choose 4 cards plus one of 2 jokers!(52

5

)+ 2∗

(524

)+(52

3

)Wait a minute! Same as choosing 5 cards from 54 or(54

5

)Theorem:

(545

)=(52

5

)+ 2∗

(524

)+(52

3

).

Algebraic Proof: Why? Just why?

Especially on Thursday!Above is combinatorial proof.

Page 313: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Sum RuleTwo indistinguishable jokers in 54 card deck.How many 5 card poker hands?Sum rule: Can sum over disjoint sets.No jokers “exclusive” or One Joker “exclusive” or Two Jokers(52

5

)+(52

4

)+(52

3

).

Two distinguishable jokers in 54 card deck.How many 5 card poker hands? Choose 4 cards plus one of 2 jokers!(52

5

)+ 2∗

(524

)+(52

3

)Wait a minute! Same as choosing 5 cards from 54 or(54

5

)Theorem:

(545

)=(52

5

)+ 2∗

(524

)+(52

3

).

Algebraic Proof: Why? Just why? Especially on Thursday!

Above is combinatorial proof.

Page 314: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Sum RuleTwo indistinguishable jokers in 54 card deck.How many 5 card poker hands?Sum rule: Can sum over disjoint sets.No jokers “exclusive” or One Joker “exclusive” or Two Jokers(52

5

)+(52

4

)+(52

3

).

Two distinguishable jokers in 54 card deck.How many 5 card poker hands? Choose 4 cards plus one of 2 jokers!(52

5

)+ 2∗

(524

)+(52

3

)Wait a minute! Same as choosing 5 cards from 54 or(54

5

)Theorem:

(545

)=(52

5

)+ 2∗

(524

)+(52

3

).

Algebraic Proof: Why? Just why? Especially on Thursday!Above is combinatorial proof.

Page 315: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Sum RuleTwo indistinguishable jokers in 54 card deck.How many 5 card poker hands?Sum rule: Can sum over disjoint sets.No jokers “exclusive” or One Joker “exclusive” or Two Jokers(52

5

)+(52

4

)+(52

3

).

Two distinguishable jokers in 54 card deck.How many 5 card poker hands? Choose 4 cards plus one of 2 jokers!(52

5

)+ 2∗

(524

)+(52

3

)Wait a minute! Same as choosing 5 cards from 54 or(54

5

)Theorem:

(545

)=(52

5

)+ 2∗

(524

)+(52

3

).

Algebraic Proof: Why? Just why? Especially on Thursday!Above is combinatorial proof.

Page 316: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Combinatorial Proofs.

Theorem:(n

k

)=( n

n−k

)

Proof: How many subsets of size k?(n

k

)How many subsets of size k?Choose a subset of size n−k

and what’s left out is a subset of size k .Choosing a subset of size k is same

as choosing n−k elements to not take.=⇒

( nn−k

)subsets of size k .

Page 317: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Combinatorial Proofs.

Theorem:(n

k

)=( n

n−k

)Proof: How many subsets of size k?

(nk

)How many subsets of size k?Choose a subset of size n−k

and what’s left out is a subset of size k .Choosing a subset of size k is same

as choosing n−k elements to not take.=⇒

( nn−k

)subsets of size k .

Page 318: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Combinatorial Proofs.

Theorem:(n

k

)=( n

n−k

)Proof: How many subsets of size k?

(nk

)

How many subsets of size k?Choose a subset of size n−k

and what’s left out is a subset of size k .Choosing a subset of size k is same

as choosing n−k elements to not take.=⇒

( nn−k

)subsets of size k .

Page 319: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Combinatorial Proofs.

Theorem:(n

k

)=( n

n−k

)Proof: How many subsets of size k?

(nk

)How many subsets of size k?

Choose a subset of size n−kand what’s left out is a subset of size k .

Choosing a subset of size k is sameas choosing n−k elements to not take.

=⇒( n

n−k

)subsets of size k .

Page 320: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Combinatorial Proofs.

Theorem:(n

k

)=( n

n−k

)Proof: How many subsets of size k?

(nk

)How many subsets of size k?Choose a subset of size n−k

and what’s left out is a subset of size k .Choosing a subset of size k is same

as choosing n−k elements to not take.=⇒

( nn−k

)subsets of size k .

Page 321: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Combinatorial Proofs.

Theorem:(n

k

)=( n

n−k

)Proof: How many subsets of size k?

(nk

)How many subsets of size k?Choose a subset of size n−k

and what’s left out

is a subset of size k .Choosing a subset of size k is same

as choosing n−k elements to not take.=⇒

( nn−k

)subsets of size k .

Page 322: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Combinatorial Proofs.

Theorem:(n

k

)=( n

n−k

)Proof: How many subsets of size k?

(nk

)How many subsets of size k?Choose a subset of size n−k

and what’s left out is a subset of size k .

Choosing a subset of size k is sameas choosing n−k elements to not take.

=⇒( n

n−k

)subsets of size k .

Page 323: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Combinatorial Proofs.

Theorem:(n

k

)=( n

n−k

)Proof: How many subsets of size k?

(nk

)How many subsets of size k?Choose a subset of size n−k

and what’s left out is a subset of size k .Choosing a subset of size k is same

as choosing n−k elements to not take.=⇒

( nn−k

)subsets of size k .

Page 324: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Combinatorial Proofs.

Theorem:(n

k

)=( n

n−k

)Proof: How many subsets of size k?

(nk

)How many subsets of size k?Choose a subset of size n−k

and what’s left out is a subset of size k .Choosing a subset of size k is same

as choosing n−k elements to not take.

=⇒( n

n−k

)subsets of size k .

Page 325: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Combinatorial Proofs.

Theorem:(n

k

)=( n

n−k

)Proof: How many subsets of size k?

(nk

)How many subsets of size k?Choose a subset of size n−k

and what’s left out is a subset of size k .Choosing a subset of size k is same

as choosing n−k elements to not take.=⇒

( nn−k

)subsets of size k .

Page 326: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Combinatorial Proofs.

Theorem:(n

k

)=( n

n−k

)Proof: How many subsets of size k?

(nk

)How many subsets of size k?Choose a subset of size n−k

and what’s left out is a subset of size k .Choosing a subset of size k is same

as choosing n−k elements to not take.=⇒

( nn−k

)subsets of size k .

Page 327: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Pascal’s Triangle

01 1

1 2 11 3 3 1

1 4 6 4 1Row n: coefficients of (1 + x)n = (1 + x)(1 + x) · · ·(1 + x).

Foil (4 terms) on steroids:2n terms: choose 1 or x froom each factor of (1 + x).

Simplify: collect all terms corresponding to xk .Coefficient of xk is

(nk

): choose k factors where x is in product.(0

0

)(10

) (11

)(20

) (21

) (22

)(30

) (31

) (32

) (33

)Pascal’s rule =⇒

(n+1k

)=(n

k

)+( n

k−1

).

Page 328: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Pascal’s Triangle

01 1

1 2 11 3 3 1

1 4 6 4 1Row n: coefficients of (1 + x)n = (1 + x)(1 + x) · · ·(1 + x).

Foil (4 terms) on steroids:2n terms: choose 1 or x froom each factor of (1 + x).

Simplify: collect all terms corresponding to xk .Coefficient of xk is

(nk

): choose k factors where x is in product.(0

0

)(10

) (11

)(20

) (21

) (22

)(30

) (31

) (32

) (33

)Pascal’s rule =⇒

(n+1k

)=(n

k

)+( n

k−1

).

Page 329: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Pascal’s Triangle

01 1

1 2 1

1 3 3 11 4 6 4 1

Row n: coefficients of (1 + x)n = (1 + x)(1 + x) · · ·(1 + x).

Foil (4 terms) on steroids:2n terms: choose 1 or x froom each factor of (1 + x).

Simplify: collect all terms corresponding to xk .Coefficient of xk is

(nk

): choose k factors where x is in product.(0

0

)(10

) (11

)(20

) (21

) (22

)(30

) (31

) (32

) (33

)Pascal’s rule =⇒

(n+1k

)=(n

k

)+( n

k−1

).

Page 330: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Pascal’s Triangle

01 1

1 2 11 3 3 1

1 4 6 4 1Row n: coefficients of (1 + x)n = (1 + x)(1 + x) · · ·(1 + x).

Foil (4 terms) on steroids:2n terms: choose 1 or x froom each factor of (1 + x).

Simplify: collect all terms corresponding to xk .Coefficient of xk is

(nk

): choose k factors where x is in product.(0

0

)(10

) (11

)(20

) (21

) (22

)(30

) (31

) (32

) (33

)Pascal’s rule =⇒

(n+1k

)=(n

k

)+( n

k−1

).

Page 331: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Pascal’s Triangle

01 1

1 2 11 3 3 1

1 4 6 4 1

Row n: coefficients of (1 + x)n = (1 + x)(1 + x) · · ·(1 + x).

Foil (4 terms) on steroids:2n terms: choose 1 or x froom each factor of (1 + x).

Simplify: collect all terms corresponding to xk .Coefficient of xk is

(nk

): choose k factors where x is in product.(0

0

)(10

) (11

)(20

) (21

) (22

)(30

) (31

) (32

) (33

)Pascal’s rule =⇒

(n+1k

)=(n

k

)+( n

k−1

).

Page 332: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Pascal’s Triangle

01 1

1 2 11 3 3 1

1 4 6 4 1

Row n: coefficients of (1 + x)n = (1 + x)(1 + x) · · ·(1 + x).

Foil (4 terms) on steroids:2n terms: choose 1 or x froom each factor of (1 + x).

Simplify: collect all terms corresponding to xk .Coefficient of xk is

(nk

): choose k factors where x is in product.(0

0

)(10

) (11

)(20

) (21

) (22

)(30

) (31

) (32

) (33

)Pascal’s rule =⇒

(n+1k

)=(n

k

)+( n

k−1

).

Page 333: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Pascal’s Triangle

01 1

1 2 11 3 3 1

1 4 6 4 1Row n: coefficients of (1 + x)n = (1 + x)(1 + x) · · ·(1 + x).

Foil (4 terms) on steroids:2n terms: choose 1 or x froom each factor of (1 + x).

Simplify: collect all terms corresponding to xk .Coefficient of xk is

(nk

): choose k factors where x is in product.(0

0

)(10

) (11

)(20

) (21

) (22

)(30

) (31

) (32

) (33

)Pascal’s rule =⇒

(n+1k

)=(n

k

)+( n

k−1

).

Page 334: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Pascal’s Triangle

01 1

1 2 11 3 3 1

1 4 6 4 1Row n: coefficients of (1 + x)n = (1 + x)(1 + x) · · ·(1 + x).

Foil (4 terms)

on steroids:2n terms: choose 1 or x froom each factor of (1 + x).

Simplify: collect all terms corresponding to xk .Coefficient of xk is

(nk

): choose k factors where x is in product.(0

0

)(10

) (11

)(20

) (21

) (22

)(30

) (31

) (32

) (33

)Pascal’s rule =⇒

(n+1k

)=(n

k

)+( n

k−1

).

Page 335: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Pascal’s Triangle

01 1

1 2 11 3 3 1

1 4 6 4 1Row n: coefficients of (1 + x)n = (1 + x)(1 + x) · · ·(1 + x).

Foil (4 terms) on steroids:

2n terms: choose 1 or x froom each factor of (1 + x).

Simplify: collect all terms corresponding to xk .Coefficient of xk is

(nk

): choose k factors where x is in product.(0

0

)(10

) (11

)(20

) (21

) (22

)(30

) (31

) (32

) (33

)Pascal’s rule =⇒

(n+1k

)=(n

k

)+( n

k−1

).

Page 336: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Pascal’s Triangle

01 1

1 2 11 3 3 1

1 4 6 4 1Row n: coefficients of (1 + x)n = (1 + x)(1 + x) · · ·(1 + x).

Foil (4 terms) on steroids:2n terms:

choose 1 or x froom each factor of (1 + x).

Simplify: collect all terms corresponding to xk .Coefficient of xk is

(nk

): choose k factors where x is in product.(0

0

)(10

) (11

)(20

) (21

) (22

)(30

) (31

) (32

) (33

)Pascal’s rule =⇒

(n+1k

)=(n

k

)+( n

k−1

).

Page 337: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Pascal’s Triangle

01 1

1 2 11 3 3 1

1 4 6 4 1Row n: coefficients of (1 + x)n = (1 + x)(1 + x) · · ·(1 + x).

Foil (4 terms) on steroids:2n terms: choose 1 or x froom each factor of (1 + x).

Simplify: collect all terms corresponding to xk .Coefficient of xk is

(nk

): choose k factors where x is in product.(0

0

)(10

) (11

)(20

) (21

) (22

)(30

) (31

) (32

) (33

)Pascal’s rule =⇒

(n+1k

)=(n

k

)+( n

k−1

).

Page 338: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Pascal’s Triangle

01 1

1 2 11 3 3 1

1 4 6 4 1Row n: coefficients of (1 + x)n = (1 + x)(1 + x) · · ·(1 + x).

Foil (4 terms) on steroids:2n terms: choose 1 or x froom each factor of (1 + x).

Simplify: collect all terms corresponding to xk .Coefficient of xk is

(nk

): choose k factors where x is in product.(0

0

)(10

) (11

)(20

) (21

) (22

)(30

) (31

) (32

) (33

)Pascal’s rule =⇒

(n+1k

)=(n

k

)+( n

k−1

).

Page 339: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Pascal’s Triangle

01 1

1 2 11 3 3 1

1 4 6 4 1Row n: coefficients of (1 + x)n = (1 + x)(1 + x) · · ·(1 + x).

Foil (4 terms) on steroids:2n terms: choose 1 or x froom each factor of (1 + x).

Simplify: collect all terms corresponding to xk .

Coefficient of xk is(n

k

): choose k factors where x is in product.(0

0

)(10

) (11

)(20

) (21

) (22

)(30

) (31

) (32

) (33

)Pascal’s rule =⇒

(n+1k

)=(n

k

)+( n

k−1

).

Page 340: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Pascal’s Triangle

01 1

1 2 11 3 3 1

1 4 6 4 1Row n: coefficients of (1 + x)n = (1 + x)(1 + x) · · ·(1 + x).

Foil (4 terms) on steroids:2n terms: choose 1 or x froom each factor of (1 + x).

Simplify: collect all terms corresponding to xk .Coefficient of xk is

(nk

): choose k factors where x is in product.

(00

)(10

) (11

)(20

) (21

) (22

)(30

) (31

) (32

) (33

)Pascal’s rule =⇒

(n+1k

)=(n

k

)+( n

k−1

).

Page 341: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Pascal’s Triangle

01 1

1 2 11 3 3 1

1 4 6 4 1Row n: coefficients of (1 + x)n = (1 + x)(1 + x) · · ·(1 + x).

Foil (4 terms) on steroids:2n terms: choose 1 or x froom each factor of (1 + x).

Simplify: collect all terms corresponding to xk .Coefficient of xk is

(nk

): choose k factors where x is in product.(0

0

)(10

) (11

)

(20

) (21

) (22

)(30

) (31

) (32

) (33

)Pascal’s rule =⇒

(n+1k

)=(n

k

)+( n

k−1

).

Page 342: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Pascal’s Triangle

01 1

1 2 11 3 3 1

1 4 6 4 1Row n: coefficients of (1 + x)n = (1 + x)(1 + x) · · ·(1 + x).

Foil (4 terms) on steroids:2n terms: choose 1 or x froom each factor of (1 + x).

Simplify: collect all terms corresponding to xk .Coefficient of xk is

(nk

): choose k factors where x is in product.(0

0

)(10

) (11

)(20

) (21

) (22

)

(30

) (31

) (32

) (33

)Pascal’s rule =⇒

(n+1k

)=(n

k

)+( n

k−1

).

Page 343: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Pascal’s Triangle

01 1

1 2 11 3 3 1

1 4 6 4 1Row n: coefficients of (1 + x)n = (1 + x)(1 + x) · · ·(1 + x).

Foil (4 terms) on steroids:2n terms: choose 1 or x froom each factor of (1 + x).

Simplify: collect all terms corresponding to xk .Coefficient of xk is

(nk

): choose k factors where x is in product.(0

0

)(10

) (11

)(20

) (21

) (22

)(30

) (31

) (32

) (33

)

Pascal’s rule =⇒(n+1

k

)=(n

k

)+( n

k−1

).

Page 344: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Pascal’s Triangle

01 1

1 2 11 3 3 1

1 4 6 4 1Row n: coefficients of (1 + x)n = (1 + x)(1 + x) · · ·(1 + x).

Foil (4 terms) on steroids:2n terms: choose 1 or x froom each factor of (1 + x).

Simplify: collect all terms corresponding to xk .Coefficient of xk is

(nk

): choose k factors where x is in product.(0

0

)(10

) (11

)(20

) (21

) (22

)(30

) (31

) (32

) (33

)Pascal’s rule =⇒

(n+1k

)=(n

k

)+( n

k−1

).

Page 345: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Combinatorial Proofs.

Theorem:(n+1

k

)=(n

k

)+( n

k−1

).

Proof: How many size k subsets of n + 1?

(n+1k

).

How many size k subsets of n + 1?How many contain the first element?Chose first element, need to choose k −1 more from remaining n

elements.=⇒

( nk−1

)How many don’t contain the first element ?Need to choose k elements from remaining n elts.=⇒

(nk

)So,

( nk−1

)+(n

k

)=(n+1

k

).

Page 346: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Combinatorial Proofs.

Theorem:(n+1

k

)=(n

k

)+( n

k−1

).

Proof: How many size k subsets of n + 1?(n+1

k

).

How many size k subsets of n + 1?How many contain the first element?Chose first element, need to choose k −1 more from remaining n

elements.=⇒

( nk−1

)How many don’t contain the first element ?Need to choose k elements from remaining n elts.=⇒

(nk

)So,

( nk−1

)+(n

k

)=(n+1

k

).

Page 347: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Combinatorial Proofs.

Theorem:(n+1

k

)=(n

k

)+( n

k−1

).

Proof: How many size k subsets of n + 1?(n+1

k

).

How many size k subsets of n + 1?

How many contain the first element?Chose first element, need to choose k −1 more from remaining n

elements.=⇒

( nk−1

)How many don’t contain the first element ?Need to choose k elements from remaining n elts.=⇒

(nk

)So,

( nk−1

)+(n

k

)=(n+1

k

).

Page 348: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Combinatorial Proofs.

Theorem:(n+1

k

)=(n

k

)+( n

k−1

).

Proof: How many size k subsets of n + 1?(n+1

k

).

How many size k subsets of n + 1?How many contain the first element?

Chose first element, need to choose k −1 more from remaining nelements.=⇒

( nk−1

)How many don’t contain the first element ?Need to choose k elements from remaining n elts.=⇒

(nk

)So,

( nk−1

)+(n

k

)=(n+1

k

).

Page 349: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Combinatorial Proofs.

Theorem:(n+1

k

)=(n

k

)+( n

k−1

).

Proof: How many size k subsets of n + 1?(n+1

k

).

How many size k subsets of n + 1?How many contain the first element?Chose first element,

need to choose k −1 more from remaining nelements.=⇒

( nk−1

)How many don’t contain the first element ?Need to choose k elements from remaining n elts.=⇒

(nk

)So,

( nk−1

)+(n

k

)=(n+1

k

).

Page 350: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Combinatorial Proofs.

Theorem:(n+1

k

)=(n

k

)+( n

k−1

).

Proof: How many size k subsets of n + 1?(n+1

k

).

How many size k subsets of n + 1?How many contain the first element?Chose first element, need to choose k −1 more from remaining n

elements.

=⇒( n

k−1

)How many don’t contain the first element ?Need to choose k elements from remaining n elts.=⇒

(nk

)So,

( nk−1

)+(n

k

)=(n+1

k

).

Page 351: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Combinatorial Proofs.

Theorem:(n+1

k

)=(n

k

)+( n

k−1

).

Proof: How many size k subsets of n + 1?(n+1

k

).

How many size k subsets of n + 1?How many contain the first element?Chose first element, need to choose k −1 more from remaining n

elements.=⇒

( nk−1

)

How many don’t contain the first element ?Need to choose k elements from remaining n elts.=⇒

(nk

)So,

( nk−1

)+(n

k

)=(n+1

k

).

Page 352: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Combinatorial Proofs.

Theorem:(n+1

k

)=(n

k

)+( n

k−1

).

Proof: How many size k subsets of n + 1?(n+1

k

).

How many size k subsets of n + 1?How many contain the first element?Chose first element, need to choose k −1 more from remaining n

elements.=⇒

( nk−1

)

How many don’t contain the first element ?Need to choose k elements from remaining n elts.=⇒

(nk

)So,

( nk−1

)+(n

k

)=(n+1

k

).

Page 353: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Combinatorial Proofs.

Theorem:(n+1

k

)=(n

k

)+( n

k−1

).

Proof: How many size k subsets of n + 1?(n+1

k

).

How many size k subsets of n + 1?How many contain the first element?Chose first element, need to choose k −1 more from remaining n

elements.=⇒

( nk−1

)How many don’t contain the first element ?

Need to choose k elements from remaining n elts.=⇒

(nk

)So,

( nk−1

)+(n

k

)=(n+1

k

).

Page 354: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Combinatorial Proofs.

Theorem:(n+1

k

)=(n

k

)+( n

k−1

).

Proof: How many size k subsets of n + 1?(n+1

k

).

How many size k subsets of n + 1?How many contain the first element?Chose first element, need to choose k −1 more from remaining n

elements.=⇒

( nk−1

)How many don’t contain the first element ?Need to choose k elements from remaining n elts.

=⇒(n

k

)So,

( nk−1

)+(n

k

)=(n+1

k

).

Page 355: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Combinatorial Proofs.

Theorem:(n+1

k

)=(n

k

)+( n

k−1

).

Proof: How many size k subsets of n + 1?(n+1

k

).

How many size k subsets of n + 1?How many contain the first element?Chose first element, need to choose k −1 more from remaining n

elements.=⇒

( nk−1

)How many don’t contain the first element ?Need to choose k elements from remaining n elts.=⇒

(nk

)

So,( n

k−1

)+(n

k

)=(n+1

k

).

Page 356: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Combinatorial Proofs.

Theorem:(n+1

k

)=(n

k

)+( n

k−1

).

Proof: How many size k subsets of n + 1?(n+1

k

).

How many size k subsets of n + 1?How many contain the first element?Chose first element, need to choose k −1 more from remaining n

elements.=⇒

( nk−1

)How many don’t contain the first element ?Need to choose k elements from remaining n elts.=⇒

(nk

)

So,( n

k−1

)+(n

k

)=(n+1

k

).

Page 357: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Combinatorial Proofs.

Theorem:(n+1

k

)=(n

k

)+( n

k−1

).

Proof: How many size k subsets of n + 1?(n+1

k

).

How many size k subsets of n + 1?How many contain the first element?Chose first element, need to choose k −1 more from remaining n

elements.=⇒

( nk−1

)How many don’t contain the first element ?Need to choose k elements from remaining n elts.=⇒

(nk

)So,

( nk−1

)+(n

k

)

=(n+1

k

).

Page 358: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Combinatorial Proofs.

Theorem:(n+1

k

)=(n

k

)+( n

k−1

).

Proof: How many size k subsets of n + 1?(n+1

k

).

How many size k subsets of n + 1?How many contain the first element?Chose first element, need to choose k −1 more from remaining n

elements.=⇒

( nk−1

)How many don’t contain the first element ?Need to choose k elements from remaining n elts.=⇒

(nk

)So,

( nk−1

)+(n

k

)=(n+1

k

).

Page 359: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Combinatorial Proof.

Theorem:(n

k

)=(n−1

k−1

)+ · · ·+

(k−1k−1

).

Proof: Consider size k subset where i is the first element chosen.

{1, . . . , i , . . . ,n}

Must choose k −1 elements from n− i remaining elements.=⇒

(n−ik−1

)such subsets.

Add them up to get the total number of subsets of size kwhich is also

(n+1k

).

Page 360: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Combinatorial Proof.

Theorem:(n

k

)=(n−1

k−1

)+ · · ·+

(k−1k−1

).

Proof: Consider size k subset where i is the first element chosen.

{1, . . . , i , . . . ,n}

Must choose k −1 elements from n− i remaining elements.=⇒

(n−ik−1

)such subsets.

Add them up to get the total number of subsets of size kwhich is also

(n+1k

).

Page 361: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Combinatorial Proof.

Theorem:(n

k

)=(n−1

k−1

)+ · · ·+

(k−1k−1

).

Proof: Consider size k subset where i is the first element chosen.

{1, . . . , i , . . . ,n}

Must choose k −1 elements from n− i remaining elements.

=⇒(n−i

k−1

)such subsets.

Add them up to get the total number of subsets of size kwhich is also

(n+1k

).

Page 362: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Combinatorial Proof.

Theorem:(n

k

)=(n−1

k−1

)+ · · ·+

(k−1k−1

).

Proof: Consider size k subset where i is the first element chosen.

{1, . . . , i , . . . ,n}

Must choose k −1 elements from n− i remaining elements.=⇒

(n−ik−1

)such subsets.

Add them up to get the total number of subsets of size kwhich is also

(n+1k

).

Page 363: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Combinatorial Proof.

Theorem:(n

k

)=(n−1

k−1

)+ · · ·+

(k−1k−1

).

Proof: Consider size k subset where i is the first element chosen.

{1, . . . , i , . . . ,n}

Must choose k −1 elements from n− i remaining elements.=⇒

(n−ik−1

)such subsets.

Add them up to get the total number of subsets of size k

which is also(n+1

k

).

Page 364: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Combinatorial Proof.

Theorem:(n

k

)=(n−1

k−1

)+ · · ·+

(k−1k−1

).

Proof: Consider size k subset where i is the first element chosen.

{1, . . . , i , . . . ,n}

Must choose k −1 elements from n− i remaining elements.=⇒

(n−ik−1

)such subsets.

Add them up to get the total number of subsets of size kwhich is also

(n+1k

).

Page 365: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Binomial Theorem: x = 1

Theorem: 2n =(n

n

)+( n

n−1

)+ · · ·+

(n0

)

Proof: How many subsets of {1, . . . ,n}?Construct a subset with sequence of n choices:

element i is in or is not in the subset: 2 poss.First rule of counting: 2×2 · · ·×2 = 2n subsets.

How many subsets of {1, . . . ,n}?(ni

)ways to choose i elts of {1, . . . ,n}.

Sum over i to get total number of subsets..which is also 2n.

Page 366: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Binomial Theorem: x = 1

Theorem: 2n =(n

n

)+( n

n−1

)+ · · ·+

(n0

)Proof: How many subsets of {1, . . . ,n}?

Construct a subset with sequence of n choices:element i is in or is not in the subset: 2 poss.

First rule of counting: 2×2 · · ·×2 = 2n subsets.

How many subsets of {1, . . . ,n}?(ni

)ways to choose i elts of {1, . . . ,n}.

Sum over i to get total number of subsets..which is also 2n.

Page 367: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Binomial Theorem: x = 1

Theorem: 2n =(n

n

)+( n

n−1

)+ · · ·+

(n0

)Proof: How many subsets of {1, . . . ,n}?Construct a subset with sequence of n choices:

element i is in or is not in the subset: 2 poss.First rule of counting: 2×2 · · ·×2 = 2n subsets.

How many subsets of {1, . . . ,n}?(ni

)ways to choose i elts of {1, . . . ,n}.

Sum over i to get total number of subsets..which is also 2n.

Page 368: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Binomial Theorem: x = 1

Theorem: 2n =(n

n

)+( n

n−1

)+ · · ·+

(n0

)Proof: How many subsets of {1, . . . ,n}?Construct a subset with sequence of n choices:

element i is in or is not in the subset: 2 poss.

First rule of counting: 2×2 · · ·×2 = 2n subsets.

How many subsets of {1, . . . ,n}?(ni

)ways to choose i elts of {1, . . . ,n}.

Sum over i to get total number of subsets..which is also 2n.

Page 369: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Binomial Theorem: x = 1

Theorem: 2n =(n

n

)+( n

n−1

)+ · · ·+

(n0

)Proof: How many subsets of {1, . . . ,n}?Construct a subset with sequence of n choices:

element i is in or is not in the subset: 2 poss.First rule of counting: 2×2 · · ·×2 = 2n subsets.

How many subsets of {1, . . . ,n}?(ni

)ways to choose i elts of {1, . . . ,n}.

Sum over i to get total number of subsets..which is also 2n.

Page 370: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Binomial Theorem: x = 1

Theorem: 2n =(n

n

)+( n

n−1

)+ · · ·+

(n0

)Proof: How many subsets of {1, . . . ,n}?Construct a subset with sequence of n choices:

element i is in or is not in the subset: 2 poss.First rule of counting: 2×2 · · ·×2 = 2n subsets.

How many subsets of {1, . . . ,n}?

(ni

)ways to choose i elts of {1, . . . ,n}.

Sum over i to get total number of subsets..which is also 2n.

Page 371: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Binomial Theorem: x = 1

Theorem: 2n =(n

n

)+( n

n−1

)+ · · ·+

(n0

)Proof: How many subsets of {1, . . . ,n}?Construct a subset with sequence of n choices:

element i is in or is not in the subset: 2 poss.First rule of counting: 2×2 · · ·×2 = 2n subsets.

How many subsets of {1, . . . ,n}?(ni

)ways to choose i elts of {1, . . . ,n}.

Sum over i to get total number of subsets..which is also 2n.

Page 372: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Binomial Theorem: x = 1

Theorem: 2n =(n

n

)+( n

n−1

)+ · · ·+

(n0

)Proof: How many subsets of {1, . . . ,n}?Construct a subset with sequence of n choices:

element i is in or is not in the subset: 2 poss.First rule of counting: 2×2 · · ·×2 = 2n subsets.

How many subsets of {1, . . . ,n}?(ni

)ways to choose i elts of {1, . . . ,n}.

Sum over i to get total number of subsets..

which is also 2n.

Page 373: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Binomial Theorem: x = 1

Theorem: 2n =(n

n

)+( n

n−1

)+ · · ·+

(n0

)Proof: How many subsets of {1, . . . ,n}?Construct a subset with sequence of n choices:

element i is in or is not in the subset: 2 poss.First rule of counting: 2×2 · · ·×2 = 2n subsets.

How many subsets of {1, . . . ,n}?(ni

)ways to choose i elts of {1, . . . ,n}.

Sum over i to get total number of subsets..which is also 2n.

Page 374: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Simple Inclusion/Exclusion

Sum Rule: For disjoint sets S and T , |S∪T |= |S|+ |T |Used to reason about all subsets

by adding number of subsets of size 1, 2, 3,. . .

Also reasoned about subsets that containedor didn’t contain an element. (E.g., first element, first i elements.)

Inclusion/Exclusion Rule: For any S and T ,|S∪T |= |S|+ |T |− |S∩T |.Example: How many 10-digit phone numbers have 7 as their first orsecond digit?

S = phone numbers with 7 as first digit.|S|= 109

T = phone numbers with 7 as second digit. |T |= 109.

S∩T = phone numbers with 7 as first and second digit. |S∩T |= 108.

Answer: |S|+ |T |− |S∩T |= 109 + 109−108.

Page 375: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Simple Inclusion/Exclusion

Sum Rule: For disjoint sets S and T , |S∪T |= |S|+ |T |Used to reason about all subsets

by adding number of subsets of size 1, 2, 3,. . .

Also reasoned about subsets that containedor didn’t contain an element. (E.g., first element, first i elements.)

Inclusion/Exclusion Rule: For any S and T ,|S∪T |= |S|+ |T |− |S∩T |.Example: How many 10-digit phone numbers have 7 as their first orsecond digit?

S = phone numbers with 7 as first digit.|S|= 109

T = phone numbers with 7 as second digit. |T |= 109.

S∩T = phone numbers with 7 as first and second digit. |S∩T |= 108.

Answer: |S|+ |T |− |S∩T |= 109 + 109−108.

Page 376: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Simple Inclusion/Exclusion

Sum Rule: For disjoint sets S and T , |S∪T |= |S|+ |T |Used to reason about all subsets

by adding number of subsets of size 1, 2, 3,. . .

Also reasoned about subsets that containedor didn’t contain an element. (E.g., first element, first i elements.)

Inclusion/Exclusion Rule: For any S and T ,|S∪T |= |S|+ |T |− |S∩T |.

Example: How many 10-digit phone numbers have 7 as their first orsecond digit?

S = phone numbers with 7 as first digit.|S|= 109

T = phone numbers with 7 as second digit. |T |= 109.

S∩T = phone numbers with 7 as first and second digit. |S∩T |= 108.

Answer: |S|+ |T |− |S∩T |= 109 + 109−108.

Page 377: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Simple Inclusion/Exclusion

Sum Rule: For disjoint sets S and T , |S∪T |= |S|+ |T |Used to reason about all subsets

by adding number of subsets of size 1, 2, 3,. . .

Also reasoned about subsets that containedor didn’t contain an element. (E.g., first element, first i elements.)

Inclusion/Exclusion Rule: For any S and T ,|S∪T |= |S|+ |T |− |S∩T |.Example: How many 10-digit phone numbers have 7 as their first orsecond digit?

S = phone numbers with 7 as first digit.|S|= 109

T = phone numbers with 7 as second digit. |T |= 109.

S∩T = phone numbers with 7 as first and second digit. |S∩T |= 108.

Answer: |S|+ |T |− |S∩T |= 109 + 109−108.

Page 378: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Simple Inclusion/Exclusion

Sum Rule: For disjoint sets S and T , |S∪T |= |S|+ |T |Used to reason about all subsets

by adding number of subsets of size 1, 2, 3,. . .

Also reasoned about subsets that containedor didn’t contain an element. (E.g., first element, first i elements.)

Inclusion/Exclusion Rule: For any S and T ,|S∪T |= |S|+ |T |− |S∩T |.Example: How many 10-digit phone numbers have 7 as their first orsecond digit?

S = phone numbers with 7 as first digit.

|S|= 109

T = phone numbers with 7 as second digit. |T |= 109.

S∩T = phone numbers with 7 as first and second digit. |S∩T |= 108.

Answer: |S|+ |T |− |S∩T |= 109 + 109−108.

Page 379: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Simple Inclusion/Exclusion

Sum Rule: For disjoint sets S and T , |S∪T |= |S|+ |T |Used to reason about all subsets

by adding number of subsets of size 1, 2, 3,. . .

Also reasoned about subsets that containedor didn’t contain an element. (E.g., first element, first i elements.)

Inclusion/Exclusion Rule: For any S and T ,|S∪T |= |S|+ |T |− |S∩T |.Example: How many 10-digit phone numbers have 7 as their first orsecond digit?

S = phone numbers with 7 as first digit.|S|= 109

T = phone numbers with 7 as second digit. |T |= 109.

S∩T = phone numbers with 7 as first and second digit. |S∩T |= 108.

Answer: |S|+ |T |− |S∩T |= 109 + 109−108.

Page 380: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Simple Inclusion/Exclusion

Sum Rule: For disjoint sets S and T , |S∪T |= |S|+ |T |Used to reason about all subsets

by adding number of subsets of size 1, 2, 3,. . .

Also reasoned about subsets that containedor didn’t contain an element. (E.g., first element, first i elements.)

Inclusion/Exclusion Rule: For any S and T ,|S∪T |= |S|+ |T |− |S∩T |.Example: How many 10-digit phone numbers have 7 as their first orsecond digit?

S = phone numbers with 7 as first digit.|S|= 109

T = phone numbers with 7 as second digit.

|T |= 109.

S∩T = phone numbers with 7 as first and second digit. |S∩T |= 108.

Answer: |S|+ |T |− |S∩T |= 109 + 109−108.

Page 381: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Simple Inclusion/Exclusion

Sum Rule: For disjoint sets S and T , |S∪T |= |S|+ |T |Used to reason about all subsets

by adding number of subsets of size 1, 2, 3,. . .

Also reasoned about subsets that containedor didn’t contain an element. (E.g., first element, first i elements.)

Inclusion/Exclusion Rule: For any S and T ,|S∪T |= |S|+ |T |− |S∩T |.Example: How many 10-digit phone numbers have 7 as their first orsecond digit?

S = phone numbers with 7 as first digit.|S|= 109

T = phone numbers with 7 as second digit. |T |= 109.

S∩T = phone numbers with 7 as first and second digit. |S∩T |= 108.

Answer: |S|+ |T |− |S∩T |= 109 + 109−108.

Page 382: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Simple Inclusion/Exclusion

Sum Rule: For disjoint sets S and T , |S∪T |= |S|+ |T |Used to reason about all subsets

by adding number of subsets of size 1, 2, 3,. . .

Also reasoned about subsets that containedor didn’t contain an element. (E.g., first element, first i elements.)

Inclusion/Exclusion Rule: For any S and T ,|S∪T |= |S|+ |T |− |S∩T |.Example: How many 10-digit phone numbers have 7 as their first orsecond digit?

S = phone numbers with 7 as first digit.|S|= 109

T = phone numbers with 7 as second digit. |T |= 109.

S∩T = phone numbers with 7 as first and second digit.

|S∩T |= 108.

Answer: |S|+ |T |− |S∩T |= 109 + 109−108.

Page 383: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Simple Inclusion/Exclusion

Sum Rule: For disjoint sets S and T , |S∪T |= |S|+ |T |Used to reason about all subsets

by adding number of subsets of size 1, 2, 3,. . .

Also reasoned about subsets that containedor didn’t contain an element. (E.g., first element, first i elements.)

Inclusion/Exclusion Rule: For any S and T ,|S∪T |= |S|+ |T |− |S∩T |.Example: How many 10-digit phone numbers have 7 as their first orsecond digit?

S = phone numbers with 7 as first digit.|S|= 109

T = phone numbers with 7 as second digit. |T |= 109.

S∩T = phone numbers with 7 as first and second digit. |S∩T |= 108.

Answer: |S|+ |T |− |S∩T |= 109 + 109−108.

Page 384: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Simple Inclusion/Exclusion

Sum Rule: For disjoint sets S and T , |S∪T |= |S|+ |T |Used to reason about all subsets

by adding number of subsets of size 1, 2, 3,. . .

Also reasoned about subsets that containedor didn’t contain an element. (E.g., first element, first i elements.)

Inclusion/Exclusion Rule: For any S and T ,|S∪T |= |S|+ |T |− |S∩T |.Example: How many 10-digit phone numbers have 7 as their first orsecond digit?

S = phone numbers with 7 as first digit.|S|= 109

T = phone numbers with 7 as second digit. |T |= 109.

S∩T = phone numbers with 7 as first and second digit. |S∩T |= 108.

Answer: |S|+ |T |− |S∩T |= 109 + 109−108.

Page 385: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Summary.First Rule of counting:

Objects from a sequence of choices:ni possibilitities for i th choice.n1×n2×·· ·×nk objects.

Second Rule of counting: If order does not matter.Count with order. Divide by number of orderings/sorted object.Typically:

(nk

).

Stars and Bars: Sample k objects with replacement from n.Order doesn’t matter.Typically:

(n+k−1k

).

Inclusion/Exclusion: two sets of objects.Add number of each subtract intersection of sets.

Sum Rule: If disjoint just add.

Combinatorial Proofs: Identity from counting same in two ways.Pascal’s Triangle Example:

(n+1k

)=

( nk−1

)+(n

k

).

RHS: Number of subsets of n + 1 items size k .LHS:

( nk−1

)counts subsets of n + 1 items with first item.(n

k

)counts subsets of n + 1 items without first item.

Disjoint – so add!

Page 386: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Summary.First Rule of counting: Objects from a sequence of choices:

ni possibilitities for i th choice.n1×n2×·· ·×nk objects.

Second Rule of counting: If order does not matter.Count with order. Divide by number of orderings/sorted object.Typically:

(nk

).

Stars and Bars: Sample k objects with replacement from n.Order doesn’t matter.Typically:

(n+k−1k

).

Inclusion/Exclusion: two sets of objects.Add number of each subtract intersection of sets.

Sum Rule: If disjoint just add.

Combinatorial Proofs: Identity from counting same in two ways.Pascal’s Triangle Example:

(n+1k

)=

( nk−1

)+(n

k

).

RHS: Number of subsets of n + 1 items size k .LHS:

( nk−1

)counts subsets of n + 1 items with first item.(n

k

)counts subsets of n + 1 items without first item.

Disjoint – so add!

Page 387: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Summary.First Rule of counting: Objects from a sequence of choices:

ni possibilitities for i th choice.

n1×n2×·· ·×nk objects.

Second Rule of counting: If order does not matter.Count with order. Divide by number of orderings/sorted object.Typically:

(nk

).

Stars and Bars: Sample k objects with replacement from n.Order doesn’t matter.Typically:

(n+k−1k

).

Inclusion/Exclusion: two sets of objects.Add number of each subtract intersection of sets.

Sum Rule: If disjoint just add.

Combinatorial Proofs: Identity from counting same in two ways.Pascal’s Triangle Example:

(n+1k

)=

( nk−1

)+(n

k

).

RHS: Number of subsets of n + 1 items size k .LHS:

( nk−1

)counts subsets of n + 1 items with first item.(n

k

)counts subsets of n + 1 items without first item.

Disjoint – so add!

Page 388: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Summary.First Rule of counting: Objects from a sequence of choices:

ni possibilitities for i th choice.n1×n2×·· ·×nk objects.

Second Rule of counting: If order does not matter.Count with order. Divide by number of orderings/sorted object.Typically:

(nk

).

Stars and Bars: Sample k objects with replacement from n.Order doesn’t matter.Typically:

(n+k−1k

).

Inclusion/Exclusion: two sets of objects.Add number of each subtract intersection of sets.

Sum Rule: If disjoint just add.

Combinatorial Proofs: Identity from counting same in two ways.Pascal’s Triangle Example:

(n+1k

)=

( nk−1

)+(n

k

).

RHS: Number of subsets of n + 1 items size k .LHS:

( nk−1

)counts subsets of n + 1 items with first item.(n

k

)counts subsets of n + 1 items without first item.

Disjoint – so add!

Page 389: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Summary.First Rule of counting: Objects from a sequence of choices:

ni possibilitities for i th choice.n1×n2×·· ·×nk objects.

Second Rule of counting:

If order does not matter.Count with order. Divide by number of orderings/sorted object.Typically:

(nk

).

Stars and Bars: Sample k objects with replacement from n.Order doesn’t matter.Typically:

(n+k−1k

).

Inclusion/Exclusion: two sets of objects.Add number of each subtract intersection of sets.

Sum Rule: If disjoint just add.

Combinatorial Proofs: Identity from counting same in two ways.Pascal’s Triangle Example:

(n+1k

)=

( nk−1

)+(n

k

).

RHS: Number of subsets of n + 1 items size k .LHS:

( nk−1

)counts subsets of n + 1 items with first item.(n

k

)counts subsets of n + 1 items without first item.

Disjoint – so add!

Page 390: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Summary.First Rule of counting: Objects from a sequence of choices:

ni possibilitities for i th choice.n1×n2×·· ·×nk objects.

Second Rule of counting: If order does not matter.

Count with order. Divide by number of orderings/sorted object.Typically:

(nk

).

Stars and Bars: Sample k objects with replacement from n.Order doesn’t matter.Typically:

(n+k−1k

).

Inclusion/Exclusion: two sets of objects.Add number of each subtract intersection of sets.

Sum Rule: If disjoint just add.

Combinatorial Proofs: Identity from counting same in two ways.Pascal’s Triangle Example:

(n+1k

)=

( nk−1

)+(n

k

).

RHS: Number of subsets of n + 1 items size k .LHS:

( nk−1

)counts subsets of n + 1 items with first item.(n

k

)counts subsets of n + 1 items without first item.

Disjoint – so add!

Page 391: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Summary.First Rule of counting: Objects from a sequence of choices:

ni possibilitities for i th choice.n1×n2×·· ·×nk objects.

Second Rule of counting: If order does not matter.Count with order.

Divide by number of orderings/sorted object.Typically:

(nk

).

Stars and Bars: Sample k objects with replacement from n.Order doesn’t matter.Typically:

(n+k−1k

).

Inclusion/Exclusion: two sets of objects.Add number of each subtract intersection of sets.

Sum Rule: If disjoint just add.

Combinatorial Proofs: Identity from counting same in two ways.Pascal’s Triangle Example:

(n+1k

)=

( nk−1

)+(n

k

).

RHS: Number of subsets of n + 1 items size k .LHS:

( nk−1

)counts subsets of n + 1 items with first item.(n

k

)counts subsets of n + 1 items without first item.

Disjoint – so add!

Page 392: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Summary.First Rule of counting: Objects from a sequence of choices:

ni possibilitities for i th choice.n1×n2×·· ·×nk objects.

Second Rule of counting: If order does not matter.Count with order. Divide by number of orderings/sorted object.

Typically:(n

k

).

Stars and Bars: Sample k objects with replacement from n.Order doesn’t matter.Typically:

(n+k−1k

).

Inclusion/Exclusion: two sets of objects.Add number of each subtract intersection of sets.

Sum Rule: If disjoint just add.

Combinatorial Proofs: Identity from counting same in two ways.Pascal’s Triangle Example:

(n+1k

)=

( nk−1

)+(n

k

).

RHS: Number of subsets of n + 1 items size k .LHS:

( nk−1

)counts subsets of n + 1 items with first item.(n

k

)counts subsets of n + 1 items without first item.

Disjoint – so add!

Page 393: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Summary.First Rule of counting: Objects from a sequence of choices:

ni possibilitities for i th choice.n1×n2×·· ·×nk objects.

Second Rule of counting: If order does not matter.Count with order. Divide by number of orderings/sorted object.Typically:

(nk

).

Stars and Bars: Sample k objects with replacement from n.Order doesn’t matter.Typically:

(n+k−1k

).

Inclusion/Exclusion: two sets of objects.Add number of each subtract intersection of sets.

Sum Rule: If disjoint just add.

Combinatorial Proofs: Identity from counting same in two ways.Pascal’s Triangle Example:

(n+1k

)=

( nk−1

)+(n

k

).

RHS: Number of subsets of n + 1 items size k .LHS:

( nk−1

)counts subsets of n + 1 items with first item.(n

k

)counts subsets of n + 1 items without first item.

Disjoint – so add!

Page 394: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Summary.First Rule of counting: Objects from a sequence of choices:

ni possibilitities for i th choice.n1×n2×·· ·×nk objects.

Second Rule of counting: If order does not matter.Count with order. Divide by number of orderings/sorted object.Typically:

(nk

).

Stars and Bars:

Sample k objects with replacement from n.Order doesn’t matter.Typically:

(n+k−1k

).

Inclusion/Exclusion: two sets of objects.Add number of each subtract intersection of sets.

Sum Rule: If disjoint just add.

Combinatorial Proofs: Identity from counting same in two ways.Pascal’s Triangle Example:

(n+1k

)=

( nk−1

)+(n

k

).

RHS: Number of subsets of n + 1 items size k .LHS:

( nk−1

)counts subsets of n + 1 items with first item.(n

k

)counts subsets of n + 1 items without first item.

Disjoint – so add!

Page 395: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Summary.First Rule of counting: Objects from a sequence of choices:

ni possibilitities for i th choice.n1×n2×·· ·×nk objects.

Second Rule of counting: If order does not matter.Count with order. Divide by number of orderings/sorted object.Typically:

(nk

).

Stars and Bars: Sample k objects with replacement from n.

Order doesn’t matter.Typically:

(n+k−1k

).

Inclusion/Exclusion: two sets of objects.Add number of each subtract intersection of sets.

Sum Rule: If disjoint just add.

Combinatorial Proofs: Identity from counting same in two ways.Pascal’s Triangle Example:

(n+1k

)=( n

k−1

)+(n

k

).

RHS: Number of subsets of n + 1 items size k .LHS:

( nk−1

)counts subsets of n + 1 items with first item.(n

k

)counts subsets of n + 1 items without first item.

Disjoint – so add!

Page 396: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Summary.First Rule of counting: Objects from a sequence of choices:

ni possibilitities for i th choice.n1×n2×·· ·×nk objects.

Second Rule of counting: If order does not matter.Count with order. Divide by number of orderings/sorted object.Typically:

(nk

).

Stars and Bars: Sample k objects with replacement from n.Order doesn’t matter.

Typically:(n+k−1

k

).

Inclusion/Exclusion: two sets of objects.Add number of each subtract intersection of sets.

Sum Rule: If disjoint just add.

Combinatorial Proofs: Identity from counting same in two ways.Pascal’s Triangle Example:

(n+1k

)=( n

k−1

)+(n

k

).

RHS: Number of subsets of n + 1 items size k .LHS:

( nk−1

)counts subsets of n + 1 items with first item.(n

k

)counts subsets of n + 1 items without first item.

Disjoint – so add!

Page 397: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Summary.First Rule of counting: Objects from a sequence of choices:

ni possibilitities for i th choice.n1×n2×·· ·×nk objects.

Second Rule of counting: If order does not matter.Count with order. Divide by number of orderings/sorted object.Typically:

(nk

).

Stars and Bars: Sample k objects with replacement from n.Order doesn’t matter.Typically:

(n+k−1k

).

Inclusion/Exclusion: two sets of objects.Add number of each subtract intersection of sets.

Sum Rule: If disjoint just add.

Combinatorial Proofs: Identity from counting same in two ways.Pascal’s Triangle Example:

(n+1k

)=( n

k−1

)+(n

k

).

RHS: Number of subsets of n + 1 items size k .LHS:

( nk−1

)counts subsets of n + 1 items with first item.(n

k

)counts subsets of n + 1 items without first item.

Disjoint – so add!

Page 398: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Summary.First Rule of counting: Objects from a sequence of choices:

ni possibilitities for i th choice.n1×n2×·· ·×nk objects.

Second Rule of counting: If order does not matter.Count with order. Divide by number of orderings/sorted object.Typically:

(nk

).

Stars and Bars: Sample k objects with replacement from n.Order doesn’t matter.Typically:

(n+k−1k

).

Inclusion/Exclusion: two sets of objects.

Add number of each subtract intersection of sets.Sum Rule: If disjoint just add.

Combinatorial Proofs: Identity from counting same in two ways.Pascal’s Triangle Example:

(n+1k

)=( n

k−1

)+(n

k

).

RHS: Number of subsets of n + 1 items size k .LHS:

( nk−1

)counts subsets of n + 1 items with first item.(n

k

)counts subsets of n + 1 items without first item.

Disjoint – so add!

Page 399: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Summary.First Rule of counting: Objects from a sequence of choices:

ni possibilitities for i th choice.n1×n2×·· ·×nk objects.

Second Rule of counting: If order does not matter.Count with order. Divide by number of orderings/sorted object.Typically:

(nk

).

Stars and Bars: Sample k objects with replacement from n.Order doesn’t matter.Typically:

(n+k−1k

).

Inclusion/Exclusion: two sets of objects.Add number of each subtract intersection of sets.

Sum Rule: If disjoint just add.

Combinatorial Proofs: Identity from counting same in two ways.Pascal’s Triangle Example:

(n+1k

)=( n

k−1

)+(n

k

).

RHS: Number of subsets of n + 1 items size k .LHS:

( nk−1

)counts subsets of n + 1 items with first item.(n

k

)counts subsets of n + 1 items without first item.

Disjoint – so add!

Page 400: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Summary.First Rule of counting: Objects from a sequence of choices:

ni possibilitities for i th choice.n1×n2×·· ·×nk objects.

Second Rule of counting: If order does not matter.Count with order. Divide by number of orderings/sorted object.Typically:

(nk

).

Stars and Bars: Sample k objects with replacement from n.Order doesn’t matter.Typically:

(n+k−1k

).

Inclusion/Exclusion: two sets of objects.Add number of each subtract intersection of sets.

Sum Rule: If disjoint just add.

Combinatorial Proofs: Identity from counting same in two ways.Pascal’s Triangle Example:

(n+1k

)=( n

k−1

)+(n

k

).

RHS: Number of subsets of n + 1 items size k .LHS:

( nk−1

)counts subsets of n + 1 items with first item.(n

k

)counts subsets of n + 1 items without first item.

Disjoint – so add!

Page 401: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Summary.First Rule of counting: Objects from a sequence of choices:

ni possibilitities for i th choice.n1×n2×·· ·×nk objects.

Second Rule of counting: If order does not matter.Count with order. Divide by number of orderings/sorted object.Typically:

(nk

).

Stars and Bars: Sample k objects with replacement from n.Order doesn’t matter.Typically:

(n+k−1k

).

Inclusion/Exclusion: two sets of objects.Add number of each subtract intersection of sets.

Sum Rule: If disjoint just add.

Combinatorial Proofs: Identity from counting same in two ways.Pascal’s Triangle Example:

(n+1k

)=( n

k−1

)+(n

k

).

RHS: Number of subsets of n + 1 items size k .LHS:

( nk−1

)counts subsets of n + 1 items with first item.(n

k

)counts subsets of n + 1 items without first item.

Disjoint – so add!

Page 402: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Summary.First Rule of counting: Objects from a sequence of choices:

ni possibilitities for i th choice.n1×n2×·· ·×nk objects.

Second Rule of counting: If order does not matter.Count with order. Divide by number of orderings/sorted object.Typically:

(nk

).

Stars and Bars: Sample k objects with replacement from n.Order doesn’t matter.Typically:

(n+k−1k

).

Inclusion/Exclusion: two sets of objects.Add number of each subtract intersection of sets.

Sum Rule: If disjoint just add.

Combinatorial Proofs: Identity from counting same in two ways.

Pascal’s Triangle Example:(n+1

k

)=( n

k−1

)+(n

k

).

RHS: Number of subsets of n + 1 items size k .LHS:

( nk−1

)counts subsets of n + 1 items with first item.(n

k

)counts subsets of n + 1 items without first item.

Disjoint – so add!

Page 403: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Summary.First Rule of counting: Objects from a sequence of choices:

ni possibilitities for i th choice.n1×n2×·· ·×nk objects.

Second Rule of counting: If order does not matter.Count with order. Divide by number of orderings/sorted object.Typically:

(nk

).

Stars and Bars: Sample k objects with replacement from n.Order doesn’t matter.Typically:

(n+k−1k

).

Inclusion/Exclusion: two sets of objects.Add number of each subtract intersection of sets.

Sum Rule: If disjoint just add.

Combinatorial Proofs: Identity from counting same in two ways.Pascal’s Triangle Example:

(n+1k

)=

( nk−1

)+(n

k

).

RHS: Number of subsets of n + 1 items size k .LHS:

( nk−1

)counts subsets of n + 1 items with first item.(n

k

)counts subsets of n + 1 items without first item.

Disjoint – so add!

Page 404: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Summary.First Rule of counting: Objects from a sequence of choices:

ni possibilitities for i th choice.n1×n2×·· ·×nk objects.

Second Rule of counting: If order does not matter.Count with order. Divide by number of orderings/sorted object.Typically:

(nk

).

Stars and Bars: Sample k objects with replacement from n.Order doesn’t matter.Typically:

(n+k−1k

).

Inclusion/Exclusion: two sets of objects.Add number of each subtract intersection of sets.

Sum Rule: If disjoint just add.

Combinatorial Proofs: Identity from counting same in two ways.Pascal’s Triangle Example:

(n+1k

)=

( nk−1

)+(n

k

).

RHS: Number of subsets of n + 1 items size k .

LHS:( n

k−1

)counts subsets of n + 1 items with first item.(n

k

)counts subsets of n + 1 items without first item.

Disjoint – so add!

Page 405: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Summary.First Rule of counting: Objects from a sequence of choices:

ni possibilitities for i th choice.n1×n2×·· ·×nk objects.

Second Rule of counting: If order does not matter.Count with order. Divide by number of orderings/sorted object.Typically:

(nk

).

Stars and Bars: Sample k objects with replacement from n.Order doesn’t matter.Typically:

(n+k−1k

).

Inclusion/Exclusion: two sets of objects.Add number of each subtract intersection of sets.

Sum Rule: If disjoint just add.

Combinatorial Proofs: Identity from counting same in two ways.Pascal’s Triangle Example:

(n+1k

)=

( nk−1

)+(n

k

).

RHS: Number of subsets of n + 1 items size k .LHS:

( nk−1

)counts subsets of n + 1 items with first item.

(nk

)counts subsets of n + 1 items without first item.

Disjoint – so add!

Page 406: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Summary.First Rule of counting: Objects from a sequence of choices:

ni possibilitities for i th choice.n1×n2×·· ·×nk objects.

Second Rule of counting: If order does not matter.Count with order. Divide by number of orderings/sorted object.Typically:

(nk

).

Stars and Bars: Sample k objects with replacement from n.Order doesn’t matter.Typically:

(n+k−1k

).

Inclusion/Exclusion: two sets of objects.Add number of each subtract intersection of sets.

Sum Rule: If disjoint just add.

Combinatorial Proofs: Identity from counting same in two ways.Pascal’s Triangle Example:

(n+1k

)=

( nk−1

)+(n

k

).

RHS: Number of subsets of n + 1 items size k .LHS:

( nk−1

)counts subsets of n + 1 items with first item.(n

k

)counts subsets of n + 1 items without first item.

Disjoint – so add!

Page 407: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Summary.First Rule of counting: Objects from a sequence of choices:

ni possibilitities for i th choice.n1×n2×·· ·×nk objects.

Second Rule of counting: If order does not matter.Count with order. Divide by number of orderings/sorted object.Typically:

(nk

).

Stars and Bars: Sample k objects with replacement from n.Order doesn’t matter.Typically:

(n+k−1k

).

Inclusion/Exclusion: two sets of objects.Add number of each subtract intersection of sets.

Sum Rule: If disjoint just add.

Combinatorial Proofs: Identity from counting same in two ways.Pascal’s Triangle Example:

(n+1k

)=

( nk−1

)+(n

k

).

RHS: Number of subsets of n + 1 items size k .LHS:

( nk−1

)counts subsets of n + 1 items with first item.(n

k

)counts subsets of n + 1 items without first item.

Disjoint

– so add!

Page 408: sp17.eecs70.orgsp17.eecs70.org/static/slides/lec-14.pdfsp17.eecs70.org

Summary.First Rule of counting: Objects from a sequence of choices:

ni possibilitities for i th choice.n1×n2×·· ·×nk objects.

Second Rule of counting: If order does not matter.Count with order. Divide by number of orderings/sorted object.Typically:

(nk

).

Stars and Bars: Sample k objects with replacement from n.Order doesn’t matter.Typically:

(n+k−1k

).

Inclusion/Exclusion: two sets of objects.Add number of each subtract intersection of sets.

Sum Rule: If disjoint just add.

Combinatorial Proofs: Identity from counting same in two ways.Pascal’s Triangle Example:

(n+1k

)=

( nk−1

)+(n

k

).

RHS: Number of subsets of n + 1 items size k .LHS:

( nk−1

)counts subsets of n + 1 items with first item.(n

k

)counts subsets of n + 1 items without first item.

Disjoint – so add!