Number of pairs of females and males of different groups There are n females, which can have m different types. There are n males, which can have m different types. Knowing how many females are of which type and how many males are of which type, how many different pairings are there?
As an urn-model: In the first urn are n balls with m different colours. In the second urn are n rectangles with m colours. In each round one ball from the left urn is drawn and one rectangle from the right urn. The colour combination is written down. e.g (red, blue). Afterwards the rectangle and the ball are removed from the urns. How many different outcomes are possible after all rectangles and balls are removed from the urns. The order of the pairs doesnt matter: e.g. (red, red), (blue, blue) is the same as (blue, blue) (red, red)
 A: Let $(x_1,\dots,x_m)$ be the number of balls of each colour in the left urn. For the right urn let $(y_1,\dots,y_m)$ denote the numbers of the different coloured  rectangles. (I.e. $x_i$ is the number of balls of colour $i$).
a) If $x_1=\dots=x_m=y_1=\dots=y_m=1$ the answer ist $n!$, since it is basically just the number of permutations of the rectangles.
b) If $x_1=\dots=x_m=1$ then the answer is $\frac{n!}{\prod_{i\in [m]} y_i!}$
For the general problem, I have the following approach:
Let $U\in\mathbb{N}^{m\times m}$. The coefficient $u_{i,j}$ of the matrix $U$ denotes the number of pairs consisting of a ball of colour $i$ and a rectangle of colour $j$ at the end of the urn experiment. A matrix $U$ can be an outcome of the above urn experiment when the i-th row sums up to $x_i$ and the j-th column sums up to $y_j$. Therefore, the question should be equivalent to: How many matrices $U\in\mathbb{N}^{m\times m}$ exist fullfilling this row-sum and column-sum property?
This is maybe a known problem. Anyone an idea, where to look or google for?
