Docsity

Combinatorics Sum and Product Rules, Study notes of Discrete Mathematics

Toggle sidebar
bg1
Combinatorics
Problem: How to count without counting.
•How do you figure out how many things there are with
a certain property without actually enumerating all of
them.
Sometimes this requires a lot of cleverness and deep math-
ematical insights.
But there are some standard techniques.
•That’s what we’ll be studying.
1
Sum and Product Rules
Example 1: In New Hampshire, license plates consisted
of two letters followed by 3 digits. How many possible
license plates are there?
Answer: 26 choices for the first letter, 26 for the second,
10 choices for the first number, the second number, and
the third number:
262×103= 676,000
Example 2: A traveling salesman wants to do a tour of
all 50 state capitals. How many ways can he do this?
Answer: 50 choices for the first place to visit, 49 for the
second, . . . : 50! altogether.
Chapter 4 gives general techniques for solving counting
problems like this. Two of the most important are:
2
The Sum Rule: If there are n(A) ways to do Aand,
distinct from them, n(B) ways to do B, then the number
of ways to do Aor Bis n(A) + n(B).
•This rule generalizes: there are n(A) + n(B) + n(C)
ways to do Aor Bor C
•In Section 4.8, we’ll see what happens if the ways of
doing Aand Baren’t distinct.
The Product Rule: If there are n(A) ways to do A
and n(B) ways to do B, then the number of ways to do
Aand Bis n(A)×n(B). This is true if the number of
ways of doing Aand Bare independent; the number of
choices for doing Bis the same regardless of which choice
you made for A.
•Again, this generalizes. There are n(A)×n(B)×n(C)
ways to do Aand Band C
3
Some Subtler Examples
Example 3: If there are nSenators on a committee, in
how many ways can a subcommittee be formed?
Two approaches:
1. Let N1be the number of subcommittees with 1 sen-
ator (n), N2the number of subcommittees with 2
senator (n(n−1)/2), . . .
According to the sum rule:
N=N1+N2+· · · +Nn
•It turns out that Nk=n!
k!(n−k)! (nchoose k); this
is discussed in Section 4.4
•A subtlety: What about N0? Do we allow sub-
committees of size 0? How about size n?
◦The problem is somewhat ambiguous.
If we allow subcommittees of size 0 and n, then
there are 2nsubcommittees altogether.
◦This is the same as the number of subsets of the
set of nSenators: there is a 1-1 correspondence
between subsets and subcommittees.
2. Simpler method: Use the product rule!
4
pf3
pf4
pf5

Partial preview of the text

Download Combinatorics Sum and Product Rules and more Study notes Discrete Mathematics in PDF only on Docsity!

Combinatorics

Problem: How to count without counting.

  • How do you figure out how many things there are with a certain property without actually enumerating all of them.

Sometimes this requires a lot of cleverness and deep math- ematical insights.

But there are some standard techniques.

  • That’s what we’ll be studying.

1

Sum and Product Rules

Example 1: In New Hampshire, license plates consisted of two letters followed by 3 digits. How many possible license plates are there? Answer: 26 choices for the first letter, 26 for the second, 10 choices for the first number, the second number, and the third number: 262 × 103 = 676, 000

Example 2: A traveling salesman wants to do a tour of all 50 state capitals. How many ways can he do this? Answer: 50 choices for the first place to visit, 49 for the second,... : 50! altogether. Chapter 4 gives general techniques for solving counting problems like this. Two of the most important are:

2

The Sum Rule: If there are n(A) ways to do A and, distinct from them, n(B) ways to do B, then the number of ways to do A or B is n(A) + n(B).

  • This rule generalizes: there are n(A) + n(B) + n(C) ways to do A or B or C
  • In Section 4.8, we’ll see what happens if the ways of doing A and B aren’t distinct.

The Product Rule: If there are n(A) ways to do A and n(B) ways to do B, then the number of ways to do A and B is n(A) × n(B). This is true if the number of ways of doing A and B are independent; the number of choices for doing B is the same regardless of which choice you made for A.

  • Again, this generalizes. There are n(A)×n(B)×n(C) ways to do A and B and C

Some Subtler Examples

Example 3: If there are n Senators on a committee, in how many ways can a subcommittee be formed? Two approaches:

  1. Let N 1 be the number of subcommittees with 1 sen- ator (n), N 2 the number of subcommittees with 2 senator (n(n − 1)/2),... According to the sum rule:

N = N 1 + N 2 + · · · + Nn

  • It turns out that Nk = (^) k!(nn−!k)! (n choose k); this is discussed in Section 4.
  • A subtlety: What about N 0? Do we allow sub- committees of size 0? How about size n? ◦ The problem is somewhat ambiguous. If we allow subcommittees of size 0 and n, then there are 2n^ subcommittees altogether. ◦ This is the same as the number of subsets of the set of n Senators: there is a 1-1 correspondence between subsets and subcommittees.
  1. Simpler method: Use the product rule!
  • Each senator is either in the subcommittee or out of it: 2 possibilities for each senator: ◦ 2 × 2 × · · · × 2 = 2n^ choices altogether

General moral: In many combinatorial problems, there’s more than one way to analyze the problem.

5

How many ways can the full committee be split into two sides on an issue? This question is also ambiguous.

  • If we care about which way each Senator voted, then the answer is again 2n: Each subcommittee defines a split + vote (those in the subcommittee vote Yes, those out vote No); and each split + vote defines de- fines a subcommittee.
  • If we don’t care about which way each Senator voted, the answer is 2n/2 = 2n−^1. ◦ This is an instance of the Division Rule.

6

Coping with Ambiguity

If you think a problem is ambiguous:

  1. Explain why
  2. Choose one way of resolving the ambiguity
  3. Solve the problem according to your interpretation
    • Make sure that your interpretation doesn’t render the problem totally trivial

More Examples

Example 4: How many legal configurations are there in Towers of Hanoi with n rings? Answer: The product rule again: Each ring gets to “vote” for which pole it’s on.

  • Once you’ve decided which rings are on each pole, their order is determined.
  • The total number of configurations is 3n Example 5: How many distinguishable ways can the letters of “computer” be arranged? How about “dis- crete”? For computer, it’s 8!:
  • 8 choices for the first letter, for the second,... Is it 8! for discrete? Not quite.
  • There are two e’s Suppose we called them e 1 , e 2 :
  • There are two “versions” of each arrangement, de- pending on which e comes first: discre 1 te 2 is the same as discre 2 te 1.
  • Thus, the right answer is 8!/2!

It’s useful to define 0! = 1.

Why?

  1. Then we can inductively define (n + 1)! = (n + 1)n!, and this definition works even taking 0 as the base case instead of 1.
  2. A better reason: Things work out right for P (n, 0) and C(n, 0)!

How many permutations of n things from n are there?

P (n, n) =

n! (n − n)!

n! 0!

= n!

How many ways are there of choosing n out of n? 0 out of n?    n n

   = n! n!0!

   n 0

   = n! 0!n!

13

More Questions

Q: How many ways are there of choosing k things from { 1 ,... , n} if 1 and 2 can’t both be chosen? (Suppose n, k ≥ 2.) A: First find all the ways of choosing k things from n— C(n, k). Then subtract the number of those ways in which both 1 and 2 are chosen:

  • This amounts to choosing k−2 things from { 3 ,... , n}: C(n − 2 , k − 2). Thus, the answer is C(n, k) − C(n − 2 , k − 2)

Q: What if order matters? A: Have to compute how many ways there are of picking k things, two of which are 1 and 2. P (n, k) − k(k − 1)P (n − 2 , k − 2)

14

Q: How many ways are there to distribute four distinct balls evenly between two distinct boxes (two balls go in each box)?

A: All you need to decide is which balls go in the first box. C(4, 2) = 6

Q: What if the boxes are indistinguishable?

A: C(4, 2)/2 = 3.

Combinatorial Identities

There all lots of identities that you can form using C(n, k). They seem mysterious at first, but there’s usually a good reason for them. Theorem 1: If 0 ≤ k ≤ n, then C(n, k) = C(n, n − k).

Proof:

C(n, k) = n! k!(n − k)!

n! (n − k)!(n − (n − k))!

= C(n, n−k)

Q: Why should choosing k things out of n be the same as choosing n − k things out of n? A: There’s a 1-1 correspondence. For every way of choos- ing k things out of n, look at the things not chosen: that’s a way of choosing n − k things out of n. This is a better way of thinking about Theorem 1 than the combinatorial proof.

Theorem 2: If 0 < k < n then    n k

   =

   n − 1 k

   +

   n − 1 k − 1

  

Proof 1: (Combinatorial) Suppose we want to choose k objects out of { 1 ,... , n}. Either we choose the last one (n) or we don’t.

  1. How many ways are there of choosing k without choos- ing the last one? C(n − 1 , k).
  2. How many ways are there of choosing k including n? This means choosing k − 1 out of { 1 ,... , n − 1 }: C(n − 1 , k − 1).

Proof 2: Algebraic...

Note: If we define C(n, k) = 0 for k > n and k < 0, Theorems 1 and 2 still hold.