Permutations with Repeated Items

Calculates the number of ways to arrange n items where some are identical, n! ÷ (a! × b! × …). List the group sizes separated by commas: for "aaabbc", enter 3, 2, 1.

This counts the ways of arranging nn items in a row when some of them are identical. Divide the factorial of the total by the factorial of each group of identical items.

n!a!b!c!\dfrac{n!}{a!\, b!\, c! \cdots}

Here a,b,c,a, b, c, \ldots are the group sizes, and together they add up to nn.

Example

Rearrange the six letters of "aaabbc". There are 3 a's, 2 b's and 1 c, so the group sizes to enter are 3, 2, 1.

6!3!2!1!=7206×2×1=72012=60\dfrac{6!}{3!\,2!\,1!} = \dfrac{720}{6 \times 2 \times 1} = \dfrac{720}{12} = 60

There are 60 distinct arrangements.

Why you divide

If all six letters were different there would be 6!=7206! = 720 orders. But the three a's are indistinguishable: the 3!=63! = 6 ways of shuffling them among themselves all produce exactly the same visible word.

The same goes for the 2!=22! = 2 shuffles of the b's. Dividing by 3!×2!×1!=123! \times 2! \times 1! = 12 removes every duplicate.

Where it is used

The combination nCr_nC_r is the special case of this formula with only two groups.