N distinct items sampled with replacement k times produces a sample space of size nk. Ordered sampling without replacement is a permutation, and produces a sample space of size
P(n, k) = n(n - 1)(n - 2)· · ·(n - k + 1)? = (n)k?As a sanity check, P(n, 1) is n, and P(n, n + 1) is 0.
Multiplying the falling factorial (n)k by (n - k)! turns it into the full factorial n! Multiplying P(n, k) by 1 in the form n!/n! gives an alternate formula for permutation counting:
P(n, k) = n!/(n - k)!For more sanity P(n, n) = n!/(n - n)! = n!/0! = n!? and P(n, 0) = n!/(n - 0)! = n!/n! = 1.
Sampling with replacement is a cheap but not tight upper-bound for sampling without replacement:
P(n, k) ≤ nkCan nk be tightened up? Multiply P(n, k) by 1 in the form of nk/nk:
P(n, k) = (nk/nk)(n(n - 1)(n - 2)· · ·(n - k + 1)))Distribute 1/nk among the other terms:
nk(n/n(n - 1)/n(n - 2)/n)· · ·((n - (k - 1))/n)Divide through:
nk((1 - 1/n)(1 - 2/n))· · ·(1 - (k - 1)/n))Now substitute the upper bound? 1 - x ≤ e-x to get
nke-1/ne-2/n· · ·e-(k + 1)/n
nke-(1/n + 2/n + · · · + (k + 1)/n)
nke-k(k - 1)/2n
Example 2.2-1 How many ways can 3 out of 10 distinct books be arranged?
P(10, 3) = 10(10 - 1)(10 - (3 - 1)) = 10×9×8 = 720Example 2.2-2 How many ways can 6 out of 10 distinct books be arranged?
P(10, 6) = 10×9×8×7×6 ×5 = 151,200Example 2.2-3 How many ways can 10 out of 10 distinct books be arranged?
P(10, 10) = 10! = 3,628,800The number of possible permutations grows quickly.
Example 2.2-4 How many permutations are there of three books, two of them indistinguishable?
Using subscripts to distinguish the otherwise indistinguishable books, the naive sample space is
Any permutation containing a1 then a2 is indistinguishable from the permutation with a1 and a2 swapped, which means the naive permutation count is two times larger than it should be.
permutations books a1 a2 a1 a2 b b a2 a1 b b a1 a2 b b a2 a1 a2 a1
The naive permutations are reduced by the same amount for each permutation, which preserves symmetry in the reduced sample space.
permutations books a a b a b a b a a