TITLE: Hypersurface missing just one point
QUESTION [6 upvotes]: Let $\mathbb F_q$ be a finite field and $n$ an integer.

What is the minimal degree $d = d(q,n)$ of a polynomial $f \in \mathbb F_q[X_1,\dots,X_n]$ such that the set $Z(f)$ of zeros of $f$ in the affine space $\mathbb F_q^n$ has cardinality $q^n-1$, that is misses exactly one point?

It is clear that $d$ is finite, more precisely $d(q,n) \leq n(q-1)$. Indeed, for $f = \prod_{i=1}^n \prod_{\alpha \in \mathbb F_q^\ast} (X_i-\alpha)$, $Z(f)$ is the complement of the origin. 
It is also easy to see that $d(q,n) \geq q$, because if $f$ is a polynomial of degree $d<q$, the cardinality of $Z(f)$ is divisible by the characteristic $p$ of $\mathbb F_q$ (Chevalley-Warning), and $\leq d q^{n-1}$ (Schwartz-Zippel), which gives two independent proofs that it cannot be $q^n-1$.
One has $d(2,2)=2$ (e.g. $f(x,y)=xy$ has three zeros) and $d(2,3)=3$ (the zeros of the degree 3 polynomial $f(x,y,z)=1+x+y+z+xy+xz+yz+xyz$ are everything but the origin, and it is not hard to see that you can't do that with a degree 2 polynomial). 
But what is the value of $d$ in general?

REPLY [4 votes]: An even further generalisation of this result is the Alon-Füredi theorem, which says that if a polynomial $f$ does not vanish completely on the "grid" $S = S_1 \times \dots \times S_n$ where $S_i$'s are finite subsets of an arbitrary field $F$, then $f$ does not vanish on at least $\min \prod y_i$ points of the grid as $y_i$'s ranges over integers satisfying $\sum y_i = \sum |S_i| - \deg f$ and $1 \leq y_i \leq |S_i|$. 
Clearly, when $\deg f < \sum (|S_i| - 1)$, this minimum value is at least $2$, thus proving that a polynomial vanishing on all points of the grid except one must have degree at least $\sum (|S_i| - 1)$ (and you can easily think of examples of this degree satisfying the condition). In general, this theorem gives you an explicit bound (it is easy to describe what the minimum value is) on the number of non-zeros of an arbitrary polynomial that does not vanish on the grid completely. 
Alon-Füredi also works in much more generality, where you can replace $F$ by any commutative ring with identity assuming that for all $i$, for all distinct $a, b$ in $S_i$, the element $a - b$ is not a zero divisor of the ring. In fact, one can generalise further by imposing extra conditions on the degrees of individual variables in the polynomial, see On Zeros of a Polynomial in a Finite Grid. The proof of Alon-Füredi and its generalisation is an easy induction argument using basic properties of single variable polynomials.