[b][size=150]Directional derivatives[/size][/b][br][br]Suppose [math]z=f(x,y)[/math] is a function of two variables and [math](x_0,y_0)[/math] is a point in the domain of [math]f[/math]. Its partial derivatives [math]f_x(x_0,y_0)[/math] and [math]f_y(x_0,y_0)[/math] are the slope of the curve on the graph of [math]z=f(x,y)[/math] in the direction of x-axis and y-axis respectively. In fact, we can also consider the slope of the curve on the graph in any direction. Let [math]\vec{u}=\langle u_1,u_2 \rangle[/math] be a unit vector. We have the following definition:[br][br][u]Definition[/u]: The [b]directional derivative[/b] of [math]f[/math] at [math](x_0,y_0)[/math] in the direction of [math]\vec{u}[/math], denoted by [math]D_\vec{u} f(x_0,y_0)[/math], is as follows:[br][br][math]D_\vec{u} f(x_0,y_0)=\lim_{t \to 0}\frac{f(x_0+t u_1,y_0+t u_2)-f(x_0,y_0)}t=\left.\frac{d}{dt}\left(f(x_0+tu_1,y_0+tu_2)\right)\right|_{t=0}[/math][br][br]([u]Note[/u]: By definition, [math]f_x(x_0,y_0)=D_{\langle 1,0\rangle}f(x_0,y_0)[/math] and [math]f_y(x_0,y_0)=D_{\langle 0,1 \rangle}f(x_0,y_0)[/math].)[br][br][br]The applet below illustrates the geometric meaning of directional derivatives of a function of two variables. You can drag the point [math]A=(x_0,y_0)[/math] and the red unit vector to see the change in the value of [math]D_\vec{u}f(x_0,y_0)[/math].[br][br]
For a function of three variables [math]w=g(x,y,z)[/math], we can define its directional derivative in a similar way. Let [math](x_0,y_0,z_0)[/math] be a point in the domain of [math]g[/math] and [math]\vec{v}=\langle v_1,v_2,v_3 \rangle[/math] be a unit vector in [math]\mathbb{R}^3[/math]. Then we have the following definition:[br][br][u]Definition[/u]: The [b]directional derivative[/b] of [math]g[/math] at [math](x_0,y_0,z_0)[/math] in the direction of [math]\vec{v}[/math] is [br][br][math]D_\vec{v}g(x_0,y_0,z_0)=\lim_{t\to 0}\frac{g(x_0+tv_1,y_0+tv_2,z_0+tv_3)-g(x_0,y_0,z_0)}t=\left.\frac{d}{dt}\left(g(x_0+tv_1,y_0+tv_2,z_0+tv_3)\right)\right|_{t=0}[/math][br][br][br]The following useful theorem is a formula for computing directional derivatives:[br][br][u]Theorem[/u]: Suppose [math]z=f(x,y)[/math] and [math]\vec{u}=\langle u_1,u_2\rangle[/math] is a unit vector in [math]\mathbb{R}^2[/math], then[br][br][math]D_\vec{u}f(x_0,y_0)=\langle f_x(x_0,y_0),f_y(x_0,y_0)\rangle \cdot \vec{u}[/math][br][br]For [math]w=g(x,y,z)[/math] and [math]\vec{v}=\langle v_1,v_2,v_3\rangle[/math] is a unit vector in [math]\mathbb{R}^3[/math], then[br][br][math]D_\vec{v}g(x_0,y_0,z_0)=\langle g_x(x_0,y_0,z_0),f_y(x_0,y_0,z_0),f_z(x_0,y_0,z_0)\rangle \cdot \vec{v}[/math][br][br][br][u]Proof[/u]: [br][br]We only prove the result for functions of two variables here. The three variable version can be proved by similar argument.[br][br]Let [math]x=x_0+tu_1[/math] and [math]y=y_0+tu_2[/math]. By chain rule, we have[br][br][math]D_\vec{u}f(x_0,y_0)=\left.\frac{d}{dt}\left(f(x_0+tu_1,y_0+tu_2)\right)\right|_{t=0}=\left.f_x(x,y)\frac{dx}{dt}+f_y(x,y)\frac{dy}{dt}\right|_{t=0}[/math][br][math]=f_x(x_0,y_0)u_1+f_y(x_0,y_0)u_2=\langle f_x(x_0,y_0),f_y(x_0,y_0)\rangle \cdot \vec{u}[/math][br][br][br][u]Example[/u]: Let [math]f(x,y)=xy[/math] and [math]\vec{u}=\left\langle \frac{\sqrt{3}}2,\frac 12\right\rangle[/math]. Find the directional derivative of [math]f[/math] at [math](1,2)[/math] in the direction of [math]\vec{u}[/math].[br][br][u]Answer[/u]:[br][br][math]f_x=y[/math] and [math]f_y=x[/math]. Moreover, it can be easily checked that [math]\vec{u}[/math] is already a unit vector. [br][br](If the given vector is not a unit vector, we need to first normalize it into a unit vector pointing towards the same direction.)[br][br][math]D_\vec{u}f(1,2)=\langle f_x(1,2),f_y(1,2)\rangle \cdot \left\langle \frac{\sqrt{3}}2,\frac 12\right\rangle[/math][br][math]=\langle 2,1 \rangle \cdot \left\langle \frac{\sqrt{3}}2,\frac 12\right\rangle=\sqrt{3}+\frac 12[/math][br]
[u]Exercise[/u]: Let [math]w=g(x,y,z)=\frac 34 x^2+\frac 12 y^2 + 3z^2[/math] and [math]\vec{v}=\left\langle \frac 13, -\frac 23, \frac 23\right\rangle[/math]. Find the directional derivative of [math]g[/math] at [math](1,2,3)[/math] in the direction of [math]\vec{v}[/math].[br][br][br]
[u]Remark[/u]: For any unit vector [math]\vec{u}[/math] in [math]\mathbb{R}^2[/math], it can be written as [math]\vec{u}=\langle \cos\phi,\sin\phi\rangle[/math], where [math]\phi[/math] is the angle measured from the positive x-axis to the direction of [math]\vec{u}[/math] in anticlockwise direction. Therefore, we have the following formula for directional derivatives in terms of [math]\phi[/math]:[br][br][math]D_\vec{u}f(x_0,y_0)=f_x(x_0,y_0)\cos\phi+f_y(x_0,y_0)\sin\phi[/math][br][br]
[b][size=150]Gradient[/size][/b][br][br]Suppose [math]z=f(x,y)[/math] is a function of two variables that is differentiable at [math](x,y)[/math]. The [b]gradient[/b] of [math]f[/math] at [math](x,y)[/math] is the vector in [math]\mathbb{R}^2[/math], denoted by [math]\nabla f(x,y)[/math], is defined as follows:[br][br][math]\nabla f(x,y)=\langle f_x(x,y), f_y(x,y) \rangle[/math][br][br]Similarly, let [math]w=g(x,y,z)[/math] be a function of three variables that is differentiable at [math](x,y,z)[/math]. The gradient of [math]g[/math] at [math](x,y,z)[/math] is [br][br][math]\nabla g(x,y,z)=\langle g_x(x,y,z), g_y(x,y,z), g_z(x,y,z) \rangle[/math][br][br]Then by the theorem above, for any unit vector [math]\vec{u}[/math] in [math]\mathbb{R}^2[/math], [br][br][math]D_{\vec{u}}f(x,y)=\nabla f(x,y)\cdot \vec{u}[/math][br][br]For any unit vector [math]\vec{v}[/math] in [math]\mathbb{R}^3[/math], [br][br][math]D_{\vec{u}}g(x,y,z)=\nabla g(x,y,z)\cdot \vec{v}[/math][br][br][br][u]Remark[/u]: When [math]\nabla f(x,y)=0[/math], all directional derivatives of [math]f[/math] at [math](x,y)[/math] is zero.[br][br][br][br][u]Geometric meaning of gradient[/u][br][br]Let [math]z=f(x,y)[/math] be a differentiable function of two variables and [math]\vec{u}[/math] be any unit vector. Then we have[br][br][math]D_{\vec{u}}f(x,y)=\nabla f(x,y)\cdot \vec{u}=|\nabla f(x,y)||\vec{u}|\cos\theta=|\nabla f(x,y)|\cos\theta[/math][br][br]where [math]\theta[/math] is the angle between [math]\nabla f(x,y)[/math] and [math]\vec{u}[/math]. Then when will the directional derivative be the maximum/minimum?[br][br][math]\cos\theta[/math] has the greatest value when [math]\theta=0[/math] ([math]\cos \theta=1[/math]). Therefore, [math]D_{\vec{u}}f(x,y)[/math] attains its maximum value when [math]\theta=0[/math] i.e. [math]\nabla f(x,y)[/math] and [math]\vec{u}[/math] are in the same direction. Moreover, the maximum value of [math]D_{\vec{u}}f(x,y)[/math] is [math]|\nabla f(x,y)|[/math].[br][br][math]\cos\theta[/math] has the smallest value when [math]\theta=\pi[/math] ([math]\cos\theta=-1)[/math]. Therefore, [math]D_{\vec{u}}f(x,y)[/math] attains its minimum value when [math]\theta=\pi[/math] i.e. [math]\nabla f(x,y)[/math] and [math]\vec{u}[/math] are in opposite directions. Moreover, the minimum value of [math]D_{\vec{u}}f(x,y)[/math] is [math]-|\nabla f(x,y)|[/math].[br][br][br][br]Geometrically, the above results imply that when we consider point [math]P=(x,y)[/math] and its corresponding point [math]Q=(x,y,f(x,y))[/math] on the graph of [math]z=f(x,y)[/math], the slope of the curve in the direction of the gradient of [math]f[/math] at [math]Q[/math] is the greatest i.e. the [math]\nabla f(x,y)[/math] is direction when the steepest ascent occurs at [math]Q[/math]. On the other hand, [math]-\nabla f(x,y)[/math] is direction when the steepest descent occurs at [math]Q[/math].[br][br][br]In the applet below, you can check the checkbox "Gradient" to reveal the gradient of the function and its norm.[br]
[u]Example[/u]: Suppose [math]f(x,y)=5+x^2+3y^2[/math]. Find the directions of the steepest ascent and descent on the graph of [math]z=f(x,y)[/math] when [math](x,y)=(1,2)[/math]. Moreover, find the maximum rate of the steepest ascent.[br][br][br][u]Answer[/u]: [math]f_x=2x[/math] and [math]f_y=6y[/math]. Therefore, we have[br][br][math]\nabla f(1,2)=\langle 2, 12\rangle[/math], which is the direction of the steepest ascent. Moreover, [math]-\langle 2, 12\rangle[/math] is the direction of the steepest descent.[br][br]The maximum rate of ascent at [math](1,2)[/math] is [math]|\nabla f(1,2)|=\sqrt{2^2+12^2}=2\sqrt{37}[/math].[br]
[u]Exercise[/u]: Let [math]f(x,y)=x^2e^y[/math]. Find the maximum value of the directional derivative of [math]f[/math] at [math](-2,0)[/math].[br]
[u]Gradient and level curves[/u][br][br]Suppose [math]z=f(x,y)[/math] is a differentiable function and [math]k[/math] is any real number. Then the equation of the level curve of [math]z=f(x,y)[/math] when [math]z=k[/math] is [math]f(x,y)=k[/math]. Suppose such level curve is parametrized by [math]\vec{r}(t)=\langle x(t),y(t)\rangle[/math]. Then we have[br][br][math]f(x(t),y(t))=k[/math][br][br]Differentiate both sides and use chain rule, we have[br][br][math]f_x(x(t),y(t)) x'(t)+f_y(x(t),y(t)) y'(t)=0[/math][br][math]\implies \nabla f(x(t),y(t))\cdot \vec{r'}(t)=0[/math][br][br]Therefore, [math]\nabla f(x(t),y(t))[/math] is orthogonal to the tangent vector [math]\vec{r'}(t)[/math] of the level curve for all [math]t[/math].[br][br]In the applet above, you can check the checkbox "Level curve" to reveal the level curve. You can see that the gradient vector is always normal to the level curve i.e. orthogonal to the tangent vector of the level curve.[br]
[u]Exercise[/u]: Let [math]z=f(x,y)=\sqrt{1+2x^2+y^2}[/math]. Find the equation of line tangent to the level curve [math]f(x,y)=2[/math] at [math](1,1)[/math].[br]
[u]Gradient and level surfaces[/u][br][br]Suppose [math]w=g(x,y,z)[/math] is a function of three variables such that its partial derivatives are all continuous (Note: This implies that [math]g[/math] is differentiable). Let [math]k[/math] be any real number. Then the equation of the level surface of [math]g[/math] when [math]w=k[/math] is [br][br][math]g(x,y,z)=k[/math][br][br]Consider any curve in the level surface, which is parametrized by [math]\vec{r}(t)=\langle x(t), y(t), z(t) \rangle[/math]. Then we have[br][br][math]g(x(t),y(t),z(t))=k[/math][br][br]Differentiate both sides and use chain rule, we have[br][br][math]g_x(x(t),y(t),z(t))x'(t)+g_y(x(t),y(t),z(t))y'(t)+g_z(x(t),y(t),z(t))z'(t)=0[/math][br][math]\implies \nabla g(x(t),y(t),z(t))\cdot \vec{r'}(t)=0[/math][br][br]Therefore, [math]\nabla g(x(t),y(t),z(t))[/math] is orthogonal to the tangent vector at [math](x(t),y(t),z(t))[/math] for any [math]t[/math]. Fix [math]t=t_0[/math] and let [math](x(t_0),y(t_0),z(t_0))=(x_0,y_0,z_0)[/math]. Then [math]\nabla g(x_0,y_0,z_0)[/math] is orthogonal to the tangent vector of any curve on the level surface at [math](x_0,y_0,z_0)[/math]. In other words, if [math]\nabla g(x_0,y_0,z_0)[/math] is non-zero, then it is normal to the tangent plane of the level surface at [math](x_0,y_0,z_0)[/math].[br][br]Therefore, if [math]\nabla g(x_0,y_0,z_0)\ne \vec{0}[/math], the equation of the plane tangent to the level surface at [math](x_0,y_0,z_0)[/math] is [br][br][math]\nabla g(x_0,y_0,z_0)\cdot \langle x-x_0,y-y_0,z-z_0\rangle=0[/math],[br][br]or more explicitly,[br][br][math]g_x(x_0,y_0,z_0)(x-x_0)+g_y(x_0,y_0,z_0)(y-y_0)+g_z(x_0,y_0,z_0)(z-z_0)=0[/math][br][br][br][br]In the applet below, the level surface [math]g(x,y,z)=k[/math] is shown. For any point [math]P[/math] in the level surface, the gradient vector is normal to the tangent plane of the level surface at [math]P[/math].[br][br]
[u]Exercise[/u]: Find the equation of the tangent plane of a unit sphere centered at the origin at the point [math]\left(\frac 1{\sqrt{3}},\frac 1{\sqrt{3}},\frac 1{\sqrt{3}}\right)[/math].[br]