I am attempting a generative art project of which I am creating all possible permutations of a template using 11 colours. There are 5 sections that can be coloured.
I have calculated the possible permutations to be 11^5 giving 161,051 different possibilities. I wish to grade them in rarity via their statistical probability of occurring,
i.e all 5 colours the same being the rarest, next being 4 the same, 3 etc etc.
So essentially I am looking for all ways to mix colours = [a, b, c, d, e, f, g, h, i, j, k] with pieces = [r, s, x, y, z]
Doing so has returned the following numbers:
- 11 of 5/5 the same colour
- 550 of 4/5 ...
- 11,000 of 3/5 ...
- 94,050 of 2/5 ...
- 55,440 of 1/5 ...
And I am coming up short with being able to calculate the odds of it returning a final result within each bracket (my maths is a little rusty) and initially thought that the values would grow larger within each bracket as the number of the same colours reduced, but as can be seen there is more in the second to last than the last. I'm thinking this may be due to combining two such as 3/5 also having the possibility to also contain a 2/5 or two 1/5 separate permutations within it?
Would anyone be able to help me calculate the correct probabilities of each tier, as currently I'm getting more in the uncommon category than the common one?
If so thank you in advance!
Here's an explanation for why each of the counts is correct, case-by-case.
$5/5$: if all of the sections are the same color, there are $11$ ways to pick the color and therefore $\boxed{11}$ permutations.
$4/5$: there are $11$ ways to pick Color $A$, the one that occupies $4$ sections; $10$ ways to pick some other Color $B$; and $5$ ways to pick the lone section colored with Color $B$, giving $11\cdot10\cdot5 = \boxed{550}$ permutations.
$3/5$: there are two cases. Either there are three colors $A$, $B$, and $C$, such that $A$ colors $3$ sections and $B$ and $C$ color one each, or there are two colors $A$ and $B$, where $A$ colors $3$ sections and $B$ colors two sections.
In the first case, there are $11$ ways to pick Color $A$, $10$ ways to pick Color $B$, and $9$ ways to pick Color $C$. There are $5$ ways to choose the section with Color $B$ and $4$ ways to choose the section with Color $C$, and the other sections can be left for Color $A$. However, this double-counts by a factor of $2$, since we can reach a permutation twice by swapping our choices of $B$ and $C$ and swapping the sections we choose. Therefore, this case includes $11\cdot10\cdot9\cdot5\cdot4 \cdot (1/2) = 9{,}900$ permutations.
In the second case, there are $11\cdot10$ ways to pick Colors $A$ and $B$, and $\binom{5}{2} = 10$ ways to pick the $2$ sections to be colored by Color $B$. Therefore, this case includes $11\cdot10\cdot10=1{,}100$ permutations, yielding a total of $\boxed{11{,}000}$ permutations for $3/5$.
$1/5$: We have to pick a different color for each section, so there are $11\cdot10\cdot9\cdot8\cdot7 = \boxed{55{,}440}$ of these permutations.
$2/5$: this is just all the other cases, so there are $161{,}051-11-550-11{,}000-55{,}440=\boxed{94{,}050}$ of these.
In general, this counter-intuitiveness only arises because there are just not enough colors for duplicates to be uncommon. On the low end–if there are only $5$ colors, for example–it'd seem pretty unlikely to manage to hit a different color each time. If there were $4$ colors, it'd be outright impossible! Meanwhile, on the high end–say, if there are $1{,}000$ colors–hitting the same color twice would be pretty unlikely. So, the "crossover" point, where using the same color twice becomes less likely than using different colors for each section, is somewhere in the middle, and it just so happens that $11$ colors is not enough to make duplicating colors less likely.
In fact, we can find the number of colors such that using a different color each time would be more frequent than using the same color twice. The probability of using all different colors is $$ \frac{n(n-1)(n-2)(n-3)(n-4)}{n}. $$ (To see why, there are $n$ ways to pick the first section's color, $n-1$ ways to pick the second section's color, etc.) Numerically solving $$ \frac{n(n-1)(n-2)(n-3)(n-4)}{n} > \frac{1}{2}$$ yields $n > 16.01$, so you'd have to have at least $17$ colors for those "common" arrangements to be more likely than not.