Overlapping Subsets

Binomial DistributionGenerating FunctionsVariance

Problem

Consider the set . Two subsets and of are uniformly at random selected from the power set of , independently. It is possible that . Define . Compute .


Original Problem Link: https://www.quantguide.io/questions/overlapping-subsets

Solution

Step 1: Set up the distribution of

We first need , the probability that and overlap in exactly elements.

To build such a pair : choose which of the elements are the common ones: that's ways. For the remaining elements, none of them may end up in both sets (otherwise the overlap would exceed ), so we need to count: in how many ways can the leftover elements be split between and so that no leftover element lands in both?

Step 2: A subproblem on mutually exclusive subsets

Define the number of ways to choose two subsets of an -element set that share no elements (i.e. two mutually exclusive subsets, either of which may be empty). Two different lines of reasoning both nail this down.

First way: sum over the size of the first subset. Suppose the first subset takes of the elements ( can range from to ); there are ways to pick which. The second subset must then live entirely inside the remaining elements, and can be any subset of those: choices. So

Recognize this as the binomial theorem with , :

Second way: go element by element. Instead of thinking in terms of subset sizes, just decide the fate of each of the elements independently: it can go into the first subset, into the second subset, or into neither (a subset doesn't need to contain every element). That's choices per element, and independent elements, so directly

Both routes agree, reassuringly, since they're counting the exact same thing.

Step 3: The distribution of

Plugging (the leftover elements) into Step 2, and combining with the choice of which elements are shared from Step 1:

The denominator is the total number of ways to pick with no restriction: each of , independently has possible values, so total pairs. Hence

Sanity check. These probabilities should sum to over . By the binomial theorem again,

so . ✓

Step 4: Computing via differentiation

Rather than quote a known formula, we can get directly from the generating function that produced Step 3. Introduce a dummy variable and write

(this is just the binomial theorem with , ; setting recovers the numerator sum from Step 3). Differentiating with respect to pulls down a factor of from each term:

Multiplying through by and setting :

so

Step 5: Computing the same way

Differentiate once more. Starting again from and its first derivative , differentiate a second time:

Multiplying by and setting :

which gives , and so

Step 6: Variance and the final ratio

Alternate Way of Thinking?. Choosing a subset of uniformly from its power set is the same as flipping a fair coin independently for each of the elements, to decide membership. So for element , define the indicator

and are themselves independent fair coin flips, so

and since membership is decided independently across elements too, are i.i.d. Bernoulli. Now is literally a sum of i.i.d. Bernoulli trials, which is exactly the definition of , with no need to have derived the formula at all.

From here and follow from the single-trial moments, without touching a binomial coefficient. For a single Bernoulli trial, and (using , since ). Linearity of expectation, and additivity of variance across independent summands, then give

so the ratio collapses immediately, with the (and even itself, partially) cancelling out:

With , that's , matching Step 6 exactly, but now visibly true for any ground set size (not just ), since never even appears in the final ratio. The long derivation above (via and differentiating generating functions) rebuilds all of this from first principles; recognizing the Bernoulli/Binomial structure up front just lets you skip straight to the answer.

Thus,

View as Markdown (with the LaTeX source)