The Degree-Sum Idea
Mantel’s theorem bounds the number of edges in a triangle-free graph. The degree-sum proof uses a local fact about each edge: its endpoints cannot have a common neighbor, since that neighbor would complete a triangle. Consequently, the two endpoint neighborhoods fit disjointly inside the vertex set. Summing this restriction over the edges turns a local observation into a global edge bound.
Throughout, graphs are finite and simple. The degree \(\deg(v)\) is the number of vertices adjacent to \(v\), and \(N(v)\) is the set of those neighbors. A triangle is a cycle of length \(3\); a graph is triangle-free if it contains no triangle. Write \(n=|V(G)|\) and \(m=|E(G)|\).
Proof. The neighborhoods \(N(u)\) and \(N(v)\) are disjoint. Indeed, if a vertex \(w\) belonged to both, then \(uw\), \(vw\), and \(uv\) would be the three edges of a triangle. Since both neighborhoods are subsets of \(V(G)\), disjointness gives \[ \deg(u)+\deg(v)=|N(u)|+|N(v)|=|N(u)\cup N(v)|\le n. \] This proves the claim for each edge. \(\square\)
The bound is summed over edges. In that sum, a vertex \(v\) contributes its degree once for each edge incident with it. Since it has \(\deg(v)\) such edges, its total contribution is \(\deg(v)^2\). Thus the sum of the endpoint-degree sums over all edges is the sum of squared degrees.
This identity can also be checked by counting the same contributions in the opposite order: first choose an edge and add the degrees of its endpoints, or first choose a vertex \(v\) and add \(\deg(v)\) once for each of its \(\deg(v)\) incident edges.
Mantel’s Bound
Proof. If \(n=0\), the graph has no vertices and hence no edges, so \(m=0=\lfloor n^2/4\rfloor\). Now suppose \(n>0\). If \(m=0\), the claimed inequality holds because \(0\le\lfloor n^2/4\rfloor\). It remains to consider \(m>0\).
Apply the lemma to each of the \(m\) edges and sum. Using the double-counting identity gives \[ \sum_{v\in V(G)}\deg(v)^2 =\sum_{uv\in E(G)}\bigl(\deg(u)+\deg(v)\bigr) \le mn. \] Each edge contributes \(1\) to the degree of each of its two endpoints, so \(\sum_v\deg(v)=2m\). For any \(n\) real numbers \(x_v\), their squared deviations from their mean have nonnegative sum: \[ 0\le\sum_{v\in V(G)}\left(x_v-\frac{\sum_w x_w}{n}\right)^2 =\sum_{v\in V(G)}x_v^2-\frac{\left(\sum_v x_v\right)^2}{n}. \] Taking \(x_v=\deg(v)\) therefore yields \[ \sum_{v\in V(G)}\deg(v)^2 \ge \frac{\left(\sum_v\deg(v)\right)^2}{n} =\frac{4m^2}{n}. \] Combining the upper and lower bounds gives \(4m^2/n\le mn\). Since \(m>0\) and \(n>0\), division by \(m\) and multiplication by \(n/4\) give \(m\le n^2/4\). Because \(m\) is an integer, \(m\le\lfloor n^2/4\rfloor\), as required. \(\square\)
The proof has two distinct ingredients. Triangle-freeness supplies the edge-by-edge bound \(\deg(u)+\deg(v)\le n\). The sum-of-squares inequality then says that a fixed total degree cannot have an arbitrarily small sum of squared degrees. Together, these force an upper bound on the number of edges.
Worked Applications of the Degree Sum
Worked Example: A Complete Bipartite Graph on Five Vertices
Let \(G\) have vertex set \(V=\{a,b,1,2,3\}\) and edge set \(E=\{a1,a2,a3,b1,b2,b3\}\). There are no edges within \(\{a,b\}\) or within \(\{1,2,3\}\), so every edge joins the two parts and the graph has no triangle.
There are \(n=5\) vertices and \(m=6\) edges: each of \(a,b\) is joined to all three numbered vertices, giving \(2\cdot3=6\) distinct edges. The degrees are \(\deg(a)=\deg(b)=3\) and \(\deg(1)=\deg(2)=\deg(3)=2\). Their sum is \(3+3+2+2+2=12=2m\).
Each edge has one endpoint of degree \(3\) and one of degree \(2\), so its endpoint-degree sum is \(3+2=5\). Summing over the six edges gives \(6\cdot5=30\). Independently, the sum of squared degrees is \(3^2+3^2+2^2+2^2+2^2=9+9+4+4+4=30\), confirming the double count. The upper bound on this sum is \(mn=6\cdot5=30\). Also, the sum-of-squares lower bound is \(12^2/5=144/5=28.8\), consistent with the actual value \(30\).
Mantel’s numerical bound is \(\lfloor 5^2/4\rfloor=\lfloor25/4\rfloor=6\), and this graph has \(6\) edges. Thus the bound is attained in this example.
Worked Example: A Five-Cycle
Let \(G\) have vertex set \(V=\{1,2,3,4,5\}\) and edge set \(E=\{12,23,34,45,51\}\). This is a cycle of length \(5\), with no other edges. Every vertex has degree \(2\); the only cycle is the listed five-cycle, so the graph is triangle-free.
The edge list contains five distinct edges, hence \(m=5\), while \(n=5\). For each edge, the endpoint-degree sum is \(2+2=4\). Summing over the five edges gives \(5\cdot4=20\). The sum of squared degrees is \(2^2+2^2+2^2+2^2+2^2=5\cdot4=20\), which checks the edge-sum identity. The upper bound \(mn\) is \(5\cdot5=25\), and the lower bound from the total degree is \((2m)^2/n=10^2/5=20\).
The edge bound is \(\lfloor25/4\rfloor=6\), so \(m=5\le6\). This example also shows why the theorem is an upper bound, not a claim that every triangle-free graph has the maximum possible number of edges.
Worked Example: A Disconnected Graph
Let \(G\) have vertex set \(V=\{1,2,3,4,5,6\}\) and edge set \(E=\{12,13,14,56\}\). The component on \(\{1,2,3,4\}\) is a star with center \(1\), and the other component is the separate edge \(56\). All six vertices have positive degree; the disconnected components are the star and the separate edge. Neither component contains a triangle, so \(G\) is triangle-free.
The listed edges are four distinct edges, so \(m=4\), and \(n=6\). The degrees are \(\deg(1)=3\) and \(\deg(2)=\deg(3)=\deg(4)=\deg(5)=\deg(6)=1\). Their sum is \(3+1+1+1+1+1=8=2m\). The endpoint-degree sums are \(3+1=4\) for each of \(12,13,14\), and \(1+1=2\) for \(56\). Their total is \(4+4+4+2=14\). The squared degrees also sum to \(3^2+1^2+1^2+1^2+1^2+1^2=9+5=14\).
Here \(mn=4\cdot6=24\), so the summed edge bound reads \(14\le24\). The theorem’s edge bound is \(\lfloor6^2/4\rfloor=\lfloor36/4\rfloor=9\), and indeed \(m=4\le9\). The isolated components do not need special treatment in the proof: the edge sum includes only edges, while every vertex is included in the total degree and in the sum-of-squares inequality.
Common Pitfalls
Using \(n-1\) instead of \(n\). A tempting but incorrect claim is that the two endpoint neighborhoods together contain at most \(n-1\) vertices. They need only be disjoint subsets of the \(n\)-vertex set; they can cover all \(n\) vertices. In the first example, every edge has endpoint-degree sum \(3+2=5=n\), so a bound of \(n-1=4\) would already be false. The correct conclusion is \(\deg(u)+\deg(v)\le n\), not \(\le n-1\).
Counting endpoint contributions only once per vertex. The sum over edges is not generally \(\sum_v\deg(v)\). A vertex \(v\) appears on \(\deg(v)\) incident edges, contributing \(\deg(v)\) each time, for a total of \(\deg(v)^2\). For the first example, the edge-endpoint sum is \(30\), whereas the ordinary degree sum is \(12\); the squared-degree sum is \(30\), as the identity requires.
Dividing when there are no edges. The proof divides by \(m\) only in the case \(m>0\). If \(m=0\), the desired edge bound holds directly. Likewise, the sum-of-squares argument divides by \(n\), so the empty graph must be handled separately. Keeping these cases explicit makes the argument valid for every finite simple triangle-free graph.
The degree-sum method is useful because it converts local restrictions into a global estimate through a transparent double count. Here, forbidden triangles limit the degrees at each edge, while the total degree records the edge count. The same style of reasoning is a central tool in extremal graph theory, where the aim is to bound the size of a graph under a structural prohibition.
Check Your Understanding
For each question, distinguish the edge-by-edge estimate from the sum-of-squares step.
- Why can \(N(u)\) and \(N(v)\) not intersect when \(uv\) is an edge of a triangle-free simple graph?
- In the double-counting identity, how many times does a vertex \(v\) contribute its degree, and what is its total contribution?
- For the graph with \(V=\{1,2,3,4\}\) and \(E=\{12,23,34\}\), compute the degree sequence, the sum of squared degrees, and the sum of endpoint-degree sums over edges.
- Explain why the proof handles \(m=0\) separately before dividing by \(m\).
- For the graph with no vertices, state \(n\), \(m\), and the asserted edge bound.