Skip to main content

Section 3.10 PD5: The Gradient

Handout PD5: Lecture Scaffold

Motivating Question.

Recall: if \(f(x,y)\) is a function of two variables, the partial derivatives represent the rates of change of \(f\) as we approach along specific trajectories. Specifically, \(f_x\) represents rate of change as we move parallel to the \(x\)-axis; \(f_y\) represents rate of change as we move parallel to the \(y\)-axis.
Question: what about other trajectories? Why limit ourselves to the \(x\) and \(y\) axes?
Fix a unit direction \(\vec{u}=\langle u_1, u_2\rangle\text{.}\) The rate of change of \(f\) at \((x_0,y_0)\) as we approach along the line in the direction of \(\vec{u}\) is called the directional derivative of \(f\) in the direction of \(\vec{u}\) and is denote:
\begin{equation*} D_{\vec{u}}(f) \end{equation*}
How do we calculuate it?

Definition 3.10.1.

The gradient of a function \(f(x,y)\) is the vector of partial derivatives:
\begin{equation*} \nabla(f)=\langle\frac{\partial f}{\partial x},\frac{\partial f}{\partial y}\rangle \end{equation*}

Example 3.10.3.

Find the derivative of \(f(x,y)=xe^y+\cos(xy)\) at the point \((2,0)\) in the direction of \(\vec{v}=\langle 3,-4\rangle\text{.}\)

Important Properties of the Gradient.

Recall that \(\vec{u}\bullet\vec{v}=|\vec{u}||\vec{v}|\cos\theta\text{.}\) Applying this to the fact that
\begin{equation*} D_{\vec{u}}(f)=\nabla(f)\bullet\vec{u} \end{equation*}
we draw the following important conclusions:

Why Stop at Straight Lines?

Suppose that \(f(x,y)\) is some function and \(\vec{r}(t)=\langle x(t),y(t)\rangle\) is some parametric curve. Then, using the chain rule, we can calculate:
\begin{align*} \frac{d}{dt}f(\vec{r}(t))=\amp\frac{\partial f}{\partial x}\frac{dx}{dt}+\frac{\partial f}{\partial y}\frac{dy}{dt} \\ =\amp \nabla(f)\bullet\vec{r}'(t) \end{align*}
which represents the rate of change of \(f\) along the trajectory \(\vec{r}(t)\text{.}\)
In particular, if \(\vec{r}(t)\) is describing a trajectory inside a level curve \(f(x,y)=0\text{,}\) then it follows that:
\begin{equation*} \nabla(f)\bullet\vec{r}'(t)=0. \end{equation*}

Example 3.10.6.

Find an equation for the tangent line to the ellipse
\begin{equation*} \frac{x^2}{4}+y^2=2 \end{equation*}
at the point \((-2,1)\text{.}\)
List 3.10.7. Gradient Rules
1. Sum Rule:
\(\displaystyle \nabla(f + g) = \nabla f + \nabla g\)
2. Difference Rule:
\(\displaystyle \nabla(f - g) = \nabla f - \nabla g\)
3. Constant Multiple Rule:
\(\displaystyle \nabla(kf) = k\nabla f \quad (\text{any number } k)\)
4. Product Rule:
\(\displaystyle \nabla(fg) = f\nabla g + g\nabla f\)
5. Quotient Rule:
\begin{equation*} \nabla\left(\frac{f}{g}\right) = \frac{g\nabla f - f\nabla g}{g^2} \end{equation*}

In More Than Two Variables.

If we have a function with three or more variables, then the gradient is defined analogously and its interpretation is the same. That is, if \(f(x_1,\cdots,x_n)\) is a function of many variables, then \(\nabla(f)\text{,}\) the vector of partial derivatives satisfies the following:
  • \(\nabla(f)\) points in the direction that \(f\) is most rapidly increasing.
  • if \(\vec{u}\) is any other unit direction, then \(D_{\vec{u}}(f)\text{,}\) the directional derivative of \(f\) in the direction of \(\vec{u}\) is computed by \(D_{\vec{u}}(f)=\nabla(f)\bullet\vec{u}\text{.}\)
  • \(\nabla(f)\) is always orthogonal to the level (hyper)-surface \(f(x_1,\dots, x_n)=c\) for any \(c\)

Example 3.10.8.

Let \(f(x,y,z)=x^3-xy^2-z\) and \(P=(1,1,0)\text{.}\)

(a)

Find the derivative of \(f\) in the direction of \(\vec{v}=\langle 2,-3,6\rangle\)

(b)

Find the equation of the tangent plane to the level surface \(f(x,y,z)=1\) at the point \(P\text{.}\)

Example 3.10.9.

The volume of the solid shown below consisting of a tetrahedron stacked on a triangular prism is given by:
\begin{equation*} f(x,y,z,w)=\frac{xy}{2}(z+\frac{w}{3}) \end{equation*}
described in detail following the image
A tetrahedron on top of a triangular prism

(a)

Calculate the derivative of \(f\) at \(P=(6,5,8,4)\) in the direction of \(\vec{v}=\langle 1,-1,-1,1\rangle\text{.}\)

Problem 3.10.10 PD5 Representative Assessment.

Consider the function \(f(x,y)=e^{x+y}+\sin(2xy)+x^2y\text{.}\)

(a)

Explain and demonstrate how to calculate \(\nabla(f)\text{.}\)
Solution.
To calculate \(\nabla f = \left\langle \frac{\partial f}{\partial x}, \frac{\partial f}{\partial y} \right\rangle\text{,}\) we compute the partial derivatives of \(f(x,y) = e^{x+y} + \sin(2xy) + x^2y\text{:}\)
\begin{equation*} \frac{\partial f}{\partial x} = e^{x+y} + 2y\cos(2xy) + 2xy \end{equation*}
\begin{equation*} \frac{\partial f}{\partial y} = e^{x+y} + 2x\cos(2xy) + x^2 \end{equation*}
Thus, the gradient is:
\begin{equation*} \nabla f(x,y) = \left\langle e^{x+y} + 2y\cos(2xy) + 2xy, \, e^{x+y} + 2x\cos(2xy) + x^2 \right\rangle \end{equation*}

(b)

Consider the point \(P=(0,0)\text{.}\) Explain and demonstrate how to determine the following:
  • the direction in which \(f\) achieves the greatest rate of change at \(P\text{.}\)
  • a direction in which the rate of change of \(f\) at \(P\) is zero.
  • the rate of change at \(P\) in the direction of \(\vec{u}=\frac{1}{\sqrt{5}}\langle 1,-2\rangle\text{.}\)
Solution.
First, evaluate the gradient at \(P = (0,0)\text{:}\)
\begin{equation*} \nabla f(0,0) = \left\langle e^0 + 0 + 0, \, e^0 + 0 + 0 \right\rangle = \langle 1, 1 \rangle \end{equation*}
  • The direction of greatest rate of change is given by the gradient vector \(\nabla f(0,0) = \langle 1, 1 \rangle\) (or its unit vector \(\frac{1}{\sqrt{2}}\langle 1, 1 \rangle\)).
  • such a direction is one that is orthogonal to the gradient, which we determined to be \(\langle 1,1\rangle\text{.}\) thus, we could take \(\langle -1,1\rangle\text{.}\)
  • The directional derivative in the direction of \(\vec{u} = \frac{1}{\sqrt{5}}\langle 1, -2 \rangle\) is calculated using the dot product:
    \begin{equation*} D_{\vec{u}}f(0,0) = \nabla f(0,0) \bullet \vec{u} = \langle 1, 1 \rangle \cdot \left(\frac{1}{\sqrt{5}}\langle 1, -2 \rangle\right) = \frac{1(1) + 1(-2)}{\sqrt{5}} = -\frac{1}{\sqrt{5}} \end{equation*}