Gradient and divergence operators

  • B
  • Thread starter Hiero
  • Start date
  • #1
321
68
One way to get the gradient of polar coordinates is to start from the Cartesian form:

##\nabla = \hat x \frac{\partial}{\partial x} + \hat y \frac{\partial}{\partial y}##

And then to use the following four identies:

##\hat x = \hat r\cos\theta - \hat{\theta}\sin\theta##

##\hat y = \hat r\sin\theta + \hat{\theta}\cos\theta##

##\frac{\partial}{\partial x} = \frac{\partial r}{\partial x}\frac{\partial}{\partial r}+\frac{\partial \theta}{\partial x}\frac{\partial}{\partial \theta}=\cos\theta \frac{\partial}{\partial r}-\frac{\sin\theta}{r}\frac{\partial}{\partial \theta}##

##\frac{\partial}{\partial y} = \frac{\partial r}{\partial y}\frac{\partial}{\partial r}+\frac{\partial \theta}{\partial y}\frac{\partial}{\partial \theta}=\sin\theta \frac{\partial}{\partial r}+\frac{\cos\theta}{r}\frac{\partial}{\partial \theta}##

Plugging those in correctly gives ##\nabla = \hat r \frac{\partial}{\partial r} + \frac{1}{r}\hat{\theta} \frac{\partial}{\partial \theta}##

But when put the latter 2 identities in the equation of the divergence operator ##\nabla ⋅ = \frac{\partial}{\partial x} + \frac{\partial}{\partial y}## we do not get the correct result.

I did the same technique in spherical coordinates (I know, I have too much time) and it also gave the correct gradient but of course the divergence comes out wrong again.

Why does this trick work for the gradient but not the divergence?
 
Last edited:

Answers and Replies

  • #2
PeroK
Science Advisor
Homework Helper
Insights Author
Gold Member
2020 Award
17,523
9,252
One way to get the gradient of polar coordinates is to start from the Cartesian form:

##\nabla = \hat x \frac{\partial}{\partial x} + \hat y \frac{\partial}{\partial y}##

And then to use the following four identies:

##\hat x = \hat r\cos\theta - \hat{\theta}\sin\theta##

##\hat y = \hat r\sin\theta + \hat{\theta}\cos\theta##

##\frac{\partial}{\partial x} = \frac{\partial r}{\partial x}\frac{\partial}{\partial r}+\frac{\partial \theta}{\partial x}\frac{\partial}{\partial \theta}=\cos\theta \frac{\partial}{\partial r}-\frac{\sin\theta}{r}\frac{\partial}{\partial \theta}##

##\frac{\partial}{\partial y} = \frac{\partial r}{\partial y}\frac{\partial}{\partial r}+\frac{\partial \theta}{\partial y}\frac{\partial}{\partial \theta}=\sin\theta \frac{\partial}{\partial r}+\frac{\cos\theta}{r}\frac{\partial}{\partial \theta}##

Plugging those in correctly gives ##\nabla = \hat r \frac{\partial}{\partial r} + \frac{1}{r}\hat{\theta} \frac{\partial}{\partial \theta}##

But when put the latter 2 identities in the equation of the divergence operator ##\nabla ⋅ = \frac{\partial}{\partial x} + \frac{\partial}{\partial y}## we do not get the correct result.

I did the same technique in spherical coordinates (I know, I have too much time) and it also gave the correct gradient but of course the divergence comes out wrong again.

Why does this trick work for the gradient but not the divergence?

It should work for divergence as well, except it will give you an expression for the divergence in terms of the Cartesian components of the vector differentiated with respect to the polar variables. If we take a vector ##\vec{A} = (A_x, A_y)##, then you will get something like:

##\vec{\nabla} \cdot \vec{A} = \cos \theta \frac{\partial A_x}{\partial r} \dots##

But, normally you want the divergence expressed in terms derivatives of the vector components in polar coordinates:

##\vec{\nabla} \cdot \vec{A} = \frac{1}{r} \frac{\partial}{\partial r}(rA_r) \dots##

To do this, you also have to transform the components of ##\vec{A}## from Cartesian to Polar.

Gradient operates on a scalar function, so there is no component transformation to complicate things. Although, of course, you still have to transform the scalar function into a function of the polar coordinates, which is implicit in the formula for gradient in polar coordinates.
 
  • #3
pasmith
Homework Helper
2,037
662
Also: the coordinate vectors in polar coordinates are functions of position. The cartesian coordinate vectors are constant.
 
  • #4
321
68
@PeroK Thanks! Makes too much sense!

Another point is that it’s wrong to leave off the operands for divergence because, for instance, ∂/∂r acts on two different components, so we can’t factor it together like we did for the gradient.

To be overly explicit about what’s happening:

##\nabla \vec A = \frac{\partial}{\partial x} A_x(r(x,y),\theta(x,y)) + \frac{\partial}{\partial y} A_y(r(x,y),\theta(x,y))##

##= \Big( \frac{\partial r(x,y)}{\partial x} \frac{\partial }{\partial r} A_x(r,\theta)+ \frac{\partial\theta (x,y)}{\partial x}\frac{\partial }{\partial \theta}A_x(r,\theta)\Big) + \Big( \frac{\partial r(x,y)}{\partial y} \frac{\partial }{\partial r}A_y(r,\theta) + \frac{\partial\theta (x,y)}{\partial y}\frac{\partial }{\partial \theta}A_y(r,\theta)\Big)##

Which would be true for any change of coordinates. If we use the polar specific identities (such as ##A_x = A_r\cos\theta - A_{\theta}\sin\theta ##, and 3 more) then it indeed comes out correct.

Thanks for the clarification.
 
  • #5
mathman
Science Advisor
7,955
498
Plugging those in correctly gives ##\nabla = \hat r \frac{\partial}{\partial r} + \frac{1}{r}\hat{\theta} \frac{\partial}{\partial \theta}##
The expression is dimensionally incorrect - the first term is non-dimensional, while the second has dimension 1/length.
 
  • #6
321
68
The expression is dimensionally incorrect - the first term is non-dimensional, while the second has dimension 1/length.
Uhh... how is d/dr non-dimensional? That’s also inverse length, isn’t it?

(##\hat r## is non-dimensional since it’s normalized.)
(Maybe ##\hat e_r## is preferable notation.)
 
Last edited:
  • #7
mathman
Science Advisor
7,955
498
Uhh... how is d/dr non-dimensional? That’s also inverse length, isn’t it?

(##\hat r## is non-dimensional since it’s normalized.)
(Maybe ##\hat e_r## is preferable notation.)
##\hat r## is normalized by what?
 
  • #8
321
68
##\hat r## is normalized by what?
By definition! It’s a unit vector! I didn’t define it because I thought this “hat” notation is very common for unit vectors?

Any unit vector ##\hat u## is dimensionless by virtue of the definition: ##\hat u ≡ \vec u/|\vec u|##

For a 2D cartesian basis the commonly taught notation is ##\hat i## and ##\hat j##
For a polar basis I like to call the basis vectors ##\hat r## and ##\hat \theta##

Wolfram-mathworld also uses this notation for the polar basis:
http://mathworld.wolfram.com/PolarCoordinates.html
(Equations 20 and 21)
 
  • #9
mathman
Science Advisor
7,955
498
I wasn't familiar with use of the ##\hat r## notation.
 
  • #10
WWGD
Science Advisor
Gold Member
5,559
4,572
Also: the coordinate vectors in polar coordinates are functions of position. The cartesian coordinate vectors are constant.
Not sure I get it. Can you expand?
 

Related Threads on Gradient and divergence operators

  • Last Post
2
Replies
36
Views
11K
  • Last Post
Replies
2
Views
1K
  • Last Post
Replies
1
Views
1K
Replies
7
Views
2K
Replies
4
Views
3K
Replies
8
Views
3K
  • Last Post
Replies
1
Views
851
Replies
1
Views
2K
  • Last Post
Replies
4
Views
2K
Top