TITLE: About a particular polynomial function
QUESTION [5 upvotes]: Let $f:\mathbb{Z}\times\mathbb{Z}\to \mathbb{R}$ a function such that $x\mapsto f(x,a)$ and $x\mapsto f(a,x)$ are both polynomial functions.
Show that if the degree of the two polynomials above is always $\le N$, $f$ can be written as a polynomial $P(x, y)$.

REPLY [6 votes]: Let $A\subset\mathbb{Z}$ such that $|A|=N+1$ (for example, $A=\{0,1,\ldots,N\}$) and consider the polynomial $$P(x,y)=\sum_{(m,n)\in A\times A}\left(f(m,n)\prod\limits_{s\in A-\{m\}}\frac{(x-s)}{(m-s)}\prod\limits_{t\in A-\{n\}}\frac{(y-t)}{(n-t)}\right)$$
It is an analogue of Lagrange interpolation polynomial in two dimensions:

(Obviously), it is a polynomial of degree $\leq 2N$.
It matches (= interpolates) $f(x,y)$ in all points of $A\times A$: If $(x,y)\in A\times A$, we have $P(x,y)=f(x,y)$. This follows easily from the observation that at least one of the products in brackets is equal to zero for all $(m,n)\in A\times A$ other than $(x,y)$.

We claim that actually $P(x,y)=f(x,y)$ for all $(x,y)\in \mathbb{Z}\times\mathbb{Z}$, not just for $(x,y)\in A\times A$:

If we take any fixed $n\in A$, the function $x\mapsto f(x,n)$ is a polynomial of degree $\leq N$ according to problem statement. We know that this polynomial agrees with polynomial $x\mapsto P(x,n)$ in each of $(N+1)$ different points ($x \in A$), so they must agree for all $x\in\mathbb{Z}$. In other words, $f(x,y)=P(x,y)$ for $(x,y)\in \mathbb{Z}\times A$.
Now, take a fixed $m\in Z$. The function $y\mapsto f(m,y)$ is a polynomial of degree $\leq N$ and it agrees with polynomial $y\mapsto P(m,y)$ in $(N+1)$ different points ($y\in A$), so just as before, they must be identical. Thus, $f(x,y)=P(x,y)$ for $(x,y)\in\mathbb{Z}\times\mathbb{Z}$.

Q.E.D.
The degree of polynomial $P(x,y)$ is guaranteed to be $\leq 2N$ and there are cases when this bound is reached (e.g. if $f(x,y)=xy$, we can take $N=1$, but there is no way of expressing this function using a polynomial of degree lower than $2=2N$). However, each single variable in the polynomial $P(x,y)$ is only raised to $N$-th power at most; it's the mixed terms of the form $x^ky^j$ (of degree $k+j$) which cause the total degree of the polynomial to possibly reach $2N$.