Type of proof technique
In combinatorics, double counting, also called counting in two ways, is a combinatorial proof technique for showing that two expressions are equal by demonstrating that they are two ways of counting the size of one set. In this technique, which call "one of the most important tools in combinatorics", one describes a finite set from two perspectives leading to two distinct expressions for the size of the set. Since both expressions equal the size of the same set, they equal each other.
Examples.
Multiplication (of natural numbers) commutes.
This is a simple example of double counting, often used when teaching multiplication to young children. In this context, multiplication of natural numbers is introduced as repeated addition, and is then shown to be commutative by counting, in two different ways, a number of items arranged in a rectangular grid. Suppose the grid has formula_1 rows and formula_2 columns. We first count the items by summing formula_1 rows of formula_2 items each, then a second time by summing formula_2 columns of formula_1 items each, thus showing that, for these particular values of formula_1 and formula_2, formula_9.
Forming committees.
One example of the double counting method counts the number of ways in which a committee can be formed from formula_1 people, allowing any number of the people (even zero of them) to be part of the committee. That is, one counts the number of subsets that an formula_1-element set may have. One method for forming a committee is to ask each person to choose whether or not to join it. Each person has two choices – yes or no – and these choices are independent of those of the other people. Therefore there are formula_12 possibilities. Alternatively, one may observe that the size of the committee must be some number between 0 and formula_1. For each possible size formula_14, the number of ways in which a committee of formula_14 people can be formed from formula_1 people is the binomial coefficient
formula_17
Therefore the total number of possible committees is the sum of binomial coefficients over formula_18. Equating the two expressions gives the identity
formula_19
a special case of the binomial theorem. A similar double counting method can be used to prove the more general identity
formula_20
Handshaking lemma.
Another theorem that is commonly proven with a double counting argument states that every undirected graph contains an even number of vertices of odd degree. That is, the number of vertices that have an odd number of incident edges must be even. In more colloquial terms, in a party of people some of whom shake hands, an even number of people must have shaken an odd number of other people's hands; for this reason, the result is known as the handshaking lemma. 
To prove this by double counting, let formula_21 be the degree of vertex formula_22. The number of vertex-edge incidences in the graph may be counted in two different ways: by summing the degrees of the vertices, or by counting two incidences for every edge. Therefore
formula_23
where formula_24 is the number of edges. The sum of the degrees of the vertices is therefore an even number, which could not happen if an odd number of the vertices had odd degree. This fact, with this proof, appears in the 1736 paper of Leonhard Euler on the Seven Bridges of Königsberg that first began the study of graph theory.
Counting trees.
What is the number formula_25 of different trees that can be formed from a set of formula_1 distinct vertices? Cayley's formula gives the answer formula_27. list four proofs of this fact; they write of the fourth, a double counting proof due to Jim Pitman, that it is "the most beautiful of them all."
Pitman's proof counts in two different ways the number of different sequences of directed edges that can be added to an empty graph on formula_1 vertices to form from it a rooted tree. The directed edges point away from the root. One way to form such a sequence is to start with one of the formula_25 possible unrooted trees, choose one of its formula_1 vertices as root, and choose one of the formula_31 possible sequences in which to add its formula_32 (directed) edges. Therefore, the total number of sequences that can be formed in this way is formula_33.
Another way to count these edge sequences is to consider adding the edges one by one to an empty graph, and to count the number of choices available at each step. If one has added a collection of formula_34 edges already, so that the graph formed by these edges is a rooted forest with formula_14 trees, there are formula_36 choices for the next edge to add: its starting vertex can be any one of the formula_1 vertices of the graph, and its ending vertex can be any one of the formula_38 roots other than the root of the tree containing the starting vertex. Therefore, if one multiplies together the number of choices from the first step, the second step, etc., the total number of choices is
formula_39
Equating these two formulas for the number of edge sequences results in Cayley's formula:
formula_40
and
formula_41
As Aigner and Ziegler describe, the formula and the proof can be generalized to count the number of rooted forests with formula_14 trees, for any formula_14.
Notes.
 ;templatestyles src="Reflist/styles.css" / ;