I'm going through a book right now where the author is going over some combinatorics equations. I apologize if the following is an easy question.

I'm trying to gain an intuitive understanding of the equations that the author is presenting for different situations. For example, to calculate the number of permutations for n distinct objects, the author says the formula is n*(n-1)*(n-2)...1 = n!, which makes perfect sense.

The one that tripped me up initially was counting the number of distinct permutations when there are repeated elements. I thought about it for a bit, and wanted to verify if my thinking was correct. He says the formula for this is $\frac{n!}{r!}$ where r represents the number of repeated elements (when there is only 1 repeated element).

The way I reasoned about this intuitively was as follows. Suppose you have the string "abc". The number of **distinct** permutations is 3! = 6. Now let's say you have the string "abb". The permutations are

abb

**abb**

bab

**bab**

bba

**bba**

All the permutations I've bolded are copies of a distinct permutation, i.e abb is a copy of the distinct permutation abb. So **each** permutation gets repeated more than once when there are repeated elements.

I extended this in my head to a larger number. If I have 3 repeated elements, like "abbb", how many times does each permutation get repeated?

ab_{1}b_{2}b_{3}

**ab _{1}b_{3}b_{2}**

**ab _{2}b_{1}b_{3}**

**ab _{2}b_{3}b_{1}**

**ab _{3}b_{1}b_{2}**

**ab _{3}b_{2}b_{1}**

So I'm thinking that if there are r repeated elements ("abb" has r = 2), then each permutation gets copied r! times. When there are no repeated elements, r = 1, so each permutation gets copied 1! = 1 times which is a distinct permutation.

So if that is the case, then lets say we have n elements where 1 of those n elements is repeated r times. Out of n elements, n! **total** permutations are produced. Let's say the count of any permutation is represented by P_{i} where i is the count of the ith permutation (so P_{1} = 6 for the permutation abbb in the above example). And let's say that since we know that each permutation is copied, the number of **distinct** permutations is j. That means

n! = (P_{0} + P_{1} + P_{2} ... P_{j})

Each distinct permutation seems to get repeated the same number of times - r! times. That means P_{i} for any i <= j has r! copies instead of 1 copy, which is what we desire, so

n! = (P_{0} + P_{1} + P_{2} ... P_{j})

= ((r!)(1) + (r!)(1) + (r!)(1) ... (r!)(1))

= (r!)(1 + 1 + 1 ... 1) = (r!)(j)

1 is added to itself j times since there are j distinct permutations. So if n! = the number of total permutations, and n! = (r!)(j) where j is the number of distinct permutations, then j = $\frac{n!}{r!}$

I am wondering if this is the correct way to think about how the formula works/is derived, and if this thought process can be naturally extended when you have multiple repeated elements (r_{1}! , r_{2}!, ...)