Mathematics | Generalized PnC Set 1 (original) (raw)

Last Updated : 15 Dec, 2021

Prerequisite - PnC and Binomial Coefficients

So far every problem discussed in previous articles has had sets of distinct elements, but sometimes problems may involve repeated use of elements. This article covers such problems, where elements of the set are indistinguishable (or identical or not distinct).

Permutations with repetition -
Counting permutations when repetition of elements can be easily done using the product rule.
Example, number of strings of length r is 26^r , since for every character there are 26 possibilities.

The number of r-permutations of a set of n objects

with repetition is n^r.

Combinations with repetition -
Counting the number of combinations with repetition is a bit more complicated than counting permutations. Consider a set of n types of objects and we need to find out in how many ways can r elements be chosen.
To solve the above problem we will first take a look at a similar problem that is arranging bars(|) and stars(*). Suppose there are 5 bars and 3 stars. One possible arrangement is -

||*||**|

They can be arranged in \frac{8!}{5!3!} = C(8,3) = C(8,5) ways.
Our original problem is similar to the above problem. The bars represent divisions between the types of elements such that each type is separated by a bar and the number of stars is r .
If a star is before the nth bar, then that means an item of nth type is selected, except for the last type where the star can be after a bar. For example, the arrangement mentioned above, ||*||**|, represents a selection of 1 element of 3rd type and 2 elements of 5th type.
In this way our original problem can be thought of as arranging r stars (elements) and (n-1) bars(divisions). The above result can be generalized as-

There are C(r+n-1,r) = C(r+n-1,n-1)

r-combinations from a set with n

elements when repetition is allowed.