Solution (source code)

= Solution

For a finite collection $\mathcal L$ of distinct <affine lines in a vector space> in $\mathbb R^n$, $n\ge2$, a <joint> is a point incident to $n$ lines whose direction vectors are <linearly independent>. The <joints theorem> asserts
$$
\boxed{\#J(\mathcal L)\lesssim_n(\#\mathcal L)^{n/(n-1)}.}
$$
In the customary three-dimensional formulation this is \b[$\#J\lesssim L^{3/2}$], with three noncoplanar incident lines at every <joint>. We prove the general form, which includes that formulation.

Let $L=\#\mathcal L$ and $M=\#J$. The conclusion is immediate when $M=0$. Otherwise set $D=\lceil nM^{1/n}\rceil$. Suppose for contradiction that $M>LD$. Repeatedly delete any line incident to at most $D$ of the currently retained <joints>, deleting those <joints> at the same time. Each deleted line loses at most $D$ current <joints>, so even deleting all $L$ lines could lose at most $LD<M$ <joints>. Therefore the process must stop with a nonempty set $J'$ and a line collection $\mathcal L'$ such that \b[each retained line contains more than $D$ retained <joints>]. Every retained <joint> still has its original $n$ independent incident lines: if any line through it had been deleted, the <joint> would have been deleted too.

There is a nonzero <multivariate polynomial> of <total degree> at most $D$ vanishing on $J'$, because
$$
\binom{D+n}{n}\ge\frac{D^n}{n!}
\ge\frac{n^n}{n!}M>M\ge\#J'.
$$
Choose such a <polynomial> $P$ of smallest possible <total degree> $d\le D$. This is an application of the <polynomial method in combinatorics>. Every line of $\mathcal L'$ contains more than $D\ge d$ <roots of a polynomial> of its <polynomial restriction to a line>, so $P$ vanishes identically on every such line.

At a retained <joint> $x$, differentiating along each of its independent line directions $v_1,\ldots,v_n$ gives $v_i\cdot\nabla P(x)=0$. Their <linear independence> therefore forces $\nabla P(x)=0$. Each <partial derivative> of $P$ vanishes on all of $J'$ and has smaller <total degree>. Minimality of $d$ forces every <partial derivative> to be the zero <polynomial>. Over the real numbers, a <polynomial> with all <partial derivatives> zero is constant; a nonzero constant cannot vanish on the nonempty $J'$. This is the required contradiction.

It follows that $M\le LD$. Since $D\le(n+1)M^{1/n}$ for $M\ge1$,
$$
M^{(n-1)/n}\le(n+1)L,
\qquad
\boxed{M\le((n+1)L)^{n/(n-1)}.}
$$
This proves the <joints theorem> by the <pruning and minimal-degree polynomial argument>.

The exponent is sharp. Take all axis-parallel lines passing through the grid $\{1,\ldots,m\}^n$. There are $n m^{n-1}$ distinct lines and $m^n$ <joints>; the coordinate directions span $\mathbb R^n$ at every grid point. Thus no smaller power of the number of lines can bound all <joint> configurations.