Tangent-line finite-field Kakeya construction (source code)

= Tangent-line finite-field Kakeya construction
{title2=$K=\{(x,y):x^2-y\text{ is a square}\}\cup\{x=0\}$}

Work in the affine plane over a <finite field> $\mathbb F_q$ of odd <characteristic>. The union of the <affine lines> $y=mx-m^2/4$, for $m\in\mathbb F_q$, contains a line of every finite <slope>. Completing the square gives
$$
x^2-y=(x-m/2)^2.
$$
For a fixed $x$, the union therefore contains exactly the $(q+1)/2$ values of $y$ for which $x^2-y$ is a square, including zero. Adding the vertical <affine line> $x=0$ completes all directions. The resulting <finite-field Kakeya set> has <cardinality>
$$
q\frac{q+1}{2}+\frac{q-1}{2}=\frac{q^2+2q-1}{2}.
$$
Its <density> tends to one half as $q$ grows through odd prime powers. Geometrically the finite-slope lines are the tangents to the <parabola> $y=x^2$, because the tangent at $x=m/2$ has the displayed equation.