Answer
$f(x,y)=ye^x+x\sin y+k$
Work Step by Step
The vector field $F(x,y)=ai+bj$ is known as conservative field throughout the domain $D$, when we have
$\dfrac{\partial a}{\partial y}=\dfrac{\partial b}{\partial x}$
$a$ and $b$ represents the first-order partial derivatives on the domain $D$.
From the given problem, we get $\dfrac{\partial a}{\partial y}=\dfrac{\partial b}{\partial x}=e^x +\cos y$
This implies that the vector field $F$ is conservative.
Here, we have $f(x,y)=ye^x+x\sin y+g(y)$ [g(y) : A function of y]
$ \implies f_y(x,y)=e^x+x\cos y+g'(y)$
and $g(y)=k$; where $k$ is a constant.
This implies that $f(x,y)=ye^x+x\sin y+k$