6
Counting nCr = n!/r!(n-r)!=nC(n-r) This equation reflects the fact that selecting r items is same as selecting n-r items in forming a combination from n items.

Counting nCr = n!/r!(n-r)!=nC(n-r) This equation reflects the fact that selecting r items is same as selecting n-r items in forming a combination from

Embed Size (px)

Citation preview

Page 1: Counting nCr = n!/r!(n-r)!=nC(n-r) This equation reflects the fact that selecting r items is same as selecting n-r items in forming a combination from

Counting

• nCr = n!/r!(n-r)!=nC(n-r)

This equation reflects the fact that selecting r items is same as selecting n-r items in forming a combination from n items.

Page 2: Counting nCr = n!/r!(n-r)!=nC(n-r) This equation reflects the fact that selecting r items is same as selecting n-r items in forming a combination from

Compare two problems

• Number of strings of 0,1, and length n

2n

• Number of strings of 0,1, length n, and r 0s

nCr

Consider the set {1,2,…,n}, the positions of the

digits in the strings. There are nCr ways to choose

r positions to assign 0.

Page 3: Counting nCr = n!/r!(n-r)!=nC(n-r) This equation reflects the fact that selecting r items is same as selecting n-r items in forming a combination from

Theorem 2. Suppose k selections are to be made from n items without regards to order and that repeats are allowed, assuming at least k copies of each of the n items. The number of ways these selections can be made is (n+k-1)Ck.

Page 4: Counting nCr = n!/r!(n-r)!=nC(n-r) This equation reflects the fact that selecting r items is same as selecting n-r items in forming a combination from

Example. Choose 3 CDs from 10 (allow repeats).

Consider the CDs one by one. 1 means select one copy

and 2 means no (more) copies from the current choice.

E.g., 2221221222212 represents selecting CD 4,6,10

1211222222222 represents CD 1,two copies 2

Conversely, any selection can be represented by such

a sequence. The string has three 1’s and ten 2’s. The last

digit is always 2. The first 3+9 digits can be either 1 or 2. Therefore, total number 12C3.

Page 5: Counting nCr = n!/r!(n-r)!=nC(n-r) This equation reflects the fact that selecting r items is same as selecting n-r items in forming a combination from

This problem is equivalent to find the number of ways to

put r identical items (or tokens, to give another name) into

n different boxes.

This is easy to see. Associate an object with a box. Choosing a copy of a certain object is associated with

putting a token into the associated box.

E.g., selecting CD 3, two copies of CD 6 is associated with putting one token in box 3 and two tokens in box 6.

Page 6: Counting nCr = n!/r!(n-r)!=nC(n-r) This equation reflects the fact that selecting r items is same as selecting n-r items in forming a combination from

Let 0 denote a token. A string of r 0’s and (n-1) 1’s

models one assignment of r tokens into n boxes.

Consider the same example as before, with r=3 and n=10.

111011011110 represents putting one token each in

box 4,6 and10

010011111111 represents putting one token in

box 1, two in box 2

Therefore, total number 12C3.