Maths WorkshopMaths problems with full solutions
Exercise 882Combinatorics › Counting principlesOlympiadAdded 3 Nov 2026

Counting pairs within subsets

#double counting#subsets#pairs

Statement

Show that ∑S⊆{1,…,n}(∣S∣2)=(n2)2n−2\sum_{S\subseteq\{1,\ldots,n\}}\binom{|S|}{2}=\binom{n}{2}2^{n-2}.

Hint

Double count pairs (x,y)(x,y) with x<yx<y both in SS.

Show solutionHide solution

Solution

First count. ∑S(∣S∣2)\sum_S\binom{|S|}{2} counts, for each subset SS, the pairs inside SS.

Second count. Fix a pair {x,y}\{x,y\}. It's in 2n−22^{n-2} subsets. Total: (n2)2n−2\binom{n}{2}2^{n-2}.

Conclusion. Both equal the number of (subset, pair inside) pairs, giving the identity.