Chapter 4: The Master Formula

4.1: The Gradient

Take another look at the formula for the differential of a function of several variables, namely \begin{equation} df = \Partial{f}{x}\,dx + \Partial{f}{y}\,dy + \Partial{f}{z}\,dz \end{equation} Each term is a product of two factors, labeled by $x$, $y$, and $z$. This looks like a dot product! Separating out the pieces, we have \begin{equation} df = \left( \Partial{f}{x}\,\ii + \Partial{f}{y}\,\jj + \Partial{f}{z}\,\kk \right) \cdot (dx\,\ii + dy\,\jj + dz\,\kk) \end{equation} The last factor is just $d\rr$, and you may recognize the first factor as the gradient of $f$, that is \begin{equation} \grad{f} = \Partial{f}{x}\,\ii + \Partial{f}{y}\,\jj + \Partial{f}{z}\,\kk \end{equation} Putting this all together, we have the master formula 1) \begin{equation} df = \grad{f} \cdot d\rr \label{Master} \end{equation}

Recall that $df$ represents the infinitesimal change in $f$ when moving to a “nearby” point. What information do you need in order to know how $f$ changes? You must know where you started, which way you went, and something about how $f$ behaves. The master formula organizes this information into two geometrically different pieces, namely the gradient, containing generic information about how $f$ changes at the point in question, and the vector differential $d\rr$, containing information about the particular change in position being made.

Differentials by themselves are rarely the answer to any question. So what good is the master formula? The short answer is that you can use it to answer any question about how $f$ changes. Here are some examples.

  1. Suppose you are an ant walking in a puddle on a flat table. The depth of the puddle is given by $h(x,y)$. You are given $x$ and $y$ as functions of time $t$. How fast is the depth of water through which you are walking changing per unit time?

This problem is asking for the derivative of $h$ with respect to $t$. So divide the master formula by $dt$ to get \begin{equation} {dh\over dt} = \grad{h} \cdot {d\rr\over dt} \end{equation} where $\rr$ describes the particular path you are taking. The factor $d\rr\over dt$ is simply your velocity! This dot product is easy to evaluate, and yields the answer to the question.

(There are of course many ways to solve this problem; which method you choose may depend on how your path is described. It is often easiest to simply insert the given expressions for $x$ and $y$ in terms of $t$ directly into $h$, then differentiate the resulting function of a single variable, thus calculating the left-hand side directly.)

  1. You are another ant on the same surface, moving on a path with $y=3x$. How fast is the depth changing compared with $x$?

This problem is asking for the derivative of $h$ with respect to $x$ as you move along the path; note that this is the total derivative $dh\over dx$, not the partial derivative $\Partial{h}{x}$, which would only be appropriate if $y$ were constant along the path. So divide the master formula by $dx$ to get \begin{equation} {dh\over dx} = \grad{h} \cdot {d\rr\over dx} \end{equation} then compute \begin{equation} d\rr = dx\,\ii+dy\,\jj = dx\,\ii+3\,dx\,\jj = (\ii+3\,\jj) \,dx \end{equation} to obtain \begin{equation} {d\rr\over dx} % = {dx\over dx}\ii + {dy\over dx}\jj = \ii + 3\,\jj \end{equation} Evaluating the dot product yields the answer to the question.

(This problem could also be done using the chain rule, but the necessary formula \begin{equation} {dh\over dx} = \Partial{h}{x} + \Partial{h}{y} {dy\over dx} \end{equation} is too abstract for many students.)

  1. You are still moving on the same surface, but now the question is how fast is the depth changing per unit distance along the path?

This problem is asking for the derivative of $h$ with respect to arclength $ds$. We can divide the master formula by $ds$, which leads to \begin{equation} {dh\over ds} = \grad{h} \cdot {d\rr\over ds} \end{equation} Unfortunately, it may be (and usually is) quite difficult to determine what $s$ is; it is not always possible to express $h$ as a function of $s$. On the other hand, all we need to know is that \begin{equation} ds = |d\rr| \end{equation} so that dividing $d\rr$ by $ds$ is just dividing by its length; the result must be a unit vector! Which unit vector? The one tangent to your path, namely the unit tangent vector $\TT$. So we finally have \begin{equation} {dh\over ds} = \grad{h} \cdot \TT \end{equation} and the left-hand side is just the directional derivative of $h$ in the direction $\TT$, often denoted by $\DD{\TT}h$. Evaluating the dot product yields the answer to the question, without ever worrying about arclength.

1) This formula can in fact be taken as the definition of the gradient!

4.2: Other Coordinates

The master formula can be used to derive expressions for the gradient in other coordinate systems. We illustrate the method for polar coordinates.

In polar coordinates, we have \begin{equation} df = \Partial{f}{r}\,dr + \Partial{f}{\phi}\,d\phi \end{equation} and of course \begin{eqnarray*} d\rr = dr\,\rhat + r\,d\phi\,\phat \end{eqnarray*} which is (5) of Chapter 3. Comparing these expressions with ($\ref{Master}$), we see immediately that we must have \begin{equation} \grad f = \Partial{f}{r}\,\rhat + \frac{1}{r}\Partial{f}{\phi}\,\phat \label{gradpolar} \end{equation} Note the factor of $\frac{1}{r}$, which is needed to compensate for the factor of $r$ in (5) of Chapter 3, and which is typical for the component expressions of vector derivatives in curvilinear coordinates.

An illustration of the advantages of using another basis is the computation of $\grad\,\left({\ln\sqrt{x^2+y^2}}\right)$. Students who try to compute this by brute force will find it straightforward but messy, but even those who first remove the square root may well apply a nonexistent addition formula and obtain an incorrect answer. Alternatively, using ($\ref{gradpolar}$), it is easy to see that \begin{equation} \grad\,\left({\ln\sqrt{x^2+y^2}}\right) = \grad\,({\ln r}) = {1\over r}\,\rhat \end{equation}


Personal Tools