一、方向导数
导数描述了函数随自变量变化的变化率。而当函数为多元函数时,取
R
n
\bm{R}^{n}
Rn上的多元函数
f
(
x
)
f(\bm{x})
f(x),其在不同方向通常有不同的变化率,因此,在描述多元函数的导数时,不仅要描述其变化率的幅值,还要描述其方向。
定义函数
f
f
f定义域上一点
p
0
\bm{p}_0
p0与
p
1
\bm{p}_1
p1,向量
l
\bm{l}
l是一个方向与
p
=
p
1
−
p
0
\bm{p} = \bm{p}_1 - \bm{p}_0
p=p1−p0一致的非零向量,用以描述
p
\bm{p}
p的方向。若极限
l
i
m
∣
p
→
0
∣
(
f
(
p
1
)
−
f
(
p
0
)
/
∣
p
∣
)
lim_{|\bm{p} \rightarrow 0|} (f(\bm{p}_1) - f(\bm{p}_0) / |\bm{p}|)
lim∣p→0∣(f(p1)−f(p0)/∣p∣)存在,则称其为函数
f
f
f在
p
0
\bm{p_0}
p0沿着
l
\bm{l}
l的方向导数,记为
∂
f
/
∂
l
∣
p
0
=
l
i
m
∣
p
→
0
∣
(
f
(
p
1
)
−
f
(
p
0
)
/
∣
p
∣
)
∂f/∂\bm{l}|_{\bm{p}_0} = lim_{|\bm{p} \rightarrow 0|} (f(\bm{p}_1) - f(\bm{p}_0) / |\bm{p}|)
∂f/∂l∣p0=lim∣p→0∣(f(p1)−f(p0)/∣p∣)其描述了函数
f
f
f在
p
0
\bm{p}_0
p0沿着
l
\bm{l}
l方向的变化率。
二、梯度
梯度定义为
▽
f
=
(
∂
f
/
∂
x
1
,
.
.
.
,
∂
f
/
∂
x
n
)
\bigtriangledown f = (∂f/∂x_1, ..., ∂f/∂x_n)
▽f=(∂f/∂x1,...,∂f/∂xn)其每个分量描述了
f
f
f沿着每个坐标轴的变化率,根据多维泰勒展开
f
(
x
)
=
f
(
x
k
)
+
[
▽
f
(
x
k
)
]
T
(
x
−
x
k
)
+
1
/
2
!
⋅
(
x
−
x
k
)
T
H
(
x
k
)
(
x
−
x
k
)
f(\bm{x}) = f(\bm{x}_k) + [\bigtriangledown f(\bm{x}_k)]^T(\bm{x} - \bm{x}_k) + 1/2!·(\bm{x} - \bm{x}_k)^TH(\bm{x}_k)(\bm{x} - \bm{x}_k)
f(x)=f(xk)+[▽f(xk)]T(x−xk)+1/2!⋅(x−xk)TH(xk)(x−xk)
有
f
(
p
1
)
=
f
(
p
0
)
+
[
▽
f
∣
p
0
]
T
p
+
o
(
∣
p
∣
)
f(\bm{p}_1) = f(\bm{p}_0) + [\bigtriangledown f|_{\bm{p}_0}]^T\bm{p} + o(|\bm{p}|)
f(p1)=f(p0)+[▽f∣p0]Tp+o(∣p∣)当
p
\bm{p}
p取极限,有
l
i
m
∣
p
∣
→
0
(
f
(
p
1
)
−
f
(
p
0
)
)
/
∣
p
∣
=
l
i
m
∣
p
∣
→
0
(
[
▽
f
∣
p
0
]
T
p
+
o
(
∣
p
∣
)
)
/
∣
p
∣
=
l
i
m
∣
p
∣
→
0
[
▽
f
∣
p
0
]
T
p
/
∣
p
∣
=
[
▽
f
∣
p
0
]
T
l
i
m
∣
p
∣
→
0
p
/
∣
p
∣
=
[
▽
f
∣
p
0
]
T
p
/
∣
p
∣
\begin{aligned} lim_{|\bm{p}| \rightarrow 0} (f(\bm{p}_1) -f(\bm{p}_0))/|\bm{p}| &= lim_{|\bm{p}| \rightarrow 0} ([\bigtriangledown f|_{\bm{p}_0}]^T\bm{p} + o(|\bm{p}|))/|\bm{p}| \\&= lim_{|\bm{p}| \rightarrow 0} [\bigtriangledown f|_{\bm{p}_0}]^T\bm{p}/|\bm{p}| \\&= [\bigtriangledown f|_{\bm{p}_0}]^T lim_{|\bm{p}| \rightarrow 0} \bm{p}/|\bm{p}| \\&=[\bigtriangledown f|_{\bm{p}_0}]^T \bm{p}/|\bm{p}| \end{aligned}
lim∣p∣→0(f(p1)−f(p0))/∣p∣=lim∣p∣→0([▽f∣p0]Tp+o(∣p∣))/∣p∣=lim∣p∣→0[▽f∣p0]Tp/∣p∣=[▽f∣p0]Tlim∣p∣→0p/∣p∣=[▽f∣p0]Tp/∣p∣即
∂
f
/
∂
l
∣
p
0
=
[
▽
f
∣
p
0
]
T
p
/
∣
p
∣
∂f/∂\bm{l}|_{\bm{p}_0} = [\bigtriangledown f|_{\bm{p}_0}]^T \bm{p}/|\bm{p}|
∂f/∂l∣p0=[▽f∣p0]Tp/∣p∣
三、内积
在上述式中,
p
/
∣
p
∣
\bm{p}/|\bm{p}|
p/∣p∣代表了
l
\bm{l}
l的单位向量,可以描述为方向余弦,形如
p
/
∣
p
∣
=
(
c
o
s
(
θ
1
)
,
.
.
.
,
c
o
s
(
θ
n
)
)
\bm{p}/|\bm{p}| = (cos(\theta_1), ..., cos(\theta_n))
p/∣p∣=(cos(θ1),...,cos(θn))表征该单位向量的方向,且显然有
∑
i
=
1
n
c
o
s
2
(
θ
i
)
=
1
\sum_{i=1}^n cos^2(\theta_i) = 1
∑i=1ncos2(θi)=1。根据向量内积,有
x
y
=
∣
x
∣
∣
y
∣
c
o
s
(
⟨
x
,
y
⟩
)
\bm{x}\bm{y} = |\bm{x}||\bm{y}|cos(\lang\bm{x}, \bm{y}\rang)
xy=∣x∣∣y∣cos(⟨x,y⟩)那么
∂
f
/
∂
l
∣
p
0
=
∂
f
/
∂
x
1
∣
p
0
⋅
c
o
s
(
θ
1
)
+
.
.
.
+
∂
f
/
∂
x
n
∣
p
0
⋅
c
o
s
(
θ
n
)
=
∣
▽
f
∣
p
0
∣
⋅
c
o
s
(
⟨
▽
f
∣
p
0
,
l
⟩
)
≤
∣
▽
f
∣
p
0
∣
\begin{aligned} ∂f/∂\bm{l}|_{\bm{p}_0} &= ∂f/∂x_1|_{\bm{p}_0}·cos(\theta_1) + ... + ∂f/∂x_n|_{\bm{p}_0}·cos(\theta_n) \\&= |\bigtriangledown f|_{\bm{p}_0}|·cos(\lang\bigtriangledown f|_{\bm{p}_0}, \bm{l}\rang) \\&\le |\bigtriangledown f|_{\bm{p}_0}| \end{aligned}
∂f/∂l∣p0=∂f/∂x1∣p0⋅cos(θ1)+...+∂f/∂xn∣p0⋅cos(θn)=∣▽f∣p0∣⋅cos(⟨▽f∣p0,l⟩)≤∣▽f∣p0∣当梯度与
l
\bm{l}
l的方向一致时,函数
f
f
f在
p
0
\bm{p}_0
p0沿着
l
\bm{l}
l方向的变化率最大,即当函数沿着梯度方向前进,函数增长速率最大。