Skip to main content

Section 2.4 Derivatives

In SectionΒ 2.3, the derivative of a differentiable map was defined as a linear map. In this section we focus on scalar fields \(f \colon A \to \R\text{.}\) Directional derivatives measure the rate of change of \(f\) in one chosen direction, partial derivatives are the special cases coming from the coordinate directions, and the gradient packages those first-order rates into a single vector.

Definition 2.4.1. Directional Derivative.

Let \(A \subseteq \R^n\text{,}\) let \(\va \in A\) be an interior point, let \(f \colon A \to \R\text{,}\) and let \(\vu \in \R^n\) be a unit vector. The directional derivative of \(f\) at \(\va\) in the direction \(\vu\) is
\begin{equation*} D_{\vu}f(\va) := \lim_{t \to 0} \frac{f(\va+t\vu)-f(\va)}{t}, \end{equation*}
provided this limit exists.
The vector \(\vu\) determines a line through \(\va\text{,}\) and \(D_{\vu}f(\va)\) measures how rapidly \(f\) changes as we move away from \(\va\) along that line. We require \(\vu\) to be a unit vector so that the parameter \(t\) measures signed distance traveled in the chosen direction.
When \(f \colon \R^2 \to \R\text{,}\) directional derivatives have a simple geometric interpretation. Fix a unit vector \(\vu\text{.}\) The vertical plane determined by \(\vu\) and the \(z\)-axis cuts the surface \(z=f(x,y)\) in a curve. The directional derivative \(D_{\vu}f(\va)\) is the slope of the tangent line to that curve at the point on the graph lying above \(\va\text{.}\)
Tilted saddle with a trace and its tangent line at the origin.
Figure 2.4.2. The tilted saddle surface \(z=x+y+x^2-y^2\text{,}\) its trace in a chosen vertical plane, and the tangent line at the origin.

Example 2.4.3.

Compute the directional derivative of \(f(x,y)=x^2+xy\) at \(\langle 1,2 \rangle\) in the direction \(\vu=\dfrac{1}{\sqrt{5}}\langle 1,2 \rangle\text{.}\)
Solution.
Let \(\va=\langle 1,2 \rangle\text{.}\) We substitute the line \(\va+t\vu\) into \(f\text{:}\)
\begin{equation*} f(\va+t\vu) = f\left(1+\frac{t}{\sqrt{5}}, 2+\frac{2t}{\sqrt{5}}\right) = \left(1+\frac{t}{\sqrt{5}}\right)^2 + \left(1+\frac{t}{\sqrt{5}}\right)\left(2+\frac{2t}{\sqrt{5}}\right). \end{equation*}
Expanding gives
\begin{equation*} f(\va+t\vu)=3+\frac{6}{\sqrt{5}}t+\frac{3}{5}t^2. \end{equation*}
Since \(f(\va)=3\text{,}\)
\begin{equation*} D_{\vu}f(\va) = \lim_{t \to 0} \frac{f(\va+t\vu)-f(\va)}{t} = \lim_{t \to 0} \left(\frac{6}{\sqrt{5}}+\frac{3}{5}t\right) = \frac{6}{\sqrt{5}}. \end{equation*}

Definition 2.4.4. Partial Derivative.

For \(1 \le i \le n\text{,}\) the \(i\)-th partial derivative of \(f \colon A \to \R\) at \(\va\) is the directional derivative in the \(i\)-th standard basis direction:
\begin{equation*} D_i f(\va) := D_{\mathbf{e}_i}f(\va) = \lim_{t \to 0} \frac{f(\va+t\mathbf{e}_i)-f(\va)}{t}, \end{equation*}
provided this limit exists.
In the classical notation, we write \(\dfrac{\partial f}{\partial x_i}\) or \(f_{x_i}\) for the partial derivatives with respect to the variable \(x_i\text{.}\)
Thus partial derivatives are directional derivatives in the coordinate directions. In \(\R^2\text{,}\) if \(\va=\langle a,b \rangle\text{,}\) then
\begin{align*} \frac{\partial f}{\partial x}(a,b) \amp = f_x(a,b) = D_1f(\va) = \lim_{t \to 0}\frac{f(a+t,b)-f(a,b)}{t},\\ \frac{\partial f}{\partial y}(a,b) \amp = f_y(a,b) = D_2f(\va) = \lim_{t \to 0}\frac{f(a,b+t)-f(a,b)}{t}. \end{align*}
Geometrically, \(\dfrac{\partial f}{\partial x}(a,b)\) is the slope of the trace obtained by holding \(y=b\) fixed, while \(\dfrac{\partial f}{\partial y}(a,b)\) is the slope of the trace obtained by holding \(x=a\) fixed.

Definition 2.4.5. Gradient.

If all partial derivatives of \(f\) at \(\va\) exist, then the gradient of \(f\) at \(\va\) is the vector
\begin{equation*} \nabla f(\va) := \langle D_1f(\va), \ldots, D_nf(\va) \rangle. \end{equation*}
In particular, for \(f \colon \R^2 \to \R\) and \(f \colon \R^3 \to \R\text{,}\)
\begin{align*} \nabla f(x,y) \amp = \langle f_x(x,y), f_y(x,y) \rangle,\\ \nabla f(x,y,z) \amp = \langle f_x(x,y,z), f_y(x,y,z), f_z(x,y,z) \rangle. \end{align*}
The gradient records all first-order coordinate rates of change at once. The next result explains how it recovers every directional derivative. This requires differentiability, not just the existence of partial derivatives.

Proof.

Since \(f\) is differentiable at \(\va\text{,}\) the scalar-valued case of TheoremΒ 2.3.3 gives continuous functions \(A_1,\ldots,A_n\text{,}\) defined near \(\va\text{,}\) such that
\begin{equation*} f(\vx)-f(\va)=\sum_{i=1}^n A_i(\vx)(x_i-a_i) \end{equation*}
for \(\vx\) near \(\va\text{,}\) and
\begin{equation*} Df(\va)(\vh)=\sum_{i=1}^n A_i(\va)h_i. \end{equation*}
Now set \(\vx=\va+t\vu\text{,}\) where \(\vu=\langle u_1,\ldots,u_n \rangle\text{.}\) Then
\begin{equation*} f(\va+t\vu)-f(\va) = \sum_{i=1}^n A_i(\va+t\vu)(tu_i) = t\sum_{i=1}^n A_i(\va+t\vu)u_i. \end{equation*}
Dividing by \(t\) and letting \(t \to 0\text{,}\) continuity of the functions \(A_i\) at \(\va\) gives
\begin{equation*} D_{\vu}f(\va) = \sum_{i=1}^n A_i(\va)u_i = Df(\va)(\vu). \end{equation*}
Taking \(\vu=\mathbf{e}_i\) gives \(D_i f(\va)=A_i(\va)\text{.}\) Therefore
\begin{equation*} D_{\vu}f(\va) = \sum_{i=1}^n D_i f(\va)u_i = \nabla f(\va)\cdot \vu. \end{equation*}

Proof.

If \(\vu\) is any unit vector, then by PropositionΒ 2.4.6,
\begin{equation*} D_{\vu}f(\va)=\nabla f(\va)\cdot\vu. \end{equation*}
\begin{equation*} -\norm{\nabla f(\va)} \le \nabla f(\va)\cdot\vu \le \norm{\nabla f(\va)}. \end{equation*}
The right-hand equality holds exactly when \(\vu\) points in the same direction as \(\nabla f(\va)\text{,}\) that is, when
\begin{equation*} \vu = \frac{\nabla f(\va)}{\norm{\nabla f(\va)}}. \end{equation*}
The left-hand equality holds exactly when \(\vu\) points in the opposite direction, namely
\begin{equation*} \vu = -\frac{\nabla f(\va)}{\norm{\nabla f(\va)}}. \end{equation*}

Example 2.4.8.

Use partial derivatives to compute the directional derivative of \(f(x,y)=x^2+xy\) at \(\langle 1,2 \rangle\) in the direction \(\vu=\dfrac{1}{\sqrt{5}}\langle 1,2 \rangle\text{.}\)
Solution.
The partial derivatives are
\begin{equation*} f_x(x,y)=2x+y, \qquad f_y(x,y)=x. \end{equation*}
Hence
\begin{equation*} \nabla f(1,2)=\langle 4,1 \rangle. \end{equation*}
\begin{equation*} D_{\vu}f(1,2) = \nabla f(1,2)\cdot \vu = \langle 4,1 \rangle \cdot \frac{1}{\sqrt{5}}\langle 1,2 \rangle = \frac{6}{\sqrt{5}}. \end{equation*}
This agrees with the direct computation above.
Partial derivatives only test the coordinate directions. Their existence at a point, by itself, does not guarantee that \(f\) has a linear approximation there.

Example 2.4.9.

Show that the function \(f \colon \R^2 \to \R\) defined by
\begin{equation*} f(x,y) = \begin{cases} \dfrac{xy}{\sqrt{x^2+y^2}}, & \langle x,y \rangle \ne \langle 0,0 \rangle, \\ 0, & \langle x,y \rangle = \langle 0,0 \rangle \end{cases} \end{equation*}
has partial derivatives at \(\langle 0,0 \rangle\) but is not differentiable there.
Solution.
First compute the partial derivatives at the origin. Since \(f(h,0)=0\) for all \(h\text{,}\)
\begin{equation*} f_x(0,0) = \lim_{h \to 0} \frac{f(h,0)-f(0,0)}{h} = 0. \end{equation*}
Likewise, since \(f(0,k)=0\) for all \(k\text{,}\)
\begin{equation*} f_y(0,0) = \lim_{k \to 0} \frac{f(0,k)-f(0,0)}{k} = 0. \end{equation*}
So both partial derivatives exist at the origin. However, along the diagonal line \(y=x\) we get
\begin{equation*} f(t,t) = \frac{t^2}{\sqrt{2t^2}} = \frac{|t|}{\sqrt{2}} \end{equation*}
for \(t \ne 0\text{.}\) Since \(\norm{\langle t,t \rangle}=\sqrt{2}|t|\text{,}\) it follows that
\begin{equation*} \frac{|f(t,t)-f(0,0)|}{\norm{\langle t,t \rangle}} = \frac{|t|/\sqrt{2}}{\sqrt{2}|t|} = \frac{1}{2}. \end{equation*}
This does not tend to \(0\) as \(t \to 0\text{,}\) so \(f\) is not differentiable at \(\langle 0,0 \rangle\text{.}\)
Coordinate axes in the plane together with the diagonal line y equals x through the.
(a) The relevant paths in the domain.
Graph of z equals the absolute value of t divided by square root of two, showing a.
(b) The trace along \(y=x\text{.}\)
Figure 2.4.10. The partial derivatives at the origin examine the coordinate axes, but the diagonal path \(y=x\) reveals the failure of differentiability.
Thus the existence of all first partial derivatives at a point is weaker than differentiability at that point. In fact, there are functions whose directional derivatives exist at a point in every direction and yet are not differentiable there. See AppendixΒ D for a standard example.

Proof.

Let \(\vx=\langle x_1,\ldots,x_n \rangle\) be near \(\va\text{,}\) and for \(i=0,1,\ldots,n\) define
\begin{equation*} \vx_i := \langle x_1,\ldots,x_i,a_{i+1},\ldots,a_n \rangle, \end{equation*}
so that \(\vx_0=\va\) and \(\vx_n=\vx\text{.}\) Then
\begin{equation*} f(\vx)-f(\va) = \sum_{i=1}^n \bigl(f(\vx_i)-f(\vx_{i-1})\bigr). \end{equation*}
For each \(i\text{,}\) consider the one-variable function
\begin{equation*} g_i(t) := f(\langle x_1,\ldots,x_{i-1},t,a_{i+1},\ldots,a_n \rangle). \end{equation*}
Since \(D_if\) exists near \(\va\text{,}\) the function \(g_i\) is differentiable, hence continuous. By the one-variable Mean Value Theorem, there exists a number \(c_i\) between \(a_i\) and \(x_i\) such that
\begin{equation*} f(\vx_i)-f(\vx_{i-1}) = D_if(\langle x_1,\ldots,x_{i-1},c_i,a_{i+1},\ldots,a_n \rangle) (x_i-a_i). \end{equation*}
Define
\begin{equation*} A_i(\vx) := D_if(\langle x_1,\ldots,x_{i-1},c_i,a_{i+1},\ldots,a_n \rangle) \end{equation*}
for \(\vx \ne \va\text{,}\) and set \(A_i(\va):=D_if(\va)\text{.}\) Then
\begin{equation*} f(\vx)-f(\va)=\sum_{i=1}^n A_i(\vx)(x_i-a_i). \end{equation*}
The point \(\langle x_1,\ldots,x_{i-1},c_i,a_{i+1},\ldots,a_n \rangle\) lies on the segment joining \(\vx_{i-1}\) and \(\vx_i\text{,}\) so it tends to \(\va\) as \(\vx \to \va\text{.}\) Since \(D_if\) is continuous at \(\va\text{,}\) we obtain
\begin{equation*} A_i(\vx)\to D_if(\va) \qquad \text{as } \vx \to \va. \end{equation*}
Thus each \(A_i\) is continuous at \(\va\text{.}\) By the scalar-valued form of the Caratheodory criterion in TheoremΒ 2.3.3, it follows that \(f\) is differentiable at \(\va\text{.}\)
This theorem gives a practical test for differentiability: if the partial derivatives exist on a neighborhood and vary continuously near the point, then the function is differentiable there.
Another subtle point concerns second partial derivatives. In general, taking partial derivatives is not a commutative process: that is
\begin{equation*} \frac{\partial^2 f}{\partial x \partial y}(a,b) \ne \frac{\partial^2 f}{\partial y \partial x}(a,b) \end{equation*}
can happen. Appendix AppendixΒ D contains a standard example.
However, if the mixed second partial derivatives exist on a neighborhood and are continuous at the point, then they are equal there. A proof of this can be found in AppendixΒ D