Let be a connected graph on vertices. The edges of bear three colours: red, green, and blue. It turns out that has a spanning tree with exactly red edges, a spanning tree with exactly green edges, and a spanning tree with exactly blue edges. Prove that has a spanning tree with exactly red edges, exactly green edges, and exactly blue edges.
Solutions — 2
Solution 1
Induct on . The base case, , is clear.
Let now . Let denote the vertex set of , and let , and be the trees with exactly red edges, green edges, and blue edges, respectively. Consider two cases.
Case 1: There exists a partition of the vertex set into two non-empty parts such that the edges joining the parts all bear the same colour, say, blue.
Since is connected, it has a (necessarily blue) edge connecting and . Let be one such.
Assume that , one of the three trees, does not contain . Then the graph has a cycle through . The cycle should contain another edge connecting and ; the edge is also blue. Replace by in to get another tree with the same number of edges of each colour as in , but containing .
Performing such an operation to all three trees, we arrive at the situation where the three trees , and all contain . Now shrink by identifying its endpoints to obtain a graph , and set , and . The new graph satisfies the conditions in the statement for those new values — indeed, under the shrinking, each of the trees , and loses a blue edge. So has a spanning tree with exactly red, exactly green, and exactly blue edges. Finally, pass back to by restoring , to obtain the desired spanning tree in .
Case 2: There is no such a partition.
Consider all possible collections , where and are acyclic sets consisting of red edges, green edges, and blue edges, respectively. By the problem assumptions, there is at least one such collection. Amongst all such collections, consider one such that the graph on with edge set has the smallest number of components. If , then the collection provides the edges of a desired tree (the number of edges is one less than the number of vertices).
Assume now that ; then in the resulting graph some component contains a cycle . Since , and are acyclic, contains edges of at least two colours, say, red and green. By assumption, the edges joining to bear at least two colours; so one of these edges is either red or green. Without loss of generality, consider a red such edge .
Let be a red edge in and set . Then is a valid collection providing a smaller number of components. This contradicts minimality of the choice above and concludes the proof.
Solution 2
For a spanning tree in , denote by , , and the number of red, green, and blue edges in , respectively.
Assume that is some collection of spanning trees in . Write
Say that a collection is good if , , and . By the problem conditions, the collection of all spanning trees in is good.
For a good collection , say that an edge of is suspicious if belongs to some tree in but not to all trees in . Choose now a good collection minimizing the number of suspicious edges. If contains a desired tree, we are done. Otherwise, without loss of generality, and .
We now distinguish two cases.
Case 1: .
Let be a tree in with . Since , there exists a green edge contained in some tree in but not in ; clearly, is suspicious. Fix one such green edge .
Now, for every in , define a spanning tree of as follows. If does not contain , then ; in particular, . Otherwise, the graph falls into two components. The tree contains some edge joining those components; this edge is necessarily suspicious. Choose one such edge and define .
Let . All edges suspicious for are also suspicious for , but no tree in contains . So the number of suspicious edges for is strictly smaller than that for .
We now show that is good, reaching thereby a contradiction with the choice of . For every in , the tree either coincides with or is obtained from it by removing a green edge and adding an edge of some colour. This already shows that , , , , and . Finally, we get ; since contains , it follows that , which concludes the proof.
Case 2: .
Consider a tree in satisfying . Since , the tree contains a suspicious red edge. Fix one such edge .
Now, for every in , define a spanning tree of as follows. If contains , then ; in particular, . Otherwise, the graph contains a cycle through . This cycle contains an edge absent from (otherwise would contain the cycle ), so is suspicious. Choose one such edge and define .
Let . All edges suspicious for are also suspicious for , but all trees in contain . So the number of suspicious edges for is strictly smaller than that for .
We now show that is good, reaching again a contradiction. For every in , the tree either coincides with or is obtained from it by removing some edge and adding a red edge. This shows that , , , , and . This concludes the proof.