Hi so i was trying to solve this problem: Given N, M where N is the number of numbers and M is the number of orders. An order consits of a pair x y which says in the permutation x should be before y. After all M orders are taken you should try to figure out the number of permutations that satisfy all orders.
For example
$N$=4 and $M$=2
First order :$2$ $1$
Second order: $4$ $3$
These permutations satisfy the constraints
$2, 1, 4, 3$
$2, 4, 1, 3$
$2, 4, 3, 1$
$4, 2, 1, 3$
$4, 2, 3, 1$
$4, 3, 2, 1$
The answer is 6.
So by trying out i understood that there is a bijection between the number of permutations where x is before y and y is before x. So there are $\binom{n}{2}$*$(n-2)!$ permutations that fulfill the first order.
But trying to combine more orders is currently giving me a headache.I would appreciate any tip .