In how many ways can we pair ourselves?

Say we have an even number of elements and we sort them into pairs in a way that every element belongs to a pair and no element belongs in two pairs.

Given $2n$ elements how many different arrangements of this sort can be made?

For example given elements named $1$, $2$, $3$ and $4$ we can do $\{\{1,2\},\{3,4\}\}$, $\{\{1,3\},\{2,4\}\}$ and $\{\{1,4\},\{2,3\}\}$ so we have $3$ different arrangements.

A wild guess I made is of the sort $\prod_{i=0}^{n-1} 2n-(1+2i)$.

The question arises form trying to figure out in how many ways can the earth population arrange themselves in couples where noone (or at most one poor human being) is left alone.

• Your guess is correct. – Empy2 Sep 7 '15 at 12:04
• It would be good exercise to put into words why it is the product of the odd numbers. – Empy2 Sep 7 '15 at 12:36
• These numbers are also called "double factorial" en.wikipedia.org/wiki/Double_factorial – user940 Sep 7 '15 at 14:11

We can start by looking at all the ways to arrange $2n$ numbers. This is $(2n)!$. Then within each of the $n$ pairs, there are $2$ ways to sort the numbers. So we want to divide our count by $2^n$. Lastly, we don't care about the order of the $n$ pairs themselves, so we further divide our count by $n!$. So the number of pairings of $2n$ numbers is

$$\dfrac{(2n)!}{2^nn!}.$$

Edit: This agrees with the OP's answer of $\;\prod_{i=0}^{n-1} 2n-(1+2i)$.

Denote the number in question by $P_{2n}$. Person number $1$ can choose his mate in $2n-1$ ways. After that there are $2n-2$ people left, which can be paired off in $P_{2n-2}$ ways. It follows that the $P_{2n}$ satisfy the recursion $$P_2=1,\qquad P_{2n}=(2n-1)\>P_{2n-2}\qquad(n>1)\ ,$$ which immediately leads to you "wild guess".

$$\frac1{n!}\binom{2n}2\binom{2n-2}2\cdots\binom42\binom22=\frac{(2n)!}{2^nn!}$$

Pick out $2$ out of all $2n$ to form a pair.

After that pick out $2$ out of remaining $2n-2$ to form a pair, et cetera.

Then every possibility has been counted $n!$ times (there are $n!$ orders for the pairs) so we must divide by $n!$ to repair this.

I appreciate all answers. To anyone interested in how I personally arrived to my guess: I imagined a string made by all elements, let's call it $S$, and noticed that any pairing can be uniquiely represented as another string where the $i$-th element is paired with the $i$-th element in $S$ (imagine one string on top of the other, the elements vertically aligned belong in the same pair). This strings however must satisfy that if element $a$ sats on top of $b$, then on top of $a$ we can only have $b$. In fact every string that obeys this rule uniquely determines a pairing. Counting them lead to the answer.

I realize that this problem has already been solved, but I got the solution in a different way and it looks a little different but plugging it in to wolfram alpha leads me to believe the previous correct solutions and this one are the same.

Background: (Note: this paragraph is how I came about the problem and you can skip it if you just want to see the answer.) This idea came up in Anthony Zee's "Quantum Field Theory in a Nutshell" book (pg 15). If you want to find certain moments of a multivariable (what is close to) Gaussian distribution, you can use a technique called Wick contraction to easily get the answer. Here is what I mean:
$$ = C_{ij}$$ $$ = C_{ij} C_{kl} + C_{il} C_{jk} + C_{ik} C_{jl}$$ $$...$$ The definition of $$C$$ does not matter, but we see we are basically pairing off the indices into however many different configurations we can. I was curious if there was a general formula for this, and here is how I got the answer.

Answer: The case of 4 indices is easy because you can just list them out like I did above--there are three. Now say we have six indices: {i, j, k, l, m, n}. Consider pairing off the first two indices to {i, j}. Now there are four more indices left to pair off, but we already know there are three different configurations for four indices. I.e. for the initial pairing of {i, j}, there are 3 "sub-configurations." Now notice there are 5 different starting pairs: {i, j}, {i, k}, {i, l}, {i, m}, {i, n}. So 6 indices gives us 5 x 3 = 15 different pairings. If you go to 8 indices, there are 7 different starting pairs which would each leave 6 indices left, which we just found out has 15 options. Therefore you have 7 x 5 x 3 options. Continuing this logic, you can see we clearly have the following:
4 indices: 3
6 indices: 5 x 3
8 indices: 7 x 5 x 3
10 indices: 9 x 7 x 5 x 3
...
Or more concisely (2n-1)!! different pairings (where !! is the double factorial).