In the nation of Onewaynia, certain pairs of cities are connected by one-way roads. Every road connects exactly two cities (roads are allowed to cross each other, e.g., via bridges), and each pair of cities has at most one road between them. Moreover, every city has exactly two roads leaving it and exactly two roads entering it.
We wish to close half the roads of Onewaynia in such a way that every city has exactly one road leaving it and exactly one road entering it. Show that the number of ways to do so is a power of 2 greater than 1 (i.e. of the form for some integer ).
Solution
In the language of graph theory, we have a simple digraph which is 2-regular and we seek the number of sub-digraphs which are 1-regular. We now present two solution paths.
First solution, combinatorial We construct a simple undirected bipartite graph as follows:
* the vertex set consists of two copies of , say and ; and
* for and we have an undirected edge if and only if the directed edge is in .
Moreover, the desired sub-digraphs of correspond exactly to perfect matchings of . However the graph is 2-regular and hence consists of several disjoint (simple) cycles of even length. If there are such cycles, the number of perfect matchings is , as desired.
**Second solution by linear algebra over (Brian Lawrence)** This is actually not that different from the first solution. For each edge , we create an indicator variable . We then require for each vertex that:
* If and are the two edges leaving , then we require .
* If and are the two edges entering , then we require .
We thus get a large system of equations. Moreover, the solutions come in natural pairs and and therefore the number of solutions is either zero, or a power of two. So we just have to prove there is at least one solution.
For linear algebra reasons, there can only be zero solutions if some nontrivial linear combination of the equations gives the sum . So suppose we added up some subset of the equations for which every variable appeared on the left-hand side an even number of times. Then every variable that did appear appeared exactly twice; and accordingly we see that the edges corresponding to these variables form one or more even cycles as in the previous solution. Of course, this means is even, so we really have as needed.