Why Does a Tree with n Vertices Have n − 1 Edges?
At a glance
- 1. Start with one vertex
A tree with one vertex has no edges, so the formula holds for n = 1.
- 2. Find a leaf
For a tree with at least two vertices, an endpoint of a longest simple path has degree one.
- 3. Remove the leaf
Deleting a leaf and its single edge leaves a smaller tree.
- 4. Apply induction
The smaller tree has n − 2 edges; restoring the deleted edge gives n − 1.
A tree is a finite, undirected, connected graph with no cycles. The statement is that if a tree has vertices, it has exactly edges. The key idea is to remove a vertex that is attached to the rest of the tree by just one edge, prove the claim for the smaller tree, and then put that edge back.
Proof by induction
We prove the claim for every positive integer .
Base case: . A tree with one vertex has no edges. Since , the formula holds.
Inductive step. Assume that every tree with vertices has edges. Let be a tree with vertices. We first show that has a leaf, a vertex of degree one.
Choose a simple path in that has as many edges as possible, and consider one of its endpoints, say . The endpoint has a neighbor because the tree is connected and has more than one vertex. If it had a neighbor not on the path, that neighbor would extend the path, contradicting its maximal length. If it had an additional neighbor elsewhere on the path, the extra edge together with part of the path would form a cycle. Both possibilities are ruled out, so has exactly one neighbor: it is a leaf.
Delete and its one incident edge. The remaining graph is still connected: a path between any two remaining vertices cannot need to pass through a degree-one vertex as an intermediate vertex. It is also still acyclic, because deleting a vertex cannot create a cycle. Thus the remaining graph is a tree with vertices. By the inductive hypothesis, it has edges. Restoring and its one edge gives exactly
edges. This completes the induction.
Worked example
Consider a graph with vertices and edges
It is connected: every vertex can be reached from every other by following edges. It has no cycle, so it is a tree. There are vertices and edges, as the formula predicts: .
You can also see the induction directly. Vertex is a leaf. Remove and the edge ; the remaining tree has vertices and edges. Adding and back increases the edge count by one, giving edges for the original tree.
Why the leaf argument works
Removing a leaf preserves both properties that define a tree. It preserves connectedness because the leaf cannot lie in the middle of a path between two other vertices: it has only one incident edge. It preserves acyclicity because removing part of a graph cannot introduce a cycle. These facts justify applying the induction hypothesis to the graph that remains.
The same reasoning also gives a useful way to construct a tree: start with one vertex and repeatedly add a new vertex using exactly one edge to the existing graph. Each added vertex contributes one edge, so after adding vertices there are edges. The leaf proof establishes that every finite tree can be reduced in the reverse way.
Common mistakes
- Using only that the graph is acyclic. A forest (an acyclic graph that may be disconnected) need not have edges. For example, two isolated vertices have vertices and edges. More generally, a forest with connected components has edges.
- Using only that the graph is connected. A connected graph can contain cycles and have more than edges. For example, a triangle has three vertices and three edges.
- Deleting an arbitrary vertex. An arbitrary vertex may have several incident edges. The proof needs a leaf, whose degree is exactly one, so the edge count changes by exactly one.
- Forgetting the base case. The one-vertex tree has zero edges, which is why the formula starts at and gives .
References
- Introduction to Graph Theory, 2nd edition — Douglas B. West
Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.