I've developed a sort of algorithm for myself in taking the "anti-gradient" and it personally expedites the process for me.
For a vector valued function,
F = grad(f) = (H,G,I)
You start by sorting all of the linearly independent terms (LITs) in F into three categories (or subsets) p, q & r for each H,G and I.
That is,
{H}={p,q,r} ,{G}={p,q,r}, {I}={p,q,r}
p-terms:
- All LITs that themselves depend on the 2 variables that were not
apart of the partial differentiation (independent variables).
For the component H, p-terms would have to be a function of (y,z) as the partial derivative was with respect to x.
q-terms:
- All LITs that depend on at least 2 variables in which one must be the dependent variable.
or
- All LITs that depend on only one of the independent variables.
For H, q-terms would include functions of: (x,y), (x,z), (x,y,z), (z) or (y)
Basically q is anything that's not p or r.
r-terms:
- All LITs that depend only on the dependent variable.
For H, r-terms are functions of x.
Once you have these sorted out you simply plug them into the following formula.
∫ (Hp+Hq+Hr)dx + (Gq+Gr)dy + (Ir)dz
in essence,
f = C1(x,y,z) + C2(y,z) + C3(z) + C4
As an aside, I found this particularly useful when calculating f for an irrotational vector field in a line integral. It saved me a ton of time on tests.