In 2009, I posted a calculational proof of the handshaking lemma, a well-known elementary result on undirected graphs. I was very pleased about my proof because the amount of guessing involved was very small (especially when compared with conventional proofs). However, one of the steps was too complicated and I did not know how to improve it.

In June, Jeremy Weissmann read my proof and he proposed a different development. His argument was well structured, but it wasn’t as goal-oriented as I’d hoped for. Gladly, after a brief discussion, we realised that we were missing a great opportunity to use the trading rule (details below)!

I was so pleased with the final outcome that I decided to record and share the new proof.

## Problem statement

In graph theory, the degree of a vertex $A$, $\fapp{d}{A}$, is the number of edges incident with the vertex $A$, counting loops twice. So, considering Graph 0 below, we have $\fapp{d}{A}=3$, $\fapp{d}{B}=3$, $\fapp{d}{C}=1$, $\fapp{d}{D}=3$, and $\fapp{d}{E}=2$.

A well-known property is that **every undirected graph contains an even number of vertices with odd degree**. The result first appeared in Euler’s 1736 paper on the Seven Bridges of Königsberg and is also known as the handshaking lemma (that’s because another way of formulating the property is that the number of people that have shaken hands an odd number of times is even).

As we can easily verify, Graph 0 satisfies this property. There are four vertices with odd degree ($A$,$B$, $C$, and $D$), and 4, of course, is an even number.

Although the proof of this property is simple, all the conventional proofs that I know of are not goal-oriented. My goal is to show you a development of a goal-oriented proof. Also, my proof is completely guided by the shape of the formulae involved, which helps reducing the amount of guessing involved.

## Notations that I use

Before we start, let me explain the notations that I use. I assume the existence of two predicates, $even$ and $odd$, that test the parity of numbers. For example, $\fapp{even}{8}$ and $\fapp{odd}{3}$ are both true, and $\fapp{even}{5}$ and $\fapp{odd}{6}$ are both false. Also, I use the so-called Eindhoven notation for quantifiers; for example, to express the sum of all natural even numbers less than 50 I write $\quantifier{\Sigma}{n}{0{\leq}n{<}50~\wedge~\fapp{even}{n}}{n}$, and instead of writing $\fapp{even}{0}{\equiv}\fapp{even}{1}{\equiv}{\cdots}{\equiv}\fapp{even}{50}$, I write $\quantifier{\equiv}{n}{0{\leq}n{\leq}50}{\fapp{even}{n}}$.

An advantage of using a systematic notation for quantifiers is that we can write the rules that manipulate quantifiers in a very general way. For example, suppose that the quantifier $\bigoplus$ generalises the binary operator $\oplus$. Moreover, let us assume that $1_{\oplus}$ is the unit of $\oplus$, that is, for all $n$, we have:

\[

n{\oplus}1_{\oplus} = 1_{\oplus}{\oplus}n = n ~~.

\]

Then, the so-called *trading rule* is valid:

\[

\beginproof

\pexp{\quantifier{\bigoplus}{n}{P \wedge Q}{T}}

\equiv & \\

\pexp{\quantifier{\bigoplus}{n}{P}{{\sf if~~} Q \rightarrow T~~\Box~~\neg{Q} \rightarrow 1_{\oplus} {~~\sf fi}} ~.}

\endproof

\]

This rule applies to all quantifiers that generalise operators with units. For example, because true is the unit of $\equiv$, we have

\[

\beginproof

\pexp{\quantifier{\equiv}{n}{P \wedge Q}{T}}

\equiv & \\

\pexp{\quantifier{\equiv}{n}{P}{{\sf if~~} Q \rightarrow T~~\Box~~\neg{Q} \rightarrow true {~~\sf fi}} ~,}

\endproof

\]

which is the same as

\[

\quantifier{\equiv}{n}{P \wedge Q}{T} \equiv

\quantifier{\equiv}{n}{P}{Q \Rightarrow T} ~~.

\]

## Calculating a solution to the handshaking lemma

Now, the first step in any goal-oriented solution is to express the goal. In other words, what do we want to prove or calculate? Using the notation just described and assuming that the variable $v$ ranges over the set of all vertices, our goal is to determine the value of the following expression:

\[

\fapp{even}

{

\quantifier{\Sigma}{v}

{\fapp{odd}{(\fapp{d}{v})}}

{1}

}~~~.

\]

Note that we are adding 1 (counting) for each vertex $v$ with an odd degree. We then apply the predicate $even$ to the result. If the result is true, there is an even number of vertices with odd degree; otherwise, there is an odd number. Our goal is thus to determine its value. (We know that it must evaluate to true, because the property is well-known. However, in general, when doing mathematics, we don’t know what is the final value; that is why goal-oriented and calculational proofs are important.)

We know that the predicate $even$ distributes over addition, so we calculate:

\[

\beginproof

\pexp{\fapp{even}{\quantifier{\Sigma}{v}{\fapp{odd}{(\fapp{d}{v})}}{1}}}

\hint{=}{$even$ distributes over addition}

\pexp{\quantifier{\equiv}{v}{\fapp{odd}{(\fapp{d}{v})}}{\fapp{even}{1}}}

\hint{=}{$\fapp{even}{1}\equiv false$}

\pexp{\quantifier{\equiv}{v}{\fapp{odd}{(\fapp{d}{v})}}{false}}

\hint{=}{trading rule (see above)}

\pexp{\quantifier{\equiv}{v}{\!}{\fapp{odd}{(\fapp{d}{v})} \Rightarrow false}}

\hint{=}{${\fapp{odd}{n}\Rightarrow{false}} ~\equiv~ {\fapp{even}{n}}$}

\pexp{\quantifier{\equiv}{v}{\!}{\fapp{even}{(\fapp{d}{v})}}}

\hint{=}{$even$ distributes over addition}

\pexp{\fapp{even}{\quantifier{\Sigma}{v}{\!}{\fapp{d}{v}}}}

\endproof

\]

This calculation shows that the parity of the number of vertices with odd degree is the same as the parity of the sum of all the degrees. But *because each edge has two ends, the sum of all the degrees is simply twice the total number of edges*. We thus have:

\[

\beginproof

\pexp{\fapp{even}{\quantifier{\Sigma}{v}{\fapp{odd}{(\fapp{d}{v})}}{1}}}

\hint{=}{calculation above}

\pexp{\fapp{even}{\quantifier{\Sigma}{v}{\!}{\fapp{d}{v})}}}

\hintf{=}{the sum of all the degrees is twice the}

\hintl{number of edges, i.e., an even number}

\pexp{true~~.}

\endproof

\]

And so we can conclude that every undirected graph contains an even number of vertices with odd degree.

## What is wrong with conventional solutions?

Conventional solutions for this problem are usually very similar to the following one, taken from the book “Ingenuity in Mathematics” (p. 8), by Ross Honsberger:

The proof in general is simple. We denote by T the total of all the local degrees:

(1) T = d(A) + d(B) + d(C) + … + d(K) .

In evaluating T we count the number of edges running into A, the number into B, etc., and add. Because each edge has two ends, T is simply twice the number of edges; hence T is even.

Now the values d(P) on the right-hand side of (1) which are even add up to a sub-total which is also even. The remaining values d(P) each of which is odd, must also add up to an even sub-total (since T is even). This shows that there is an even number of odd d(P)’s (it takes an even number of odd numbers to give an even sum). Thus there must be an even number of vertices with odd local degree.

There is nothing wrong with this solution in the sense that it shows why the property holds. However, it is clearly oriented to verification: it starts by introducing the total sum of all the local degrees, observing that its value is even; then it analyses that sum to conclude the property. The question is: how can we teach students to come with the total sum of all the local degrees? **In general, how can we teach students to come with seemingly unrelated concepts that will be crucial in the development of their arguments? I don’t think we can.**

On the other hand, if we look at the goal-oriented proof, we see that the goal is simple to express. Furthermore, with some training, most students would write it correctly and would be able to calculate that the parity of the number of vertices with odd degree is the same as the parity of the sum of all the degrees. And then (and only then) the introduction of the total sum of all the degrees would make sense. In a way, goal-oriented calculations are like that famous masked magician that reveals magic’s biggest secrets, for they reveal how the rabbit got into the hat.

god explination!!!