8 Gradient of a scalar field
Lets consider the problem of calculating the rate of change of a scalar \(\phi\) in some particular direction. For an infinitesimal vector displacement \(d\mathbf{r}\) forming its scalar product we get \[ \begin{aligned} \nabla \phi \cdot d \mathbf{r} & =\left(\frac{\partial \phi}{\partial x} \hat{\imath}+\frac{\partial \phi}{\partial y} \hat{\jmath}+\frac{\partial \phi}{\partial z} \hat{k}\right) \cdot(\hat{\imath} d x+\hat{\jmath} dy+ \hat{k} d z) \\ & =\frac{\partial \phi}{\partial x} d x+\frac{\partial \phi}{\partial y} d y+\frac{\partial \phi}{\partial z} d z \end{aligned} \]
8.1 Partial Derivative
Ok lets pause for a second and look at exactly what a partial derivative is.
Lets take a function of two variables \(f(x, y)\) We can define a derivative for \(f(x, y)\) in \(x\) by saying that it is the derisive of \(f(x, y)\) when holding \(y\) constant (we could do the same with respect to \(y\) holding \(x\) constant). We write this \(\frac{\partial f}{\partial x}\) the partial derivative of \(f(x, y)\) with respect to \(x\). Similarly \(\frac{\partial f}{\partial y}\). Formally this is \[ \frac{\partial f}{\partial x}=\lim _{\Delta x \rightarrow 0} \frac{f(x+\Delta x, y)-f(x, y)}{\Delta x} \]
and similarly for \(\frac{\partial f}{\partial y}\). You may also see partials written as \(\left(\frac{\partial f}{\partial x}\right)_{y}\) would indicate \(y\) is held constant.
8.2 Total differential and total derivative
Suppose we make small changes in \(x\) and \(y\) \[ \begin{aligned} \Delta f &=f(x+\Delta x, y+\Delta y)-f(x, y) \\ &= \left[\frac{f(x+\Delta x, y+\Delta y)-f(x, y+\Delta y)}{ \Delta x}\right] \Delta x+\left[\frac{f(x+\Delta x, y + \Delta y)-f(x+\Delta x, y)}{\Delta y}\right]\Delta y\\ \Delta f &\approx \frac{\partial f(x, y)}{\partial x} \Delta x+\frac{\partial f(x, y)}{\partial y} \Delta y \end{aligned} \]
\(\Delta x+\Delta y \rightarrow 0\) we get the ‘total differential’ \[ d f=\frac{\partial f(x, y)}{\partial x} d x+\frac{\partial f(x, y)}{\partial y} d y \]
this can he extended to \[ d f=\frac{\partial f}{\partial x_{1}} d x_{1}+\frac{\partial f}{\partial x_{2}} d x_{2}+\frac{\partial f}{\partial x_{3}} d x_{3}+\cdots \frac{\partial f}{\partial x_{n}} d x_{n} \]
Returning back to our original work \[ \nabla \phi \cdot d \mathbf{r}=\frac{\partial \phi}{\partial x} d x+\frac{\partial \phi}{\partial y} d y+\frac{\partial \phi}{\partial z} d z \] the right hand side is the total differential in \(\phi\).
Now lets consider \(x\) and \(y\) are functions of \(u\) \[ \begin{aligned} & d f=\frac{\partial f}{\partial x} d x+\frac{\partial f}{\partial y} d y \\ & \frac{d f}{d u}=\frac{\partial f}{\partial x} \frac{d x}{d u}+\frac{\partial f}{\partial y} \frac{d y}{d y} \\ & \frac{d f}{d u}=\sum_{i=1}^{n} \frac{\partial f}{\partial x_{i}} \frac{d x_{i}}{d u} \end{aligned} \]
Chain Rule for partial differentiation.