Permutations with grouped items

I'm reviewing some core statistics. I never had problems understanding this before but now I seem to get confused by questions which have $$n$$ items of which $$n_1$$ of of one kind, $$n_2$$ are of another etc. and we want a permutation or combination of $$k$$ of $$n$$.

In other words, a permutation of k of n is $$\frac{n!}{(n-k)!}$$ and a combination is $$\frac{n!}{(n-k)!k!}$$. However, how do I also factor in the fact that $$n_1$$ items are of one kind $$n_2$$ items are of another kind etc.? Logic tells me to divide by the permutation of the kinds: $$\frac{\frac{n!}{(n-k)!}}{n_1!n_2!...n_m!}$$ for $$m$$ groups. This does not work.

Let's say we have 9 books: 5 novels, 3 poems and 1 dictionary. How can we select 3 books.

1. It is clear that a combination will be $$_9C_3 = 84$$.
2. A permutation will be $$_9P_3 = 504$$.

But what about if we want express the idea that the permutation $$N_1 N_2 D$$ is identical to $$N_2 N_1 D$$? but not to $$N_1 D N_2$$? In other words, it's a permutation as far as different items go but a combination for items within the same kind.

Another example. Let's say we have 5 red and 2 blue balls and we want to get all the combinations of 2 balls. They are RR, BB, RB so 3. How do I calculate this using combinations? $$_7C_2$$ gives 21.

EDIT: Another one - 5 red, 3 blue, 1 green balls. RR, BB, RB, RG, BG so 5 combinations.

• Taking your 5 red and 2 blue balls example, what you are looking for is arrangements without distinction (within balls of the same color). That is equivalent to finding sum of two different numbers (balls of different colors) adding to two. Pls see this math.stackexchange.com/questions/1462099/… Aug 29, 2020 at 16:04

The problem that you are coming across is the question of distinguishability. Many a combinatorial problem has been stated ambiguously as a result of the author not making the scenario clear (including one of my own high school teachers many years ago). You need to be sure which pairs of items are distinguishable and which are indisinguishable. If we are dealing with permutations of objects, some of which are indistinguishable from each other, take a look at multiset permutations. The formula for that scenario is $$\binom{n}{n_1,n_2,\ldots, n_k} = \frac{n!}{n_1!\cdot n_2!\cdots n_k!}.$$ Though you should certainly understand why the formula works before applying it.
For combinations, as one of the comments has stated, this is like solving the equation, and there is a method by generating functions that allows you to make the general computation. For example, if you have $$3$$ indistinguishable blue balls and $$2$$ indistinguishable red balls, and you want to select $$4$$ balls in total, then you want to coefficient of $$x^4$$ in the expansion of $$(1+x+x^2+x^3)(1+x+x^2),$$ which is $$2.$$