Docsity

Permutation and Combination - Discrete Structures | CS 173, Study notes of Discrete Structures and Graph Theory

Toggle sidebar
bg1
Permutations and Combinations
Margaret M. Fleck
27 October 2008
This lecture covers more examples of permutations and combinations,
from section 5.3 of Rosen plus part of section 5.4. It also introduces “combi-
natorial” proofs.
1 Announcements
Exam a week from Wednesday (Nov 5th) in class. Tell Margaret ASAP if
you have a conflict. Spec sheet should be posted mid this week. Next week:
discussions Nov 3-4 are exam review, no homework due Friday the 7th.
2 Recap: basic counting methods
Last Friday, Eric covered several basic counting rules.
The product rule: if you have pchoices for one part of a task, then q
choices for a second part, and your options for the second part don’t depend
on what you chose for the first part, then you have pq options for the whole
task.
The sum rule: suppose your task can be done in one of two ways, which
are mutually exclusive. If the first way has pchoices and the second way has
qchoices, then you have p+qchoices for how to do the task.
1
pf3
pf4
pf5

Partial preview of the text

Download Permutation and Combination - Discrete Structures | CS 173 and more Study notes Discrete Structures and Graph Theory in PDF only on Docsity!

Permutations and Combinations

Margaret M. Fleck

27 October 2008

This lecture covers more examples of permutations and combinations, from section 5.3 of Rosen plus part of section 5.4. It also introduces “combi- natorial” proofs.

1 Announcements

Exam a week from Wednesday (Nov 5th) in class. Tell Margaret ASAP if you have a conflict. Spec sheet should be posted mid this week. Next week: discussions Nov 3-4 are exam review, no homework due Friday the 7th.

2 Recap: basic counting methods

Last Friday, Eric covered several basic counting rules.

The product rule: if you have p choices for one part of a task, then q choices for a second part, and your options for the second part don’t depend on what you chose for the first part, then you have pq options for the whole task.

The sum rule: suppose your task can be done in one of two ways, which are mutually exclusive. If the first way has p choices and the second way has q choices, then you have p + q choices for how to do the task.

Pidgeonhole principle: Suppose you have n objects and assign k labels to these objects. If n > k, then two objects must get the same label.

More specifically, there must be d n k e objects with the same label. For example, if you have 47 playing cards and the cards come in five colors, then you must have at least 10 cards that are all the same color.

How to remember this? Suppose you want to assign the same label to no more than p objects. Then the most objects you can have is pk. That is, p = n k. If n is any larger, then you’ll need to assign (at least) p + 1 objects to one of the labels.

3 Another pigeonhole example

The pigeonhole principle itself is fairly obvious. The other formulas we’ll see are not that hard either. (We all make mistakes memorizing formulas for examples, but at least we all understand what’s involved.) The hardest aspect of counting problems is figuring out how to relate a word problem to one of the formulas presented in class. Often you have to look at the problem “the right way”, which sometimes means trying several approaches until you find one that works.

Here’s a less-than-obvious fact, with a proof that’s easy to follow but much harder to come up with.

Claim 1 Let S be a set of n + 1 integers, all ≤ 2 n. There must be a member of S that divides another member of S.

Proof: Suppose that the members of S are a 1 , a 2 ,... , an+1. We can write each integer as a power of two times an odd integer. That is, ai = 2ki^ qi for each i. Consider the integers q 1 ,... , qn+1. They are all odd. But there are only n odd integers ≤ 2 n. So two of them are the same. That is, there are two integers i and j such that ai = 2ki^ p and aj = 2ki^ p. Suppose without loss of generality that ki ≤ kj. (If that’s not

This is (^) 0!0!0! = 11 = 1.

The easiest way to remember this formula is to remember that we have n! (n−k)! ways to choose^ k^ elements in some particular order. Since there are^ k! ways to put each subset into an order, we need to divide by k! so that we will only count each subset once.

Example: How many ways can I select a 7-card hand from a 60-card deck of magic cards (assuming no two cards are identical)?

Answer:

This is 60 ·^597 ·^58 · 6 ·· 557 · 4 ··^563 · 2 ·^55 ·^54. Probably not worth multiplying

this out unless you really have to. (Get a computer to do it.)

Beware: The canned formula only works when all items in the set are distinguishable. If some of the items in our set are identical, we have to use subtle approaches. The details, and the difficulty, depend subtly on the problem.

6 The bit string viewpoint

Applying these formulas sometimes requires reworking how you think about the problem. In particular, it often helps to see placing objects in certain positions of an arrangement as choosing a subset of the positions.

Example: How many 16-digit bit strings contain exactly 5 zeros?

Solution: The string contains 16 positions. We need to pick 5 of these to

be the ones with the zeros. So we have

ways to do this.

More complex example: How many 10-digit strings from the 26-letter ASCII alphabet contain exactly 3 A’s?

Solution: We need to pick a subset of the 10 positions in which to put

the three A’s. There are

ways to do this. After we’ve done that, we

have seven positions to fill with our choice of any character except A. We

have 25^7 ways to do that. So our total number of strings is

Warning: this latter sort of example is a custom solution which may be hard to generalize to similar situations. You have to think about each situation carefully when your problem involves multiple identical objects.

7 Combinatorial proofs

There are a large number of useful identities involving binomial coefficients. A very simple example is:

Claim 2

n k

n n − k

There are two ways to prove this. First, we could convert both sides to expressions involving factorials and show that they are equal.

Proof:

n k

= (^) k!(nn−!k)!

Also,

n n − k

= (^) (n−k)!(nn−!(n−k))! = (^) (n−nk!)!k!

So

n k

n n − k

Alternatively, you can prove this by choosing two sets and discussing why the two numbers of combinations must be the same.

Suppose we have a set S containing n elements. We can match up the subsets containing k elements with the subsets containing n − k elements. Specifically, each subset A of S is matched to S −A. This is a bijection, so there are the same number of subsets of size k as subsets of size n − k. So C(n, k) and C(n, n − k) must be equal. That is,

n k

n n − k

The second proof technique is called a “combinatorial proof.”