Find a function $u(x,y)$ such that a line integral $I=u(B) - u(A)$ where B and A are limits of the integral As the title, where function $u(x,y)$ can satisfy $I=u(B)-u(A)$ 
the line integral $I$ is already shown to be path independent and is defined as
$I=\int_A^B(1+e^\frac{x}{y})dx+e^\frac{x}{y}(1-\frac{x}{y})dy$
Have been working on this for a while, I'm sure it's something to do with it being path independent but can't see the link between the two.
 A: Thinking of the integral $I$ as the line integral of some vector field $\mathbf{V}$, we would have to have
$\mathbf{V}_x =1 + e^{\frac{x}{y}}$,
and
$\mathbf{V}_y = e^{\frac{x}{y}}(1 - \frac{x}{y})$.
Furthermore, path-independence implies $\mathbf{V}$ must be a gradient, so let's try for a function $\phi(x, y)$ such that 
$\frac{\partial \phi}{\partial x} = \mathbf{V}_x$
and
$\frac{\partial \phi}{\partial y} = \mathbf{V}_y$.
Integrating the first of these two with respect to $x$ yields
$\phi(x, y) = x + ye^{\frac{x}{y}} + w(y)$,
for some function $w(y)$ of $y$ which does not depend on $x$.  If we now take $\frac{\partial \phi}{\partial y}$ we find
$\frac{\partial \phi}{\partial y} = e^{\frac{x}{y}}(1 - \frac{x}{y^2}) + \frac{\partial w}{\partial y}$,
and using
$\frac{\partial \phi}{\partial y} = \mathbf{V}_y$
we see that
$\frac{\partial w}{\partial y} = 0$,
i.e. $w(y)$ must be a constant.  And since additive constants can't effect a function's gradient, we might as well take $w(y) = 0$; thus we can set 
$u(x, y) = \phi(x, y) = x +ye^{\frac{x}{y}}$;
then $\nabla u = \mathbf{V}$ and we are done.  
Hope this helps.  Cheers!
