CMSC250

Combinatorics

Combinatorics

Interesting Examples
Permutations of repeated Elements
Combinations of Repeated Elements

Interesting Examples

Recall: Permutations: $P(n,k) = \frac{n!}{(n-k)!}$

Recall: Combinations: $C(n,k) = \frac{n!}{k!(n-k)!}$

Event: An action with an outcome

Multiplication: Events occurring together or in series

Addition (and subtraction): Events in Parallel

Suppose we have 10 people and have 6 placements for a championship

How many ways can they ranked? $P(10,6)$

Suppose we have 10 people and we want to situate 6 around a round table

How many ways can they be ordered around the table? $\frac{P(10,6)}{6}$

Cycle: Order matters, but not which one is 'first'

How many anagrams of "PYTHON"? $P(6,6) = 6!$

How many anagrams of "PYTHON"? $P(6,6) = 6!$

What if "P" and "Y" cannot be next to each other? $P(6,6)-10(4!)$

"PY____","_PY___","__PY__",___PY_","____PY"

"YP____","_YP___","__YP__",___YP_","____YP"

Each option has $4!$ ways of arranging the rest of the letters

Suppose I have 6 friends and I need 4 for a team of 5

How many ways can I choose 4 friends? $C(6,4)$

Suppose I have 6 friends and I need 4 for a team of 5

What if 2 of my friends refuse to be separated?

How many ways can I choose 4 friends? $C(4,4) + C(4,2)$

$C(4,4)$ If I do not choose the two

$C(4,2)$ If I do choose the two

Can only do one of these options: add

Permutations of Repeated Elements

Recall: How many ATM Pins exist?

$10$ digits, $4$ places so $10^4$

How many anagrams of "CLIFF" exist?

The Two 'F's are indistinguishable

_ _ _ _ _

First Choose where to put the "F"s $C(5,2)$

How many anagrams of "CLIFF" exist?

The Two 'F's are indistinguishable

_ F _ F _

First Choose where to put the "F"s $C(5,2)$

How many anagrams of "CLIFF" exist?

The Two 'F's are indistinguishable

_ F _ F _

First Choose where to put the "F"s $C(5,2)$

How many ways can we arrange the last 3 letters? $3!$

_ F _ F _

How many ways can we arrange the last 3 letters? $3!$

What does this mean?

We have 3 places to choose where to put the "C"

We have 2 places to choose where to put the "L"

We have 1 places to choose where to put the "I"

$3! = C(3,1)\cdot C(2,1) \cdot C(1,1)$

How many anagrams of "CLIFF" exist?

_ F _ F _

$3! = C(3,1)\cdot C(2,1) \cdot C(1,1)$

$C(5,2)\cdot C(3,1)\cdot C(2,1) \cdot C(1,1)$

How many anagrams of "BABAR" exist?

_ _ _ _ _

Choose 2 places to put the "B" $C(5,2)$

Choose 2 places to put the "A" $C(3,2)$

Choose 1 places to put the "R" $C(1,1)$

$C(5,2) \cdot C(3,2) \cdot C(1,1)$

$C(5,2) \cdot C(3,2) \cdot C(1,1)$

$\frac{5!}{(5-2)!2!}\cdot\frac{3!}{(3-2)!2!}\cdot\frac{1!}{(1-1)!1!}$

$\frac{5!}{3!2!}\cdot\frac{3!}{1!2!}\cdot\frac{1!}{0!1!}$

$\frac{5!}{2!2!1!}$

Suppose I have $n$ items in $k$ categories

$\frac{n!}{n_1!n_2!\dots n_k!}$

$n = n_1+n_2+\dots+n_k$

You want $4$ plain, $3$ pineapple, and $1$ pepperoni slices of pizza. The order you consume matters. How many ways can you do this?

$3$ Categories: plain, pineapple, pepperoni

$4$, $3$, and $1$ items respectively

$4 + 3 + 1 = 8$ total slices

$\frac{8!}{4!3!1!}$

You want $4$ plain, $3$ pineapple, and $1$ pepperoni slices OR $4$ plain and $4$ pepperoni. The order you consume matters. How many ways can you do this?

2 options: $3$ or $2$ categories

$\frac{8!}{4!3!1!} + \frac{8}{4!4!}$

You want $4$ plain, $3$ pineapple, and $1$ pepperoni slices OR $4$ plain and $4$ pepperoni. The order you consume matters. No 4 plain in a row. How many ways can you do this?

PPPP????, ?PPPP???,??PPPP??,???PPPP?,????PPPP

Each ???? is a 4 slices from 2 categories

$\frac{8!}{4!3!1!} - 5\Big(\frac{4!}{3!1!}\Big)$

Combinations and Categories

I want 7 sodas. The store has 3 types. How many possibilities?

Fun Approach: Add Dividers

XX|XXX|XX

XXXXX|XX|

||XXXXXXX

Note: Permutation of 7+2 items in 2 categories

$\frac{(7+2)!}{7!2!} = \frac{9!}{7!2!}$

I want 7 sodas. The store has 3 types. How many possibilities?

XX|XXX|XX

Note: Permutation of 7+2 items in 2 categories

$\frac{(7+2)!}{7!2!} = \frac{9!}{7!2!}$

Observation: $\frac{9!}{7!2!} = C(9,7)$

Observation: $C(9,7) = C(7 + 3 - 1,7)$

Observation: $C(9,7) = C(7 + 3 - 1,7)$

Combination of $n$ items in $k$ categories: $C(n+k-1,n)$

A store offers 4 colours of plates. I need 20 for a party.

Combination of $20$ items in $4$ categories: $C(20+4-1,20)$

A store offers 4 colours of plates and 3 colours of hats. I need 20 plates and 10 hats.

Combination of $20$ items in $4$ categories: $C(20+4-1,20)$

Combination of $10$ items in $3$ categories: $C(10+3-1,10)$

I need both- multiply: $C(12,10)\cdot C(23,20)$

Putting it all together

I need 5 people for a panel at a round table. I have 11 people to choose from, and if 2 specific people are at the table they refuse to have a common 3rd enemy at the table