# Partial integration of gradient vector to find potential field

#### Gza

"partial integration" of gradient vector to find potential field

I'm studying out of Stewart's for my Calc IV class, and hit a stumbling block in his section on the fundamental theorem for line integrals. He shows a process of finding a potential function $$f$$ such that $$\vec{F} = \nabla f$$, where $$\vec{F}$$ is a vector field defined as

$$\vec{F} = (3 + 2xy) \mathbf{\hat{i}} + (x^2 - 3y^2) \mathbf{\hat{j}}$$

He then goes on to equate the components of the gradient vector of the function we want to find with the components of; with the given vector field.

$$\frac{\partial f(x,y)}{\partial x} = 3 + 2xy$$ (eq. 7)

$$\frac{\partial f(x,y)}{\partial y} = x^2 - 3y^2$$ (eq.8)

no problems so far.

but now he integrates equation 7 with respect to x and obtains:

$$f(x,y) = 3x + x^2y + g(y)$$

He doesn't really explain where g(y) comes from, or why it is needed. I know a constant of integration is needed, but why must it be a function of y? Thanks for the help.

Last edited:

#### DarkEternal

well what you are trying to find is the scalar function, correct? when you take the gradient of this function, taking the two spatial derivatives separately, you should end up with what you started with, the gradient given. then, looking at the problem given it should be easy to see why the constant of integration may be a function of y. taking the derivative of your final scalar function with respect to y must somehow give you $-3y^2$, which is a function of y only. this information gets "lost" when the derivative is taken only with respect to x and thus must be restored by looking at the derivative with respect to y.

#### Galileo

Homework Helper
Gza said:
I know a constant of integration is needed, but why must it be a function of y? Thanks for the help.
You have integrated with respect to x, so you will get a constant with respect to x. (That is if you differentiate with respect to x, it should drop out). But it can still depend on y.

#### Corneo

Remember when you take partial derivatives w.r.t x, y is treated like a constant. So when you "partially integrated" you need to take into account for any y's that may have been elminated, this includes regular constants also.

Best way I would have done it is the same this as Stewart but with a twist.

$$\vec{F} = (3 + 2xy) \mathbf{\hat{i}} + (x^2 - 3y^2) \mathbf{\hat{j}}$$

I wish to find $$\vec F = \nabla \Phi$$

So from that I know $$\frac {\partial \Phi}{\partial x} = 3+2xy$$ and $$\frac {\partial \Phi}{\partial y} = x^2-3y^2$$

Using seperation of variables on the $$\frac {\partial \Phi}{\partial x} = 3+2xy$$, I get $$\Phi=3x+x^2y+g(y)$$. Now I take the partial derivative of this w.r.t y and try to match it with $$\frac {\partial \Phi}{\partial y} = x^2-3y^2$$

$$\frac {\partial}{\partial y} (3x+x^2y+g(y))=x^2+g'(y)$$

From that I know $$g'(y) = -3y^2$$ or $$g(y)=-y^3$$

So $$\Phi = 3x+x^2y-y^3 + C$$

#### Gza

Thanks for the help everyone. Would this technique of integration be something you would learn in a class on partial differential equations, or are there better ways of doing this, since it seems a rather ad hoc method.

#### Corneo

Seperations of variables is something you will definately see in ordinary differential equations. Its one of the most simple methods out there. I am sure your regular calculus book will include this also especially one by James Stewart. If there is a section about exponential growth, you might find it there.

#### Galileo

Homework Helper
Another way (though not a better one in my opinion) is to perform a line integral from your reference point (say (0,0)) to the point (x,y).
This seems straightforward from the definition:

$$V(x,y)=\int_{(0,0)}^{(x,y)}\vec{F}\cdot d\vec r = \int_{(0,0)}^{(x,y)}\left((3 + 2x'y')\mathbf{\hat{i}} + (x'^2 - 3y'^2)\mathbf{\hat{j}}\right)\cdot d \vec r'$$
Since the integral is independent of path you can choose any path you like for your line integral.
Let's go from (0,0) to (x,0) and then from (x,0) to (x,y) in straight lines.
For the first part; from (0,0) to (x,0):

$$V(x,0)=\int_{(0,0)}^{(x,0)}3dx'=3x$$
since y is zero along that path and dr=dx
Then from (x,0) to (x,y):
$$\int_{(x,0)}^{(x,y)}(x^2-3y'^2)dy'=x^2y-y^3$$

So that $V(x,y)=3x+x^2y-y^3$

This calculation wasn't so bad, but in three dimensions, it can get pretty tedious though. :zzz:

Last edited:

#### Gza

Thanks Galileo. Your method seemed much more intuitive than the book's. Not that I enjoy doing line integrals :yuck: .