# What is the probability of a subset appearing within another random set?

this might be a silly question but here goes:

I have this set of variables [T, T, T, T, O, V, M, M] where T and M are the same.

I have a few questions:

How do I calculate the total possible combinations for the set above? I ran 8! but 40k seems a little bit too large. Is this correct?

How do I calculate the total possible combinations in which O or V has an M appearing next to it if the set were scrambled?

How do I calculate the probability that either an O or V will have an M appear immediately after (to the right)?

So something such as the following would be off target:

[T, O, T, V, T, M, T, M]

or where the M appears before:

[M, V, M, O, T, T, T, T]

Intuitively, I feel that calculating the total possible calculations where an O has an M appear after it, and the total possible outcomes where a V has an M appearing next to it could be added together and then divided by the total, however I am not able to reach a value in which seems correct so I am asking the experts for help!

Thanks for the clarification! And if anyone knows any buzzwords which I can look up to help understand this concept I would also appreciate it!

• If "T and M are the same" then why using two different letters??? Aug 10, 2016 at 13:36
• @barakmanos : I believe he wants to emphasize that the four Ts are all undistinguishable as are the two Ms. Aug 10, 2016 at 13:45
• The first step is to clearly ask the question. It appears that you want the number of orders you can put the elements in. These are permutations, not combinations. Questions like this are often quite subtle in counting as it is easy to count some possibilities twice or not at all. Aug 10, 2016 at 14:22
• You can reorder the four Ts or the two Ms without generating a new pattern. So $8!$ is indeed too big and you have to divide by two factors to reflect the duplications of Ts and Ms Aug 10, 2016 at 14:26

You are first asking for the number of permutations of your collection. First imagine the $$T$$s and $$M$$s were distinct from each other-maybe they are painted different colors. There would be $$8!$$ permutations in that case. When you unpaint the $$T$$s, you lose the ability to tell one order of the $$T$$s from another, so you lose a factor $$4!=24$$. Similarly when the $$M$$s become identical you can't tell if the two of them are swapped, so you lose a factor $$2!=2$$. The final count of permutations is $$\frac {8!}{4!2!}=840$$
Your question about how many have an $$O$$ or $$V$$ with $$M$$ immediately after is an example of the difficulty of counting. You can't just compute the number that have $$M$$ after $$O$$ and double it to account for the ones with $$M$$ after $$V$$ because you can have $$OM$$ and $$VM$$ in the same arrangement. You would count those twice. To get the arrangements with $$OM$$, glue one $$M$$ to the $$O$$ and arrange the $$7$$ items in $$\frac {7!}{4!}$$ ways. Similarly there are $$\frac {7!}{4!}$$ arrangements with $$VM$$. As I said, adding these to get those with $$OM$$ or $$VM$$ double counts those that have both, of which there are $$\frac {6!}{4!}$$, so the total number of arrangements is $$2\cdot \frac {7!}{4!}-\frac {6!}{4!}$$