14. Directional Derivatives and Gradients

a. Derivative along a Curve and the Gradient

Suppose the density of the air in a room is given by \(\delta=\delta(x,y,z)\). Also suppose there is a fly flying around the room moving along some path \(\vec r(t)=(x(t),y(t),z(t))\). At each time \(t\), the fly sees the density to be the composition \[ \delta(t)=(\delta\circ\vec r)(t)=\delta(\vec r(t)) \] Find the rate of change of the density as seen by the fly.

The notation \(\delta(t)\) is mathematically incorrect since \(\delta\) is actually a function of \(3\) variables not \(1\). However, this usage is commonplace and referred to as “abuse of notation”.

The derivative of the density is found by the chain rule: \[ \dfrac{d\delta}{dt}=\dfrac{d(\delta\circ\vec r)}{dt} =\dfrac{\partial \delta}{\partial x}\dfrac{dx}{dt} +\dfrac{\partial \delta}{\partial y}\dfrac{dy}{dt} +\dfrac{\partial \delta}{\partial z}\dfrac{dz}{dt} \] Looking at this formula, we recognize the right side as a dot product of two vectors: \[ \dfrac{d\delta }{dt} =\left\langle \dfrac{dx}{dt},\dfrac{dy}{dt},\dfrac{dz}{dt}\right\rangle \cdot\left\langle \dfrac{\partial \delta}{\partial x}, \dfrac{\partial \delta}{\partial y}, \dfrac{\partial \delta}{\partial z}\right\rangle \] The first is simply the velocity (tangent vector) to the curve: \[ \vec v=\dfrac{d\vec r}{dt} =\left\langle \dfrac{dx}{dt},\dfrac{dy}{dt},\dfrac{dz}{dt}\right\rangle \] The second is something new. It is called the gradient of the function \(\delta\) which is denoted: \[ \text{grad}\,\delta=\vec\nabla\delta= \left\langle \dfrac{\partial \delta}{\partial x}, \dfrac{\partial \delta}{\partial y}, \dfrac{\partial \delta}{\partial z}\right\rangle \]

The symbol \(\nabla\) is read as "del". It is an upside down, capital, Greek delta \(\Delta\). If you want, you can think of \(\nabla\) as an upper case partial \(\partial\).

Consequently, the rate of change of the density as seen by the fly is: \[ \dfrac{d\delta}{dt}=\dfrac{d(\delta\circ\vec r)}{dt} =\vec v\cdot\vec\nabla\delta \]

To summarize:

Given a function \(f(x,y,z)\), its gradient is the vector field of its partial derivatives: \[ \text{grad}\,f=\vec\nabla f= \left\langle \dfrac{\partial f}{\partial x}, \dfrac{\partial f}{\partial y}, \dfrac{\partial f}{\partial z}\right\rangle \] Given a curve \(\vec r(t)=(x(t),y(t),z(t))\), the composition \[ f(t)=(f\circ\vec r)(t)=f(\vec r(t)) \] is called the value of the function \(f\) along the curve \(\vec r(t)\) or the restriction of the function \(f\) to the curve \(\vec r(t)\). Further, the derivative of the composition \[ \dfrac{df}{dt}=\dfrac{d(f\circ\vec r)}{dt} =\dfrac{\partial f}{\partial x}\dfrac{dx}{dt} +\dfrac{\partial f}{\partial y}\dfrac{dy}{dt} +\dfrac{\partial f}{\partial z}\dfrac{dz}{dt} =\vec v\cdot\vec\nabla f \] is called the derivative of the function \(f\) along the curve \(\vec r(t)\).

It should be noted that the derivative along a curve is independent of the detailed path of the curve other than the current position and current velocity. In other words, if two curves pass through the same point and have the same velocity at that point, then the derivative along the curve at that point is the same for both curves. In the figure, all three curves pass through \(P\) and have the same velocity there: \[ \vec v_1(P)=\vec v_2(P)=\vec v_3(P). \] So the derivative of any function \(f\) at \(P\) is the same along all \(3\) curves: \[ \left.\dfrac{d(f\circ\vec r_1)}{dt}\right|_P =\left.\dfrac{d(f\circ\vec r_2)}{dt}\right|_P =\left.\dfrac{d(f\circ\vec r_3)}{dt}\right|_P \]

The temperature in \(^\circ K\) in a room is given by \(T=275+\sin(\pi x)\cos(\pi y)+\sin(\pi z)\). A fly is flying along the curve \(\vec r(t)=(1+t,-t^2,2t)\). Find the rate of change of \(T\) as seen by the fly at \(t=1\).

The fly's velocity is \(\vec v(t)=\vec r'(t)=\langle 1,-2t,2\rangle\). At \(t=1\) the fly's position is \(\vec r(1)=(2,-1,2)\) and its velocity is \(\vec v(1)=\langle 1,-2,2\rangle\). The gradient of the temperature is \[\begin{aligned} \vec\nabla T &=\left\langle \dfrac{\partial T}{\partial x}, \dfrac{\partial T}{\partial y}, \dfrac{\partial T}{\partial z}\right\rangle\\ &=\langle \pi\cos(\pi x)\cos(\pi y), -\pi\sin(\pi x)\sin(\pi y), \pi\cos(\pi z)\rangle \end{aligned}\] At \(P=(2,-1,2)\) this is \[\begin{aligned} \left.\vec\nabla T\right|_P &=\langle \pi\cos(2\pi)\cos(-\pi), -\pi\sin(2\pi)\sin(-\pi), \pi\cos(2\pi)\rangle\\ &=\langle -\pi,0,\pi\rangle \end{aligned}\] So the derivative along the curve at \(t=1\) is: \[\begin{aligned} \left.\dfrac{dT}{dt}\right|_{t=1} &=\vec v(1)\cdot\left.\vec\nabla T\right|_P &=\langle 1,-2,2\rangle\cdot\langle -\pi,0,\pi\rangle &=-\pi+0+2\pi=\pi \end{aligned}\]

Since we have complete information about the functions, we can also form the composition: \[ T(t)=T(\vec r(t))=275+\sin(\pi(1+t))\cos(-\pi t^2)+\sin(2\pi t) \] and compute the derivative directly: \[\begin{aligned} \dfrac{dT}{dt} &=\pi\cos(\pi(1+t))\cos(-\pi t^2) \\ &\quad+2\pi t\sin(\pi(1+t))\sin(-\pi t^2)+2\pi\cos(2\pi t) \\ \end{aligned}\] Then \[\begin{aligned} \left.\dfrac{dT}{dt}\right|_{t=1} &=\pi\cos(2\pi)\cos(-\pi) \\ &\quad+2\pi\sin(2\pi)\sin(-\pi)+2\pi\cos(2\pi) =\pi \end{aligned}\] The benefit of the gradient formula, \(\dfrac{df}{dt}=\vec v\cdot\vec\nabla f\), comes when we only have partial information,

Since the derivative along a curve only depends on the current position and velocity, we can solve a problem with only partial information.

A weather balloon is passing through a region where the barometric pressure is given by \(P=z(2-\cos x)(2+\sin y)\). If its current position is \((x,y,z)=\left(\dfrac{\pi}{2},\pi,2\right)\) and its current velocity is \(\vec v=\langle 3,2,1\rangle\), find the rate of change of the barometric pressure as seen by the balloon.


The gradient of the barometric pressure is \[\begin{aligned} \vec\nabla P &=\left\langle \dfrac{\partial P}{\partial x}, \dfrac{\partial P}{\partial y}, \dfrac{\partial P}{\partial z}\right\rangle\\ &=\langle z(\sin x)(2+\sin y),z(2-\cos x)(\cos y), \\ &\qquad(2-\cos x)(2+\sin y)\rangle \end{aligned}\] Currently, this is \[\begin{aligned} \left.\vec\nabla P\right|_{(\pi/2,\pi,2)} &=\left\langle 2\left(\sin\dfrac{\pi}{2}\right)(2+\sin\pi), 2\left(2-\cos\dfrac{\pi}{2}\right)(\cos\pi), \right. \\ &\qquad\left.\left(2-\cos\dfrac{\pi}{2}\right)(2+\sin\pi)\right\rangle \\ &=\langle 4,-4,4\rangle \end{aligned}\] So, the current rate of change of the barometric pressure as seen by the balloon is: \[ \dfrac{dP}{dt} =\vec v\cdot\left.\vec\nabla P\right|_{(\pi/2,\pi,2)} =\left\langle 3,2,1\right\rangle\cdot\left\langle 4,-4,4\right\rangle =8 \]

Here, we only have partial information because we don't know the weather balloon's full path, only it current position and velocity.

© MYMathApps

Supported in part by NSF Grant #1123255