# Number of ways to group some set

i'm curious about that: i have given some number N and numbers $a_1, a_2, .., a_m$ and $a_1+a_2+..+a_m=N$. It is: in how many ways i group N( lets say persons ) that they make M groups with those sizes. For example i have $N=5$ and $M=3$ and groups sizes are :$2,2,1$ let's label our people with letter we have $a,b,c,d,e$ and now we can make 30(?) different groupings it is

$ab cd e$

$ac bd e$

$ad bc e$

and so on... My attempt is like this: i choose $\frac{N(N-1)}{2}$ different pairs and fix them at first position and last position

for example i choose first letter $a$ and $b$.

So i have to fill groups like this:

$a_ __ b$

where _ stand for empty space to fill with other letters

so i can make permutations with repetitions.

It is i have remaining letters: $c,d,e$ and i can make $\frac{3!}{(2!*1!)}$ different groupings for this permutations. So final answer for this grouping is 30. Cuz there is 10 different pairs.

I must say that group made of ${a,b}$ is sam as group made of ${b,a}$...

So there is my question how to show that if that way of thinking is correct. And maybe there is more less complicated one? Thanks...

-
If the first group of $2$ and the second group of $2$ are treated differently, then your answer is given here – polkjh Mar 6 '13 at 14:26
Generally, proving that a combinatorial counting argument is correct is hard. One usual approach is to show a bijection (one to one correspondence) between what you are counting and something else for which a formula is known. – utdiscant Mar 6 '13 at 14:27
Thanks for link polkjh, but no, groups of size X are considered the same. This is if we have $N = 2$ and $M = 2$ then there is only one way to complete it. – Spinach Mar 6 '13 at 21:41
I've solved this problem adding theorem from factorials with repetitions to theorem from polkhj links. Thanks for your time guys. – Spinach Mar 7 '13 at 15:06