This procedure, while basic in execution, is nothing short of amazing if

visualized. Imagine being given the fasted path of descent for a mountain and being asked to find a level path alongside it.

Impossible? Not if you know this handy trick!

Let's assume you are given the gradient in form:

g(x,y)=(4x^{3}y^{3} - 3x^{2})**i** + (3x^{4}y^{2} + cos 2y)**j**

We know that the first partial derivatives of our original function f(x,y) are:

*d*f/*d*x(x,y) = (4x^{3}y^{3} - 3x^{2})

*d*f/*d*y(x,y) = (3x^{4}y^{2} + cos 2y)

Integrating df/dx in respect to x (leaving y as a constant) we find that:

f(x,y) = x^{4}y^{3} - x^{3} + W(y)

Where W(y) is an unknown function of y. The function W plays the same role as the arbitrary constant C that arises when one integrates a function of one variable. Now, differentiation in respect to y gives:

*d*f/*d*y(x,y) = 3x^{4}y^{2} + W'(y)

We know have two equivalent statements for *d*f/*d*y which we can use to solve for W(y).

3x^{4}y^{2} + W'(y) = 3x^{4}y^{2} + cos 2y

W'(y) = cos 2y, so W(y) = (1/2)sin y + C

This means that

**f(x,y) = x**^{4}y^{3} - x^{3} + (1/2)sin 2y + C

*It should be noted that the above procedure is symmetric in respect to x and y. Therefore, we could have just as well integrated df/dy and differentiated it in respect to x, setting it equal to the original partial derivative in respect to x of the gradient.*