# Sufficient condition for irreducibility of polynomial $f(x,y)$

Suppose we have a non-constant polynomial $f(x,y)\in\mathbb{Q}[x,y]$ such that the following two conditions are satisfied:

1) For every $x_0\in\mathbb{Q}$, the polynomial $f(x_0, y)\in\mathbb{Q}[y]$ is irreducible.

2) For every $y_0\in\mathbb{Q}$, the polynomial $f(x,y_0)\in\mathbb{Q}[x]$ is irreducible.

My question is this:

Can we conclude from these two conditions that $f(x,y)$ is an irreducible polynomial in $\mathbb{Q}[x,y]$?

I am leaning on "yes" side. This was my unsuccessful attempt: Suppose $f(x,y)$ is reducible, then $f(x,y)=g(x,y)h(x,y)$ for some non-constant polynomials $g, h\in\mathbb{Q}$. Now, for each fixed $x_0\in\mathbb{Q}$, we have $f(x_0,y)=g(x_0, y)h(x_0,y)$. Since $f(x_0, y)$ is irreducible, it means $g(x_0,y)$ or $h(x_0,y)$ must be constant. I think from here we should be able to conclude either $g$ or $h$ does not depend on $y$. Is this approach correct? Or perhaps there is a counter-example?

Thanks!

-

No. Let $f(x, y) = (x^2 + 1)(y^2 + 1)$.