TITLE: A question about polynomial in two variables
QUESTION [6 upvotes]: Let $f:\mathbb R^2 \to \mathbb R$ be a function such that for any $b \in \mathbb R$ , the function $f_b : \mathbb R \to \mathbb R$ defined as $f_b(x):=f(x,b) , \forall x \in \mathbb R$ , is a polynomial in $x$ and for any $a \in \mathbb R$ , the function $f_a : \mathbb R \to \mathbb R$ defined as $f_a(y):=f(a,y) , \forall y \in \mathbb R$ , is a polynomial in $y$ . Then is the function $f(x,y)$ a polynomial in $x,y$ i.e. is $f \in \mathbb R [x,y]$ ?

REPLY [2 votes]: For $n\in\mathbb{N}$, denote
$$E_n=\{x\in\mathbb{R}: \deg(f(x,\cdot))\leq n\}.$$
Since $\mathbb{R}=\cup_n E_n$ is uncountable, all the $E_n$'s cannot be finite and there exists $n$ such that $E_n$ is infinite. For all $x\in E_n$, $f(x,\cdot)$ is entirely determined by its values at $n+1$ given points (say $0,\ldots,n$) and by denoting $L_0,\ldots, L_n$ the Lagrange polynomials at these points, we get
$$\forall x\in E_n, \forall y\in\mathbb{R}, f(x,y) = \sum_{i=0}^n f(x,i)L_i(y).$$
When $y$ is fixed, $f(x,y)$ and the right hand side term are both polynomials in $x$ which coincide on the infinite set $E_n$, so they coincide on $\mathbb{R}$. Finally, $f$ coincide on $\mathbb{R}^2$ with the right hand side term, which is a polynomial in $x$ and $y$.