# How do I undo a gradient?

1. Jan 6, 2016

### Amrator

1. The problem statement, all variables and given/known data
$\nabla U = 2 r^4 \vec r$ Find U.

2. Relevant equations
$\vec r = x \hat i + y \hat j + z \hat j$
$r = \sqrt (x^2 + y^2 + z^2)$

3. The attempt at a solution
$\nabla U = 2 (x^2 + y^2 + z^2)^2 (x \hat i + y \hat j + z \hat j)$

I multiplied everything out,

$\nabla U = (2 x^4 + 4 x^2 y^2 + 4 x^2 z^2 + 4 y^2 z^2 + 2 y^4 + 2 z^4)x\hat i + (2 x^4 + 4 x^2 y^2 + 4 x^2 z^2 + 4 y^2 z^2 + 2 y^4 + 2 z^4)y\hat j + (2 x^4 + 4 x^2 y^2 + 4 x^2 z^2 + 4 y^2 z^2 + 2 y^4 + 2 z^4)z\hat k$

Since $\nabla U = \frac{\partial U}{\partial x} \hat i + \frac{\partial U}{\partial y} \hat j + \frac{\partial U}{\partial z} \hat k$, we really only need one of the partial derivatives.

$\frac{\partial U}{\partial x} = (2 x^5 + 4 x^3 y^2 + 4 x^3 z^2 + 4 x y^2 z^2 + 2 x y^4 + 2 x z^4)$

Then I took the integral of only the x terms,

$\frac{\partial U}{\partial x} = \frac{\partial}{\partial x} (\frac {x^6}{3} + x^4 y^2 + x^4 z^2 + 2 x^2 y^2 z^2 + x^2 y^4 + x^2 z^4)$

Therefore,

$U = \frac {x^6}{3} + x^4 y^2 + x^4 z^2 + 2 x^2 y^2 z^2 + x^2 y^4 + x^2 z^4$

Am I correct so far? If so, where do I go from here?

Last edited: Jan 6, 2016
2. Jan 6, 2016

### SteamKing

Staff Emeritus
If $r = \sqrt{x^2 + y^2 + z^2}$, then what is r2?

3. Jan 6, 2016

### Amrator

Sorry about that, I screwed up the question. I'll edit right now. It should be r^4.

4. Jan 6, 2016

### SammyS

Staff Emeritus
You need a "constant" of integration. Of, course it's only constant w.r.t. $x$ . It's potentially a function of $y$ and $z$ .

5. Jan 6, 2016

### Amrator

So $\frac{\partial U}{\partial x} = \frac{\partial}{\partial x} (\frac {x^6}{3} + x^4 y^2 + x^4 z^2 + 2 x^2 y^2 z^2 + x^2 y^4 + x^2 z^4 + constant)$?

6. Jan 6, 2016

### SammyS

Staff Emeritus
I would put it more like:
$\displaystyle U = \frac {x^6}{3} + x^4 y^2 + x^4 z^2 + 2 x^2 y^2 z^2 + x^2 y^4 + x^2 z^4 + f(y,z)$​

Now, take the partial derivative w.r.t. y or z.

7. Jan 6, 2016

### Amrator

But f(y,z) is a function, not a constant? And why do I need to take the PD w.r.t. y or z? Just trying to understand.

8. Jan 6, 2016

### SammyS

Staff Emeritus
$\displaystyle \ \frac{\partial}{\partial x}f(y\,,z)=0\,,\$ right ?

So ƒ(y, z) plays the same role here as the constant of integration plays for a single variable integral .

9. Jan 6, 2016

### Amrator

Yes.

So taking the PD w.r.t. y yields,

$U = 2 x^4 y + 4 x^2 y z^2 + 4 x^2 y^3 + f(y,z)$

10. Jan 6, 2016

### Staff: Mentor

Yes (but), if I made no mistake by scrolling up and down. However, can the constant here be a function of y?

Last edited: Jan 6, 2016
11. Jan 6, 2016

### vela

Staff Emeritus
Why didn't you take the partial derivative of f(y,z)? And that's supposed to be $\partial U/\partial y$ on the LHS, right?

12. Jan 7, 2016

### Ray Vickson

Because you have not yet matched $\partial U/ \partial y$ and $\partial U/ \partial z$ to the given forms that you started with. Notice that if you did not have the $f(y,z)$ term, the $y$ and $z$ partials would come out wrong. Try it and see! Don't agonize about it; just do it.

13. Jan 7, 2016

### Amrator

${\partial U}/{\partial y} = 2 x^4 y + 4 x^2 y z^2 + 4 x^2 y^3$

${\partial U}/{\partial z} = 4 x^2 y^2 z$

Last edited: Jan 7, 2016
14. Jan 7, 2016

### Staff: Mentor

Are you not allowed to solve this in spherical coordinates? dU/dr = 2 r5?

15. Jan 7, 2016

### Amrator

I don't see why not. The book doesn't say I can't. Although, I am trying to get used to partial derivatives and the del operator.

16. Jan 7, 2016

### Staff: Mentor

So.....

17. Jan 7, 2016

### Staff: Mentor

Thanks a lot. I just did it by hand and at the end I came out with: "There must be a way to see it immediately!" Thank you.

18. Jan 7, 2016

### vela

Staff Emeritus
You're missing a bunch of terms in ${\partial U}/{\partial z}$.

Note that the result you got for ${\partial U}/{\partial y}$ by neglecting f(y,z) only has the first three terms of $\hat{j}$ component of $\nabla U$. The missing terms only depend on y and z. That's why the f(y,z) has to be there.

19. Jan 7, 2016

### Amrator

I see, and f(y,z) contains only y and z terms, correct?
So $U = x^6 / 3 + x^4 y^2 + x^4 z^2 + 2 x^2 y^2 z^2 + x^2 y^4 + x^2 z^4 + f(y,z)$
$f(y,z) = \int {4 y^3 z^2 + 2 y^5 +2 y z^4} dy$
Something doesn't seem right with that above equation though. I have not learned multiple integrals yet. That's after this section.

20. Jan 7, 2016

### SammyS

Staff Emeritus
What you have for $\displaystyle {\partial U}/{\partial y}\$ is missing $\displaystyle \frac{\partial }{\partial y}f(y,\,z)\$.

Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted