Kruskal's Algorithm produces Minimum Spanning Tree

Theorem
Kruskal's Algorithm produces a minimum spanning tree.

Proof
Let $N = \left({V, E, f}\right)$ be an undirected network.

Let $H$ be a subgraph of the underlying graph $G = \left({V, E}\right)$ of $N$.

Let $\displaystyle f \left({H}\right) = \sum_{e \mathop \in H} f \left({e}\right)$.

Let $N$ be of order $p$.

Let $T$ be a spanning tree of $N$, created using Kruskal's Algorithm.

Then from Size of Tree is One Less than Order, $T$ has $p - 1$ edges.

Let the edges of $T$ be ordered $e_1, e_2, \ldots, e_{p-1}$ according to the construction of Kruskal's Algorithm.

Then:
 * $\displaystyle f \left({T}\right) = \sum_{i \mathop = 1}^{p-1} f \left({e_i}\right)$

Let $T_0$ be a minimum spanning tree of $N$.

Suppose that $T_0$ and $T$ are not equal.

Then $T$ has one or more edges which are not in $T_0$.

Using the ordering on the edges of $T$ created above, let $e_i$ be the first edge of $T$ not in $T_0$.

By construction, $1 \le i \le p-1$.

Let $e_i$ be added to $T_0$, to obtain the graph $G_0$.

Let $e_i = u v$ where $u, v \in V$ are vertices of $N$

Then there exists a $u-v$ path $P$ in $T_0$.

Together with $e_i$ this makes a cycle $C$ in $G_0$.

Since $T$ contains no cycles, there must be an edge $e_0$ of $C$ which is not in $T$.

Thus the edge deletion $T'_0 = G_0 - e_0$ is also a spanning tree of $N$, and:
 * $f \left({T'_0}\right) = f \left({T_0}\right) + f \left({e_i}\right) - f \left({e_0}\right)$

But as $T_0$ is a minimum spanning tree:
 * $f \left({T_0}\right) \le f \left({T'_0}\right)$

So:
 * $f \left({T_0}\right) - f \left({T'_0}\right) \le 0$

But since:
 * $f \left({T_0}\right) - f \left({T'_0}\right) = f \left({e_0}\right) - f \left({e_i}\right)$

it follows that: $f \left({e_0}\right) \le f \left({e_i}\right)$

However, the manner in which $T$ was constructed, $e_i$ is an edge of smallest valuewhich can be added to $\left\{{e_1, e_2, \ldots, e_{i-1}}\right\}$ without producing a cycle.

Also, if $e_0$ is added to $\left\{{e_1, e_2, \ldots, e_{i-1}}\right\}$, again no cycle is produced.

Therefore $f \left({e_i}\right) = f \left({e_0}\right)$ and so $f \left({T'_0}\right) = f \left({T_0}\right)$.

Thus $T'_0$ is a minimum spanning tree which has one more edge in common with $T$ than $T_0$, that is, $e_i$.

The procedure can be repeated as many times as there are edges in $T_0$ which are not in $T$.

Finally the spanning tree $T$ is arrived at, which by the above is a minimum spanning tree.

Hence the result.