
Shuvam C. answered 07/17/23
CS Major with University Experience in Discrete Math
Your approach and intuition for the first method are correct and give a solution of 654729075 ways. Let's look at a different way to do it.
We can use the following strategy to pair up students: line all of the students up and make the first two students a pair, then make the next two students a pair, and so on.
How many different ways are there to line up n students? There are n! different ways. However, some of these ways give repeated pairs. We can think of this using a smaller value of n. Let's say that n=4 and we have 4 students named A, B, C, and D.
Both ABCD and CDAB are ways to line up the students, but they end up with A and B paired and C and D paired, so they have the same pairing. The issue here is that we have the same pairings, but the pairs are ordered differently. We don't want to double count here. With n students, there will be n/2 pairs, so there are (n/2)! ways to order those pairs. To avoid double counting, we will divide by (n/2)!.
Also, both ABCD and BACD are valid ways to line up the students, but both ways give A and B paired and C and D paired. We also don't want to double count situations where the pairings are the same, but a pair is swapped in order (AB vs. BA). With n/2 pairs, there are 2^(n/2) ways to choose which pairs to swap, so we would like to divide by that, too.
Let's now look at the problem with n=20. The formula we get is (20!) / (10! * 2^10). Plugging this into a calculator gives 654729075 once again.