TITLE: Every affine variety in $\mathbb A^n$ consisting of finitely many points can be written as the zero locus of $n$ polynomials
QUESTION [7 upvotes]: I am reading Gathmann's free online notes on Algebraic Geometry. One exercise asks to show that

"Every affine variety in $\mathbb A^n$ consisting of finitely many points can be written as the zero locus of $n$ polynomials". 

There is a hint says "interpolation". I don't know how to start with the hint. 
If $n=2$, we can use interpolation to get 1 polynomial for finitely many points. But we need to show 2 polynomials instead. I am also not sure how to apply interpolation for higher dimensions. Anyone can help? Thank you!

REPLY [2 votes]: To simplify exposition, let's say $n=3$ and the points are $p_i = (x_i, y_i, z_i)$ ($1\leq i\leq n$). Let's assume that all $x_i$ are distinct - since we only have finitely many points we can always find a linear transformation of the plane that makes this true.
Let the first polynomial be $P_x := \prod_i (x-x_i)$. The zero locus of this polynomial are the points that agree with some $p_i$ in the first coordinate. Now consider the set of points $(x_i, y_i) \subset\mathbb{R}^2$, and use Lagrange interpolation to find some polynomial $P_y$ such that for all $i$, $P_y(x_i) = y_i$. Our second polynomial will then be $P_y(x) - y$.
Note that if we have a point on which $P_x$ vanishes, then $x$ is one of the $x_i$ in our set of points, and $P_y(x)-y = P_y(x_i) - y = y_i - y = 0$ if and only if $y = y_i$. We can similarly construct a polynomial $P_z$ to enforce $x = x_i \implies z = z_i$. Note that the construction of $P_y$ and $P_z$ are independent so in fact this construction generalizes to any $n$ (it's just that the notation for the general case would have become a bit cumbersome).