# Ruzsa–Szemerédi problem

In combinatorial mathematics and extremal graph theory, the Ruzsa–Szemerédi problem or (6,3)-problem asks for the maximum number of edges in a graph in which every edge belongs to a unique triangle. Equivalently it asks for the maximum number of edges in a balanced bipartite graph whose edges can be partitioned into a linear number of induced matchings, or the maximum number of triples one can choose from $n$ points so that every six points contain at most two triples. The problem is named after Imre Z. Ruzsa and Endre Szemerédi, who first proved that its answer is smaller than $n^{2}$ by a slowly-growing (but still unknown) factor.

## Equivalence between formulations

The following questions all have answers that are asymptotically equivalent: they differ by, at most, constant factors from each other.
* What is the maximum possible number of edges in a graph with $n$ vertices in which every edge belongs to a unique triangle? The graphs with this property are called locally linear graphs or locally matching graphs.
* What is the maximum possible number of edges in a bipartite graph with $n$ vertices on each side of its bipartition, whose edges can be partitioned into $n$ induced subgraphs that are each matchings?
* What is the largest possible number of triples of points that one can select from $n$ given points, in such a way that every six points contain at most two of the selected triples?
The Ruzsa–Szemerédi problem asks for the answer to these equivalent questions.
To convert the bipartite graph induced matching problem into the unique triangle problem, add a third set of $n$ vertices to the graph, one for each induced matching, and add edges from vertices $u$ and $v$ of the bipartite graph to vertex $w$ in this third set whenever bipartite edge $uv$ belongs to induced matching $w$. The result is a balanced tripartite graph with $3n$ vertices and the unique triangle property. In the other direction, an arbitrary graph with the unique triangle property can be made into a balanced tripartite graph by choosing a partition of the vertices into three equal sets randomly and keeping only the triangles that respect the partition. This will retain (in expectation) a constant fraction of the triangles and edges. A balanced tripartite graph with the unique triangle property can be made into a partitioned bipartite graph by removing one of its three subsets of vertices, and making an induced matching on the neighbors of each removed vertex.
To convert a graph with a unique triangle per edge into a triple system, let the triples be the triangles of the graph. No six points can include three triangles without either two of the three triangles sharing an edge or all three triangles forming a fourth triangle that shares an edge with each of them. In the other direction, to convert a triple system into a graph, first eliminate any sets of four points that contain two triples. These four points cannot participate in any other triples, and so cannot contribute towards a more-than-linear total number of triples. Then, form a graph connecting any pair of points that both belong to any of the remaining triples.

## Lower bound

A nearly-quadratic lower bound on the Ruzsa–Szemerédi problem can be derived from a result of Felix Behrend, according to which the numbers modulo an odd prime number $p$ have large Salem–Spencer sets, subsets $A$ of size $|A|=p/e^{O({\sqrt {\log p}})}$ with no three-term arithmetic progressions. Behrend's result can be used to construct tripartite graphs in which each side of the tripartition has $p$ vertices, there are $3|A|p$ edges, and each edge belongs to a unique triangle. Thus, with this construction, $n=3p$ and the number of edges is $n^{2}/e^{O({\sqrt {\log n}})}$.
To construct a graph of this form from Behrend's arithmetic-progression-free subset $A$, number the vertices on each side of the tripartition from $0$ to $p-1$, and construct triangles of the form $(x,x+a,x+2a)$ modulo $p$ for each $x$ in the range from $0$ to $p-1$ and each $a$ in $A$. For example, with $p=3$ and $A=\{\pm 1\}$, the result is a nine-vertex balanced tripartite graph with 18 edges, shown in the illustration. The graph formed from the union of these triangles has the desired property that every edge belongs to a unique triangle. For, if not, there would be a triangle $(x,x+a,x+a+b)$ where $a$, $b$, and $c=(a+b)/2$ all belong to $A$, violating the assumption that there be no arithmetic progressions $(a,c,b)$ in $A$.

## Upper bound

The Szemerédi regularity lemma can be used to prove that any solution to the Ruzsa–Szemerédi problem has at most $o(n^{2})$ edges or triples. A stronger form of the graph removal lemma by Jacob Fox implies that the size of a solution is at most $n^{2}/e^{\Omega (\log ^{*}n)}$. Here the $o$ and $\Omega$ are instances of little o and big Omega notation, and $\log ^{*}$ denotes the iterated logarithm. Fox proves that, in any $n$-vertex graph with $O(n^{3-\delta })$ triangles for some $\delta >0$, one can find a triangle-free subgraph by removing at most $n^{2}/e^{\Omega (\log ^{*}n)}$ edges. In a graph with the unique triangle property, there are (naively) $O(n^{2})$ triangles, so this result applies with $\delta =1$. But in this graph, each edge removal eliminates only one triangle, so the number of edges that must be removed to eliminate all triangles is the same as the number of triangles.

## History

The problem is named after Imre Z. Ruzsa and Endre Szemerédi, who studied this problem, in the formulation involving triples of points, in a 1978 publication. However, it had been previously studied by W. G. Brown, Paul Erdős, and Vera T. Sós, in two publications in 1973 which proved that the maximum number of triples can be $\Omega (n^{3/2})$, and conjectured that it was $o(n^{2})$. Ruzsa and Szemerédi provided (unequal) nearly-quadratic upper and lower bounds for the problem, significantly improving the previous lower bound of Brown, Erdős, and Sós, and proving their conjecture.

## Applications

The existence of dense graphs that can be partitioned into large induced matchings has been used to construct efficient tests for whether a Boolean function is linear, a key component of the PCP theorem in computational complexity theory. In the theory of property testing algorithms, the known results on the Ruzsa–Szemerédi problem have been applied to show that it is possible to test whether a graph has no copies of a given subgraph $H$, with one-sided error in a number of queries polynomial in the error parameter, if and only if $H$ is a bipartite graph.
In the theory of streaming algorithms for graph matching (for instance to match internet advertisers with advertising slots), the quality of matching covers (sparse subgraphs that approximately preserve the size of a matching in all vertex subsets) is closely related to the density of bipartite graphs that can be partitioned into induced matchings. This construction uses a modified form of the Ruzsa-Szemerédi problem in which the number of induced matchings can be much smaller than the number of vertices, but each induced matching must cover most of the vertices of the graph. In this version of the problem, it is possible to construct graphs with a non-constant number of linear-sized induced matchings, and this result leads to nearly-tight bounds on the approximation ratio of streaming matching algorithms.
The subquadratic upper bound on the Ruzsa–Szemerédi problem was also used to provide an $o(3^{n})$ bound on the size of cap sets, before stronger bounds of the form $c^{n}$ for $c<3$ were proven for this problem. It also provides the best known upper bound on tripod packing.