---
title: '18.156 notes 08: the szemeredi-trotter theorem'
description: The Szemeredi-Trotter theorem gives the sharp answer to a natural discrete projection problem in the plane.
date: '2025-03-04'
tags:
  - course
  - mit
  - ocw
  - lecture-notes
cssclasses:
  - course-notes
license: Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International
license_url: https://creativecommons.org/licenses/by-nc-sa/4.0/
latex:
  source: static_resources/mit18_156_s25_lec_full.tex
  lines:
    - 1719
    - 2079
  section: 8
  unit: 8
  pdf: mit18_156_s25_lec_full_pdf
  pages:
    - 51
    - 58
created: '2025-03-04'
modified: '2025-03-04'
published: '2025-03-04'
pageLayout: default
slug: courses/18-156-projection-theory-spring-2025/notes/08
permalink: https://aarnphm.xyz/courses/18-156-projection-theory-spring-2025/notes/08.md
generator:
  quartz: v4.6.0
  hostedProvider: Cloudflare
  baseUrl: aarnphm.xyz
full: https://aarnphm.xyz/llms-full.txt
---
The Szemeredi-Trotter theorem gives the sharp answer to a natural discrete projection problem in the plane. It was proven in the early 1980s. The proof of the theorem is based on topology, and it is completely different from the proofs we have explored earlier. Tom Wolff noticed the connection between the Szemeredi-Trotter theorem and problems in geometric measure theory like the exceptional set problem and the Furstenberg set problem.

## 8.1 the szemeredi-trotter projection theorem

> \[!theorem|latex\] Theorem 8.1.
>
> Let $X$ be a set of points in $\mathbb{R}^2$ and $D$ a set of directions in $S^1$. Then we define
>
> <a id="eq-20" class="latex-eq"></a>
>
> $$
> S(X,D) = \max_{\theta \in D} |\pi_\theta(X)| \tag{20}
> $$
>
> Then
>
> <a id="eq-21" class="latex-eq"></a>
>
> $$
> |D| \leq \frac{S^2}{|X|} + 1 \tag{21}
> $$
>
> <ref slug="courses/18-156-projection-theory-spring-2025/resources/mit18_156_s25_lec08_pdf/#page=1">

^theorem-8-1

Now for the general theorem, let $X$ be a set of points in $\mathbb{R}^2$ and $L$ a set of lines in $\mathbb{R}^2$. Then we define

$$
I(X,L) := \#\{ x\in X, \ell \in L, x \in \ell \}
$$

Note that

$$
I(X,L) = \sum_{\ell \in L} |\ell \cap X|
$$

Then the Szemerédi–Trotter (ST) theorem states that

> \[!theorem|latex\] Theorem 8.2.
>
> <a id="eq-22" class="latex-eq"></a>
>
> $$
> I(X,L) \leq |X| + |L| + |X|^{2/3} |L|^{2/3} \tag{22}
> $$
>
> <ref slug="courses/18-156-projection-theory-spring-2025/resources/mit18_156_s25_lec08_pdf/#page=1">

^theorem-8-2

> \[!example|latex\] Example 8.3. Example 1 for ST Theorem
>
> The ST theorem is sharp with the $|X|$ bound when the number of lines is small and each point lies on a single line.
>
> ![[courses/18-156-projection-theory-spring-2025/static_resources/latex/tikz-2bd2ff856e.svg]]
>
> _Figure 10._ Example of setup where $|X|$ term dominates and $I \sim |X|$
>
> ^figure-10
>
> <ref slug="courses/18-156-projection-theory-spring-2025/resources/mit18_156_s25_lec08_pdf/#page=1">

^example-8-3

> \[!example|latex\] Example 8.4. Example 2 for ST Theorem
>
> The ST theorem is sharp with the $|L|$ bound when the number of lines is large and each line lies on a single point.
>
> ![[courses/18-156-projection-theory-spring-2025/static_resources/latex/tikz-dd47d8584b.svg]]
>
> _Figure 11._ Example of setup where $|L|$ term dominates and $I \sim |L|$.
>
> ^figure-11
>
> <ref slug="courses/18-156-projection-theory-spring-2025/resources/mit18_156_s25_lec08_pdf/#page=2">

^example-8-4

> \[!example|latex\] Example 8.5. Example 3 for ST Theorem
>
> We let $X$ be an $N\times N$ grid, and define $Q_M := \{\frac{a}{b} : a,b \in [M]\}$. Define $L$ to be the set of lines with slopes in $Q_M$ that pass through points in $X$. Then $|Q_M| \sim M^2$ (the double counting when $\gcd(a,b) > 1$ only affects the magnitude of $|Q_M|$ up to a constant factor). Every point in $X$ has a line passing through it for each slope in $Q_M$. Then
>
> <a id="eq-23" class="latex-eq"></a>
>
> $$
> I(X,L) =|X| |Q_M| \sim N^2 M^2 \tag{23}
> $$
>
> We now define projection operators for each $s\in Q_M$ as
>
> <a id="eq-24" class="latex-eq"></a>
>
> $$
> \pi_s(x_1, x_2) = x_2 = -sx_1 \tag{24}
> $$
>
> The fibers of $\pi_s$ are lines of slope $s$, and the number of lines in $L$ with direction $s$ is $|\pi_s(X)|$. We now prove the following lemma:
>
> > \[!lemma|latex\] Lemma 8.6.
> >
> > For all $s\in Q_M$, $|\pi_s(X)| \lesssim MN$
> >
> > <ref slug="courses/18-156-projection-theory-spring-2025/resources/mit18_156_s25_lec08_pdf/#page=2">
>
> ^lemma-8-6
>
> > \[!proof|latex\]+ Proof of lemma 8.6.
> >
> > Take $x_1, x_2 \in [N]$ and $s = \frac{a}{b}$. Then
> >
> > <a id="eq-25" class="latex-eq"></a>
> >
> > $$
> > \pi_s(x_1, x_2) = x_2 - \frac{a}{b} x_2 = \frac{bx_2 - ax_1}{b} \tag{25}
> > $$
> >
> > Since $a,b \leq M$ and $x_1, x_2 \leq N$, $|bx_2 - ax_1| \lesssim MN$. Since $bx_2 - ax_1$ must be an integer, there are at most $MN$ distinct values in $\pi_s(X)$.
>
> ^proof-8-6
>
> Then since $L$ has at most $NM$ lines for every element of $Q_M$. $|L \lesssim |Q_M|NM \sim M^3 N$. Then
>
> <a id="eq-26" class="latex-eq"></a>
>
> $$
> I(X,L) \sim N^2 M^2 \gtrsim (M^3 N \cdot N^2)^{2/3} \gtrsim |X|^{2/3} |L|^{2/3} \tag{26}
> $$
>
> Therefore the grid is a sharp example of the Szemerédi–Trotter theorem where the $|X|^{2/3}|L|^{2/3}$ term dominates. Note that the Szemerédi–Trotter theorem implies the ST projection theorem, which is a special case when $L$ is the set of lines with directions in $D$ passing through points in $X$.
>
> <ref slug="courses/18-156-projection-theory-spring-2025/resources/mit18_156_s25_lec08_pdf/#page=2">

^example-8-5

## 8.2 question: are there other sharp examples for the szemerédi–trotter theorem?

Another example is grids over number fields. Let $R$ be a number field, (for example $\mathbb{Z}[\sqrt{2 }]$). Then define

$$
R_N = \{a_1 + a_2 \sqrt{2}: a_1, a_2 \in \mathbb{Z}, |a_1|, |a_2| \leq N\}
$$

$$
QR_M = \{\frac{a}{b}: a,b \in R_M\}
$$

Then define $X:= R_N \times R_N$ and $L$ as the set of lines with slopes in $QR_M$ that pass through a point in $X$. This is similar to the grid example.

## 8.3 proof of the szemeredi-trotter theorem

We begin the proof of the Szemeredi-Trotter theorem with a lemma.

> \[!lemma|latex\] Lemma 8.7.
>
> $$
> I(X,L) \leq |X| |L|^{1/2} + |L|
> $$
>
> <ref slug="courses/18-156-projection-theory-spring-2025/resources/mit18_156_s25_lec08_pdf/#page=3">

^lemma-8-7

> \[!proof|latex\]+ Proof of lemma 8.7.
>
> We start with expanding $I(X,L)$ and applying Cauchy Schwartz to get
>
> $$
> I(X,L) = \sum_{\ell \in l} |\ell \cap X| \leq \left(|L|\sum_{\ell \in L} |\ell \cap X|^2 \right)^{1/2}
> $$
>
> This is advantageous because $|\ell \cap X|^2 \lesssim \binom{|\ell \cap X|}{ 2} + 1$. Then
>
> $$
> \sum_{\ell \in L} |\ell \cap X|^2  \lesssim |L| + \sum_{\ell \in L} \binom{|\ell \cap X|}{2}
> $$
>
> Since for every pair of points $x_1, x_2 \in X$, there is at most one line $\ell$ that contains $x_1$ and $x_2$, every pair of points in $X$ can be counted at most once. Then
>
> $$
> \sum_{\ell \in L} \binom{|\ell \cap X|}{2} \leq \binom{|X|}{2} \lesssim |X|^2
> $$
>
> This gives the final conclusion
>
> $$
> I(X,L) \lesssim \left(|L| (|X|^2 + |L|)\right)^{1/2} \leq |X||L|^{1/2} + |L|
> $$

^proof-8-7

Note that this proof uses only the very general fact that any two points define a line. Therefore it holds over spaces such as finite fields. However, the Szemerédi–Trotter theorem does not hold over finite fields. To see this take $X = \mathbb{F}_q^2$ (as the whole space) and $L$ as all lines in $\mathbb{F}_q^2$. Then for every $\ell$, $|\ell \cap X| = q$, so $I(X,L) = q^3$. However, $|X|^{2/3} |L|^{2/3} = q^{8/3} \leq I(X,L)$. Therefore, the Szemerédi–Trotter theorem requires properties of the topology of $\mathbb{R}^2$ to work. In particular, it uses a cell decomposition lemma, which allows cutting the plane into pieces.

> \[!lemma|latex\] Lemma 8.8. Cell decomposition lemma
>
> Let $X$ be a set of points in $\mathbb{R}^2$ and pick an integer $s\geq 1$. Then the plane can be disjointly partitioned into a set of open sets $O_i$ and a closed set $W$ such that
>
> $$
> \mathbb{R}^2 = W \cup \bigcup_i O_i
> $$
>
> and additionally,
>
> $$
> |\ell \cap W| \leq s
> $$
>
> and for every $i$,
>
> $$
> |X| \cap O_i| \lesssim \frac{|X|}{s^2}
> $$
>
> <ref slug="courses/18-156-projection-theory-spring-2025/resources/mit18_156_s25_lec08_pdf/#page=4">

^lemma-8-8

This lemma essentially states that the plane can be split into cells that each contain only a small subset of $X$, and that the walls don’t intersect any line too many times. As an example of this theorem, let $X$ be a “roughly” square grid. That is $\subset [N]^2$ and fir every ball $B_1(c)$ of radius 1 (where $c$ is an arbitrary point in the plane), $|X\cap B_1(c)| \lesssim 1$. The below example shows the grid for $s = 2$.

![[courses/18-156-projection-theory-spring-2025/static_resources/latex/tikz-5bdf3c905c.svg]]

_Figure 12._ The points show the points in $X$. The dashed lines indicate the “rough grid” shape of $X$. The solid lines show $W$, which is the set dividing $X$

^figure-12

Each line can only intersect $2s$ lines in $W$, so $|\ell \cap W| \leq 2s$. Since $X$ is roughly grid shaped, and each cell is a square of side length $N/s$, $|X\cap O_i| \lesssim |X|/s^2$, which satisfies the requirements.

We now proceed to the proof of the Szemerédi–Trotter theorem. It hinges on the fact that lemma [[courses/18-156-projection-theory-spring-2025/notes/08#^lemma-8-7|8.7]] is sharp when the number of lines is either small (bounded by a constant) or much larger than the number of points $(|L| > |X|^2)$. We can use this by using the cell decomposition lemma to pick cells where one of these conditions holds.

> \[!proof|latex\]+ Proof of lemma 8.8.
>
> Given $X$ and $L$, and arbitrary $s$. Then using the cell decomposition lemma, define $X_i = X \cap O_i$. Then $|X_i| \leq |X|/s^2$ and
>
> $$
> \sum_i |X_i| \leq |X|
> $$
>
> Define
>
> $$
> L_i = \{\ell \in L: \ell \cap O_i \neq \emptyset\}
> $$
>
> From the cell decomposition lemma
>
> $$
> \sum_i |L_i| \leq s |L|
> $$
>
> Then as every intersection of a point and a line is either on a cell boundary or within a cell. Then
>
> $$
> I(X,L) \leq \sum_i I(X_i, L_i) + I(X\cap W, L)
> $$
>
> Applying lemma [[courses/18-156-projection-theory-spring-2025/notes/08#^lemma-8-7|8.7]] to the first term, and the $|\ell \cap W| \lesssim s$ bound to the second term,
>
> $$
> \begin{align*}
> I(X,L) \lesssim & \sum_i (|X_i| |L_i|^{1/2} + |L_i|) + s|L| \\
> \lesssim & \left(\sum_i |X_i|^2 \sum_i |L_i|\right)^{1/2}+ 2s|L| \\
> \lesssim & \left(\sum_i \frac{|X|}{s^2} |X_i| \right)^{1/2}(s|L|)^{1/2} + 2s|L| \\
> \lesssim & s^{-1/2} |X| |L|^{1/2} + s|L|
> \end{align*}
> $$
>
> We then choose $s$ to minimize this quantity. This is effectively choosing $s$ so that both terms are equal. Then
>
> $$
> \begin{align*}
> s^{-1/2} |X| |L|^{1/2} = & s|L| \\
> |X||L|^{-1/2} = & s^{3/2} \\
> s = & |X|^{2/3} |L|^{-1/3}
> \end{align*}
> $$
>
> Plugging $s$ back into the inequality gives
>
> $$
> I(X,L) \lesssim |X|^{2/3}|L|^{2/3}
> $$
>
> which gives the desired bound.

^proof-8-8

Note that in the above argument $s$ must be an integer, so this can only be done when $|X|^2 > |L|$. When $|X|^2 < |L|$ then setting $s = 1$ gives the the bound $I(X,L) \lesssim |L|$. Additionally, $s^2$ can be at most $|X|$. Then when $|X| < |X|^{4/3} |L|^{-2/3}$, $|X| > |L|^2$, so setting $s =|X|^{1/2}$ gives the bound $I(X,L) \lesssim |X|$

We now prove the cell decomposition lemma. However, several prelimary theorems must be shown first.

> \[!theorem|latex\] Theorem 8.9. Borsuk Ulam Theorem
>
> Let $f: S^n \to \mathbb{R}^n$ be a continuous function that is antipodal, ie for every $\theta \in S^n$, $f(\theta) = -f(- \theta)$. Then 0 is in the image of $f$.
>
> <ref slug="courses/18-156-projection-theory-spring-2025/resources/mit18_156_s25_lec08_pdf/#page=6">

^theorem-8-9

> \[!corollary|latex\] Corollary 8.10. Ham Sandwich Theorem
>
> Let $O_1, O_2, ..., O_n \subset \mathbb{R}^n$ be bounded open subsets. Then there exists a hyperplane $H$ that bisects every $O_i$.
>
> <ref slug="courses/18-156-projection-theory-spring-2025/resources/mit18_156_s25_lec08_pdf/#page=6">

^corollary-8-10

> \[!proof|latex\]+ Proof of corollary 8.10.
>
> An upper half (hyper)plane can be described as the set $\{x: a \cdot x > b\}$, for some vector $a$ and $b$ a real number. As scaling $a$ and $b$ by a positive real number preserves this hyperplane, the tuple $(a,b)$, can be identified with an element of $S^n$. Then for an element $\theta \in S_n$ corresponding to $(a,b)$, we let $c_\theta$ be the affine operator defined by $c_\theta(x) = a\cdot x + b$. We then define the vector valued function $f$ by
>
> $$
> f_i(\theta) = \text{Vol}(O_i \cap \{x: c_\theta(x) > 0\}) - \text{Vol}(O_i \cap \{x: c_\theta(x) < 0\})
> $$
>
> $f$ is antipodal, so it has a zero. This zero corresponds to each set being bisected, which proves the theorem

^proof-8-10

The Ham Sandwich theorem works when there are up to $n$ subsets of $\mathbb{R}^n$. This is roughly because $n$ degrees of freedom are needed to bisect the $n$ sets. We can then use polynomials to increase the number of degrees of freedom, and so the number of sets that can be bisected.

> \[!theorem|latex\] Theorem 8.11. Polynomial Ham Sandwich Theorem
>
> We use the same setup as the ham sandwich theorem, except that there can be up to $N$ sets $O_i$. Then there exists a polynomial zero set that bisects every $O_i$
>
> <ref slug="courses/18-156-projection-theory-spring-2025/resources/mit18_156_s25_lec08_pdf/#page=7">

^theorem-8-11

> \[!proof|latex\]+ Proof of theorem 8.11.
>
> First define the space
>
> $$
> \text{Poly}_D(\mathbb{R}^n) = \{p \in \mathbb{R}[x_1, ..., x_n]: \deg  p \leq D\}
> $$
>
> $\text{Poly}_D(\mathbb{R}^n)$ is then a vector space of degree $D^n$. We claim that if $N < D^n$, then there is a nonzero element of $\text{Poly}_D(\mathbb{R}^n)$ that satisfies the claim. We define the vector valued function $f$ by
>
> $$
> f_i(p) = \text{Vol}(O_i \cap \{x: p(x) > 0\}) - \text{Vol}(O_i \cap \{x: p(x) < 0\})
> $$
>
> Since scaling each nonzero $p$ by a positive real does not change $f$, $f$ is a function from $S^{D^{N}-1}$ to $\mathbb{R}^n$. Additionally, $f$ is antipodal. Then by the Borsuk Ulam theorem the conclusion follows.

^proof-8-11

The Ham Sandwich theorems allow open subsets of Euclidean space to be subdivided, but the cell decomposition lemma requires dividing sets of points. This is a technical detail that follows from the Polynomial Ham Sandwich Theorem.

> \[!lemma|latex\] Lemma 8.12. Ham Sandwich theorem for finite sets
>
> Let $s_1,s_2,... ,s_N$ be a set of finite sets in $\mathbb{R}^n$. Then there exists a polynomial level set such that for every $s_i$,
>
> $$
> |s_i \cap \{x: p(x) > 0\}| \leq \frac{|s_i|}{2}
> $$
>
> $$
> |s_i \cap \{x: p(x) < 0\}| \leq \frac{|s_i|}{2}
> $$
>
> <ref slug="courses/18-156-projection-theory-spring-2025/resources/mit18_156_s25_lec08_pdf/#page=7">

^lemma-8-12

As individual points cannot be bisected, this lemma instead guarantees that excess points will lie on the level set.

> \[!proof|latex\]+ Proof of lemma 8.12.
>
> Take some $\epsilon > 0$ and for each $i$ define $N_\epsilon(s_i)$ to be the set of balls of radius $\epsilon$ centered at the points on $s_i$. Then by the Polynomial Ham Sandwich theorem the $N_\epsilon(s_i)$ can all bisected by the zero set of a polynomial of degree $D^n > n$. Then taking $\epsilon$ to 0 we get a sequence of polynomials $p_\epsilon$ that each bisect the $N_\epsilon(s_i)$. Since the sphere $S^n$ is compact, there must a convergent subsequence to some polynomial $p$. To show that this polynomial $p$ satisfies the conclusion, for contradiction assume that there exists $i$ such that
>
> $$
> |s_i \cap \{x: p(x) > 0\}| > \frac{1}{2} |s_i|
> $$
>
> Since every point in $s_i \cap \{x: p(x) > 0\}$ is some nonzero distance from the set $\{x: p(x) = 0\}$, there is some $\epsilon > 0$ such that modifying $p$ by $\epsilon$ and enlarging $s_i$ by $\epsilon$ gives
>
> $$
> |N_\epsilon(s_i) \cap \{x: p_\epsilon(x) > 0\}| > \frac{1}{2} |N_\epsilon(s_i)| =
> $$
>
> a contradiction. Note that this step requires the boundedness of $s_i$ to take a perturbation of $p$ continuous.

^proof-8-12

We will now prove the cell decomposition lemma.

> \[!proof|latex\]+ Proof of lemma 8.12.
>
> We begin with step $k=1$. Then define $p_1$ to be the degree 1 polynomial that splits $X$ into two parts. Then $X_{1,1} := \{x \in X: p_1(x) > 0\}$ and $X_{1,2} := \{x \in X: p_1(x) < 0\}$
>
> Then at stek $k+1$, define $p_k$ to be the polynomial of degree $D_k$ with $D^2 \sim 2^{k}$ such that $p_k$ bisects all $X_{k,1},..., X_{k, 2^k}$. Then $D_k \sim 2^{k/2}$.
>
> Then pick $k_{final}$ such that $2^{k_{final}} \sim s^2$. Then let $O_i$ be the sets defined by $\{x: \pm p_1(x) > 0\} \cap ... \cap \{x: \pm p_{k_{final}}(x) > 0\}$ for all choices of $\pm$. Define $W = \{x: p_1(x) = 0\} \cup ... \cup \{x: p_{k_{final}}(x) = 0\}$
>
> $X$ has been bisected $k_{final}$ times, so then
>
> $$
> |X_{k_{final}, i}| \lesssim |X|/s^2
> $$
>
> A line can intersect a polynomial of degree $D$ at most $D$ times, so then
>
> $$
> |\ell \cap W| \leq 1 + 2 + 4 + ... + 2^{k_{final}/2} \sim s
> $$
>
> Then each line can intersect $W$ at most $\sim s$ times.

^proof-8-12-b

