We have that for every closed curve of finite length $\gamma$ in space $\mathbb{R}^3$
$$ \oint_\gamma Pdx + Qdy + Rdz = 0 \tag{1} $$
where $P=P(x,y,z), Q=Q(x,y,z), R=R(x,y,z)$ are functions.
We define
$$ u(M) \equiv \int_{M_0}^M Pdx + Qdy + Rdz \tag{2} $$
where $M_0 = M_0 (x,y,z), M = M(x,y,z)$ are points. It follows from $(1)$ that any line integral over a finite-length curve is path independent, so $u(M)$ is well-defined.
I need to show
$$ \frac{\partial u}{\partial x} = P, \frac{\partial u}{\partial y} = Q, \frac{\partial u}{\partial z} = R. \tag{3}$$
What idea do I need to use?