Show that a connected graph on $n$ vertices is a tree if and only if it has $n-1$ edges.

Can someone please verify this?

Show that a connected graph on $n$ vertices is a tree if and only if it has $n-1$ edges.

$(\Rightarrow)$ If a tree $G$ has only $1$ vertex, it has $0$ edges. Now, assume that any tree with $k-1$ vertices has $k-2$ edges. Let $T$ be a tree with $k$ vertices. Remove a leaf $l$ to obtain a tree $T'$ with $k-1$ vertices. Then, $T'$ has $k-2$ edges, by the inductive hypothesis. The addition of $l$ to $T'$ produces a graph with $k-1$ edges, since $l$ has degree $1$.

$(\Leftarrow)$ Let $G$ be a connected graph on $n$ vertices, with $n-1$ edges. Suppose $G$ is not a tree. Then, there exists at least one cycle in $G$. Successively remove edges from cycles in $G$ to obtain a graph $G'$ with no cycles. Then, $G'$ is connected and has no cycles. Therefore, $G'$ is a tree, with $n$ vertices and $n-1-x$ edges, for some $x > 0$. However, this contradicts the previous derivation. Therefore, it must be the case that $G$ is a tree.


The proofs are correct. Here's alternative proof that a connected graph with n vertices and n-1 edges must be a tree modified from yours but without having to rely on the first derivation:

Let $G$ be a connected graph on n vertices, with n−1 edges. Suppose $G$ is not a tree. Then, there exists at least one cycle in $G$. Remove one of the edges within a cycle. This leaves a connected graph on n vertices with n-2 edges which is impossible as a connected graph on n vertices must at least have n - 1 edges.


Yes, this seems like it is true, although you didn't prove a leaf must always exist, if you really want to be rigorous. And in the other part you didn't explain why if it contained a cycle you could remove an edge without the graph being disconnected, but I like the proof over all.