Calculus/Vector calculus

Vector calculus specifically refers to multi-variable calculus applied to scalar and vector fields. While vector calculus can be generalized to $$n$$ dimensions ($$\R^n$$), this chapter will specifically focus on 3 dimensions ($$\R^3$$)

Scalar fields
A scalar field is a function $$f: \R^3 \to \R$$ that assigns a real number to each point in space. Scalar fields typically denote densities or potentials at each specific point. For the sake of simplicity, all scalar fields considered by this chapter will be assumed to be defined at all points and differentiable at all points.

Vector fields
A vector field is a function $$\mathbf{F}: \R^3 \to \R^3$$ that assigns a vector to each point in space. Vector fields typically denote flow densities or potential gradients at each specific point. For the sake of simplicity, all vector fields considered by this chapter will be assumed to be defined at all points and differentiable at all points.



Vector fields in cylindrical coordinates
The cylindrical coordinate system used here has the three parameters: $$(\rho,\phi,z)$$. The Cartesian coordinate equivalent to the point $$(\rho,\phi,z)$$ is

$$ x = \rho\cos\phi $$

$$ y = \rho\sin\phi $$

$$ z = z $$

Any vector field in cylindrical coordinates is a linear combination of the following 3 mutually orthogonal unit length basis vectors:

$$ \hat{\mathbf{\rho}} = \cos\phi\mathbf{i} + \sin\phi\mathbf{j} $$

$$ \hat{\mathbf{\phi}} = -\sin\phi\mathbf{i} + \cos\phi\mathbf{j} $$

$$ \hat{\mathbf{z}} = \mathbf{k} $$

Note that these basis vectors are not constant with respect to position. The fact that the basis vectors change from position to position should always be considered. The cylindrical basis vectors change according to the following rates:

Any vector field $$\mathbf{F}$$ expressed in cylindrical coordinates has the form: $$\mathbf{F}(\mathbf{q}) = F_\rho(\mathbf{q})\hat{\mathbf{\rho}} + F_\phi(\mathbf{q})\hat{\mathbf{\phi}} + F_z(\mathbf{q})\hat{\mathbf{z}}$$

Given an arbitrary position $$\mathbf{q} = (\rho,\phi,z)$$ that changes with time, the velocity of the position is:

$$\frac{d\mathbf{q}}{dt} = \frac{d\rho}{dt}\hat{\mathbf{\rho}} + \rho\frac{d\phi}{dt}\hat{\mathbf{\phi}} + \frac{dz}{dt}\hat{\mathbf{z}}$$

The coefficient of $$\rho$$ for the term $$\rho\frac{d\phi}{dt}\hat{\mathbf{\phi}}$$ originates from the fact that as the azimuth angle $$\phi$$ increases, the position $$\mathbf{q}$$ swings around at a speed of $$\rho$$.



Vector fields in spherical coordinates
The spherical coordinate system used here has the three parameters: $$(r,\theta,\phi)$$. The Cartesian coordinate equivalent to the point $$(r,\theta,\phi)$$ is

$$ x = r\sin\theta\cos\phi $$

$$ y = r\sin\theta\sin\phi $$

$$ z = r\cos\theta $$

Any vector field in spherical coordinates is a linear combination of the following 3 mutually orthogonal unit length basis vectors:

$$ \hat{\mathbf{r}} = \sin\theta\cos\phi\mathbf{i} + \sin\theta\sin\phi\mathbf{j} + \cos\theta\mathbf{k} $$

$$ \hat{\mathbf{\theta}} = \cos\theta\cos\phi\mathbf{i} + \cos\theta\sin\phi\mathbf{j} - \sin\theta\mathbf{k} $$

$$ \hat{\mathbf{\phi}} = -\sin\phi\mathbf{i} + \cos\phi\mathbf{j} $$

Note that these basis vectors are not constant with respect to position. The fact that the basis vectors change from position to position should always be considered. The spherical basis vectors change according to the following rates:

Any vector field $$\mathbf{F}$$ expressed in spherical coordinates has the form: $$\mathbf{F}(\mathbf{q}) = F_r(\mathbf{q})\hat{\mathbf{r}} + F_\theta(\mathbf{q})\hat{\mathbf{\theta}} + F_\phi(\mathbf{q})\hat{\phi}$$

Given an arbitrary position $$\mathbf{q} = (r,\theta,\phi)$$ that changes with time, the velocity of this position is:

$$\frac{d\mathbf{q}}{dt} = \frac{dr}{dt}\hat{\mathbf{r}} + r\frac{d\theta}{dt}\hat{\mathbf{\theta}} + r\sin\theta\frac{d\phi}{dt}\hat{\mathbf{\phi}} $$

The coefficient of $$r$$ for the term $$r\frac{d\theta}{dt}\hat{\mathbf{\theta}}$$ arises from the fact that as the latitudinal angle $$\theta$$ changes, the position $$\mathbf{q}$$ traverses a great circle at a speed of $$r$$.

The coefficient of $$r\sin\theta$$ for the term $$r\sin\theta\frac{d\phi}{dt}\hat{\mathbf{\phi}}$$ arises from the fact that as the longitudinal angle $$\phi$$ changes, the position $$\mathbf{q}$$ traverses a latitude circle at a speed of $$r\sin\theta$$.

Volume Integrals
Volume integrals have already been discussed in the chapter Multivariable calculus, but a brief review is given here for completeness.

Given a scalar field $$\rho: \R^3 \to \R$$ that denotes a density at each specific point, and an arbitrary volume $$\Omega \subseteq \R^3$$, the total "mass" $$M$$ inside of $$\Omega$$ can be determined by partitioning $$\Omega$$ into infinitesimal volumes. At each position $$\mathbf{q} \in \Omega$$, the volume of the infinitesimal volume is denoted by the infinitesimal $$dV$$. This gives rise to the following integral:

$$ M = \iiint_{\mathbf{q} \in \Omega} \rho(\mathbf{q})dV $$

Path Integrals
Given any oriented path $$C$$ (oriented means that there is a preferred direction), the differential $$d\mathbf{q} = dx\mathbf{i} + dy\mathbf{j} + dz\mathbf{k}$$ denotes an infinitesimal displacement along $$C$$ in the preferred direction. This differential can be used in various path integrals. Letting $$f: \R^3 \to \R$$ denote an arbitrary scalar field, and $$\mathbf{F}: \R^3 \to \R^3$$ denote an arbitrary vector field, various path integrals include:

$$\int_{\mathbf{q} \in C} f(\mathbf{q})d\mathbf{q}$$, $$\int_{\mathbf{q} \in C} f(\mathbf{q})|d\mathbf{q}|$$, $$\int_{\mathbf{q} \in C} \mathbf{F}(\mathbf{q}) \cdot d\mathbf{q}$$, $$\int_{\mathbf{q} \in C} \mathbf{F}(\mathbf{q})|d\mathbf{q}|$$, and many more.

$$\int_{\mathbf{q} \in C} d\mathbf{q}$$ denotes the total displacement along $$C$$, and $$\int_{\mathbf{q} \in C} |d\mathbf{q}|$$ denotes the total length of $$C$$.

Calculating Path Integrals
To compute a path integral, the continuous oriented curve $$C$$ must be parameterized. $$\mathbf{q}_C(t)$$ will denote the point along $$C$$ indexed by $$t$$ from the range $$[t_0, t_1]$$. $$\mathbf{q}_C(t_0) = \mathbf{q}_0$$ must be the starting point of $$C$$ and $$\mathbf{q}_C(t_1) = \mathbf{q}_1$$ must be the ending point of $$C$$. As $$t$$ increases, $$\mathbf{q}_C(t)$$ must proceed along $$C$$ in the preferred direction. An infinitesimal change in $$t$$, $$dt$$, results in the infinitesimal displacement $$d\mathbf{q} = \frac{d\mathbf{q}_C}{dt}dt$$ along $$C$$. In the path integral $$\int_{\mathbf{q} \in C} \mathbf{F}(\mathbf{q}) \cdot d\mathbf{q}$$, the differential $$d\mathbf{q}$$ can be replaced with $$\frac{d\mathbf{q}_C}{dt}dt$$ to get $$\int_{t = t_0}^{t_1} \mathbf{F}(\mathbf{q}_C(t)) \cdot \frac{d\mathbf{q}_C}{dt}dt$$

If a vector field $$\mathbf{F}$$ denotes a "force field", which returns the force on an object as a function of position, the work performed on a point mass that traverses the oriented curve $$C$$ is $$W = \int_{\mathbf{q} \in C} \mathbf{F}(\mathbf{q}) \cdot d\mathbf{q}$$

Surface Integrals
Given any oriented surface $$\sigma$$ (oriented means that the there is a preferred direction to pass through the surface), an infinitesimal portion of the surface is defined by an infinitesimal area $$|dS|$$, and a unit length outwards oriented normal vector $$\mathbf{n}$$. $$\mathbf{n}$$ has a length of 1 and is perpendicular to the surface of $$\sigma$$, while penetrating $$\sigma$$ in the preferred direction. The infinitesimal portion of the surface is denoted by the infinitesimal "surface vector": $$\mathbf{dS} = |dS|\mathbf{n}$$. If a vector field $$\mathbf{F}: \R^3 \to \R^3$$ denotes a flow density, then the flow through the infinitesimal surface portion in the preferred direction is $$\mathbf{F}(\mathbf{q}) \cdot \mathbf{dS}$$.

The infinitesimal "surface vector" $$\mathbf{dS} = \mathbf{n}|dS|$$ describes the infinitesimal surface element in a manner similar to how the infinitesimal displacement $$d\mathbf{q}$$ describes an infinitesimal portion of a path. More specifically, similar to how the interior points on a path do not affect the total displacement, the interior points on a surface to not affect the total surface vector.



Consider for instance two paths $$C_1$$ and $$C_2$$ that both start at point $$A$$, and end at point $$B$$. The total displacements, $$\int_{\mathbf{q} \in C_1} d\mathbf{q}$$ and $$\int_{\mathbf{q} \in C_2} d\mathbf{q}$$, are both equivalent and equal to the displacement between $$A$$ and $$B$$. Note however that the total lengths $$\int_{\mathbf{q} \in C_1} |d\mathbf{q}|$$ and $$\int_{\mathbf{q} \in C_2} |d\mathbf{q}|$$ are not necessarily equivalent.

Similarly, given two surfaces $$S_1$$ and $$S_2$$ that both share the same counter-clockwise oriented boundary $$C$$, the total surface vectors $$\int_{\mathbf{q} \in S_1} \mathbf{dS}$$ and $$\int_{\mathbf{q} \in S_2} \mathbf{dS}$$ are both equivalent and are a function of the boundary $$C$$. This implies that a surface can be freely deformed within its boundaries without changing the total surface vector. Note however that the surface areas $$\int_{\mathbf{q} \in S_1} |\mathbf{dS}|$$ and $$\int_{\mathbf{q} \in S_2} |\mathbf{dS}|$$ are not necessarily equivalent.

The fact that the total surface vectors of $$S_1$$ and $$S_2$$ are equivalent is not immediately obvious. To prove this fact, let $$\mathbf{F}$$ be a constant vector field. $$S_1$$ and $$S_2$$ share the same boundary, so the flux/flow of $$\mathbf{F}$$ through $$S_1$$ and $$S_2$$ is equivalent. The flux through $$S_1$$ is $$\Phi_1 = \int_{\mathbf{q} \in S_1} \mathbf{F} \cdot \mathbf{dS} = \mathbf{F} \cdot \int_{\mathbf{q} \in S_1} \mathbf{dS} $$, and similarly for $$S_2$$ is $$\Phi_2 = \int_{\mathbf{q} \in S_2} \mathbf{F} \cdot \mathbf{dS} = \mathbf{F} \cdot \int_{\mathbf{q} \in S_2} \mathbf{dS} $$. Since $$ \mathbf{F} \cdot \int_{\mathbf{q} \in S_1} \mathbf{dS} = \mathbf{F} \cdot \int_{\mathbf{q} \in S_2} \mathbf{dS} $$ for every choice of $$\mathbf{F}$$, it follows that $$ \int_{\mathbf{q} \in S_1} \mathbf{dS} = \int_{\mathbf{q} \in S_2} \mathbf{dS} $$.

The geometric significance of the total surface vector is that each component measures the area of the projection of the surface onto the plane formed by the other two dimensions. Let $$\sigma$$ be a surface with surface vector $$\mathbf{S} = S_x\mathbf{i} + S_y\mathbf{j} + S_z\mathbf{k}$$. It is then the case that: $$S_x$$ is the area of the projection of $$\sigma$$ onto the yz-plane; $$S_y$$ is the area of the projection of $$\sigma$$ onto the xz-plane; and $$S_z$$ is the area of the projection of $$\sigma$$ onto the xy-plane.



Given an oriented surface $$\Sigma$$, another important concept is the oriented boundary. The boundary of $$\Sigma$$ is an oriented curve $$\partial\Sigma$$ but how is the orientation chosen? If the boundary is "counter-clockwise" oriented, then the boundary must follow a counter-clockwise direction when the oriented surface normal vectors point towards the viewer. The counter-clockwise boundary also obeys the "right-hand rule": If you hold your right hand with your thumb in the direction of the surface normals (penetrating the surface in the "preferred" direction), then your fingers will wrap around in the direction of the counter-clockwise oriented boundary.

Calculating Surface Integrals
To calculate a surface integral, the oriented surface $$\sigma$$ must be parameterized. Let $$\mathbf{q}_{\sigma}(u, v)$$ be a continuous function that maps each point $$(u,v)$$ from a two-dimensional domain $$D_{u,v}$$ to a point in $$\sigma$$. $$\mathbf{q}_{\sigma}(u, v)$$ must be continuous and onto. While $$\mathbf{q}_{\sigma}(u, v)$$ does not necessarily have to be one to one, the parameterization should never "fold back" on itself. The infinitesimal increases in $$u$$ and $$v$$ are respectively $$du$$ and $$dv$$. These respectively give rise to the displacements $$\frac{\partial \mathbf{q}_{\sigma}}{\partial u}du$$ and $$\frac{\partial \mathbf{q}_{\sigma}}{\partial v}dv$$. Assuming that the surface's orientation follows the right hand rule with respect to the displacements $$\frac{\partial \mathbf{q}_{\sigma}}{\partial u}du$$ and $$\frac{\partial \mathbf{q}_{\sigma}}{\partial v}dv$$, the surface vector that arises is $$\mathbf{dS} = (\frac{\partial \mathbf{q}_{\sigma}}{\partial u} \times \frac{\partial \mathbf{q}_{\sigma}}{\partial v})dudv$$.

In the surface integral $$\iint_{\mathbf{q} \in \sigma} \mathbf{F}(\mathbf{q}) \cdot \mathbf{dS}$$, the differential $$\mathbf{dS}$$ can be replaced with $$(\frac{\partial \mathbf{q}_{\sigma}}{\partial u} \times \frac{\partial \mathbf{q}_{\sigma}}{\partial v})dudv$$ to get $$\iint_{(u,v) \in D_{u,v}} \mathbf{F}(\mathbf{q}_{\sigma}(u,v)) \cdot (\frac{\partial \mathbf{q}_{\sigma}}{\partial u} \times \frac{\partial \mathbf{q}_{\sigma}}{\partial v})dudv$$.

The Gradient and Directional Derivatives
Given a scalar field $$\phi: \R^3 \to \R$$ that denotes a potential, and given a curve $$C$$, a commonly sought after quantity is the rate of change in $$\phi$$ as $$C$$ is being traversed. Let $$t$$ be an arbitrary parameter for $$C$$, and let $$\mathbf{q}_C(t) = (x(t),y(t),z(t))$$ denote the point indexed by $$t$$. Given an arbitrary $$t = t_0$$ which corresponds to the point $$\mathbf{q}_C(t_0) = \mathbf{q}_0 = (x_0,y_0,z_0)$$, then using the chain rule gives the following expression for the rate of increase of $$\phi$$ at $$t = t_0$$, $$\frac{d\phi}{dt}\bigg|_{t_0}$$:

$$\frac{d\phi}{dt}\bigg|_{t_0} = \frac{\partial \phi}{\partial x}\bigg|_{\mathbf{q}_0}\frac{dx}{dt}\bigg|_{t_0} + \frac{\partial \phi}{\partial y}\bigg|_{\mathbf{q}_0}\frac{dy}{dt}\bigg|_{t_0} + \frac{\partial \phi}{\partial z}\bigg|_{\mathbf{q}_0}\frac{dz}{dt}\bigg|_{t_0} = (\nabla \phi)|_{\mathbf{q}_0} \cdot \mathbf{v}|_{t_0}$$

where $$ \nabla \phi = \frac{\partial \phi}{\partial x}\mathbf{i} + \frac{\partial \phi}{\partial y}\mathbf{j} + \frac{\partial \phi}{\partial z}\mathbf{k} $$ is a vector field that denotes the "gradient" of $$\phi$$, and $$\mathbf{v} = \frac{dx}{dt}\mathbf{i} + \frac{dy}{dt}\mathbf{j} + \frac{dz}{dt}\mathbf{k}$$ is the unnormalized tangent of $$C$$.

If $$t$$ is an arc-length parameter, i.e. $$\left|\mathbf{v}\right| = 1$$, then the direction of the gradient is the direction of maximum gain: Given any unit length tangent $$\mathbf{v}$$, the direction $$\mathbf{v} = \frac{\nabla \phi}{|\nabla\phi|}$$ will maximize the rate of increase in $$\phi$$. This maximum rate of increase is $$|\nabla\phi|$$.

Calculating total gain
Given the gradient of a scalar field $$\phi$$: $$\nabla\phi$$, the difference between $$\phi$$ at two different points can be calculated, provided that there is a continuous path that links the two points. Let $$C$$ denote an arbitrary continuous path that starts at point $$\mathbf{q}_0$$ and ends at point $$\mathbf{q}_1$$. Given an infinitesimal path segment $$P$$ with endpoints $$\mathbf{q}_l$$ and $$\mathbf{q}_u$$, let $$\mathbf{q}_c \in P$$ be an arbitrary point in $$P$$. $$\Delta\mathbf{q} = \mathbf{q}_u - \mathbf{q}_l$$ denotes the infinitesimal displacement denoted by $$P$$. The increase in $$\phi$$ along $$P$$ is:

$$\phi(\mathbf{q}_u) - \phi(\mathbf{q}_l) \approx (\nabla \phi)|_{\mathbf{q}_c} \cdot \Delta\mathbf{q}$$

The relative error in the approximations vanish as $$\Delta\mathbf{q} \rightarrow \mathbf{0}$$. Adding together the above equation over all infinitesimal path segments of $$C$$ yields the following path integral equation:

$$\phi(\mathbf{q}_1) - \phi(\mathbf{q}_0) = \int_{\mathbf{q} \in C} (\nabla \phi)|_\mathbf{q} \cdot d\mathbf{q}$$

This is the path integral analog of the fundamental theorem of calculus.

The gradient in cylindrical coordinates
Let $$f: \R^3 \to \R$$ be a scalar field that denotes a potential and a curve $$C$$ that is parameterized by $$t$$: $$\mathbf{q}_C(t) = (\rho(t),\phi(t),z(t))$$. Let the rate of change in $$\mathbf{q}_C(t)$$ be quantified by the vector $$\frac{d\mathbf{q}_C}{dt} = \frac{d\rho}{dt}\hat{\mathbf{\rho}} + \rho\frac{d\phi}{dt}\hat{\mathbf{\phi}} + \frac{dz}{dt}\hat{\mathbf{z}} = v_\rho\hat{\mathbf{\rho}} + v_\phi\hat{\mathbf{\phi}} + v_z\hat{\mathbf{z}}$$. The rate of change in $$f$$ is:

$$\frac{df}{dt} = \frac{\partial f}{\partial \rho}\frac{d\rho}{dt} + \frac{\partial f}{\partial \phi}\frac{d\phi}{dt} + \frac{\partial f}{\partial z}\frac{dz}{dt} = \frac{\partial f}{\partial \rho}v_\rho + \frac{\partial f}{\partial \phi}\frac{v_\phi}{\rho} + \frac{\partial f}{\partial z}v_z = \left(\frac{\partial f}{\partial \rho}\hat{\mathbf{\rho}} + \frac{1}{\rho}\frac{\partial f}{\partial \phi}\hat{\mathbf{\phi}} + \frac{\partial f}{\partial z}\hat{\mathbf{z}}\right) \cdot (v_\rho\hat{\mathbf{\rho}} + v_\phi\hat{\mathbf{\phi}} + v_z\hat{\mathbf{z}}) = (\nabla f) \cdot \frac{d\mathbf{q}_C}{dt} $$

Therefore in cylindrical coordinates, the gradient is: $$\nabla f = \frac{\partial f}{\partial \rho}\hat{\mathbf{\rho}} + \frac{1}{\rho}\frac{\partial f}{\partial \phi}\hat{\mathbf{\phi}} + \frac{\partial f}{\partial z}\hat{\mathbf{z}} $$

The gradient in spherical coordinates
Let $$f: \R^3 \to \R$$ be a scalar field that denotes a potential and a curve $$C$$ that is parameterized by $$t$$: $$\mathbf{q}_C(t) = (r(t),\theta(t),\phi(t))$$. Let the rate of change in $$\mathbf{q}_C(t)$$ be quantified by the vector $$\frac{d\mathbf{q}_C}{dt} = \frac{dr}{dt}\hat{\mathbf{r}} + r\frac{d\theta}{dt}\hat{\mathbf{\theta}} + r\sin\theta\frac{d\phi}{dt}\hat{\mathbf{\phi}} = v_r\hat{\mathbf{r}} + v_\theta\hat{\mathbf{\theta}} + v_\phi\hat{\mathbf{\phi}}$$. The rate of change in $$f$$ is:

$$\frac{df}{dt} = \frac{\partial f}{\partial r}\frac{dr}{dt} + \frac{\partial f}{\partial \theta}\frac{d\theta}{dt} + \frac{\partial f}{\partial \phi}\frac{d\phi}{dt} = \frac{\partial f}{\partial r}v_r + \frac{\partial f}{\partial \theta}\frac{v_\theta}{r} + \frac{\partial f}{\partial \phi}\frac{v_\phi}{r\sin\theta} = \left(\frac{\partial f}{\partial r}\hat{\mathbf{r}} + \frac{1}{r}\frac{\partial f}{\partial \theta}\hat{\mathbf{\theta}} + \frac{1}{r\sin\theta}\frac{\partial f}{\partial \phi}\hat{\mathbf{\phi}}\right) \cdot (v_r\hat{\mathbf{r}} + v_\theta\hat{\mathbf{\theta}} + v_\phi\hat{\phi}) = (\nabla f) \cdot \frac{d\mathbf{q}_C}{dt} $$

Therefore in spherical coordinates, the gradient is: $$\nabla f = \frac{\partial f}{\partial r}\hat{\mathbf{r}} + \frac{1}{r}\frac{\partial f}{\partial \theta}\hat{\mathbf{\theta}} + \frac{1}{r\sin\theta}\frac{\partial f}{\partial \phi}\hat{\mathbf{\phi}} $$

The Directional Derivative
Given a scalar field $$f$$ and a vector $$\mathbf{v}$$, scalar field $$g = \mathbf{v} \cdot (\nabla f)$$ computes the rate of change in $$f$$ at each position $$\mathbf{q}$$ where the velocity of $$\mathbf{q}$$ is $$\frac{d\mathbf{q}}{dt} = \mathbf{v}$$. Scalar field $$g$$ can also be expressed as $$g = (\mathbf{v} \cdot \nabla)f$$. Velocity $$\mathbf{v}$$ can also be a vector field $$\mathbf{V}$$ so $$\frac{d\mathbf{q}}{dt}$$ depends on the position $$\mathbf{q}$$. Scalar field $$g$$ becomes $$g = (\mathbf{V} \cdot \nabla)f$$.

In Cartesian coordinates where $$\mathbf{V} = v_x\mathbf{i} + v_y\mathbf{j} + v_z\mathbf{k}$$ the directional derivative is:

$$(\mathbf{V} \cdot \nabla)f = v_x\frac{\partial f}{\partial x} + v_y\frac{\partial f}{\partial y} + v_z\frac{\partial f}{\partial z}$$

In cylindrical coordinates where $$\mathbf{V} = v_\rho\hat{\mathbf{\rho}} + v_\phi\hat{\mathbf{\phi}} + v_z\hat{\mathbf{z}}$$ the directional derivative is:

$$(\mathbf{V} \cdot \nabla)f = v_\rho\frac{\partial f}{\partial \rho} + \frac{v_\phi}{\rho}\frac{\partial f}{\partial \phi} + v_z\frac{\partial f}{\partial z}$$

In spherical coordinates where $$\mathbf{V} = v_r\hat{\mathbf{r}} + v_\theta\hat{\mathbf{\theta}} + v_\phi\hat{\mathbf{\phi}}$$ the directional derivative is:

$$(\mathbf{V} \cdot \nabla)f = v_r\frac{\partial f}{\partial r} + \frac{v_\theta}{r}\frac{\partial f}{\partial \theta} + \frac{v_\phi}{r\sin\theta}\frac{\partial f}{\partial \phi}$$

What makes the discussion of directional derivatives nontrivial is the fact that $$f$$ can instead be a vector field $$\mathbf{F}$$. Vector field $$\mathbf{G} = (\mathbf{V} \cdot \nabla)\mathbf{F}$$ computes $$\frac{d\mathbf{F}}{dt}$$ at each position $$\mathbf{q}$$ where $$\frac{d\mathbf{q}}{dt} = \mathbf{V}(\mathbf{q})$$.

In cylindrical coordinates, basis vectors $$\hat{\mathbf{\rho}}$$ and $$\hat{\mathbf{\phi}}$$ are not fixed, and in spherical coordinates, all of the basis vectors $$\hat{\mathbf{r}}$$, $$\hat{\mathbf{\theta}}$$, and $$\hat{\mathbf{\phi}}$$ are not fixed. This makes determining the directional derivative of a vector field that is expressed using the cylindrical or spherical basis vectors non-trivial. To directly compute the directional derivative, the rates of change of each basis vector with respect to each coordinate should be used. Alternatively, the following identities related to the directional derivative can be used (proofs can be found here):

Given vector fields $$\mathbf{V}$$, $$\mathbf{F}$$, and $$\mathbf{G}$$, then $$(\mathbf{V} \cdot \nabla)(\mathbf{F} + \mathbf{G}) = (\mathbf{V} \cdot \nabla)\mathbf{F} + (\mathbf{V} \cdot \nabla)\mathbf{G}$$

Given vector fields $$\mathbf{V}$$ and $$\mathbf{G}$$, and scalar field $$f$$, then $$(\mathbf{V} \cdot \nabla)(f\mathbf{G}) = ((\mathbf{V} \cdot \nabla)f)\mathbf{G} + f((\mathbf{V} \cdot \nabla)\mathbf{G})$$

In cylindrical coordinates, $$((v_\rho \hat{\mathbf{\rho}} + v_\phi \hat{\mathbf{\phi}} + v_z \hat{\mathbf{z}}) \cdot \nabla)\hat{\mathbf{\rho}} = \frac{v_\phi}{\rho}\hat{\mathbf{\phi}}$$ and $$((v_\rho \hat{\mathbf{\rho}} + v_\phi \hat{\mathbf{\phi}} + v_z \hat{\mathbf{z}}) \cdot \nabla)\hat{\mathbf{\phi}} = -\frac{v_\phi}{\rho}\hat{\mathbf{\rho}}$$

In spherical coordinates, $$((v_r \hat{\mathbf{r}} + v_\theta \hat{\mathbf{\theta}} + v_\phi \hat{\mathbf{\phi}}) \cdot \nabla)\hat{\mathbf{r}} = \frac{1}{r}(v_\theta\hat{\mathbf{\theta}} + v_\phi\hat{\mathbf{\phi}})$$, and $$((v_r \hat{\mathbf{r}} + v_\theta \hat{\mathbf{\theta}} + v_\phi \hat{\mathbf{\phi}}) \cdot \nabla)\hat{\mathbf{\theta}} = \frac{1}{r}(-v_\theta\hat{\mathbf{r}} + \cot\theta v_\phi\hat{\mathbf{\phi}})$$, and $$((v_r \hat{\mathbf{r}} + v_\theta \hat{\mathbf{\theta}} + v_\phi \hat{\mathbf{\phi}}) \cdot \nabla)\hat{\mathbf{\phi}} = -\frac{v_\phi}{r\sin\theta}(\sin\theta\hat{\mathbf{r}} + \cos\theta\hat{\mathbf{\theta}})$$

The Divergence and Gauss's Divergence Theorem
Let $$\mathbf{F} = F_x\mathbf{i} + F_y\mathbf{j} + F_z\mathbf{k}$$ denote a vector field that denotes "flow density". For any infinitesimal surface vector $$\mathbf{dS} = dS_x\mathbf{i} + dS_y\mathbf{j} + dS_z\mathbf{k}$$ at position $$\mathbf{q}$$, the flow through $$\mathbf{dS}$$ in the preferred direction is $$\mathbf{F}(\mathbf{q}) \cdot \mathbf{dS} = F_x(\mathbf{q})dS_x + F_y(\mathbf{q})dS_y + F_z(\mathbf{q})dS_z$$. $$F_x$$ is the flow density parallel to the x-axis etc.

Given a volume $$\Omega$$ with a closed surface boundary $$\partial\Omega$$ with an outwards orientation, the total outwards flow/flux through $$\partial\Omega$$ is given by the surface integral $$\iint_{\mathbf{q} \in \partial\Omega} \mathbf{F}(\mathbf{q}) \cdot \mathbf{dS}$$. This outwards flow is equal to the total flow that is being generated in the interior of $$\Omega$$.

For an infinitesimal rectangular prism $$R = [x_l,x_u] \times [y_l,y_u] \times [z_l,z_u]$$ ($$\Delta x = x_u - x_l$$, $$\Delta y = y_u - y_l$$, and $$\Delta z = z_u - z_l$$) that is centered on position $$(x_c,y_c,z_c)$$, the outwards flow through the surface $$\partial R$$ is:

$$\iint_{\mathbf{q} \in \partial R} \mathbf{F}(\mathbf{q}) \cdot \mathbf{dS} \approx $$ $$ \mathbf{F}(x_u,y_c,z_c) \cdot (\Delta y \Delta z \mathbf{i}) + \mathbf{F}(x_l,y_c,z_c) \cdot (-\Delta y \Delta z \mathbf{i}) + $$ $$ \mathbf{F}(x_c,y_u,z_c) \cdot (\Delta x \Delta z \mathbf{j}) + \mathbf{F}(x_c,y_l,z_c) \cdot (-\Delta x \Delta z \mathbf{j}) + $$ $$ \mathbf{F}(x_c,y_c,z_u) \cdot (\Delta x \Delta y \mathbf{k}) + \mathbf{F}(x_c,y_c,z_l) \cdot (-\Delta x \Delta y \mathbf{k}) = $$

$$ \frac{F_x(x_u,y_c,z_c) - F_x(x_l,y_c,z_c)}{\Delta x} (\Delta x\Delta y\Delta z) + $$ $$ \frac{F_y(x_c,y_u,z_c) - F_y(x_c,y_l,z_c)}{\Delta y} (\Delta x\Delta y\Delta z) + $$ $$ \frac{F_z(x_c,y_c,z_u) - F_z(x_c,y_c,z_l)}{\Delta z} (\Delta x\Delta y\Delta z) \approx $$

$$ \left(\frac{\partial F_x}{\partial x}\bigg|_{(x_c,y_c,z_c)} + \frac{\partial F_y}{\partial y}\bigg|_{(x_c,y_c,z_c)} + \frac{\partial F_z}{\partial z}\bigg|_{(x_c,y_c,z_c)}\right)\Delta x\Delta y\Delta z \approx $$

$$ \iiint_{\mathbf{q} \in R} \left(\frac{\partial F_x}{\partial x} + \frac{\partial F_y}{\partial y} + \frac{\partial F_z}{\partial z}\right)dV $$

All relative errors vanish as $$\Delta x, \Delta y, \Delta z \rightarrow 0^+$$.

$$ \nabla \cdot \mathbf{F} = \frac{\partial F_x}{\partial x} + \frac{\partial F_y}{\partial y} + \frac{\partial F_z}{\partial z} $$ is the "divergence" of $$\mathbf{F}$$ and is the density of "flow generation" at $$(x_c,y_c,z_c)$$. As noted above, the total outwards flow through $$\partial\Omega$$ is the total flow generated inside of $$\Omega$$, which gives Gauss's divergence theorem:

$$ \iint_{\mathbf{q} \in \partial\Omega} \mathbf{F}(\mathbf{q}) \cdot \mathbf{dS} = \iiint_{\mathbf{q} \in \Omega} (\nabla \cdot \mathbf{F})|_{\mathbf{q}} dV $$



In the image to the right, an example of the total flow across a closed boundary being the total flow generated in the interior of the boundary is given. The direction of the flow across each edge is denoted by the direction of the arrows, and the rate is denoted by the number of arrows. Each node inside the boundary is labelled with the rate of flow generation at the current node. It can be checked that a net total of 2 units of flow is being drawn into the boundary, and the total rate of flow generation across all interior nodes is a net consumption of 2 units.

The divergence in cylindrical coordinates
Let $$\mathbf{F} = F_\rho\hat{\mathbf{\rho}} + F_\phi\hat{\mathbf{\phi}} + F_z\hat{\mathbf{z}}$$ denote a vector field that denotes "flow density". In order to compute the divergence (flow generation density) of $$\mathbf{F}$$, consider an infinitesimal volume $$R$$ defined by all points $$(\rho,\phi,z)$$ where $$\rho \in [\rho_l,\rho_u]$$, $$\phi \in [\phi_l,\phi_u]$$, and $$z \in [z_l,z_u]$$. Note that $$R$$ is not a rectangular prism. Let $$\Delta\rho = \rho_u - \rho_l$$, $$\Delta\phi = \phi_u - \phi_l$$, and $$\Delta z = z_u - z_l$$. Let $$(\rho_c,\phi_c,z_c) \in R$$ be an arbitrary point from $$R$$.

The volume of $$R$$ is approximately $$\Delta\rho \cdot \rho_c\Delta\phi \cdot \Delta z$$. The 6 surfaces bounding $$R$$ are described in the following table:

The total outwards flow through the surface $$\partial R$$ of $$R$$ is:

$$\iint_{\mathbf{q} \in \partial R} \mathbf{F}(\mathbf{q}) \cdot \mathbf{dS} \approx $$ $$ \mathbf{F}(\rho_u,\phi_c,z_c) \cdot (\rho_u\Delta\phi \cdot \Delta z \cdot \hat{\mathbf{\rho}}) + \mathbf{F}(\rho_l,\phi_c,z_c) \cdot (\rho_l\Delta\phi \cdot \Delta z \cdot -\hat{\mathbf{\rho}}) + $$ $$ \mathbf{F}(\rho_c,\phi_u,z_c) \cdot (\Delta\rho \cdot \Delta z \cdot \hat{\mathbf{\phi}}) + \mathbf{F}(\rho_c,\phi_l,z_c) \cdot (\Delta\rho \cdot \Delta z \cdot -\hat{\mathbf{\phi}}) + $$ $$ \mathbf{F}(\rho_c,\phi_c,z_u) \cdot (\Delta\rho \cdot \rho_c\Delta\phi \cdot \hat{\mathbf{z}}) + \mathbf{F}(\rho_c,\phi_c,z_l) \cdot (\Delta\rho \cdot \rho_c\Delta\phi \cdot -\hat{\mathbf{z}}) = $$

$$ \frac{\rho_uF_\rho(\rho_u,\phi_c,z_c) - \rho_lF_\rho(\rho_l,\phi_c,z_c)}{\Delta\rho} (\Delta\rho\Delta\phi\Delta z) + $$ $$ \frac{F_\phi(\rho_c,\phi_u,z_c) - F_\phi(\rho_c,\phi_l,z_c)}{\Delta\phi} (\Delta\rho\Delta\phi\Delta z) + $$ $$ \rho_c\frac{F_z(\rho_c,\phi_c,z_u) - F_z(\rho_c,\phi_c,z_l)}{\Delta z} (\Delta\rho\Delta\phi\Delta z) \approx $$

$$ \left(\frac{\partial}{\partial\rho}(\rho F_\rho)\bigg|_{(\rho_c,\phi_c,z_c)} + \frac{\partial}{\partial\phi}(F_\phi)\bigg|_{(\rho_c,\phi_c,z_c)} + \rho_c\frac{\partial}{\partial z}(F_z)\bigg|_{(\rho_c,\phi_c,z_c)}\right)(\Delta\rho\Delta\phi\Delta z) = $$

$$ \left(\frac{1}{\rho_c}\frac{\partial}{\partial\rho}(\rho F_\rho)\bigg|_{(\rho_c,\phi_c,z_c)} + \frac{1}{\rho_c}\frac{\partial}{\partial\phi}(F_\phi)\bigg|_{(\rho_c,\phi_c,z_c)} + \frac{\partial}{\partial z}(F_z)\bigg|_{(\rho_c,\phi_c,z_c)}\right)(\Delta\rho \cdot \rho_c\Delta\phi \cdot \Delta z) \approx $$

$$ \iiint_{\mathbf{q} \in R} \left(\frac{1}{\rho}\frac{\partial}{\partial\rho}(\rho F_\rho) + \frac{1}{\rho}\frac{\partial}{\partial\phi}(F_\phi) + \frac{\partial}{\partial z}(F_z)\right)dV $$

All relative errors vanish as $$\Delta \rho, \Delta \phi, \Delta z \rightarrow 0^+$$.

The divergence (flow generation density) is therefore:

$$ \nabla \cdot \mathbf{F} = \frac{1}{\rho}\frac{\partial}{\partial\rho}(\rho F_\rho) + \frac{1}{\rho}\frac{\partial}{\partial\phi}(F_\phi) + \frac{\partial}{\partial z}(F_z) $$

The divergence in spherical coordinates
Let $$\mathbf{F} = F_r\hat{\mathbf{r}} + F_\theta\hat{\mathbf{\theta}} + F_\phi\hat{\mathbf{\phi}}$$ denote a vector field that denotes "flow density". In order to compute the divergence (flow generation density) of $$\mathbf{F}$$, consider an infinitesimal volume $$R$$ defined by all points $$(r,\theta,\phi)$$ where $$r \in [r_l,r_u]$$, $$ \theta \in [\theta_l,\theta_u]$$, and $$ \phi \in [\phi_l,\phi_u] $$. Note that $$R$$ is not a rectangular prism. Let $$\Delta r = r_u - r_l$$, $$\Delta \theta = \theta _u - \theta_l$$, and $$\Delta \phi = \phi_u - \phi_l$$. Let $$(r_c,\theta_c,\phi_c) \in R$$ be an arbitrary point from $$R$$.

The volume of $$R$$ is approximately $$\Delta r \cdot r_c\Delta\theta \cdot r_c\sin\theta_c\Delta\phi$$. The 6 surfaces bounding $$R$$ are shown in the following table:

The total outwards flow through the surface $$\partial R$$ of $$R$$ is:

$$\iint_{\mathbf{q} \in \partial R} \mathbf{F}(\mathbf{q}) \cdot \mathbf{dS} \approx $$

$$ \mathbf{F}(r_u,\theta_c,\phi_c) \cdot (r_u\Delta\theta \cdot r_u\sin\theta_c\Delta\phi \cdot \hat{\mathbf{r}}) + \mathbf{F}(r_l,\theta_c,\phi_c) \cdot (r_l\Delta\theta \cdot r_l\sin\theta_c\Delta\phi \cdot -\hat{\mathbf{r}}) + $$

$$ \mathbf{F}(r_c,\theta_u,\phi_c) \cdot (\Delta r \cdot r_c\sin\theta_u\Delta\phi \cdot \hat{\mathbf{\theta}}) + \mathbf{F}(r_c,\theta_l,\phi_c) \cdot (\Delta r \cdot r_c\sin\theta_l\Delta\phi \cdot -\hat{\mathbf{\theta}}) + $$

$$ \mathbf{F}(r_c,\theta_c,\phi_u) \cdot (\Delta r \cdot r_c\Delta\theta \cdot \hat{\mathbf{\phi}}) + \mathbf{F}(r_c,\theta_c,\phi_l) \cdot (\Delta r \cdot r_c\Delta\theta \cdot -\hat{\mathbf{\phi}}) = $$

$$ \left(\sin\theta_c\frac{r_u^2 F_r(r_u,\theta_c,\phi_c) - r_l^2F_r(r_l,\theta_c,\phi_c)}{\Delta r} + r_c\frac{\sin\theta_u F_\theta(r_c,\theta_u,\phi_c) - \sin\theta_l F_\theta(r_c,\theta_l,\phi_c)}{\Delta\theta} + r_c\frac{F_\phi(r_c,\theta_c,\phi_u) - F_\phi(r_c,\theta_c,\phi_l)}{\Delta\phi}\right)\Delta r\Delta\theta\Delta\phi \approx $$

$$ \left( \sin\theta_c\frac{\partial}{\partial r}(r^2F_r)\bigg|_{(r_c,\theta_c,\phi_c)} + r_c\frac{\partial}{\partial\theta}(\sin\theta F_\theta)\bigg|_{(r_c,\theta_c,\phi_c)} + r_c\frac{\partial}{\partial\phi}(F_\phi)\bigg|_{(r_c,\theta_c,\phi_c)} \right)(\Delta r\Delta\theta\Delta\phi) = $$

$$ \left( \frac{1}{r_c^2}\frac{\partial}{\partial r}(r^2F_r)\bigg|_{(r_c,\theta_c,\phi_c)} + \frac{1}{r_c\sin\theta_c}\frac{\partial}{\partial\theta}(\sin\theta F_\theta)\bigg|_{(r_c,\theta_c,\phi_c)} + \frac{1}{r_c\sin\theta_c}\frac{\partial}{\partial\phi}(F_\phi)\bigg|_{(r_c,\theta_c,\phi_c)} \right)(\Delta r \cdot r_c\Delta\theta \cdot r_c\sin\theta_c\Delta\phi) \approx $$

$$ \iiint_{\mathbf{q} \in R} \left(\frac{1}{r^2}\frac{\partial}{\partial r}(r^2F_r) + \frac{1}{r\sin\theta}\frac{\partial}{\partial\theta}(\sin\theta F_\theta) + \frac{1}{r\sin\theta}\frac{\partial}{\partial\phi}(F_\phi)\right)dV $$

All relative errors vanish as $$\Delta r, \Delta\theta, \Delta\phi \rightarrow 0^+$$

The divergence (flow generation density) is therefore:

$$ \nabla \cdot \mathbf{F} = \frac{1}{r^2}\frac{\partial}{\partial r}(r^2F_r) + \frac{1}{r\sin\theta}\frac{\partial}{\partial\theta}(\sin\theta F_\theta) + \frac{1}{r\sin\theta}\frac{\partial}{\partial\phi}(F_\phi) $$

Divergence free vector fields
A vector field $$\mathbf{F}$$ for which $$\nabla \cdot \mathbf{F} = 0$$ is a "divergence free" vector field. $$\mathbf{F}$$ can also be referred to as "incompressible" (since the flow density of an incompressible fluid is divergence free) or "solenoidal" (since magnetic fields are divergence free).

A key property of a divergence free vector field $$\mathbf{F}$$ is that the flux of $$\mathbf{F}$$ through a surface is purely a function of the surface's boundary. If $$\sigma_1$$ and $$\sigma_2$$ are two surfaces which share the same counterclockwise oriented boundary $$C$$, then $$\iint_{\mathbf{q} \in \sigma_1} \mathbf{F}(\mathbf{q}) \cdot \mathbf{dS} = \iint_{\mathbf{q} \in \sigma_2} \mathbf{F}(\mathbf{q}) \cdot \mathbf{dS}$$. In other words, the flux is purely a function of $$C$$. This property can be derived from Gauss's divergence theorem as follows:

To begin, it will be assumed that $$\sigma_1$$ and $$\sigma_2$$ do not intersect each other, except for at the common boundary $$C$$. The argument presented here easily generalizes to cases where $$\sigma_1$$ and $$\sigma_2$$ do intersect each other. Invert the orientation of $$\sigma_2$$ to get $$-\sigma_2$$ and combine $$\sigma_1$$ and $$-\sigma_2$$ to get a closed surface $$\sigma_3 = \sigma_1 - \sigma_2$$, stitching the surfaces together along the seam $$C$$. Let $$\Omega$$ denote the volume which is the interior of $$\sigma_3$$, and it will also be assumed that $$\sigma_3$$ is oriented outwards (which is the case if $$\sigma_1$$ is "in front" of $$\sigma_2$$).

Gauss's divergence theorem states that $$\iint_{\mathbf{q} \in \sigma_3} \mathbf{F}(\mathbf{q}) \cdot \mathbf{dS} = \iiint_{\mathbf{q} \in \Omega} (\nabla \cdot \mathbf{F})|_\mathbf{q}dV = 0$$. The flux through $$\sigma_3$$ is the flux through $$\sigma_1$$ minus the flux through $$\sigma_2$$: $$\iint_{\mathbf{q} \in \sigma_3} \mathbf{F}(\mathbf{q}) \cdot \mathbf{dS} = \iint_{\mathbf{q} \in \sigma_1} \mathbf{F}(\mathbf{q}) \cdot \mathbf{dS} + \iint_{\mathbf{q} \in -\sigma_2} \mathbf{F}(\mathbf{q}) \cdot \mathbf{dS}$$ $$ = \iint_{\mathbf{q} \in \sigma_1} \mathbf{F}(\mathbf{q}) \cdot \mathbf{dS} - \iint_{\mathbf{q} \in \sigma_2} \mathbf{F}(\mathbf{q}) \cdot \mathbf{dS}$$. Therefore:

$$\iint_{\mathbf{q} \in \sigma_3} \mathbf{F}(\mathbf{q}) \cdot \mathbf{dS} = 0$$ $$\implies \iint_{\mathbf{q} \in \sigma_1} \mathbf{F}(\mathbf{q}) \cdot \mathbf{dS} = \iint_{\mathbf{q} \in \sigma_2} \mathbf{F}(\mathbf{q}) \cdot \mathbf{dS}$$

The Laplacian Operator
Given a scalar field $$f$$, if the gradient $$\nabla f$$ is interpreted as denoting flow density, the rate of flow generation at each point is $$\nabla \cdot (\nabla f)$$ which is referred to as the "Laplacian" of $$f$$ and is denoted by $$\nabla^2 f$$ (or alternately $$\Delta f$$).

The laplacian $$\nabla^2 f$$ is effectively a measure of the "convexity" of $$f$$ at each point $$\mathbf{q}$$. When there is a net flow of the gradient away from $$\mathbf{q}$$, this means that $$f(\mathbf{q})$$ is "low" compared to its neighboring points and that the convexity $$(\nabla^2 f)|_{\mathbf{q}}$$ is positive. When there is a net flow of the gradient towards $$\mathbf{q}$$, this means that $$f(\mathbf{q})$$ is "high" compared to its neighboring points and that the convexity $$(\nabla^2 f)|_{\mathbf{q}}$$ is negative.

In Cartesian coordinates, the Laplacian is:

$$\nabla^2 f = \nabla \cdot (\nabla f) = \nabla \cdot (\frac{\partial f}{\partial x}\mathbf{i} + \frac{\partial f}{\partial y}\mathbf{j} + \frac{\partial f}{\partial z}\mathbf{k}) = \frac{\partial^2 f}{\partial x^2} + \frac{\partial^2 f}{\partial y^2} + \frac{\partial^2 f}{\partial z^2}$$

In cylindrical coordinates, the Laplacian is:

$$\nabla^2 f = \nabla \cdot (\nabla f) = \nabla \cdot (\frac{\partial f}{\partial \rho}\hat{\mathbf{\rho}} + \frac{1}{\rho}\frac{\partial f}{\partial \phi}\hat{\mathbf{\phi}} + \frac{\partial f}{\partial z}\hat{\mathbf{z}}) = \frac{1}{\rho}\frac{\partial}{\partial \rho}(\rho\frac{\partial f}{\partial \rho}) + \frac{1}{\rho^2}\frac{\partial^2 f}{\partial \phi^2} + \frac{\partial^2 f}{\partial z^2}$$

In spherical coordinates, the Laplacian is:

$$\nabla^2 f = \nabla \cdot (\nabla f) = \nabla \cdot (\frac{\partial f}{\partial r}\hat{\mathbf{r}} + \frac{1}{r}\frac{\partial f}{\partial \theta}\hat{\mathbf{\theta}} + \frac{1}{r\sin\theta}\frac{\partial f}{\partial \phi}\hat{\mathbf{\phi}}) = \frac{1}{r^2}\frac{\partial}{\partial r}(r^2\frac{\partial f}{\partial r}) + \frac{1}{r^2\sin\theta}\frac{\partial}{\partial \theta}(\sin\theta \frac{\partial f}{\partial \theta}) + \frac{1}{r^2\sin^2\theta}\frac{\partial^2 f}{\partial \phi^2}$$

The Laplacian and Vector fields
Occasionally, the Laplacian operator is applied to a vector field as opposed to a scalar field. Other than for Cartesian coordinates, the Laplacian cannot be applied directly to each component, as in non-Cartesian coordinate systems, the basis vectors are subject to change. In cylindrical coordinates, basis vectors $$\hat{\mathbf{\rho}}$$ and $$\hat{\mathbf{\phi}}$$ are not fixed, and in spherical coordinates, all of the basis vectors $$\hat{\mathbf{r}}$$, $$\hat{\mathbf{\theta }}$$, and $$\hat{\mathbf{\phi}}$$ are not fixed. This makes determining the Laplacian of a vector field that is expressed using the cylindrical or spherical basis vectors non-trivial. To directly compute the Laplacian, the rates of change of each basis vector with respect to each coordinate should be used. Alternatively, the following identities related to the Laplacian can be used (proofs can be found here):

Given vector fields $$\mathbf{F}$$ and $$\mathbf{G}$$, then $$\nabla^2(\mathbf{F} + \mathbf{G}) = \nabla^2\mathbf{F} + \nabla^2\mathbf{G}$$

Given scalar field $$f$$ and vector field $$\mathbf{G}$$, then $$\nabla^2(f\mathbf{G}) = (\nabla^2 f)\mathbf{G} + 2((\nabla f) \cdot \nabla)\mathbf{G} + f(\nabla^2\mathbf{G})$$

In cylindrical coordinates, $$\nabla^2\hat{\mathbf{\rho}} = -\frac{1}{\rho^2}\hat{\mathbf{\rho}}$$ and $$\nabla^2\hat{\mathbf{\phi}} = -\frac{1}{\rho^2}\hat{\mathbf{\phi}}$$

In spherical coordinates, $$\nabla^2\hat{\mathbf{r}} = -\frac{2}{r^2}\hat{\mathbf{r}}$$, and $$\nabla^2\hat{\mathbf{\theta}} = -\frac{1}{r^2\sin^2\theta}(\sin(2\theta)\hat{\mathbf{r}} + \hat{\mathbf{\theta}})$$, and $$\nabla^2\hat{\mathbf{\phi}} = -\frac{1}{r^2\sin^2\theta}\hat{\mathbf{\phi}}$$

The Curl and Stokes' Theorem
Given a scalar field $$f: \R^3 \to \R$$ and a curve $$C$$ with endpoints $$\mathbf{q}_0$$ and $$\mathbf{q}_1$$, the difference between $$f(\mathbf{q}_1)$$ and $$f(\mathbf{q}_0)$$ is given by the following path integral involving the gradient field $$\mathbf{F} = \nabla f$$: $$f(\mathbf{q}_1) - f(\mathbf{q}_0) = \int_{\mathbf{q} \in C} \mathbf{F}(\mathbf{q}) \cdot d\mathbf{q}$$. If $$C$$ is closed ($$\mathbf{q}_1 = \mathbf{q}_0$$), then $$\int_{\mathbf{q} \in C} \mathbf{F}(\mathbf{q}) \cdot d\mathbf{q} = 0$$. In other words, the "gain" of $$\mathbf{F} = \nabla f$$ around a closed curve $$C$$ is always 0. Most vector fields $$\mathbf{F}: \R^3 \to \R^3$$ are not the gradient of any scalar field however, and the gain of $$\mathbf{F}$$ around a closed curve $$C$$ may not always be 0. This gives rise to the notion of circulation or "curl".

The path integral $$\int_{\mathbf{q} \in C} \mathbf{F}(\mathbf{q}) \cdot d\mathbf{q}$$ for a closed curve $$C$$ is the "circulation" of $$\mathbf{F}$$ around $$C$$. Stokes' theorem will show that the circulation around $$C$$ is the total circulation accumulated in the interior of $$C$$.

Green's Theorem


Quantifying "circulation density" is best introduced in 2 dimensions. Given a large counter-clockwise oriented loop $$C$$ that is confined to 2 dimensions, $$C$$ can be decomposed into a family of infinitesimal loops as shown on the right. Boundaries that are common to adjacent loops cancel each other out due to their opposite orientations, so the total circulation around $$C$$ is the sum of the circulations around each infinitesimal loop.



Consider the infinitesimal rectangle $$R = [x_l,x_u] \times [y_l,y_u]$$. Let $$(x_c,y_c) \in R$$ be an arbitrary point inside the rectangle, let $$\Delta x = x_u - x_l$$ and $$\Delta y = y_u - y_l$$, and let $$\partial R$$ be the counterclockwise boundary of $$R$$.

The circulation around $$\partial R$$ is approximately (the relative error vanishes as $$\Delta x, \Delta y \rightarrow 0^+$$):

$$ \int_{\mathbf{q} \in \partial R} \mathbf{F}(\mathbf{q}) \cdot d\mathbf{q} \approx \mathbf{F}(x_u,y_c) \cdot (+\Delta y \mathbf{j}) + \mathbf{F}(x_c,y_u) \cdot (-\Delta x \mathbf{i}) + \mathbf{F}(x_l,y_c) \cdot (-\Delta y \mathbf{j}) + \mathbf{F}(x_c,y_l) \cdot (+\Delta x \mathbf{i}) $$ $$ = F_y(x_u,y_c)\Delta y - F_x(x_c,y_u)\Delta x - F_y(x_l,y_c)\Delta y + F_x(x_c,y_l)\Delta x $$ $$ = \left(\frac{F_y(x_u,y_c)-F_y(x_l,y_c)}{\Delta x} - \frac{F_x(x_c,y_u)-F_x(x_c,y_l)}{\Delta y}\right)\Delta x \Delta y$$ $$ \approx \left(\frac{\partial F_y}{\partial x}\bigg|_{(x_c,y_c)} - \frac{\partial F_x}{\partial y}\bigg|_{(x_c,y_c)}\right)\Delta x \Delta y$$ $$ \approx \iint_R \left(\frac{\partial F_y}{\partial x} - \frac{\partial F_x}{\partial y}\right)dxdy $$

As $$\Delta x, \Delta y \rightarrow 0^+$$, the relative errors present in the approximations vanish, and therefore, for an infinitesimal rectangle, $$ \int_{\mathbf{q} \in \partial R} \mathbf{F}(\mathbf{q}) \cdot d\mathbf{q} = \iint_{\mathbf{q} \in R} \left(\frac{\partial F_y}{\partial x} - \frac{\partial F_x}{\partial y}\right)dxdy $$

$$\frac{\partial F_y}{\partial x} - \frac{\partial F_x}{\partial y}$$ is the "circulation density" at $$(x_c, y_c)$$. Let $$C$$ be a counter-clockwise oriented loop with interior $$D$$. The circulation around loop $$C$$ is the total circulation contained by $$D$$: $$\int_{\mathbf{q} \in C} \mathbf{F}(\mathbf{q}) \cdot d\mathbf{q} = \iint_{\mathbf{q} \in D} \left(\frac{\partial F_y}{\partial x} - \frac{\partial F_x}{\partial y}\right)dxdy $$. This is Green's theorem.

Stokes' Theorem
Stokes' Theorem is effectively a generalization of Green's theorem to 3 dimensions, and the "curl" is a generalization of the quantity $$\frac{\partial F_y}{\partial x} - \frac{\partial F_x}{\partial y}$$ to 3 dimensions. An arbitrary oriented surface $$\sigma$$ can be articulated into a family of infinitesimal surfaces, some parallel to the xy-plane, others parallel to the zx-plane, and the remainder parallel to the yz-plane. Let $$\mathbf{F}$$ denote an arbitrary vector field.

Let $$\sigma$$ be a surface that is parallel to the yz-plane with counter-clockwise oriented boundary $$C$$. Green's theorem gives:

$$\int_{\mathbf{q} \in C} \mathbf{F}(\mathbf{q}) \cdot d\mathbf{q} = \iint_{\mathbf{q} \in \sigma}\left(\frac{\partial F_z}{\partial y} - \frac{\partial F_y}{\partial z}\right)(\mathbf{dS} \cdot \mathbf{i}) = \iint_{\mathbf{q} \in \sigma}\left(\left(\frac{\partial F_z}{\partial y} - \frac{\partial F_y}{\partial z}\right)\mathbf{i}\right) \cdot \mathbf{dS}$$

$$\mathbf{dS} \cdot \mathbf{i}$$ is positive if the normal direction to $$\sigma$$ points in the positive x direction and is negative if otherwise. If the normal direction to $$\sigma$$ points in the negative x direction, then $$C$$ is oriented clockwise instead of counter-clockwise in the yz-plane.



Repeating this argument for $$\sigma$$ being parallel to the zx-plane and xy-plane respectively gives:

$$\int_{\mathbf{q} \in C} \mathbf{F}(\mathbf{q}) \cdot d\mathbf{q} = \iint_{\mathbf{q} \in \sigma}\left(\frac{\partial F_x}{\partial z} - \frac{\partial F_z}{\partial x}\right)(\mathbf{dS} \cdot \mathbf{j}) = \iint_{\mathbf{q} \in \sigma}\left(\left(\frac{\partial F_x}{\partial z} - \frac{\partial F_z}{\partial x}\right)\mathbf{j}\right) \cdot \mathbf{dS}$$

and

$$\int_{\mathbf{q} \in C} \mathbf{F}(\mathbf{q}) \cdot d\mathbf{q} = \iint_{\mathbf{q} \in \sigma}\left(\frac{\partial F_y}{\partial x} - \frac{\partial F_x}{\partial y}\right)(\mathbf{dS} \cdot \mathbf{k}) = \iint_{\mathbf{q} \in \sigma}\left(\left(\frac{\partial F_y}{\partial x} - \frac{\partial F_x}{\partial y}\right)\mathbf{k}\right) \cdot \mathbf{dS}$$

Treating $$\sigma$$ as an ensemble of infinitesimal surfaces parallel to the yz-plane, zx-plane, or xy-plane gives:

$$\int_{\mathbf{q} \in C} \mathbf{F}(\mathbf{q}) \cdot d\mathbf{q} = \iint_{\mathbf{q} \in \sigma}\left( \left(\frac{\partial F_z}{\partial y} - \frac{\partial F_y}{\partial z}\right)\mathbf{i} + \left(\frac{\partial F_x}{\partial z} - \frac{\partial F_z}{\partial x}\right)\mathbf{j} + \left(\frac{\partial F_y}{\partial x} - \frac{\partial F_x}{\partial y}\right)\mathbf{k} \right) \cdot \mathbf{dS} $$

This is Stokes' theorem, and $$\nabla \times \mathbf{F} = \left(\frac{\partial F_z}{\partial y} - \frac{\partial F_y}{\partial z}\right)\mathbf{i} + \left(\frac{\partial F_x}{\partial z} - \frac{\partial F_z}{\partial x}\right)\mathbf{j} + \left(\frac{\partial F_y}{\partial x} - \frac{\partial F_x}{\partial y}\right)\mathbf{k}$$ is the "curl" of $$\mathbf{F}$$ which generalizes the "circulation density" to 3 dimensions.

The direction of $$\nabla \times \mathbf{F}$$ at $$\mathbf{q}$$ is effectively an "axis of rotation" around which the counterclockwise circulation density in a plane whose normal is parallel to $$\nabla \times \mathbf{F}$$ is $$|\nabla \times \mathbf{F}|$$. Out of all planes that pass through $$\mathbf{q}$$, the plane whose normal is parallel to $$\nabla \times \mathbf{F}$$ has the largest counterclockwise circulation density at $$\mathbf{q}$$ which is $$|\nabla \times \mathbf{F}|$$.

An arbitrary vector field $$\mathbf{F}$$ that is differentiable everywhere is considered to be "irrotational" or "conservative" if $$\nabla \times \mathbf{F} = \mathbf{0}$$ everywhere, or equivalently that $$\int_{\mathbf{q} \in C} \mathbf{F}(\mathbf{q}) \cdot d\mathbf{q} = 0$$ for all continuous closed curves $$C$$.

The curl in cylindrical coordinates
Let $$\mathbf{F} = F_\rho\hat{\mathbf{\rho}} + F_\phi\hat{\mathbf{\phi}} + F_z\hat{\mathbf{z}}$$ denote an arbitrary vector field in cylindrical coordinates. By calculating the circulation densities in surfaces perpendicular to $$\hat{\mathbf{\rho}}$$, $$\hat{\mathbf{\phi}}$$, and $$\hat{\mathbf{z}}$$, the curl can be computed:

$$\nabla \times \mathbf{F} = \frac{1}{\rho}(\frac{\partial}{\partial \phi}(F_z) - \frac{\partial}{\partial z}(\rho F_\phi))\hat{\mathbf{\rho}} + (\frac{\partial}{\partial z}(F_\rho) - \frac{\partial}{\partial \rho}(F_z))\hat{\mathbf{\phi}} + \frac{1}{\rho}(\frac{\partial}{\partial \rho}(\rho F_\phi) - \frac{\partial}{\partial \phi}(F_\rho))\hat{\mathbf{z}}$$ $$ = (\frac{1}{\rho}\frac{\partial}{\partial \phi}(F_z) - \frac{\partial}{\partial z}(F_\phi))\hat{\mathbf{\rho}} + (\frac{\partial}{\partial z}(F_\rho) - \frac{\partial}{\partial \rho}(F_z))\hat{\mathbf{\phi}} + \frac{1}{\rho}(\frac{\partial}{\partial \rho}(\rho F_\phi) - \frac{\partial}{\partial \phi}(F_\rho))\hat{\mathbf{z}}$$

The curl in spherical coordinates
Let $$\mathbf{F} = F_r\hat{\mathbf{r}} + F_\theta\hat{\mathbf{\theta}} + F_\phi\hat{\mathbf{\phi}}$$ denote an arbitrary vector field in spherical coordinates. By calculating circulation densities in surfaces perpendicular to $$\hat{\mathbf{r}}$$, $$\hat{\mathbf{\theta}}$$, and $$\hat{\mathbf{\phi}}$$, the curl can be computed:

$$\nabla \times \mathbf{F} = \frac{1}{r^2\sin\theta}(\frac{\partial}{\partial \theta}(r\sin\theta F_\phi) - \frac{\partial}{\partial \phi}(r F_\theta))\hat{\mathbf{r}} + \frac{1}{r\sin\theta}(\frac{\partial}{\partial \phi}(F_r) - \frac{\partial}{\partial r}(r\sin\theta F_\phi))\hat{\mathbf{\theta}} + \frac{1}{r}(\frac{\partial}{\partial r}(r F_\theta) - \frac{\partial}{\partial \theta}(F_r))\hat{\mathbf{\phi}}$$

$$ = \frac{1}{r\sin\theta}(\frac{\partial}{\partial \theta}(\sin\theta F_\phi) - \frac{\partial}{\partial \phi}(F_\theta))\hat{\mathbf{r}} + \frac{1}{r}(\frac{1}{\sin\theta}\frac{\partial}{\partial \phi}(F_r) - \frac{\partial}{\partial r}(r F_\phi))\hat{\mathbf{\theta}} + \frac{1}{r}(\frac{\partial}{\partial r}(r F_\theta) - \frac{\partial}{\partial \theta}(F_r))\hat{\mathbf{\phi}}$$

Irrotational vector fields
A vector field $$\mathbf{F}$$ for which $$\nabla \times \mathbf{F} = \mathbf{0}$$ at all points is an "irrotational" vector field. $$\mathbf{F}$$ can also be referred to as being "conservative" since the gain around any closed curve is always 0.

A key property of an irrotational vector field $$\mathbf{F}$$ is that the gain of $$\mathbf{F}$$ along a continuous curve is purely a function of the curve's end points. If $$C_1$$ and $$C_2$$ are two continuous curves which share the same starting point $$\mathbf{q}_0$$ and end point $$\mathbf{q}_1$$, then $$\int_{\mathbf{q} \in C_1} \mathbf{F}(\mathbf{q}) \cdot d\mathbf{q} = \int_{\mathbf{q} \in C_2} \mathbf{F}(\mathbf{q}) \cdot d\mathbf{q}$$. In other words, the gain is purely a function of $$\mathbf{q}_0$$ and $$\mathbf{q}_1$$. This property can be derived from Stokes' theorem as follows:

Invert the orientation of $$C_2$$ to get $$-C_2$$ and combine $$C_1$$ and $$-C_2$$ to get a continuous closed curve $$C_3 = C_1 - C_2$$, linking the curves together at the endpoints $$\mathbf{q}_0$$ and $$\mathbf{q}_1$$. Let $$\sigma$$ denote a surface for which $$C_3$$ is the counterclockwise oriented boundary.

Stokes' theorem states that $$\int_{\mathbf{q} \in C_3} \mathbf{F}(\mathbf{q}) \cdot d\mathbf{q} = \iint_{\mathbf{q} \in \sigma} (\nabla \times \mathbf{F})|_\mathbf{q} \cdot \mathbf{dS} = 0$$. The gain around $$C_3$$ is the gain along $$C_1$$ minus the gain along $$C_2$$: $$\int_{\mathbf{q} \in C_3} \mathbf{F}(\mathbf{q}) \cdot d\mathbf{q} = \int_{\mathbf{q} \in C_1} \mathbf{F}(\mathbf{q}) \cdot d\mathbf{q} + \int_{\mathbf{q} \in -C_2} \mathbf{F}(\mathbf{q}) \cdot d\mathbf{q}$$ $$ = \int_{\mathbf{q} \in C_1} \mathbf{F}(\mathbf{q}) \cdot d\mathbf{q} - \int_{\mathbf{q} \in C_2} \mathbf{F}(\mathbf{q}) \cdot d\mathbf{q}$$. Therefore:

$$\int_{\mathbf{q} \in C_3} \mathbf{F}(\mathbf{q}) \cdot d\mathbf{q} = 0$$ $$\implies \int_{\mathbf{q} \in C_1} \mathbf{F}(\mathbf{q}) \cdot d\mathbf{q} = \int_{\mathbf{q} \in C_2} \mathbf{F}(\mathbf{q}) \cdot d\mathbf{q}$$

Summary and Extensions
In summary:


 * The gradient of a scalar field $$f$$ is $$\nabla f = \frac{\partial f}{\partial x}\mathbf{i} + \frac{\partial f}{\partial y}\mathbf{j} + \frac{\partial f}{\partial z}\mathbf{k}$$ which denotes the rate of change in $$f$$ in each direction, at each point.
 * Given an oriented curve $$C$$ which starts at $$\mathbf{q}_0$$ and ends at $$\mathbf{q}_1$$, the increase in $$f$$ along $$C$$ is: $$f(\mathbf{q}_1) - f(\mathbf{q}_0) = \int_{\mathbf{q} \in C} (\nabla f)|_{\mathbf{q}} \cdot d\mathbf{q}$$ (the gradient theorem)


 * If a vector field $$\mathbf{F} = F_x\mathbf{i} + F_y\mathbf{j} + F_z\mathbf{k}$$ denotes "flow density", then the divergence is $$\nabla \cdot \mathbf{F} = \frac{\partial F_x}{\partial x} + \frac{\partial F_y}{\partial y} + \frac{\partial F_z}{\partial z}$$ which denotes the density of "flow generation" at each point.
 * Given a volume $$\Omega$$ with outwards oriented surface $$\partial\Omega$$, the total flow being generated inside $$\Omega$$ is: $$\iint_{\mathbf{q} \in \partial\Omega} \mathbf{F}(\mathbf{q}) \cdot \mathbf{dS} = \iiint_{\mathbf{q} \in \Omega} (\nabla \cdot \mathbf{F})|_{\mathbf{q}} dV$$ (Gauss's divergence theorem)


 * The curl of a vector field $$\mathbf{F} = F_x\mathbf{i} + F_y\mathbf{j} + F_z\mathbf{k}$$ is $$\nabla \times \mathbf{F} = \left(\frac{\partial F_z}{\partial y} - \frac{\partial F_y}{\partial z}\right)\mathbf{i} + \left(\frac{\partial F_x}{\partial z} - \frac{\partial F_z}{\partial x}\right)\mathbf{j} + \left(\frac{\partial F_y}{\partial x} - \frac{\partial F_x}{\partial y}\right)\mathbf{k}$$ which denotes the "circulation density" at each point.
 * Given an oriented surface $$\sigma$$ with a counter-clockwise oriented boundary $$\partial\sigma$$, the total circulation present in $$\sigma$$ is: $$\int_{\mathbf{q} \in \partial\sigma} \mathbf{F}(\mathbf{q}) \cdot d\mathbf{q} = \iint_{\mathbf{q} \in \sigma} (\nabla \times \mathbf{F})|_{\mathbf{q}} \cdot \mathbf{dS}$$ (Stokes' theorem)

Extending the gradient theorem
The gradient theorem states that given an everywhere differentiable scalar field $$f$$ and a continuous oriented curve $$C$$ with endpoints $$\mathbf{q}_0$$ and $$\mathbf{q}_1$$, that $$f(\mathbf{q}_1) - f(\mathbf{q}_0) = \int_{\mathbf{q} \in C} (\nabla f)|_{\mathbf{q}} \cdot d\mathbf{q}$$. This theorem can be extended to equate a surface integral with a volume integral, as opposed to equating a difference with a path integral.

Let $$\Omega$$ be an arbitrary volume with outwards oriented surface $$\partial\Omega$$. Let $$L = (x_l,y,z)-(x_u,y,z)$$ be an arbitrary line segment parallel to the x-axis that is completely contained by $$\Omega$$ and that starts and ends on the surface of $$\Omega$$. Let this line segment have an infinitesimal cross-sectional area of $$t$$. The volume integral of $$\frac{\partial f}{\partial x}$$ over $$L$$ is: $$\iiint_{\mathbf{q} \in L} \frac{\partial f}{\partial x}dV = t\int_{x=x_l}^{x_u} \frac{\partial f}{\partial x}dx = t(f(x_u,y,z) - f(x_l,y,z))$$. Let $$\mathbf{dS}_l$$ and $$\mathbf{dS}_u$$ be the infinitesimal surface portions of $$\partial\Omega$$ formed when $$L$$ intersects $$\partial\Omega$$ at $$(x_l,y,z)$$ and $$(x_u,y,z)$$ respectively. The x-component of $$\mathbf{dS}_l$$ and $$\mathbf{dS}_u$$ is $$-t$$ and $$t$$ respectively. Adding up all possible line segments $$L$$ gives:

$$\iiint_{\mathbf{q} \in \Omega} \frac{\partial f}{\partial x}dV = \iint_{\mathbf{q} \in \partial\Omega} f(\mathbf{q})dS_x$$ where $$dS_x$$ is the x-component of the differential $$\mathbf{dS}$$.

Repeating for the y-axis and z-axis gives:

$$\iiint_{\mathbf{q} \in \Omega} \frac{\partial f}{\partial y}dV = \iint_{\mathbf{q} \in \partial\Omega} f(\mathbf{q})dS_y$$ where $$dS_y$$ is the y-component of the differential $$\mathbf{dS}$$.

$$\iiint_{\mathbf{q} \in \Omega} \frac{\partial f}{\partial z}dV = \iint_{\mathbf{q} \in \partial\Omega} f(\mathbf{q})dS_z$$ where $$dS_z$$ is the z-component of the differential $$\mathbf{dS}$$.

This yields:

$$\iiint_{\mathbf{q} \in \Omega} \left(\frac{\partial f}{\partial x}\mathbf{i} + \frac{\partial f}{\partial y}\mathbf{j} + \frac{\partial f}{\partial z}\mathbf{k}\right)dV = \iint_{\mathbf{q} \in \partial\Omega} f(\mathbf{q})(dS_x\mathbf{i} + dS_y\mathbf{j} + dS_z\mathbf{k})$$

and hence:

$$\iint_{\mathbf{q} \in \partial\Omega} f(\mathbf{q})\mathbf{dS} = \iiint_{\mathbf{q} \in \Omega} (\nabla f)|_{\mathbf{q}}dV$$

The above integral equation is effectively a generalization of the gradient theorem.

Extending Stokes' Theorem
Stokes' theorem states that given an everywhere differentiable vector field $$\mathbf{F} = F_x\mathbf{i} + F_y\mathbf{j} + F_z\mathbf{k}$$ and an oriented surface $$\sigma$$ with counterclockwise boundary $$\partial\sigma$$, that $$\int_{\mathbf{q} \in \partial\sigma} \mathbf{F}(\mathbf{q}) \cdot d\mathbf{q} = \iint_{\mathbf{q} \in \sigma} (\nabla \times \mathbf{F})|_{\mathbf{q}} \cdot \mathbf{dS}$$. This theorem can be extended to equate a surface integral with a volume integral, as opposed to equating a path integral with a surface integral.

Let $$\Omega$$ be an arbitrary volume with outwards oriented surface $$\partial\Omega$$. Let $$x_c \in \R$$ be arbitrary, and let $$D$$ be the cross-section of $$\Omega$$ in the plane $$x = x_c$$. Let $$\partial D$$ be the counter-clockwise boundary of $$D$$ (the surface normal vectors of $$D$$ point in the positive x-direction). Green's theorem gives:

$$\int_{\mathbf{q} \in \partial D} \mathbf{F}(\mathbf{q}) \cdot d\mathbf{q} = \iint_{\mathbf{q} \in D} \left(\frac{\partial F_z}{\partial y}-\frac{\partial F_y}{\partial z}\right)dydz$$

Now let the cross-section $$D$$ have an infinitesimal thickness $$dx$$, forming the volume slice $$D'$$. Let $$E$$ denote the infinitesimal strip of $$\partial\Omega$$ that wraps the cross-section ($$E$$ is similar to $$\partial D$$ except that $$E$$ is a surface with a non-zero infinitesimal width). Let $$\mathbf{dS}$$ be an infinitesimal portion of $$E$$. Ignoring the component of $$\mathbf{dS}$$ that is parallel to $$D$$, $$dS_y\mathbf{j} + dS_z\mathbf{k}$$ denotes a thin strip of surface that wraps around $$D$$, and is parallel to the x-axis. The counterclockwise displacement $$d\mathbf{q}$$ along the boundary of $$D$$ manifested by $$dS_y\mathbf{j} + dS_z\mathbf{k}$$ is $$d\mathbf{q} = -\frac{dS_z}{dx}\mathbf{j} + \frac{dS_y}{dx}\mathbf{k}$$. Substituting into the path integral around $$\partial D$$ gives:

$$\iint_{\mathbf{q} \in E} (F_z(\mathbf{q})\frac{dS_y}{dx} - F_y(\mathbf{q})\frac{dS_z}{dx}) = \iint_{\mathbf{q} \in D} \left(\frac{\partial F_z}{\partial y}-\frac{\partial F_y}{\partial z}\right)dydz $$

$$ \implies \iint_{\mathbf{q} \in E} (F_z(\mathbf{q})dS_y - F_y(\mathbf{q})dS_z) = \iiint_{\mathbf{q} \in D'} \left(\frac{\partial F_z}{\partial y}-\frac{\partial F_y}{\partial z}\right)dV$$

Integrating over all cross-sections gives:

$$\iint_{\mathbf{q} \in \partial\Omega} (F_z(\mathbf{q})dS_y - F_y(\mathbf{q})dS_z) = \iiint_{\mathbf{q} \in \Omega} \left(\frac{\partial F_z}{\partial y}-\frac{\partial F_y}{\partial z}\right)dV$$

Repeating the above argument for the y-axis and z-axis gives:

$$\iint_{\mathbf{q} \in \partial\Omega} (F_x(\mathbf{q})dS_z - F_z(\mathbf{q})dS_x) = \iiint_{\mathbf{q} \in \Omega} \left(\frac{\partial F_x}{\partial z}-\frac{\partial F_z}{\partial x}\right)dV$$

$$\iint_{\mathbf{q} \in \partial\Omega} (F_y(\mathbf{q})dS_x - F_x(\mathbf{q})dS_y) = \iiint_{\mathbf{q} \in \Omega} \left(\frac{\partial F_y}{\partial x}-\frac{\partial F_x}{\partial y}\right)dV$$

This yields:

$$\iint_{\mathbf{q} \in \partial\Omega} ((F_z(\mathbf{q})dS_y - F_y(\mathbf{q})dS_z)\mathbf{i} + (F_x(\mathbf{q})dS_z - F_z(\mathbf{q})dS_x)\mathbf{j} + (F_y(\mathbf{q})dS_x - F_x(\mathbf{q})dS_y)\mathbf{k})$$ $$= \iiint_{\mathbf{q} \in \Omega} \left(\left(\frac{\partial F_z}{\partial y}-\frac{\partial F_y}{\partial z}\right)\mathbf{i} + \left(\frac{\partial F_x}{\partial z}-\frac{\partial F_z}{\partial x}\right)\mathbf{j} + \left(\frac{\partial F_y}{\partial x}-\frac{\partial F_x}{\partial y}\right)\mathbf{k}\right)dV$$

$$\implies \iint_{\mathbf{q} \in \partial\Omega} \mathbf{dS} \times \mathbf{F}(\mathbf{q}) = \iiint_{\mathbf{q} \in \Omega} (\nabla \times \mathbf{F})|_\mathbf{q} dV$$

The above integral equation is effectively a generalization of Stokes' theorem.