# Real-Life Pairings, Couple Swapping, Hypergeometric Distribution Probability

## 1. Introductory Notes to Wife-Swapping (Couple Swapping): Serious Mathematics!

• The final version published on May 10, 2004; first capture on the WayBack Machine (web.archive.org) on June 6, 2004.

This may look or sound like a frivolous subject. You should be mindful that nothing is frivolous. It's all about being true (truthfulness) or being untrue. Feelings must be discarded when dealing with the Truth. It's not important that you like or dislike a relation when evaluated to the status of Truth.

The following is a very serious, highbrow problem of mathematics, specifically probability theory. It relates to the complex hypergeometric distribution probability formula. It isn't about bare naked sex, either.

This number pairing problem was presented in Usenet 

Newsgroups: alt.sci.math.probability
Subject: Wife-swapping question
Date: Mon, 3 May 2004 15:48:59 +0100

"A number of married couples attend a wife-swapping party, with the pairing-off being completely random. What is the limiting probability that no man will be paired up with his wife, as the number of couples tends to infinity? Matti"

I wrote about a similar probability matter in this article: Probability Player Index X Draws Ticket Number X.

Although the problem might be of more ardent interest to the anthropologists of the global village Internet, there is also profound mathematics involved. The solution necessitates combinatorics and the probability of the hypergeometric distribution.

## 2. The Combinatorics of the Couple Swapping Problem

Let's start with the combinatorics. Let's start with just 3 couples3 men and 3 women. There is a total of 6 elements. Combination of 6 taken 2 at a time is C(2x3,2) = C(6,2) = 15. The following two restrictions apply:
1) No 2 men at a time is a valid pairing;
2) No 2 women at a time is a valid pairing.
Combinations of 3 men taken 2 a time is C(3,2) = 3.
Combinations of 3 women taken 2 a time is C(3,2) = 3.
The total number of exclusions is 2 x 3 = 6. If we deduct the exclusions from total number of combinations, the result is: 15  6 = 9. The result represents the square of the number of couples: 32.

The 3 couples consist of {Wife1+Husband1}, {Wife2+Husband2}, {Wife2+Husband2}. These are the 9 pairings:

W1+H1, W1+H2, W1+H3
W2+H1, W2+H2, W2+H3
W3+H1, W3+H2, W3+H3

There are 3 cases of equal index: W1+H1, W2+H2, W3+H3. They represent the unfavorable cases. The remaining 9  3 = 6 pairings represent the cases of interest: NO husband is paired with his own wife (equivalent to NO wife is paired with her own husband).

We can generalize for a number of N couples.
C(2N, 2) = {2xN x (2N-1)} / {1 x 2) ={N x (2xN - 1)} = 2N2 - N.

The two exclusions can be computed as:
2 x C(N, 2) = 2 x {N x (N-1) / (1x2)} = 2 x{(N2  N) /2} = N2 - N.

Finally, deduct the exclusions from total number of combinations total husbands and wives taken two at a time:
{2N2 - N}  {N2 - N} = 2N2 - N - N2 + N = N2.

Total possible cases (pairings) = N2.
Total possible homogeneous pairings (husband & wife) = N.
Total possible heterogeneous pairings = N2  N.

## 3. Theory of Probability Applied to Couple Swapping: The Hypergeometric Distribution

Now, let's do all those calculations for the probabilities (odds).

There will be a random drawing of N pairings. The draw represents a hypergeometric distribution probability. You can see the formula to calculate the probability of hypergeometric distribution reading this article: Software, formulae to calculate lotto odds with hypergeometric distribution probability. The spouse-swapping problem resembles playing lotto from a pool of numbers  The probability to get 6 of 6 in a pool of 12 from a field of 49 numbers. In the pairing case:
N of N in {N2  N} from a field of N2.

I used my probability software SuperFormula, option H = Hypergeometric distribution, then 1 = Standard Lotto & Keno). I worked out a few particular cases.

1) N = 4; four couples.
Total cases = N2 = 16.
The pool of cases of interest (heterogeneous pairings) = N2  N = 12.
Probability of '4 of 4 in 12 from 16' = 1 in 3.677.

2) N = 5; five couples.
Total cases = N2 = 25.
The pool of cases of interest (heterogeneous pairings) = N2  N = 20.
Probability of '5 of 5 in 20 from 25' = 1 in 3.427.

3) N = 6; 6 couples.
Total cases = N2 = 36.
The pool of cases of interest (heterogeneous pairings) = N2  N = 30.
Probability of '6 of 6 in 30 from 36' = 1 in 3.28.

4) N = 7; 7 couples.
Total cases = N2 = 49.
The pool of cases of interest (heterogeneous pairings) = N2  N = 42.
Probability of '7 of 7 in 42 from 49' = 1 in 3.18.

5) N = 100; 100 couples.
Total cases = N2 = 10000.
The pool of cases of interest (heterogeneous pairings) = N2  N = 9900.
Probability of '100 of 100 in 9900 from 10000' = 1 in 2.746.

6) N = 200; 200 couples.
Total cases = N2 = 40000.
The pool of cases of interest (heterogeneous pairings) = N2  N = 39800.
Probability of '200 of 200 in 39800 from 40000' = 1 in 2.732.

7) N = 500; 500 couples.
Total cases = N2 = 250000.
The pool of cases of interest (heterogeneous pairings) = N2  N = 249500.
Probability of '500 of 500 in 249500 from 250000' = 1 in 2.724.

My trial for N = 1000 resulted in a probability equal to 0. That trial goes beyond the capacity of today's computers, as far as the maximum size of numbers is concerned. We can notice, however that the probability very slowly increases with the increase of N (number of couples). It appears that the limit of p when N tends to infinity is 1/e (where e = 2.71828...).

II. We can also apply the hypergeometric distribution probability for the case of 'every man paired with his own woman/every woman paired with her own man'. The probability is much lower and decreases at a much faster pace than the increase in the preceding situation.

1) N = 4; four couples.
Total cases = N2 = 16.
The pool of cases of interest (homogeneous pairings: Wn+Hn) = N = 4.
Probability of '4 of 4 in 4 from 16' = 1 in 1820.

2) N = 5; 5 couples.
Total cases = N2 = 25.
The pool of cases of interest (homogeneous pairings: Wn+Hn) = N = 5.
Probability of '5 of 5 in 5 from 25' = 1 in 53130.

Super Formula can be used for many variations on this theme. For example, calculate the probability of 'exactly one man NOT to be paired with his own woman'; or, 'exactly one woman to be paired with her own man'.

## 4. Theory of Probability Applied to Couple Swapping: The Problem of Coincidences (Montmort)

The spouse-swapping problem resembles the Problem of Coincidences or Montmort's Problem (1708). Warren Weaver presents the Problem of Coincidences in his book Lady Luck (page 135). The formula presented in the book is:

p = 1/2! - 1/3! + 1/4!  1/5! + ...

The limit of the series is 1/e, where e is the base of the natural logarithm. Warren Weaver considers that the formula holds accurately so long as there are at least eight men at the party, and is approximately true for smaller number of guests.

I do believe that the hypergeometric distribution probability is a more accurate tool in this regard. We know precisely the number of all possible elements and the number of favorable elements. The hypergeometric distribution deals with four terms and we can determine them precisely. Besides, applying the above formula {(-1)N-1} / N! becomes impractical for N greater than 10. On the contrary, the hypergeometric distribution probability handles easily cases such as N = 100. I was able to work up to N = 800 (p = 1 in 2.722).

The big problem with the hypergeometric distribution probability is REPETITION. If we generate the N2 outcomes and draw N randomly, it could happen that the same woman/man can be drawn in all N cases. For example, in the N=3 case: W3+H1, W3+H2, W3+H3. Wife #3 was drawn 3 times! The other two women could only watch the party...Or, two of the men could only watch the party...

IV. There is another method to calculate total possible pairings. It applies also to cases of unequal groups. In the first case, we had 3 wives and 3 husbands. The total possible combinations of two elements, one from each group is 3 x 3. (W1, H1), (W1, H2), (W1, H3); (W2, H1), (W2, H2), (W2, H3); (W3, H1), (W3, H2), (W3, H3).

If the two groups consist of N1 and N2 elements, respectively, the total number of combinations of two elements, one from each group is N1 x N2.

I made a more detailed analysis of such situations in correlation with lotto games. Instead of playing the numbers from the entire group (N, M), it is better to play the numbers position by position (no, it's not those positions!). The median of each position represents a very relevant statistical factor. Read: Lottery Software, Excel Programming, Spreadsheets, Strategies.

Said Tabaki Paravicius, netizen extraordinaire:
"Swapping could be bad for memory, Krushbeck. Just think how Windows behaves because of too much swapping in and out memory and onto the hard drive!