Find the number of ways for having $2n$ distinct balls in $n$ distinct bins such that each bin will hold exactly two balls using a generating function
The generating function (exponential) would be: $(e^x-(e^x-\frac {x^2} 2))^n =(\frac {x^2} 2)^n$, so the closed form of that would be: $\frac 1 2 1^{n-2}\cdot (n-2)! = 2^{-1}(n-2)!$ but this isn't right...
This is the same as Ways to have exactly $n$ nominees out of $2n$ voters Only here I'm having trouble with the generating function of the same problem.
The exponential generating for the number of ways to partition $[n]$ into a single pair is $\frac{x^2}{2!}$, since there is one way when $n=2$ and $0$ otherwise. Thus, the exponential generating function for the number of ways to partition $[n]$ into pairs is
$$e^{x^2/2}=\sum_{n\ge 0}\frac{x^{2n}}{2^nn!}=\sum_{n\ge 0}\left(\frac{(2n)!}{2^nn!}\cdot\frac{x^{2n}}{(2n)!}\right)\;.$$
Now just take into account the number of ways to order the pairs.
Added: I’m using here what Miklós Bóna refers to as the exponential formula in his Introduction to Enumerative Combinatorics.