# Find function $F(x,y)$ given its total differential

If I have a differential $dF = 2xy e^{xy^2} dy + y^2e^{xy^2} dx$, what are the steps to find the original function? Is there a formula?

You must have $$\frac{\partial F}{\partial y} = 2xye^{xy^2} \\ \frac{\partial F}{\partial x} = y^2e^{xy^2}$$

From the first one you get that $$F(x,y) = e^{xy^2} + C(x)$$ and writing this result plus the second one: $$y^2e^{xy^2} + C'(x) = y^2e^{xy^2}\implies C(x) = C$$

hence $$F(x,y) = e^{xy^2} + C$$

Note that the total differential is for a function, $F$, of two variables is given by

$$dF=\partial_{x}Fdx+\partial_{y}Fdy$$

Now to find the function $F$, we need only to choose $\partial_{x}F$ or $\partial_{y}F$ and integrate appropriately. So

$$F=\int\partial_{x}Fdx=\int y^2e^{xy^2}dx=e^{xy^2}+g(y)$$

Note that we have a function of $y$ instead of a constant of integration since we integrated with respect to $x$.

To solve for $g$, we take the derivative of $F$ with respect to $y$ and compare to the form in the total differential.

So

$$\partial_{y}F=\frac{\partial}{\partial y}(e^{xy^2}+g(y))=2xye^{xy^2}+g'(y)=2xye^{xy^2}$$

Thus

$$g'(y)=0\Rightarrow g(y)=C$$.

Therefore

$$F(x,y)=e^{xy^2}+C$$

If $M\, dx + N\, dy$ is indeed a total differential $dF$, then you can calculate $F$ as:

$$F = \int M \,dx + \int \text{terms of N not containing x} \, dy$$ or $$F = \int N \,dy + \int \text{terms of M not containing y} \, dx$$

Here:

\begin{align} F & = \int 2xy e^{xy^2} \, dy + \int 0 \,dx\\ & = \int e^{xy^2} \, d(xy^2)\\ & = \boxed{e^{xy^2} + C} \end{align}

Note: You can check whether $M\,dx + N\, dy$ is a total differential $dF$, by checking whether $\dfrac{\partial M}{\partial y} = \dfrac{\partial N}{\partial x}$. This is because if $dF = M\,dx + N\, dy = \dfrac{\partial f}{\partial x}dx + \dfrac{\partial f}{\partial y}dy$, then $M = \dfrac{\partial f}{\partial x}$ and $N = \dfrac{\partial f}{\partial y}$, so $\dfrac{\partial M}{\partial y} = \dfrac{\partial^2 f}{\partial y \partial x} = \dfrac{\partial^2 f}{\partial x \partial y} = \dfrac{\partial N}{\partial x}$.