# 14. Directional Derivatives and Gradients

## b. Derivative along a Vector

When we introduced the *limit* definition of partial derivatives,
we also gave the definition of the derivative of a function \(f(x,y)\)
along an
arbitrary vector \(\vec v\):

Given any vector \(\vec v\), the derivative of \(f(x,y)\) along \(\vec v\) (or with respect to \(\vec v\)) is: \[ \nabla_{\vec v}f=\lim_{h\rightarrow 0} \dfrac{f((x,y)+h\vec v)-f(x,y)}{h} \]

Now that we have covered the
chain rule, we can give a formula for the derivative along a vector
that does *not* involve *limits*.

Given any vector \(\vec v\), the derivative of \(f(x,y)\) along \(\vec v\) (or with respect to \(\vec v\)) is: \[ \nabla_{\vec v}f=\vec v\cdot\vec\nabla f \] The proof is easy. Try reading it!

Given a vector \(\vec v\), consider the parametric curve \(\vec r(t)=(x,y)+t\vec v\). We will compute the derivative of the composition \[ f(t)=(f\circ\vec r)(t)=f(\vec r(t)) \] at \(t=0\) in two ways. On the one hand, the derivative of the composition is the derivative along the curve as discussed on the previous page: \[ \left.\dfrac{df}{dt}\right|_{t=0} =\left.\dfrac{d(f\circ\vec r)}{dt}\right|_{t=0} =\vec v\cdot\left.\vec\nabla f\right|_{\vec r(0)} =\vec v\cdot\left.\vec\nabla f\right|_{(x,y)} \] On the other hand, since the composition is a function of \(1\) variable, we can compute its derivative using the limit definition: \[\begin{aligned} \left.\dfrac{df}{dt}\right|_{t=0} =\left.\dfrac{d(f\circ\vec r)}{dt}\right|_{t=0} &=\lim_{h\rightarrow 0} \dfrac{(f\circ\vec r)(0+h)-(f\circ\vec r)(0)}{h}\\ &=\lim_{h\rightarrow 0} \dfrac{(f(\vec r(h))-(f(\vec r(0))}{h}\\ &=\lim_{h\rightarrow 0} \dfrac{f((x,y)+h\vec v)-f(x,y)}{h} \end{aligned}\] But this is the limit of \(\nabla_{\vec v}f\). Consequently: \[ \nabla_{\vec v}f=\vec v\cdot\vec\nabla f \]

As a simple consequence, we have:

The derivative of \(f(x,y)\) along a curve \(\vec r(t)\) is: \[ \dfrac{df}{dt}=\dfrac{d(f\circ\vec r)}{dt} =\vec v\cdot\vec\nabla f=\nabla_{\vec v}f \] In words, the derivative of \(f(x,y)\) along a curve \(\vec r(t)\) is the derivative of \(f(x,y)\) along its velocity (tangent vector) \(\vec v\). Conversely, the derivative of \(f(x,y)\) along a vector \(\vec v\) is the derivative of \(f(x,y)\) along any curve which passes through \((x,y)\) with velocity \(\vec v\).

Find the derivative of \(f(x,y)=\dfrac{x}{y}\) along \(\vec v=\langle 3,4\rangle\) at the point \(P=(1,2)\).

The gradient of \(f\) is: \[ \vec\nabla f =\left\langle \dfrac{\partial f}{\partial x}, \dfrac{\partial f}{\partial y}\right\rangle =\left\langle \dfrac{1}{y},-\,\dfrac{x}{y^2}\right\rangle \] At the point \(P\) this is: \[ \left.\vec\nabla f\right|_P =\left\langle \dfrac{1}{2},-\,\dfrac{1}{4}\right\rangle \] So the derivative of \(f\) along \(\vec v\) is: \[ \left.\vec\nabla_{\vec v}f\right|_P =\vec v\cdot\left.\vec\nabla_f\right|_P =\langle 3,4\rangle\cdot\left\langle \dfrac{1}{2},-\,\dfrac{1}{4}\right\rangle =\dfrac{3}{2}-1 =\dfrac{1}{2} \]

Find the rate of change of \(f=\dfrac{x}{y}\) along the curve \(\vec r(t)=(1+3t,2+4t)\) at \(t=0\). (Note that this is a straight line.)

Since the point is \(P=\vec r(0)=(1,2)\) and the velocity is \(\vec v=\dfrac{d\vec r}{dt}=\langle 3,4\rangle\), the rate of change is the same as the derivative in the previous example. \[ \dfrac{df}{dt}=\left.\vec\nabla_{\vec v}f\right|_P =\dfrac{1}{2} \]

Find the rate of change of \(f=\dfrac{x}{y}\) along the curve
\(\vec r(t)=(t^3,2 t^2)\) at \(t=1\). (Note that this is *not* a
straight line.)

Since the point is \(P=\vec r(1)=(1,2)\) and the velocity is \(\vec v=\left.\dfrac{d\vec r}{dt}\right|_{t=1} =\left.\langle 3t^2,4t\rangle\right|_{t=1} =\langle 3,4\rangle\), the rate of change is the same as in the previous example. \[ \dfrac{df}{dt}=\left.\vec\nabla_{\vec v}f\right|_P =\dfrac{1}{2} \]

Find the derivative of \(P=z(2-\cos x)(2+\sin y)\) along \(\vec v=\langle 3,2,1\rangle\) at the point \(X=(x,y,z)=(\dfrac{\pi}{2},\pi,2)\).

\(\nabla_{\vec v}P=8\)

The gradient of \(P\) is \[\begin{aligned} \vec\nabla P &=\left\langle z(\sin x)(2+\sin y), z(2-\cos x)(\cos y),\right. \\ &\qquad\left.(2-\cos x)(2+\sin y)\right\rangle \end{aligned}\] At the point \(X\) 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 derivative of \(P\) along \(\vec v\) is: \[ \nabla_{\vec v}P =\vec v\cdot\left.\vec\nabla P\right|_{(\pi/2,\pi,2)} =\langle 3,2,1\rangle\cdot\langle 4,-4,4\rangle =8 \]

Notice that this exercise is essentially the same as the last exercise on the previous page except the first is along a curve and the second is along a vector which happens to be the velocity of that curve.

## Heading

Placeholder text: Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum