| 
  ||
|  
       | 
  ||
 
      
  | 
  
The gradient of a scalar 
  and divergence and curl of a vector have a simple form in rectilinear coordinates. 
  This form is maintained if you move the origin or rotate the coordinates, but 
  still use rectilinear coordinates. 
  Their forms change, however, under if you choose arbitrary coordinates, 
  and they look quite different even in polar coordinates in the plane, and in 
  cylindric and spherical coordinates in three dimensions.
  We will derive the form of the divergence and curl in an arbitrary orthogonal 
  coordinate systems by application of Stokes' theorem and the divergence theorem. 
  
  The character of a coordinate system that affects the form 
  of these objects is encapsulated in the expression for distance in the coordinate 
  system.
  In rectilinear coordinates distance is described by the Pythagorian Theorem:  
  ds2 = dx2 
  + dy2 + dz2.
  In a general orthogonal coordinate system, with variables w1 
  , w2 
  and w3, distance 
  can take on the more general form 
  ds2 = u12dw12 
  + u22dw22 
  + u32dw32, 
  where the u's are each functions of the variables.
  Thus,
  In polar coordinates with w1 = 
  r and w2 = 
  q, we have
 u1 
  =1 and u2 = 
  r: ds2 = dr2 
  + r2d
2
  In spherical coordinates with w1 
  = 
, 
  w3 = 
 
  and w2 =
, 
  and r = rsin
, 
  we have
u1 =1, 
  u3 = r =
sin
 
  and u2=
: 
  ds2 
  = d
2 
  + r2d
2 + 
  
2d![]()
In cylindric coordinates, we have
ds2 
  = dr2 + r2d
2 
  + dz2
We now apply the divergence theorem to a little 
  rectangular box of space around the point r oriented with sides parallel 
  to the directions of w1 , 
  w2, and w3, 
  so that the  the coordinates change by dw1, dw2 and dw3 
  in it. We make these quantities so small that div v is essentially constant 
  inside it, and v is essentially constant on it boundaries.
  We get:
(div v(r))V = d(A1v1(r)) + d(A2v2(r)) + d(A3v3(r))
where Ai is the area of the part of the boundary 
  of our box on which wi is constant, and V is the volume of the box.
  We can differentiate to get
![]()
and observe that
 
  and V = u1u2u3dw1dw2dw3
Substituting these facts into the last equation and dividing by V gives us
 
The key observation here is that both vi and Ai can change across the box, so that one must differentiate the product vi Ai and not just vi .
In two dimensions, there is no w3 and the same equation holds without any last term and with u3 =1.
Thus, in polar coordinates, we get:
![]()
In spherical coordinates we find
