Permutations of $k$ elements from $n$ elements with repeated elements Say there are $n$ elements where some of the $n$ elements are repeated elements. For example, there are $10$ dogs and there are $2$ dogs of species $A$, $3$ of species $B$ and $5$ of species $C$.
Now how many ways are there to permute $k$ elements from the $n$ elements?
For example, how many ways are there to select $4$ dogs from the $10$ dogs (order matters).
I know that for $k = 10$, the answer is
$$\frac{10!}{2!\cdot3!\cdot5!}$$
But what about general $k \neq n$?
I thought maybe answer would be
$$\frac{nP_k}{n_1!n_2!n_3!...}$$
but it doesn’t seem right?
What is answer with full explanation please, thank you. Actually even hints are fine. I am trying to make my concepts more clear basically.
Note: I am looking for a general formula, not a strategy to solve. I can solve these kind of questions by considering cases but I want a general formula
 A: It depends very much on the multiplicities of the elements. Suppose your multiset is
$$ \{\underbrace{1,\cdots,1}_{m_1},\underbrace{2,\cdots,2}_{m_2},\cdots\} $$
with $m_1+m_2+\cdots=n$ elements. If you pick $k$ out of the $n$ elements, and more specifically you pick $k_1$ ones, $k_2$ twos, $k_3$ threes and so on, with $k=k_1+k_2+\cdots$ then  the number of ways to permute the $k$ elements is the multinomial coefficient $\binom{k}{k_1,k_2,\cdots}$ by a standard argument.
Tallying this over all possible $k_i$s, we get
$$ \sum_{\substack{0\le k_i\le m_i \\ k_1+k_2+\cdots=k}} \binom{k}{k_1,k_2,\cdots} $$
I expect this will not simplify.
A: If you want a general formula rather than a case by case, you'll have to use generating functions, which here can be understood quite simply.
For each type of dog, we shall use $x$ as a sort of place holder with the coefficient of x denoting the number taken from each type, taking care to divide by the appropriate factorial when more than $1$ of that type is taken, e.g.
$(x^0 + x^1 + x^2/2! + x^3/3! +x^4/4!+x^5/5!)$, would select $0,1,2,3,4 \;or\; 5$ from species $C$ dogs.
So what we do is to find $4!$ times the coefficient of $x^4$ considering each species of dog in $(x^0+ x^1+x^2)(x^0+x^1+x^2+x^3)(x^0+x^1+x^2+x^3+x^4+x^5)$
which works out to $264$
