# Triangle removal lemma

**Triangle removal lemma**: If a graph on [math]n[/math] vertices contains [math]o(n^3)[/math] triangles, then all triangles can be deleted by removing at most [math]o(n^2)[/math] edges. That is, for every [math]a\gt0[/math] there exists [math]c\gt0[/math] such that if [math]G[/math] is any graph with [math]n[/math] vertices and at most [math]cn^3[/math] triangles, then it is possible to remove at most [math]an^2[/math] 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 [math]A[/math] be a subset of [math][n]^2[/math] of density [math]\delta[/math]. Define a tripartite graph [math]G[/math] by taking its vertex sets to be [math]X=Y=[n][/math] and [math]Z=[2n][/math]. Join [math]x\in X[/math] to [math]y\in Y[/math] if and only if [math](x,y)\in A[/math]. Join [math]x\in X[/math] to [math]z\in Z[/math] if and only if [math](x,z-x)\in A[/math]. Join [math]y\in Y[/math] to [math]z\in Z[/math] if and only if [math](z-y,y)\in A[/math]. (One thinks of [math]X[/math] as the set of vertical lines through [math][n]^2[/math], [math]Y[/math] as the set of horizontal lines, and [math]Z[/math] as the set of lines of gradient [math]-1[/math]. Two vertices are joined if the corresponding lines intersect at a point in [math]A[/math].)

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

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

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

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

Suppose now that we have a triangle [math]U,V,W[/math] in this graph and let [math]D[/math] be the complement of [math]U\cup V\cup W[/math]. Then the three sequences with 1-set, 2-set and 3-set equal to [math](U,V,W\cup D), (U\cup D,V,W)[/math] and [math](U,V\cup D,W)[/math] all belong to [math]A[/math]. This gives us a combinatorial line unless [math]D=\emptyset[/math]. 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 [math]|A|[/math] edges. If this is a contradiction, then DHJ is proved.