Maths WorkshopMaths problems with full solutions
Exercise 1940Combinatorics › Graph theoryOlympiadAdded 4 Nov 2026

Graphs with no 4-cycle

#extremal graph theory#double counting#convexity#cycles

Statement

A graph on nn vertices contains no cycle of length 44.

  1. Prove that ∑v(d(v)2)≤(n2)\displaystyle\sum_{v}\binom{d(v)}2\le\binom n2, where d(v)d(v) is the degree of vv.
  2. Deduce that a graph on 55 vertices with no 44-cycle has at most 66 edges, and give an example with 66 edges.
Hint

Count pairs {x,y}\{x,y\} of vertices together with a common neighbour vv. Two vertices can have at most one common neighbour.

Show solutionHide solution

Solution

1. Count the pairs (v,{x,y})(v,\{x,y\}) where x≠yx\ne y are both neighbours of vv. For a fixed vv there are (d(v)2)\binom{d(v)}2 pairs of neighbours, so the total is ∑v(d(v)2)\sum_v\binom{d(v)}2.

Fix a pair {x,y}\{x,y\}. If it had two distinct common neighbours v,wv,w, then x v y wx\,v\,y\,w would be a 44-cycle. So each pair {x,y}\{x,y\} occurs for at most one vv, and the total is at most (n2)\binom n2.

2. Let n=5n=5 and suppose there are e≥7e\ge7 edges. The function f(x)=x(x−1)2f(x)=\frac{x(x-1)}2 is convex, so by Jensen's inequality
∑vf(d(v))≥5f(2e5)≥5f(145)=12.6>10=(52),\sum_{v}f(d(v))\ge5f\left(\frac{2e}5\right)\ge5f\left(\frac{14}5\right)=12.6>10=\binom52,
contradicting part 1. So e≤6e\le6.

Example with 66 edges. Take two triangles sharing one vertex cc (a "bowtie"): triangles c,a,bc,a,b and c,d,ec,d,e. Every cycle lies inside one of the two triangles, because cc is the only vertex joining them. So there is no 44-cycle.

Remark. The same method gives, for large nn, that a C4C_4-free graph has at most about 12n3/2\frac12n^{3/2} edges.

Lesson. Double count (vertex, pair of neighbours); forbidden configurations bound the count from above and convexity bounds it from below.