Directional derivative and gradient examples
Example 1
Let $f(x,y) = x^2y.$ (a) Find $\nabla f(3,2)$. (b) Find the derivative of $f$ in the direction of (1,2) at the point (3,2).
Solution: (a) The gradient is just the vector of partial derivatives. The partial derivatives of $f$ at the point $(x,y)=(3,2)$ are: \begin{align*} \pdiff{f}{x}(x,y) & = 2xy & \pdiff{f}{y}(x,y) & = x^2\\ \pdiff{f}{x}(3,2) & = 12 & \pdiff{f}{y}(3,2) & = 9 \end{align*} Therefore, the gradient is \begin{align*} \nabla f (3,2) = 12 \vc{i} + 9 \vc{j} = (12,9). \end{align*}
(b) Let $\vc{u}=u_1\vc{i} + u_2 \vc{j}$ be a unit vector. The directional derivative at (3,2) in the direction of $\vc{u}$ is \begin{align} D_{\vc{u}}f(3,2) &= \nabla f(3,2) \cdot \vc{u}\notag\\ &= (12 \vc{i} + 9 \vc{j}) \cdot (u_1\vc{i} + u_2 \vc{j})\notag\\ &= 12 u_1 + 9 u_2. \label{Dub} \end{align}
To find the directional derivative in the direction of the vector (1,2), we need to find a unit vector in the direction of the vector (1,2). We simply divide by the magnitude of $(1,2)$. \begin{align*} \vc{u} = \frac{(1,2)}{\| (1,2) \|} = \frac{(1,2)}{\sqrt{1^2+2^2}} = \frac{(1,2)}{\sqrt{5}} = (1/\sqrt{5},2/\sqrt{5}). \end{align*} Plugging this expression for $\vc{u} = (u_1, u_2)$ into equation \eqref{Dub} for the directional derivative, and we find that the directional derivative at the point $(3,2)$ in the direction of $(1,2)$ is \begin{align*} D_{\vc{u}}f(3,2) &= 12 u_1 + 9 u_2\\ &= \frac{12}{\sqrt{5}} + \frac{18}{\sqrt{5}} = \frac{30}{\sqrt{5}}. \end{align*}
Example 2
For the $f$ of Example 1, find the directional derivative of $f$ at the point (3,2) in the direciton of $(2,1)$.
Solution: The unit vector in the direction of $(2,1)$ is \begin{align*} \vc{u} = \frac{(2,1)}{\sqrt{5}} = (2/\sqrt{5},1/\sqrt{5}). \end{align*} Since we are still at the point (3,2), equation \eqref{Dub} is still valid. We plug in our new $\vc{u}$ to obtain \begin{align*} D_{\vc{u}}f(3,2) &= 12 u_1 + 9 u_2\\ &= \frac{24}{\sqrt{5}} + \frac{9}{\sqrt{5}} = \frac{33}{\sqrt{5}} \end{align*}
Example 3
For the $f$ of Example 1 at the point (3,2), (a) in which direction is the directional derivative maximal, (b) what is the directional derivative in that direction?
Solution: (a) The gradient points in the direction of the maximal directional derivative. The directional derivative is maximal in the direction of (12,9). (A unit vector in that direction is $\vc{u} = (12,9)/\sqrt{12^2+9^2} = (4/5, 3/5)$.)
(b) The magnitude of the gradient is this maximal directional derivative, which is $\|(12,9)\| = \sqrt{12^2+9^2} = 15$. Hence the directional derivative at the point (3,2) in the direction of (12,9) is 15.
We could double-check by calculating the result using equation \eqref{Dub} and the unit vector $\vc{u} = (4/5,3/5)$. Then we find that \begin{align*} D_{\vc{u}}f(3,2) &= 12 u_1 + 9 u_2\\ &= \frac{48}{5} + \frac{27}{5} = \frac{75}{5}=15, \end{align*} which agrees with our result.
Example 4
For the $f$ of Example 1 at the point (3,2), (a) what is the directional derivative in the direction (-3,4) (which is perpendicular to $\nabla f(3,2)$), and (b) what is the directional derivative in the direction (-4,-3) (which is opposite of the direction of $\nabla f(3,2)$)?
Solution: (a) The directional derivative must be zero. (b) The directional derivative must be $-\| \nabla f(3,2)\|$, which is $-15$. (You can verify these by calculating the results directly using equation \eqref{Dub}.)
