此页面介绍的是集合的0-1指示函数。关于其他指示特征的函数,请见“
示性函数 ”。
在集合论 中,指示函数 是定义在某集合 X 上的函数 ,表示其中有哪些元素属于某一子集 A 。指示函数有时候也称为示性函数 或特征函数 。
集X 的子集A 的指示函数是函数
1
A
:
X
→
{
0
,
1
}
{\displaystyle 1_{A}:X\to \lbrace 0,1\rbrace }
,定义为
1
A
(
x
)
=
{
1
0
{\displaystyle 1_{A}(x)={\begin{cases}1\\0\end{cases}}\quad }
若
x
∈
A
{\displaystyle x\in A}
若
x
∉
A
{\displaystyle x\notin A}
A 的指示函数也记作
χ
A
(
x
)
{\displaystyle \chi _{A}(x)\,}
或
I
A
(
x
)
{\displaystyle I_{A}(x)\,}
。
简单性质
把X 的子集A 对应到它的指示函数的映射是双射 ,值域是所有函数
f
:
X
→
{
0
,
1
}
{\displaystyle f:X\to \{0,1\}}
的集合。
如果A 和B 是X 的两个子集,那么
1
A
∩
B
=
min
{
1
A
,
1
B
}
=
1
A
1
B
{\displaystyle 1_{A\cap B}=\min\{1_{A},1_{B}\}=1_{A}1_{B}\,}
,
以及
1
A
∪
B
=
max
{
1
A
,
1
B
}
=
1
A
+
1
B
−
1
A
1
B
{\displaystyle 1_{A\cup B}=\max\{{1_{A},1_{B}}\}=1_{A}+1_{B}-1_{A}1_{B}\,}
。
更一般地,设A 1 , ..., A n 是X 的子集。对任意
x
∈
X
{\displaystyle x\in X}
,可知
∏
k
∈
I
(
1
−
1
A
k
(
x
)
)
=
1
{\displaystyle \prod _{k\in I}(1-1_{A_{k}}(x))=1}
当且仅当x 不属于任何A k 。
故有
∏
k
∈
I
(
1
−
1
A
k
)
=
1
X
−
⋃
k
A
k
=
1
−
1
⋃
k
A
k
{\displaystyle \prod _{k\in I}(1-1_{A_{k}})=1_{X-\bigcup _{k}A_{k}}=1-1_{\bigcup _{k}A_{k}}}
。
展开左式
1
⋃
k
A
k
{\displaystyle 1_{\bigcup _{k}A_{k}}}
=
1
−
∑
F
⊆
{
1
,
2
,
…
,
n
}
(
−
1
)
|
F
|
1
⋂
F
A
k
{\displaystyle =1-\sum _{F\subseteq \{1,2,\ldots ,n\}}(-1)^{|F|}\;1_{\bigcap _{F}A_{k}}}
=
∑
∅
≠
F
⊆
{
1
,
2
,
…
,
n
}
(
−
1
)
|
F
|
+
1
1
⋂
F
A
k
{\displaystyle =\sum _{\varnothing \neq F\subseteq \{1,2,\ldots ,n\}}(-1)^{|F|+1}\;1_{\bigcap _{F}A_{k}}}
,
其中|F |是F 的势 。这是容斥原理 的一个形式。
如上一例子所示,指示函数是组合数学 一个有用记法。这记法也用在其他地方,例如在概率论 :若X 是概率空间 ,有概率测度P ,A 是可测集 ,那么1A 就是随机变量 ,其期望值 等于A 的概率。
E
(
1
A
)
=
∫
X
1
A
(
x
)
d
P
=
∫
A
d
P
=
P
(
A
)
{\displaystyle E(1_{A})=\int _{X}1_{A}(x)\,dP=\int _{A}dP=P(A)}
。
这等式用于马尔可夫不等式 的一个简单证明里。
平均、变异数以及共变异数
给定一个机率空间
(
Ω
,
F
,
P
)
{\displaystyle \textstyle (\Omega ,{\mathcal {F}},\operatorname {P} )}
,其中
A
∈
F
,
{\displaystyle A\in {\mathcal {F}},}
指示函数可以被定义成以下形式:
1
A
:
Ω
→
R
:=
{\displaystyle \mathbf {1} _{A}\colon \Omega \rightarrow \mathbb {R} :=}
1
A
=
1
if
ω
∈
A
,
otherwise
1
A
=
0
{\displaystyle {\begin{aligned}\mathbf {1} _{A}=1\ {\text{if}}\ \omega \in A,\\{\text{otherwise}}\ \mathbf {1} _{A}=0\end{aligned}}}
平均
E
(
1
A
(
ω
)
)
=
P
(
A
)
{\displaystyle \operatorname {E} (\mathbf {1} _{A}(\omega ))=\operatorname {P} (A)}
变异数
Var
(
1
A
(
ω
)
)
=
P
(
A
)
(
1
−
P
(
A
)
)
{\displaystyle \operatorname {Var} (\mathbf {1} _{A}(\omega ))=\operatorname {P} (A)(1-\operatorname {P} (A))}
共变异数
Cov
(
1
A
(
ω
)
,
1
B
(
ω
)
)
=
P
(
A
∩
B
)
−
P
(
A
)
P
(
B
)
{\displaystyle \operatorname {Cov} (\mathbf {1} _{A}(\omega ),\mathbf {1} _{B}(\omega ))=\operatorname {P} (A\cap B)-\operatorname {P} (A)\operatorname {P} (B)}
指示函数的微分
以下我们讨论一个特别的指示函数,黑维塞函数 :
H
(
x
)
:=
1
x
>
0
{\displaystyle H(x):=\mathbf {1} _{x>0}}
The distributional derivative of the Heaviside step function is equal to the Dirac delta function , i.e.
d
H
(
x
)
d
x
=
δ
(
x
)
{\displaystyle {\frac {dH(x)}{dx}}=\delta (x)}
and similarly the distributional derivative of
G
(
x
)
:=
1
x
<
0
{\displaystyle G(x):=\mathbf {1} _{x<0}}
is
d
G
(
x
)
d
x
=
−
δ
(
x
)
{\displaystyle {\frac {dG(x)}{dx}}=-\delta (x)}
Thus the derivative of the Heaviside step function can be seen as the inward normal derivative at the boundary of the domain given by the positive half-line. In higher dimensions, the derivative naturally generalises to the inward normal derivative, while the Heaviside step function naturally generalises to the indicator function of some domain D . The surface of D will be denoted by S . Proceeding, it can be derived that the inward normal derivative of the indicator gives rise to a 'surface delta function', which can be indicated by
δ
S
(
x
)
{\displaystyle \delta _{S}(\mathbf {x} )}
:
δ
S
(
x
)
=
−
n
x
⋅
∇
x
1
x
∈
D
{\displaystyle \delta _{S}(\mathbf {x} )=-\mathbf {n} _{x}\cdot \nabla _{x}\mathbf {1} _{\mathbf {x} \in D}}
where n is the outward normal of the surface S . This 'surface delta function' has the following property:[ 1]
−
∫
R
n
f
(
x
)
n
x
⋅
∇
x
1
x
∈
D
d
n
x
=
∮
S
f
(
β
)
d
n
−
1
β
.
{\displaystyle -\int _{\mathbb {R} ^{n}}f(\mathbf {x} )\,\mathbf {n} _{x}\cdot \nabla _{x}\mathbf {1} _{\mathbf {x} \in D}\;d^{n}\mathbf {x} =\oint _{S}\,f(\mathbf {\beta } )\;d^{n-1}\mathbf {\beta } .}
By setting the function f equal to one, it follows that the inward normal derivative of the indicator integrates to the numerical value of the surface area S .
^ Lange, Rutger-Jan. Potential theory, path integrals and the Laplacian of the indicator. Journal of High Energy Physics. 2012, 2012 (11): 29–30. Bibcode:2012JHEP...11..032L . S2CID 56188533 . arXiv:1302.0864 . doi:10.1007/JHEP11(2012)032 .