Finding the potential function for path-independent vector fields
You are given a vector field, say,
You calculate
so that its curl is zero, i.e.,
is defined on all of , so there are no tricks to worry about. The vector field is path-independent.
Since is path-independent, we know there exists some potential function so that . How do we go about finding ?
Well, means that
So we need to find a function that satisfies the two conditions
and
Let’s take these conditions one by one and see if we can find an that satisfies both of them. (We know this is possible since is path-independent. If were path-dependent, the procedure that follows would hit a snag somewhere.)
Let’s start with condition (1). We can take the equation
and treat as though it were a number. In other words, we pretend that the equation is
for some number . We can integrate the equation with respect to and obtain that
But, then we have to remember that really was the variable so that
But actually, that’s not right yet either. Since we were viewing as a constant, really could be a function of and it wouldn’t make a difference. We can replace with any function of , say , and condition (1) will be satisfied
If you are still skeptical, try taking the partial derivative with respect to of defined by equation (3). Since does not depend on , we can conclude that . Indeed, condition (1) is satisfied for the of equation (3).
Now, we need to satisfy condition (2). We can take the of equation (3) (so we know that condition (1) will be satisfied) and take its partial derivative with respect to , obtaining
Comparing this to condition (2), we are in luck. We can easily make this satisfy condition (2) as long as
(If the vector field had been path-dependent, we would have found it impossible to satisfy both condition (1) and condition (2), and would have run into trouble at this point.)
If we let
for some constant , then
and we have satisfied both conditions.
Combining this definition of with equation (3), we conclude that the function
is a potential function for You can verify that indeed
With this in hand, calculating the integral
is simple, no matter what path is. The integral is simply , where is the beginning point and is the ending point of . (For this reason, if is a closed curve, the integral is zero.)
We might like to give a problem such as find
where is the curve given by the following graph.

The answer is simply
(The constant is always guaranteed to cancel, so you could just set .)
If the curve is complicated, it’s a good hint that is probably path-independent. It’s always a good idea to check if is path-independent before computing its line integral
You might save yourself a lot of work.