Partial derivatives of polynomials in $k[X_1,X_2]$ Let $f$ and $g$ be two polynomials in $k[X_1,X_2]$ such that $$\frac{\partial f}{\partial X_2} = \frac{\partial g}{\partial X_1}.$$ Is it true that there exists $h$ in $k[X_1,X_2]$ such that $$\frac{\partial h}{\partial X_1} = f \text{ and } \frac{\partial h}{\partial X_2}=g?$$
Thanks in advance.
 A: Yes, because you define:
$$ h(X_1,X_2)=\int{f(X_1,X_2)dX_1}+A(X_2) $$
First, by definition of $h$ you will have:
$$ \frac{\partial h}{\partial X_1}=f(X_1,X_2). $$
Second, take the other partial derivative:
$$g(X_1,X_2)=\frac{\partial h}{\partial X_2}=\frac{\partial }{\partial X_2}\int{f(X_1,X_2)dX_1}+A^{\prime}(X_2)$$
so, you isolate $A^{\prime}(X_2)$
$$ A^{\prime}(X_2)=g(X_1,X_2)-\frac{\partial }{\partial X_2}\int{f(X_1,X_2)dX_1}  $$
finallly
$$ A(X_2)=\int{\left(g(X_1,X_2)-\frac{\partial}{\partial X_2}\int{f(X_1,X_2)dX_1}\right)}dX_2 + K $$
where $K$ is a constant (not depending neither $X_1$ nor $X_2$).
The difference between two differents primitives of a function is always a constant. That explains why the following expression is not always zero (like I said in a previous version):
$$ g(X_1,X_2)-\frac{\partial}{\partial X_2}\int{f(X_1,X_2)dX_1}\neq 0 $$
In fact, for your example $f=1+X_2$ and $g=1+X_1$ the difference above equals 1.
The final formula can be written as:
$$ h(X_1,X_2)=\int{f(X_1,X_2)dX_1}+\int{\left(g(X_1,X_2)-\frac{\partial}{\partial X_2}\int{f(X_1,X_2)dX_1}\right)}dX_2 + K$$
Also, starting with:
$$h(X_1,X_2)=\int{g(X_1,X_2)dX_2}+B(X_1)$$
we find that:
$$ B^{\prime}(X_1)=f(X_1,X_2)-\frac{\partial}{\partial X_1}\int{g(X_1,X_2)dX_2} $$
so
$$ B(X_1)=\int{\left(f(X_1,X_2)-\frac{\partial}{\partial X_1}\int{g(X_1,X_2)dX_2}\right)}dX_1+C $$
Finally
$$h(X_1,X_2)=\int{g(X_1,X_2)dX_2}+\int{\left(f(X_1,X_2)-\frac{\partial}{\partial X_1}\int{g(X_1,X_2)dX_2}\right)}dX_1+C.$$
A: Yes. This is an example in 2D of the fact that the $\nabla \times \nabla \equiv 0$, that is, the curl of the gradient of any scalar function is zero on a domain that is contractible. So, the first equation you gave above says that the curl of the vector $[f,g]$ is zero. Therefore, if the domain is contractible, then $[f,g]$ is in the image of the gradient operator. Therefore, there must exist a scalar, $h$, such that $\nabla h = [f, g]$.
Note that the curl in 2D is defined as follows (up to a minus sign):
$$
 \nabla \times [f,g] := \partial f/\partial y - \partial g/\partial x\;.
$$
A: No, in positive characteristic. For example, the polynomials $f(x,y) = x$ and $g(x,y) = 0$ have $\partial f/\partial y = \partial g/\partial x$, but in characteristic 2, $f$ is not the $x$-derivative of any polynomial because the power rule falls apart.
Otherwise yes, consult any multivariate calculus textbook for how to do it, as demonstrated in other answers.
