What is a formula to find the permutation of $r$ objects given that there are $n$ total object and out of them $n_1$ and $n_2$ are indistinguishable? The question is I've $n$ the total number of objects, out of them I've to find the permutation of $r$ objects given that $r < n$. It's also given that there $m$ and $t$ are indistinguishable objects in $n$ such that $m+t=n$. What will be the formula to find the permutation in such a case?
As an example, we've $8$ marbles out of which $5$ are red and $3$ and blue, and the number of objects we have to choose is $2$. The permutation we know would be equal to $4$. But I don't don't the formula to evaluate this value of $4$.
 A: One way is dividing it into cases, eg for the numerical example, either you can have 2 red, 2 blue, or 1 red + 1 blue in two ordered  ways
But this sort of computation quickly becomes very tedious.
So here is a way you can use where a lot of cases may arise.
We know that when we multiply polynomials in $x$, the indices of $x$ get added up.
And we also know that if one type, eg, $M$ occurs, say, $k$ times in the extracted letters, we need to divide the permutations by $k!$
Using these two ideas, we can represent each letter as a polynomial of x, the indices representing the number of times a letter can occur. You can regard $x's$ as only  placeholders for the number of times a letter can occur.
Putting it all together, for a somewhat more complex example, $4$ letter permutations of PINEAPPLE  (I,N,A,L occur once each, E occurs twice, P occurs thrice), Remember that $P$, for example, may occur $0,1,2,\; or\; 3$ times
find  $4!$ times the coefficient of $x^4$ in the expression $(x^0+x^1)(x^0+x^1)(x^0+x^1)(x^0+x^1)(x^0+x^1+\frac{x^2}{2!})(x^0+x^1+\frac{x^2}{2!}+\frac{x^3}{3!})$
where the successive terms in parentheses are for $I,N,A,L,E,P$
which of course would normally be written as
$4!(1+x)^4(1+x+\frac{x^2}{2!})(1+x+\frac{x^2}{2!}+\frac{x^3}{3!})$
and gives an  answer of $626$
You may like to countercheck by the case by case approach, eg

*

*$4$ singles: $\binom64*4! = 360$


*$2$ singles and a double: $\binom43\binom21\frac{4!}{2!} = 240$


*$1$ single, $1$ triple: $\binom51\frac{4!}{3!} = 20$


*$2$ doubles: $\binom 22\frac{4!}{2!2!} = 6$
PS
The second approach is called the generating function approach, which for the moment you can understand simply the way it has been explained for use in the type of permutations you have asked for
