Yesterday, Alek Westover and I walked around South Boston, Seaport, and some beaches, and I witnessed kiteboarding for the first time! Anwyays, we started our journey at the Andrew subway station on the Red Line, which is at a six-way intersection with the confusingly named roads Dorchester Avenue and Dorchester Street. We didn’t notice that there were two roads both named Dorchester and took the wrong one, so that added a lot of unnecessary walking. Moral of the story: don’t name your roads the same name.

During the extra-long walk, Alek introduced me to extremal graph theory, which deals with problems like “How many edges can a certain kind of graph have before it must have another property?” He used the example of “How many edges can a graph have before it must have a 3-cycle (cycle of length 3)?”

One kind of graph that doesn’t have 3-cycles are bipartite graphs. Maybe we can make a bipartite graph with the $N$ vertices split into two $\frac{N}{2}$ halves and stick as many edges as possible between the two halves. This gives us a graph with $\lfloor \frac{N^2}{4} \rfloor$ edges without any 3-cycles. But can we do better?

Let’s try to upper-bound the number of edges for any graph without 3-cycles. This takes some ingenuity and we failed twice before finding a solution that actually works. Our key observation is that for any edge, the two vertices $u,v$ of that edge can’t share a common vertex, because that would be a 3-cycle. Thus, $\deg(u)+\deg(v)$ must be at most $N-2+2 = N$. Now let’s try summing over all $M$ edges.

\[MN = \sum \deg(u)+\deg(v)\]

Each vertex $v$ gets counted $\deg(v)$ times for each edge that uses it, so we can rewrite the sum on the right.

\[MN = \sum \deg(v)^2\]

Now using the Cauchy-Schwarz inequality, we can bound the right side.

\[MN = \sum \deg(v)^2 \geq \frac{1}{N} (\sum \deg(v))^2\]

However, $\sum \deg(v)$ is just $2M$ because each edge contributes to increasing the degree of its two vertices.

\[MN \geq \frac{4M^2}{N}\]

Thus, we get our bound.

\[\frac{N^2}{4} \geq M\]

This bound is tight with our earlier result, so we can’t do better than a complete bipartite graph with two even halves. And that’s it!

Alek wrote up the same proof of this theorem on his blog as well.

Further reading