2
Distribution of How many balls boxes can contain k Balls into n Boxes No Restrictions ≤ 1 (At most one) ≥ 1 (At least one) = 1 (Exactly one) Distinct Distinct n k (formula 1) n P k (formula 2) S(k,n) × n! (formula 3) (See more details below) n P n = n! if k = n 0 if k ≠ n (formula 4) Identical Distinct (n+k-1) C k (formula 5) n C k (formula 6) (k-1) C (n-1) (formula 7) 1 if k = n 0 if k ≠ n (formula 8) Distinct Identical (formula 9) (See more details below) 1 if k ≤ n 0 if k > n (formula 10) S(k,n) (formula 11) (See more details below) 1 if k = n 0 if k ≠ n (formula 12) Identical Identical (formula 13) (See more details below) 1 if k ≤ n 0 if k > n (formula 14) P(k, n) (formula 15) (See more details below) 1 if k = n 0 if k ≠ n (formula 16) S(k,n) Stirling number of the second kind and can be defined as Special Cases : S(0,0) = 1, S(k,0) = 0 for k ≥ 1 S(k,n) = 0 for k < n P(k,n) = The number of partitions of the integer k into n parts. Formula for P(k,n) is much harder than that of S(k, n). The following example will explain how we can find the value of P(k,n). What is the value of P(6,3) ? The partitions of 6 into 3 parts are 4 + 1 + 1 3 + 2 + 1 2 + 2 + 2 (Note that 4 + 1 + 1 ,1 + 4 + 1, and 1 + 1 + 4. all are same. Similarly we need to consider all other cases as well) Hence the number of partitions of 6 into 3 parts are = 3 => P(6,3) = 3 What is the value of P(6,2) ? The partitions of 6 into 2 parts are 1 + 5 2 + 4 3 + 3 Hence the number of partitions of 6 into 2 parts are = 3 => P(6,2) = 3 What is the value of P(6,1) ? Here, we count the number of partitions of 6 into 1 part. Clearly the number of such partitions = 1 => P(6,1) = 1 Now try to find out the value of P(6,4) The partitions of 6 into 4 parts are 1 + 1 + 1 + 3 1 + 2 + 2 + 2 Hence the number of partitions of 6 into 4 parts are = 2 S(k,i) i=1 n P(k, i) i=1 n S(k,n) = (n i 1 n! i=0 n−1 (−1) i n C i ) k = [ (n −0 (n −1 + (n −2 +⋯+ (1 ] 1 n! n C 0 ) k n C 1 ) k n C 2 ) k (−1) n−1 n C n−1 ) k Page 1 of 2 Distributing Balls into Boxes 29/10/2014 http://www.careerbless.com/aptitude/qa/permutations_combinations_imp7.php

Permutations Combination

Embed Size (px)

DESCRIPTION

PnC

Citation preview

Page 1: Permutations Combination

Distribution of How many balls boxes can contain

k Balls into n Boxes No Restrictions≤ 1

(At most one)≥ 1

(At least one)= 1

(Exactly one)

Distinct Distinctnk

(formula 1)

nPk

(formula 2)

S(k,n) × n!

(formula 3)(See more details below)

nPn = n! if k = n

0 if k ≠ n

(formula 4)

Identical Distinct

(n+k-1)Ck

(formula 5)

nCk

(formula 6)

(k-1)C(n-1)

(formula 7)

1 if k = n 0 if k ≠ n

(formula 8)

Distinct Identical

(formula 9)(See more details below)

1 if k ≤ n 0 if k > n

(formula 10)

S(k,n)

(formula 11)(See more details below)

1 if k = n 0 if k ≠ n

(formula 12)

Identical Identical

(formula 13)(See more details below)

1 if k ≤ n 0 if k > n

(formula 14)

P(k, n)

(formula 15)(See more details below)

1 if k = n 0 if k ≠ n

(formula 16)

S(k,n) Stirling number of the second kind and can be defined as

Special Cases :S(0,0) = 1, S(k,0) = 0 for k ≥ 1S(k,n) = 0 for k < nP(k,n) = The number of partitions of the integer k into n parts.

Formula for P(k,n) is much harder than that of S(k, n). The following example will explain how we can find the value of P(k,n).

What is the value of P(6,3) ?

The partitions of 6 into 3 parts are4 + 1 + 13 + 2 + 12 + 2 + 2(Note that 4 + 1 + 1 ,1 + 4 + 1, and 1 + 1 + 4. all are same. Similarly we need to consider all other cases as well)

Hence the number of partitions of 6 into 3 parts are = 3=> P(6,3) = 3

What is the value of P(6,2) ?

The partitions of 6 into 2 parts are1 + 52 + 43 + 3Hence the number of partitions of 6 into 2 parts are = 3=> P(6,2) = 3

What is the value of P(6,1) ?

Here, we count the number of partitions of 6 into 1 part. Clearly the number of such partitions = 1=> P(6,1) = 1

Now try to find out the value of P(6,4)

The partitions of 6 into 4 parts are1 + 1 + 1 + 31 + 2 + 2 + 2Hence the number of partitions of 6 into 4 parts are = 2

S(k,i)∑i=1

n

P(k, i)∑i=1

n

S(k,n) = (n − i1n!

∑i=0

n−1(−1)i

nCi)k

= [ (n − 0 − (n − 1 + (n − 2 + ⋯ + (1 ]1n!

nC0 )knC1 )k

nC2 )k (−1)n−1nCn−1 )k

Page 1 of 2Distributing Balls into Boxes

29/10/2014http://www.careerbless.com/aptitude/qa/permutations_combinations_imp7.php

Page 2: Permutations Combination

=> P(6,4) = 2

Special Cases: P(0, 0) = P(k, k) = P(k, k-1) = P(k, 1) = 1

Page 2 of 2Distributing Balls into Boxes

29/10/2014http://www.careerbless.com/aptitude/qa/permutations_combinations_imp7.php