# Triangle removal lemma

Triangle removal lemma: If a graph on $n$ vertices contains $o(n^3)$ triangles, then all triangles can be deleted by removing at most $o(n^2)$ edges. That is, for every $a\gt0$ there exists $c\gt0$ such that if $G$ is any graph with $n$ vertices and at most $cn^3$ triangles, then it is possible to remove at most $an^2$ edges and end up with a graph that is triangle free.

This lemma was first proven by Ruzsa and Szemerédi, who observed that it implies Roth's theorem. Solymosi later observed that it also implies the corners theorem.

### Deducing the corners theorem

Let $A$ be a subset of $[n]^2$ of density $\delta$. Define a tripartite graph $G$ by taking its vertex sets to be $X=Y=[n]$ and $Z=[2n]$. Join $x\in X$ to $y\in Y$ if and only if $(x,y)\in A$. Join $x\in X$ to $z\in Z$ if and only if $(x,z-x)\in A$. Join $y\in Y$ to $z\in Z$ if and only if $(z-y,y)\in A$. (One thinks of $X$ as the set of vertical lines through $[n]^2$, $Y$ as the set of horizontal lines, and $Z$ as the set of lines of gradient $-1$. Two vertices are joined if the corresponding lines intersect at a point in $A$.)

Now suppose that we have a triangle $xyz$ in the graph $G$. Then $(x,y), (x,y+d)$ and $(x+d,y)$ belong to $A$, where $d=z-x-y$. This gives us a corner unless $x+y=z$. If $x+y=z$ then the three lines corresponding to $x, y$ and $z$ all go through the same point. Let us call this a degenerate triangle in $G$.

It is easy to check that the degenerate triangles are edge disjoint. Moreover, for each point of $A$ there is a degenerate triangle. Therefore, one cannot remove fewer than $\delta n^2$ edges and end up with no triangles. By the triangle removal lemma, it follows that there are at least $c(\delta)n^3$ triangles in the graph $G$. If $n$ is sufficiently large, this implies that there is at least one non-degenerate triangle in $G$, and hence a corner in $A$.

### A triangle-removal lemma that would imply DHJ

Let $A$ be a subset of $^n$. Then we can define a tripartite graph as follows. Its three vertex sets $X, Y$ and $Z$ are all copies of the power set of $[n]$. We join $U\in X$ to $V\in Y$ if $U$ and $V$ are disjoint and the sequence that is 1 in $U$, 2 in $V$ and 3 in $[n]\setminus(U\cup V)$ belongs to $A$. We join $V\in Y$ to $W\in Z$ if the sequence that is 2 on $V$ and 3 on $W$ and 1 elsewhere belongs to $A$. And we join $U\in X$ to $W\in Z$ if the sequence that is 1 on $U$ and 3 on $W$ and 2 elsewhere belongs to $A$.

Suppose now that we have a triangle $U,V,W$ in this graph and let $D$ be the complement of $U\cup V\cup W$. Then the three sequences with 1-set, 2-set and 3-set equal to $(U,V,W\cup D), (U\cup D,V,W)$ and $(U,V\cup D,W)$ all belong to $A$. This gives us a combinatorial line unless $D=\emptyset$. Let us call such triangles degenerate.

This argument shows that if DHJ is false then there is a tripartite graph with degenerate triangles only, and its three parts are all dense subgraphs of the graph where you join two sets if they are disjoint. We cannot remove all degenerate triangles without removing $|A|$ edges. If this is a contradiction, then DHJ is proved.