1

I want to find the number of permutations for element sets like AABC, AABBC, AABBCCFQQQ, etc. Element sets where there are distinct elements, whose placement relative to each other matters, but also identical elements (sub-sets of the element set), within which order doesn't matter. Put shortly, order matters within the element set, but not within the individual sub-sets.

In the case of AABC, there's four element spaces. If one is only directly moving the A-elements (and thus indirectly displacing the other elements), one gets six permutations. That makes sense because you're choosing two places out of four, and order doesn't matter: $\frac{4!}{(4-2)!2!}$, which is six. With the other elements, you're choosing one place out of four: $\frac{4!}{(4-1)!1!}$, which is four. So I thought, maybe the total number of permutations is all of these combinations added together?

AABC ...... Copy 1A

ABAC

ABCA

BAAC

BACA

BCAA ...... Copy 1B


BCAA ...... Copy 2B

CBAA

CABA

CAAB ...... Copy 1C


CAAB ...... Copy 2C

ACAB

AACB

AABC ...... Copy 2A

There are six copies, which divided by two yields three superfluous. Adding everything together, and subtracting three, gives eleven as the total number of permutations. This has led me to believe that this equation may give the answer. $$\frac{\text{No. elements}!}{(\text{No. elements} - \text{No. e}_1)! \ \ \text{No. e}_1!} + ... + \frac{\text{No. elements}!}{(\text{No. elements} - \text{No. e}_n)! \ \ \text{No. e}_n!} - n$$

If n is greater than 2, n being the number of distinct elements. e$_n$ is the nth element, and e$_1$ is the first element.

I've seen that when n = 2, there is no addition, but simply one combination. I think this may be because no. e$_1 = x$ and e$_2 = y$, $$\frac{(x+y)!}{(x+y-x)!x!} = \frac{(x+y)!}{(x+y-y)!y!}$$

Basically, by directly moving the A-elements through all of their combinations, one is indirectly displacing the B-elements through all of their combinations.

That's all I have, and it should give the answerer a rough notion of my level of combinatorics and math understanding. To conclude, I'm looking for an equation that gives the number of permutations with the input variables of the number of distinct elements, and the individual numbers of the element sub-sets.

EDIT:

I forgot to mention that I was looking for the permutations using all of the letters. Also, my brute force method missed ACBA.

user110391
  • 1,223
  • 4
  • 17
  • 2
    https://en.m.wikipedia.org/wiki/Multinomial_theorem#Ways_to_put_objects_into_bins – Asher2211 Sep 16 '21 at 12:14
  • 2
    As for your proposed formula and brute forced list... you must be missing something. The correct total count should have been $\frac{4!}{2!1!1!}=12$, not $11$. At a glance it looks like you missed ACBA from your list. A reminder that brute force, while easy to understand conceptually, is highly prone to error and should only be used as a last resort. – JMoravitz Sep 16 '21 at 12:18
  • 1
    For AABBCCFQQQ, say, do you want the permutations of the entire letters, or of shorter words drawn from the letters ? – true blue anil Sep 16 '21 at 12:46
  • @trueblueanil I only wanted the permutations of all the letters, should have said this in the post. – user110391 Sep 16 '21 at 14:55
  • @JMoravitz I did miss ACBA. I had an algorithm for my brute force listing that I thought would catch all permutations, but it didn't. – user110391 Sep 16 '21 at 14:57
  • @user10391: Then just remember the simplest of the formulas, viz for AABBCCFQQQ, it'll be $\dfrac{10!}{2!2!2!1!3!}$, the denominator reflecting the number of times different letters are repeated. – true blue anil Sep 16 '21 at 15:22

2 Answers2

3

Suppose you have a set of $N$ letters consisting of $k$ distinct letters, the first of which repeated $n_1$ times, the second of which repeated $n_2$ times, and so on up to the $k$'th of which repeated $n_k$ times. So, $n_1+n_2+\dots+n_k=N$. For instance, your AABC example you have $N=4,k=3,n_1=2,n_2=1,n_3=1$ or in your AABBCCFQQQ example you have $N=10,k=5,n_1=2,n_2=2,n_3=2,n_4=1,n_5=3$.

The answer to the question of how many rearrangements of this string exist using some (but not necessarily all) of the letters can be seen in @Bulbasaur's answer here or in 6-letter permutations of MISSISSIPPI and is a more challenging problem than what I expect you are expecting.

As for the far simpler question of how many rearrangements of this string exist using all of the letters, this is precisely what Multinomial Coefficients count.

$$\binom{N}{n_1,n_2,\dots,n_k}=\dfrac{N!}{n_1!n_2!\cdots n_k!}=\binom{N}{n_1}\binom{N-n_1}{n_2}\binom{N-n_1-n_2}{n_3}\cdots\binom{N-n_1-\dots -n_{k-1}}{n_k}$$

These are the coefficients of the $x_1^{n_1}x_2^{n_2}\cdots x_k^{n_k}$ term in the expansion of $(x_1+x_2+\dots+x_k)^N$

A quick handwavy proof is that if you imagine each letter has being uniquely identifiable then we have $N!$ arrangements. Recognizing then that each relabeling of the ids of each respective letter yields another equivalent arrangement so to "forget" which copy of a letter was which we divide by the number of ways to have labeled them which is $n_1!n_2!\cdots n_k!$

Another explanation is that if you were to just choose the spaces used by each letter a group at a time, so... choosing which $n_1$ spaces were used by the first letter out of the $N$, then choosing which $n_2$ spaces were used by the second letter out of the remaining $N-n_1$, and so on... you arrive at the same expression noting the massive algebraic cancellation that can occur.

For your example of $AABC$, there are $\dfrac{4!}{2!1!1!}=12$ different arrangements, this corresponding to the coefficient of the $a^2bc$ term in the expansion of $(a+b+c)^4$

JMoravitz
  • 80,908
  • This is what I was looking for, I should have specified that I was looking for the permutations using all letters. – user110391 Sep 16 '21 at 14:46
1

What you looking for is exponential generating function. For example , lets think of the example $AABBCCFQQQ$ ,which given by you. Assume that we want to find the number of all permutations consisting of these letter and lenght $5$.Then you should write the exponential generating function form of all of these letters separetely.

For $A$ : $$\bigg(1 +\frac{x}{1} + \frac{x^2}{2!}\bigg)$$

For $B$ : $$\bigg(1 +\frac{x}{1} + \frac{x^2}{2!}\bigg)$$

For $C$ : $$\bigg(1 +\frac{x}{1} + \frac{x^2}{2!}\bigg)$$

For $F$ : $$\bigg(1 +\frac{x}{1} \bigg)$$

For $Q$ : $$\bigg(1 +\frac{x}{1} + \frac{x^2}{2!} +\frac{x^3}{3!}\bigg)$$

Then ,find the expansion of them and find the coefficient of $x^5$ and multiply it by $5$ or find just the coefficient of $\frac{x^5}{5!}$

expansion in this link

Then, $$5! \times \frac{28}{3} =1120$$ is the number of all permutations of lenght $5$ by using these letters.

For example , $$3! \times \frac{16}{1}=96$$ is the number of all permutations of lenght $3$ by using these letters.

link for exponential generating functions

NOTE= If you want to find the case where all letter used , the find the coefficient of $x^{10}$ and multiply by $10!$ in given link.

Not a Salmon Fish
  • 5,910
  • 2
  • 11
  • 31
  • To emphasize, this answers the question of "How many length 5 strings can be made using letters from AABBCCFQQQ where we cannot use more copies of a letter than were present in the original word." While that question is relatively difficult and generating functions are probably the recommended approach, the OP appears to be asking the far simpler question about multinomial coefficients... the question of how many rearrangements of a word there are using all letters from the word, which has a far more elementary counting approach which avoids the use of generating functions. – JMoravitz Sep 16 '21 at 12:43
  • @JMoravitz thanks for emphasizing , i can edit it for all letters , but i can delete it ,as well.which one do you prefer ? by the way , i did not realize that OP wants simpler solution – Not a Salmon Fish Sep 16 '21 at 12:52
  • @JMoravitz i am wating your recommendation – Not a Salmon Fish Sep 16 '21 at 12:57
  • I think it is fine to leave as is, your answer is correct and someone searching in the future may have been wanting the question of if not all letters were used answered but happened upon this post first. Part of the consideration is not just about what is useful to the OP here and now, but what is useful to future visitors. – JMoravitz Sep 16 '21 at 13:01