将2D函数f (x , y ) = xe −(x 2 + y 2 ) 的梯度绘制为蓝色箭头,还绘制了这个函数的伪色图。
假設有一个房间,房间内所有点的温度由一个标量场
ϕ
{\displaystyle \phi }
给出的,即点
(
x
,
y
,
z
)
{\displaystyle (x,y,z)}
的温度是
ϕ
(
x
,
y
,
z
)
{\displaystyle \phi (x,y,z)}
。假设温度不随时间改变。然后,在房间的每一点,该点的梯度将显示变热最快的方向。梯度的大小将表示在该方向上的溫度變化率。
考虑一座高度在
(
x
,
y
)
{\displaystyle (x,y)}
点是
H
(
x
,
y
)
{\displaystyle H(x,y)}
的山。
H
{\displaystyle H}
这一点的梯度是在该点坡度 (或者说斜度 )最陡的方向。梯度的大小告诉我们坡度到底有多陡。
梯度也可以告诉我们一个数量在不是最快变化方向的其他方向的变化速度。再次考虑山坡的例子。可以有条直接上山的路其坡度是最大的,则其坡度是梯度的大小。也可以有一条和上坡方向成一个角度的路,例如投影在水平面上的夹角为60°。则,若最陡的坡度是40%,这条路的坡度小一点,是20%,也就是40%乘以60°的余弦。
这个现象可以如下数学的表示。山的高度函数
H
{\displaystyle H}
的梯度点积 一个单位向量 给出表面在该向量的方向上的斜率。这称为方向導數 。
将函数f (x ,y ) = −(cos2 x + cos2 y )2 的梯度描绘为在底面上投影的向量场 。
純量函数
f
:
R
n
↦
R
{\displaystyle f\colon \mathbb {R} ^{n}\mapsto \mathbb {R} }
的梯度表示為:
∇
f
{\displaystyle \nabla f}
或
grad
f
{\displaystyle \operatorname {grad} f}
,其中
∇
{\displaystyle \nabla }
(nabla )表示向量微分算子 。
函數
f
{\displaystyle f}
的梯度,
∇
f
{\displaystyle \nabla f}
, 為向量場且對任意單位向量 v 滿足下列方程式:
(
∇
f
(
x
)
)
⋅
v
=
D
v
f
(
x
)
{\displaystyle {\big (}\nabla f(x){\big )}\cdot \mathbf {v} =D_{\mathbf {v} }f(x)}
。
∇
f
{\displaystyle \nabla f}
在三维直角坐标系 中表示为
∇
f
=
(
∂
f
∂
x
,
∂
f
∂
y
,
∂
f
∂
z
)
=
∂
f
∂
x
i
+
∂
f
∂
y
j
+
∂
f
∂
z
k
{\displaystyle \nabla f={\begin{pmatrix}{\frac {\partial f}{\partial x}},{\frac {\partial f}{\partial y}},{\frac {\partial f}{\partial z}}\end{pmatrix}}={\frac {\partial f}{\partial x}}\mathbf {i} +{\frac {\partial f}{\partial y}}\mathbf {j} +{\frac {\partial f}{\partial z}}\mathbf {k} }
,
i , j , k 為標準的單位向量,分別指向 x , y 跟 z 座標的方向。
(参看偏导数 和向量 。 )
虽然使用坐标表达,但结果是在正交变换 下不变,从几何的观点来看,这是应该的。
舉例來講,函数
f
(
x
,
y
,
z
)
=
2
x
+
3
y
2
−
sin
(
z
)
{\displaystyle f(x,y,z)=2x+3y^{2}-\sin(z)}
的梯度为:
∇
f
=
(
2
,
6
y
,
−
cos
(
z
)
)
=
2
i
+
6
y
j
−
cos
(
z
)
k
{\displaystyle \nabla f={\begin{pmatrix}{2},{6y},{-\cos(z)}\end{pmatrix}}=2\mathbf {i} +6y\mathbf {j} -\cos(z)\mathbf {k} }
。
在圓柱坐標系 中,
f
{\displaystyle f}
的梯度為:[ 7]
∇
f
(
ρ
,
φ
,
z
)
=
∂
f
∂
ρ
e
ρ
+
1
ρ
∂
f
∂
φ
e
φ
+
∂
f
∂
z
e
z
{\displaystyle \nabla f(\rho ,\varphi ,z)={\frac {\partial f}{\partial \rho }}\mathbf {e} _{\rho }+{\frac {1}{\rho }}{\frac {\partial f}{\partial \varphi }}\mathbf {e} _{\varphi }+{\frac {\partial f}{\partial z}}\mathbf {e} _{z}}
,
ρ 是 P 點與 z-軸的垂直距離。
φ 是線 OP 在 xy-面的投影線 與正 x-軸之間的夾角。
z 與直角坐標 的
z
{\displaystyle z}
等值。
e ρ , e φ 跟 e z
為單位向量,指向座標的方向。
在球坐標系 中:
∇
f
(
r
,
θ
,
φ
)
=
∂
f
∂
r
e
r
+
1
r
∂
f
∂
θ
e
θ
+
1
r
sin
θ
∂
f
∂
φ
e
φ
{\displaystyle \nabla f(r,\theta ,\varphi )={\frac {\partial f}{\partial r}}\mathbf {e} _{r}+{\frac {1}{r}}{\frac {\partial f}{\partial \theta }}\mathbf {e} _{\theta }+{\frac {1}{r\sin \theta }}{\frac {\partial f}{\partial \varphi }}\mathbf {e} _{\varphi }}
,
其中θ 为极角,φ 方位角。
相对于n×1向量x 的梯度算子记作
∇
x
{\displaystyle \nabla _{\boldsymbol {x}}}
,定义为[ 8]
∇
x
=
d
e
f
[
∂
∂
x
1
,
∂
∂
x
2
,
⋯
,
∂
∂
x
n
]
T
=
∂
∂
x
{\displaystyle \nabla _{\boldsymbol {x}}{\overset {\underset {\mathrm {def} }{}}{=}}\left[{\frac {\partial }{\partial x_{1}}},{\frac {\partial }{\partial x_{2}}},\cdots ,{\frac {\partial }{\partial x_{n}}}\right]^{T}={\frac {\partial }{\partial {\boldsymbol {x}}}}}
以n×1实向量x 为变元的实标量函数f(x )相对于x 的梯度为一n×1列向量x ,定义为
∇
x
f
(
x
)
=
d
e
f
[
∂
f
(
x
)
∂
x
1
,
∂
f
(
x
)
∂
x
2
,
⋯
,
∂
f
(
x
)
∂
x
n
]
T
=
∂
f
(
x
)
∂
x
{\displaystyle \nabla _{\boldsymbol {x}}f({\boldsymbol {x}}){\overset {\underset {\mathrm {def} }{}}{=}}\left[{\frac {\partial f({\boldsymbol {x}})}{\partial x_{1}}},{\frac {\partial f({\boldsymbol {x}})}{\partial x_{2}}},\cdots ,{\frac {\partial f({\boldsymbol {x}})}{\partial x_{n}}}\right]^{T}={\frac {\partial f({\boldsymbol {x}})}{\partial {\boldsymbol {x}}}}}
m维行向量函数
f
(
x
)
=
[
f
1
(
x
)
,
f
2
(
x
)
,
⋯
,
f
m
(
x
)
]
{\displaystyle {\boldsymbol {f}}({\boldsymbol {x}})=[f_{1}({\boldsymbol {x}}),f_{2}({\boldsymbol {x}}),\cdots ,f_{m}({\boldsymbol {x}})]}
相对于n维实向量x 的梯度为一n×m矩阵,定义为
∇
x
f
(
x
)
=
d
e
f
[
∂
f
1
(
x
)
∂
x
1
∂
f
2
(
x
)
∂
x
1
⋯
∂
f
m
(
x
)
∂
x
1
∂
f
1
(
x
)
∂
x
2
∂
f
2
(
x
)
∂
x
2
⋯
∂
f
m
(
x
)
∂
x
2
⋮
⋮
⋱
⋮
∂
f
1
(
x
)
∂
x
n
∂
f
2
(
x
)
∂
x
n
⋯
∂
f
m
(
x
)
∂
x
n
]
=
∂
f
(
x
)
∂
x
{\displaystyle \nabla _{\boldsymbol {x}}{\boldsymbol {f}}({\boldsymbol {x}}){\overset {\underset {\mathrm {def} }{}}{=}}{\begin{bmatrix}{\frac {\partial f_{1}({\boldsymbol {x}})}{\partial x_{1}}}&{\frac {\partial f_{2}({\boldsymbol {x}})}{\partial x_{1}}}&\cdots &{\frac {\partial f_{m}({\boldsymbol {x}})}{\partial x_{1}}}\\{\frac {\partial f_{1}({\boldsymbol {x}})}{\partial x_{2}}}&{\frac {\partial f_{2}({\boldsymbol {x}})}{\partial x_{2}}}&\cdots &{\frac {\partial f_{m}({\boldsymbol {x}})}{\partial x_{2}}}\\\vdots &\vdots &\ddots &\vdots \\{\frac {\partial f_{1}({\boldsymbol {x}})}{\partial x_{n}}}&{\frac {\partial f_{2}({\boldsymbol {x}})}{\partial x_{n}}}&\cdots &{\frac {\partial f_{m}({\boldsymbol {x}})}{\partial x_{n}}}\\\end{bmatrix}}={\frac {\partial {\boldsymbol {f}}({\boldsymbol {x}})}{\partial {\boldsymbol {x}}}}}
标量函数
f
(
A
)
{\displaystyle f({\boldsymbol {A}})}
相对于m×n实矩阵A 的梯度为一m×n矩阵,简称梯度矩阵,定义为
∇
A
f
(
A
)
=
d
e
f
[
∂
f
(
A
)
∂
a
11
∂
f
(
A
)
∂
a
12
⋯
∂
f
(
A
)
∂
a
1
n
∂
f
(
A
)
∂
a
21
∂
f
(
A
)
∂
a
22
⋯
∂
f
(
A
)
∂
a
2
n
⋮
⋮
⋱
⋮
∂
f
(
A
)
∂
a
m
1
∂
f
(
A
)
∂
a
m
2
⋯
∂
f
(
A
)
∂
a
m
n
]
=
∂
f
(
A
)
∂
A
{\displaystyle \nabla _{\boldsymbol {A}}f({\boldsymbol {A}}){\overset {\underset {\mathrm {def} }{}}{=}}{\begin{bmatrix}{\frac {\partial f({\boldsymbol {A}})}{\partial a_{11}}}&{\frac {\partial f({\boldsymbol {A}})}{\partial a_{12}}}&\cdots &{\frac {\partial f({\boldsymbol {A}})}{\partial a_{1n}}}\\{\frac {\partial f({\boldsymbol {A}})}{\partial a_{21}}}&{\frac {\partial f({\boldsymbol {A}})}{\partial a_{22}}}&\cdots &{\frac {\partial f({\boldsymbol {A}})}{\partial a_{2n}}}\\\vdots &\vdots &\ddots &\vdots \\{\frac {\partial f({\boldsymbol {A}})}{\partial a_{m1}}}&{\frac {\partial f({\boldsymbol {A}})}{\partial a_{m2}}}&\cdots &{\frac {\partial f({\boldsymbol {A}})}{\partial a_{mn}}}\\\end{bmatrix}}={\frac {\partial f({\boldsymbol {A}})}{\partial {\boldsymbol {A}}}}}
以下法则适用于实标量函数对向量的梯度以及对矩阵的梯度。
线性法则:若
f
(
A
)
{\displaystyle f({\boldsymbol {A}})}
和
g
(
A
)
{\displaystyle g({\boldsymbol {A}})}
分别是矩阵A的实标量函数,c1 和c2 为实常数,则
∂
[
c
1
f
(
A
)
+
c
2
g
(
A
)
]
∂
A
=
c
1
∂
f
(
A
)
∂
A
+
c
2
∂
g
(
A
)
∂
A
{\displaystyle {\frac {\partial [c_{1}f({\boldsymbol {A}})+c_{2}g({\boldsymbol {A}})]}{\partial {\boldsymbol {A}}}}=c_{1}{\frac {\partial f({\boldsymbol {A}})}{\partial {\boldsymbol {A}}}}+c_{2}{\frac {\partial g({\boldsymbol {A}})}{\partial {\boldsymbol {A}}}}}
乘积法则:若
f
(
A
)
{\displaystyle f({\boldsymbol {A}})}
,
g
(
A
)
{\displaystyle g({\boldsymbol {A}})}
和
h
(
A
)
{\displaystyle h({\boldsymbol {A}})}
分别是矩阵A的实标量函数,则
∂
f
(
A
)
g
(
A
)
∂
A
=
g
(
A
)
∂
f
(
A
)
∂
A
+
f
(
A
)
∂
g
(
A
)
∂
A
{\displaystyle {\frac {\partial f({\boldsymbol {A}})g({\boldsymbol {A}})}{\partial {\boldsymbol {A}}}}=g({\boldsymbol {A}}){\frac {\partial f({\boldsymbol {A}})}{\partial {\boldsymbol {A}}}}+f({\boldsymbol {A}}){\frac {\partial g({\boldsymbol {A}})}{\partial {\boldsymbol {A}}}}}
∂
f
(
A
)
g
(
A
)
h
(
A
)
∂
A
=
g
(
A
)
h
(
A
)
∂
f
(
A
)
∂
A
+
f
(
A
)
h
(
A
)
∂
g
(
A
)
∂
A
+
f
(
A
)
g
(
A
)
∂
h
(
A
)
∂
A
{\displaystyle {\frac {\partial f({\boldsymbol {A}})g({\boldsymbol {A}})h({\boldsymbol {A}})}{\partial {\boldsymbol {A}}}}=g({\boldsymbol {A}})h({\boldsymbol {A}}){\frac {\partial f({\boldsymbol {A}})}{\partial {\boldsymbol {A}}}}+f({\boldsymbol {A}})h({\boldsymbol {A}}){\frac {\partial g({\boldsymbol {A}})}{\partial {\boldsymbol {A}}}}+f({\boldsymbol {A}})g({\boldsymbol {A}}){\frac {\partial h({\boldsymbol {A}})}{\partial {\boldsymbol {A}}}}}
商法则:若
g
(
A
)
≠
0
{\displaystyle g({\boldsymbol {A}})\neq 0}
,则
∂
f
(
A
)
/
g
(
A
)
∂
A
=
1
g
(
A
)
2
[
g
(
A
)
∂
f
(
A
)
∂
A
−
f
(
A
)
∂
g
(
A
)
∂
A
]
{\displaystyle {\frac {\partial f({\boldsymbol {A}})/g({\boldsymbol {A}})}{\partial {\boldsymbol {A}}}}={\frac {1}{g({\boldsymbol {A}})^{2}}}\left[g({\boldsymbol {A}}){\frac {\partial f({\boldsymbol {A}})}{\partial {\boldsymbol {A}}}}-f({\boldsymbol {A}}){\frac {\partial g({\boldsymbol {A}})}{\partial {\boldsymbol {A}}}}\right]}
链式法则:若A 为m×n矩阵,且
y
=
f
(
A
)
{\displaystyle y=f({\boldsymbol {A}})}
和
g
(
y
)
{\displaystyle g(y)}
分别是以矩阵A 和标量y为变元的实标量函数,则
∂
g
(
f
(
A
)
)
∂
A
=
d
g
(
y
)
d
y
∂
f
(
A
)
∂
A
{\displaystyle {\frac {\partial g(f({\boldsymbol {A}}))}{\partial {\boldsymbol {A}}}}={\frac {dg(y)}{dy}}{\frac {\partial f({\boldsymbol {A}})}{\partial {\boldsymbol {A}}}}}
书籍
Bachman, David, Advanced Calculus Demystified, New York: McGraw-Hill , 2007, ISBN 0-07-148121-4
Beauregard, Raymond A.; Fraleigh, John B., A First Course In Linear Algebra: with Optional Introduction to Groups, Rings, and Fields, Boston: Houghton Mifflin Company , 1973, ISBN 0-395-14017-X
Downing, Douglas, Ph.D., Barron's E-Z Calculus, New York: Barron's , 2010, ISBN 978-0-7641-4461-5
Dubrovin, B. A.; Fomenko, A. T.; Novikov, S. P. Modern Geometry—Methods and Applications: Part I: The Geometry of Surfaces, Transformation Groups, and Fields. Graduate Texts in Mathematics 2nd. Springer. 1991. ISBN 978-0-387-97663-1 .
Harper, Charlie, Introduction to Mathematical Physics, New Jersey: Prentice-Hall , 1976, ISBN 0-13-487538-9
Kreyszig, Erwin , Advanced Engineering Mathematics 3rd, New York: Wiley , 1972, ISBN 0-471-50728-8
McGraw-Hill Encyclopedia of Science & Technology 10th. New York: McGraw-Hill . 2007. ISBN 0-07-144143-3 .
Moise, Edwin E., Calculus: Complete, Reading: Addison-Wesley , 1967
Protter, Murray H.; Morrey, Jr., Charles B., College Calculus with Analytic Geometry 2nd, Reading: Addison-Wesley , 1970, LCCN 76087042
Schey, H. M. Div, Grad, Curl, and All That 2nd. W. W. Norton. 1992. ISBN 0-393-96251-2 . OCLC 25048561 .
Stoker, J. J., Differential Geometry, New York: Wiley , 1969, ISBN 0-471-82825-4
Swokowski, Earl W.; Olinick, Michael; Pence, Dennis; Cole, Jeffery A., Calculus 6th, Boston: PWS Publishing Company, 1994, ISBN 0-534-93624-5
张贤达 , 《矩阵分析与应用》, 清华大学出版社, 2004, ISBN 9787302092711 (中文(中国大陆))