Answer
$f(x,y)=y^2 \sin x+x\cos 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}=2y\cos x-\sin y$
Thus, the vector field $F$ is conservative.
Here, we have $f(x,y)=y^2 \sin x+x\cos y+g(y)$
$\implies f_y(x,y)=2y \sin x-x\sin y+g'(y)$
and $g(y)=k$; where $k$ is a constant.
Thus, $f(x,y)=y^2 \sin x+x\cos y+k$