# Probability of ordered sequence

There are 3 squares, 5 triangles, and 4 circles. I need to generate possibilities of certain sequences if they are randomly generated.

What is the probability that all the squares are grouped, next all the triangles, then all the circles? What is the probability that all the shapes will be grouped together (all squares together, etc.) What is the probability that all the squares are grouped (everything else is random)

I think the number of sequences for the second one is 3!5!4! = 17280

• What you got is actually the number of possibilities for the first question.

It's like having:

3S 2S 1S 5T 4T 3T 2T 1T 4C 3C 2C 1C


S meaning square, T meaning triangle and C meaning circle.

In the first slot, you have 3 possibilities (there are 3 squares), then there are 2 possibilities left for the second spot and so on.

And the total number of possibilities without restriction is $(3+5+4)! = 12!$. Can you work out the probability for the first question with that?

• For the second question, it's very similar to the first, except that you can have triangles first, or circles first, meaning there are more possibilities. For this, you can treat each group as 1 unit. With this, you get 3 units: 1 set of squares, 1 for triangles and 1 for circles. The number of ways to arrange them becomes $3!$.

Now, within each group, the shapes can be shuffled. For the squares: $3!$, for the triangles $5!$ and for the circles $4!$. This gives: $3!3!5!4!$.

• For the third question, you need to treat the squares as a single block. This gives you one big block for squares and 9 other shapes (5 being triangles and 4 being circles) for a total of 10 items. Thus, the number of ways you can arrange them is $10!$.

On top of that, the squares can shuffle between themselves within the set of squares, so you get $3!$.

The total number of ways hence is $10!3!$.

Can you work out the respective probabilities?