高等数学基础:方向导数的计算与梯度

方向导数

方向导数定义

定理:若函数$f(x,y,z)$在点$P(x,y,z)$处可微,沿任意方向$l$的方向导数

$$
\frac{\partial f}{\partial l} = \frac{\partial f}{\partial x} \cos \alpha + \frac{\partial f}{\partial y} \cos \beta + \frac{\partial f}{\partial z} \cos \gamma
$$

其中$\alpha,\beta,\gamma$为$l$的方向角

证明:又函数$f(x,y,z)$在点$P$可微

$$
\begin{align}
\Delta f &= \frac{\partial f}{\partial x} \Delta x + \frac{\partial f}{\partial y} \Delta y + \frac{\partial f}{\partial z} \Delta z + o(\rho) \
&= \rho(\frac{\partial f}{\partial x} \cos \alpha + \frac{\partial f}{\partial y} \cos \beta + \frac{\partial f}{\partial z} \cos \gamma) + o(\rho)
\end{align}
$$

$$
\frac{\partial f}{\partial l} = \lim \limits_{\rho \to 0} \frac{\Delta f}{\rho} = \rho(\frac{\partial f}{\partial x} \cos \alpha + \frac{\partial f}{\partial y} \cos \beta + \frac{\partial f}{\partial z} \cos \gamma)
$$

对于二元函数$f(x,y)$,在点$P(x,y)$处沿方向$l$(方向角为$\alpha,\beta$)的方向导数为

$$
\begin{align}
\frac{\partial f}{\partial l} &= \lim \limits_{\rho \to 0} \frac{f(x+\Delta x,y+\Delta y) - f(x,y)}{\rho} \
&= f_x(x,y) \cos \alpha + f_y(x,y) \cos \beta
\end{align}
$$

$$
\rho = \sqrt{(\Delta x)^2 + (\Delta y)^2}, , \Delta x = \rho \cos \alpha, , \Delta y = \rho \cos \beta
$$

特别

$l$与$x$轴同向$\alpha=0,\beta=\frac{\pi}{2}$时,有$\frac{\partial f}{\partial l}=\frac{\partial f}{\partial x}$
$l$与$x$轴反向$\alpha=\pi,\beta=\frac{\pi}{2}$时,有$\frac{\partial f}{\partial l}=-\frac{\partial f}{\partial x}$

方向导数意义

**方向导数(Directional Derivative)**:有时不仅仅需要知道函数在坐标轴上的变化率(即偏导数),而且还需要设法求得函数在其他特定方向上的变化率,而方向导数就是函数在其它特定方向上的变化率。

如果函数$z=f(x,y)$在点$P(x,y)$是可微分的,那么函数在该点沿着任一方向$L$的方向导数都存在,且计算公式为:

$$
\frac{\partial f}{\partial l} = \frac{\partial f}{\partial x} \cos \alpha + \frac{\partial f}{\partial y} \cos \beta
$$

方向导数例题

例:求函数$u=x^2yz$在点$P(1,1,1)$沿向量$\vec{l}=(2,-1,3)$的方向导数

解:向量$\vec{l}$的方向余弦为

$$
\cos \alpha = \frac{2}{\sqrt{14}},,\cos \beta = \frac{-1}{\sqrt{14}},,\cos \gamma = \frac{3}{\sqrt{14}}
$$

$$
\frac{\partial u}{\partial l} \left|p = \left(2xyz·\frac{2}{\sqrt{14}} - x^2z·\frac{1}{\sqrt{14}} + x^2y·\frac{3}{\sqrt{14}}\right) \right|{(1,1,1)} = \frac{6}{\sqrt{14}}
$$

梯度

梯度(gradient)的概念及计算

在空间的每一个点都可以确定无限多个方向,因此,一个多元函数在某个点也必然有无限多个方向导数。在这无限多个方向导数中,描述最大方向导数及其所沿方向的矢量,就是梯度。梯度是场论里的一个基本概念。

方向导数

$$
\frac{\partial f}{\partial l} = \lim \limits_{\lambda \to 0} \frac{\Delta f}{\rho} = \rho(\frac{\partial f}{\partial x} \cos \alpha + \frac{\partial f}{\partial y} \cos \beta + \frac{\partial f}{\partial z} \cos \gamma)
$$

令向量

$$
\vec{G} = \left( \frac{\partial f}{\partial x}, \frac{\partial f}{\partial y}, \frac{\partial f}{\partial z} \right)
$$

$$
\vec{l^o} = ( \cos \alpha, \cos \beta, \cos \gamma )
$$

$$
\frac{\partial f}{\partial l} = \vec{G}·\vec{l^o} = |\vec{G}|\cos(\vec{G},\vec{l^o}) ,,,, (|\vec{l^o}|=1)
$$

当$\vec{l^o}$与$\vec{G}$方向一致时,方向导数取得最大值

$$
\operatorname{max}(\frac{\partial f}{\partial l}) = |\vec{G}|
$$

$$
\vec{G}:\left \{
\begin{array} {c}
方向: f变化率最大的方向 \
模: f的最大变化率之值
\end{array}
\right.
$$

梯度定义

向量$\vec{G}$:称为函数$f(P)$在点$P$处的梯度(gradient),记作$\operatorname{grad} f$,即

$$
\operatorname{grad} f = \left( \frac{\partial f}{\partial x}, \frac{\partial f}{\partial y}, \frac{\partial f}{\partial z} \right) = \left( \frac{\partial f}{\partial x}\vec{i} + \frac{\partial f}{\partial y}\vec{j}, \frac{\partial f}{\partial z}\vec{k} \right)
$$

同样可定义二元函数$f(x,y)$在点$P(x,y)$处的梯度

$$
\operatorname{grad} f = \frac{\partial f}{\partial x}\vec{i} + \frac{\partial f}{\partial y}\vec{j} = \left( \frac{\partial f}{\partial x}, \frac{\partial f}{\partial y} \right)
$$

说明:函数的方向导数为梯度在该方向上的投影

$\nabla = \left( \frac{\partial}{\partial x},\frac{\partial}{\partial y} \right)$引用记号,称为奈布拉(Nebla)算符,或称为向量微分算子,或哈密顿(W.R.Hamilton)算子。则梯度可记为

$$
\operatorname{grad} f = \left( \frac{\partial f}{\partial x},\frac{\partial f}{\partial y} \right) = \nabla f
$$

函数$f$沿梯度$\operatorname{grad} f$方向,增加(上升)最快
函数$f$沿负梯度$-\operatorname{grad} f$方向,减小(下降)最快

以三元函数为例,设$u=f(x,y,z)$在点$P(x,y,z)$处可微分,则函数在该点的梯度为

$$
\operatorname{grad} f = \nabla f = \frac{\partial f}{\partial x}\vec{i} + \frac{\partial f}{\partial y}\vec{j} + \frac{\partial f}{\partial z}\vec{k} = \left( \frac{\partial f}{\partial x},\frac{\partial f}{\partial y},\frac{\partial f}{\partial z} \right) = \left( \frac{\partial f}{\partial (x,y,z)} \right)
$$

梯度是函数$u=f(x,y,z)$在点$P$处取得最大方向导数的方向,最大方向导数为

$$
|\operatorname{grad} f| = \sqrt{(\frac{\partial f}{\partial x})^2 + (\frac{\partial f}{\partial y})^2 + (\frac{\partial f}{\partial z})^2}
$$

函数$u=f(x,y,z)$在点$P$处沿方向$\vec{l}$的方向导数

$$
\frac{\partial f}{\partial l} = \operatorname{grad} f · \vec{l^o} = \nabla f · \vec{l^o}
$$

梯度示例

例1:求$\operatorname{grad} = \frac{1}{x^2+y^2}$

解:这里$f(x,y)=\frac{1}{x^2+y^2}$

因为 $\frac{\partial f}{\partial x}=-\frac{2x}{(x^2+y^2)^2},\frac{\partial f}{\partial y}=-\frac{2y}{(x^2+y^2)^2}$

所以 $\operatorname{grad} \frac{1}{x^2+y^2} = -\frac{2x}{(x^2+y^2)^2} \vec{i} -\frac{2y}{(x^2+y^2)^2} \vec{j}$

例2:设$f(x,y,z)=x^3-xy^2-z$,$f(x,y,z)$在点$P(1,1,0)$处沿什么方向变化最快,在这方向的变化率是多少?

解:$\nabla f = f_xi+f_yj+f_zk = (3x^2-y^2)i-2xyj-k$

$\nabla f(1,1,0) = 2i-2j-k$

沿$\nabla f(1,1,0)$方向,增加最快(上升),$-\nabla f(1,1,0)$方向,减小最快(下降)

$
\operatorname{max} \left\{\frac{\partial f}{\partial l}\left|_p\right.\right\} = |\operatorname{grad} f| = |\operatorname{grad} f(1,1,0)| = 3
$

$
\operatorname{min} \left\{\frac{\partial f}{\partial l}\left|_p\right.\right\} = -|\operatorname{grad} f| = -|\operatorname{grad} f(1,1,0)| = -3
$