▓▒░RASTKO'S DIGITAL REALM░▒▓
>
00:00:00

[proof] Counting in two ways

Counting in two ways is a common proof technique in combinatorics. It consists of considering a suitable matrix and computing the sum of its entries in two different ways: firstly as the sum of its row sums, and secondly as the sum of its column sums. Equating these two quantities results in an identity (they're equal).

Often the choice of the appropriate matrix is fairly obvious, but in some cases making the right choice requires ingenuity.

Note that an upper bound on the sum of the column sums of a matrix is also an upper bound on the sum of its row sums (and vice versa). The method of counting in two ways may therefore be adapted to establish inequalities.

Why it works

Both sides add up exactly the same numbers, just grouped differently. Every entry lies in exactly one row and exactly one column, so it is counted exactly once in the sum of row sums and exactly once in the sum of column sums. Since addition is commutative and associative, regrouping and reordering a finite sum doesn't change its value.

The equality itself is trivial. The power of the technique comes from choosing a matrix whose row sums and column sums each mean something, so that the trivial equality becomes a non-trivial identity.

Note: this relies on the matrix being finite (always the case in combinatorics). For infinite sums, reordering can change the value unless the series converges absolutely.