# Combinatorics: distributions of 16 students over 16 desks plus a restriction

In a classroom there are $$16$$ students, $$4$$ rows of desks, each made up of $$4$$ desks.

1. How many different ways are there to distribute the students over the desks?
2. Assuming there are $$4$$ female students, and $$12$$ male students, how many ways are there to distribute the students over the desks so that all four females aren't in the same row?

Point $$(1)$$ was pretty straightforward in my opinion: we are trying to find the number of functions: $$f : \{1,2,...,16\} \rightarrow \{1,2,...,16\}$$ that are injective. Since the domain and codomain have the same cardinality, such number is $$16!$$, that is the number of permutations of a set of $$16$$ elements.

For point $$(2)$$, we have to take the number of permutations from the previous point, and subtract the permutations where all four females are sitting in the same row. Since there are $$4$$ females, the number of arrangements of those four students over a row of desks is $$4!$$. Since there are $$4$$ rows, the configurations that have $$4$$ female students, in any order, all sitting in the same one row out of the four, is $$4\cdot4!$$.

Therefore, the final answer is $$16! - 4\cdot4!$$. This is the first combinatory problem I try to solve so I'm not sure if my reasoning is correct. Feedback is much appreciated.

• You were close. It should be $16!-4{\,\cdot\,}4!{\,\cdot\,}12!$.$\;$Do you see why we need the factor $12!$? – quasi Apr 12 at 15:56
• Is that because, for every one of the $4\cdot4!$ cases, the remaining $12$ students can be arranged in $12!$ ways? – Samuele B. Apr 12 at 15:58
• Yes, exactly.${}{}{}$ – quasi Apr 12 at 15:59
• Feel free to post an answer to your own question. – quasi Apr 12 at 16:18

As user quasi made me notice in the comments, the correct answer is: $$16!-4\cdot4!\cdot12!$$ Because, for every one of those $$4\cdot4!$$ arrangements of the 4 female students over the 4 sets of 4 seats, the remaining $$12$$ male students can be arranged in $$12!$$ ways. Thank you for pointing it out to me.