此頁面介紹的是集合的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 .