{
  "id": "indicator-function",
  "title": "指示函数",
  "lang": "zh-Hans",
  "source_lang": "en",
  "summary": "指示函数用数值表示元素是否属于某个集合：属于时取一，否则取零。",
  "category": "mathematics",
  "subcategory": "discrete-logic",
  "type": "concept",
  "aliases": [
    "示性函数",
    "集合的特征函数"
  ],
  "generated_at": "2026-10-04",
  "model": "pro/gpt-6.1-sol",
  "url": "https://aiwiki.page/zh/indicator-function/",
  "translations": {
    "en": {
      "url": "https://aiwiki.page/en/indicator-function/",
      "json": "https://aiwiki.page/en/indicator-function.json"
    }
  },
  "sections": [
    {
      "heading": "",
      "text": "指示函数是用零和一来表示元素是否属于某个子集的函数。对于集合 \\(X\\) 的子集 \\(A\\)，其指示函数在属于 \\(A\\) 的元素处取值为一，在其他元素处取值为零。指示函数将关于集合或事件的陈述转化为数值表达式，因此在概率、测度论和计数论证中十分有用。在概率论中，事件的指示函数也称为指示随机变量。(ocw.mit.edu)"
    },
    {
      "heading": "定义与记号",
      "text": "对于 \\(A\\subseteq X\\)，指示函数定义为\n\n\\[\\mathbf 1_A(x)= \\begin{cases} 1,&x\\in A,\\\\ 0,&x\\notin A. \\end{cases}\\]\n\n其他常用记号有 \\(I_A\\) 和 \\(\\chi_A\\)。它的定义域是所在的整个集合 \\(X\\)，而不只是 \\(A\\)；它的陪域可以取为 \\(\\{0,1\\}\\)，也可以取为实数集。明确集合 \\(X\\) 很重要，因为它决定了函数在哪些元素处取值为零。(people.csail.mit.edu)\n\n例如，在掷骰子的结果集合 \\(\\{1,2,3,4,5,6\\}\\) 上，事件“出现偶数”的指示函数在 \\(2,4,6\\) 处取值为一，在 \\(1,3,5\\) 处取值为零。这个定义只记录事件是否发生；只有给定概率模型后，才涉及概率。(statlect.com)"
    },
    {
      "heading": "集合运算",
      "text": "指示函数通过逐点算术运算来表示集合运算。对于子集 \\(A,B\\subseteq X\\)，令 \\(A^c=X\\setminus A\\)，则\n\n\\[\\mathbf 1_{A^c}=1-\\mathbf 1_A,\\qquad \\mathbf 1_{A\\cap B}=\\mathbf 1_A\\mathbf 1_B,\\]\n\n以及\n\n\\[\\mathbf 1_{A\\cup B} =\\mathbf 1_A+\\mathbf 1_B-\\mathbf 1_A\\mathbf 1_B.\\]\n\n并集公式中的减法项修正了同时属于两个集合的元素被重复计算的问题。考察每个点是否属于 \\(A\\) 和 \\(B\\)，即可逐点验证这些恒等式。(ocw.mit.edu)\n\n对于有限个集合，\n\n\\[\\mathbf 1_{\\bigcup_{j=1}^{n}A_j} =1-\\prod_{j=1}^{n}(1-\\mathbf 1_{A_j}).\\]\n\n展开乘积便得到函数形式的容斥原理。如果这些集合两两不相交，其并集的指示函数就是各自指示函数之和，因为在任何一点上，非零项都不会超过一项。对这些函数恒等式取期望，便得到相应的概率公式。(ocw.mit.edu)"
    },
    {
      "heading": "可测性与积分",
      "text": "在可测空间 \\((X,\\mathcal F)\\) 上，其中 \\(\\mathcal F\\) 是一个σ代数，实值函数 \\(\\mathbf 1_A\\) 是可测函数，当且仅当 \\(A\\in\\mathcal F\\)。因此，集合的可测性可以用一个数值函数的可测性来表达。(math.mit.edu)\n\n若 \\(\\mu\\) 是测度，且 \\(A\\) 可测，则其指示函数的积分满足\n\n\\[\\int_X\\mathbf 1_A\\,d\\mu=\\mu(A).\\]\n\n更一般地，对于非负可测函数 \\(f\\) 或可积函数 \\(f\\)，\n\n\\[\\int_A f\\,d\\mu=\\int_X f\\mathbf 1_A\\,d\\mu.\\]\n\n因此，乘以指示函数可以在不改变原有定义域的情况下，将积分限制在选定区域内。(math.mit.edu)\n\n指示函数是构成简单函数的基本组成部分；简单函数只取有限个值。非负可测简单函数可以写成\n\n\\[s=\\sum_{k=1}^{m}a_k\\mathbf 1_{A_k},\\]\n\n其中 \\(A_k\\) 是两两不相交的可测集，且 \\(a_k\\geq0\\)。它的积分为\n\n\\[\\int_Xs\\,d\\mu=\\sum_{k=1}^{m}a_k\\mu(A_k).\\]\n\n每个非负可测函数都是一列这样的简单函数逐点递增的极限。这种逼近是构造勒贝格积分的基础，使积分从集合测度的加权求和推广到一般的可测函数。(math.mit.edu)"
    },
    {
      "heading": "指示随机变量",
      "text": "在概率空间 \\((\\Omega,\\mathcal F,\\mathbb P)\\) 上，事件 \\(A\\in\\mathcal F\\) 确定了一个随机变量 \\(\\mathbf 1_A\\)。若 \\(p=\\mathbb P(A)\\)，则它服从伯努利分布：\n\n\\[\\mathbb P(\\mathbf 1_A=1)=p,\\qquad \\mathbb P(\\mathbf 1_A=0)=1-p.\\]\n\n它的期望值和方差分别为\n\n\\[\\mathbb E[\\mathbf 1_A]=p,\\qquad \\operatorname{Var}(\\mathbf 1_A)=p(1-p).\\]\n\n方差恒等式由 \\(\\mathbf 1_A^2=\\mathbf 1_A\\) 推出，因为零和一的平方都等于自身。(ocw.mit.edu)\n\n对于两个事件，其指示函数的协方差为\n\n\\[\\operatorname{Cov}(\\mathbf 1_A,\\mathbf 1_B) =\\mathbb P(A\\cap B)-\\mathbb P(A)\\mathbb P(B).\\]\n\n因此，这两个指示函数的协方差为零，当且仅当两个事件满足统计独立性。这种等价关系是事件指示函数特有的；对于任意随机变量，协方差为零通常并不意味着独立。(math.mit.edu)\n\n指示函数还能简化计数问题的分析。如果 \\(N\\) 表示事件 \\(A_1,\\ldots,A_n\\) 中发生的事件个数，则\n\n\\[N=\\sum_{j=1}^{n}\\mathbf 1_{A_j},\\qquad \\mathbb E[N]=\\sum_{j=1}^{n}\\mathbb P(A_j).\\]\n\n这个期望公式不需要独立性假设。当这些指示函数相互独立，且具有相同的成功概率 \\(p\\) 时，它们的和服从参数为 \\(n,p\\) 的二项分布。(ocw.mit.edu)"
    },
    {
      "heading": "优化中的另一种约定",
      "text": "在凸优化中，“指示函数”常指另一种取扩展实数值的函数：\n\n\\[\\delta_C(x)= \\begin{cases} 0,&x\\in C,\\\\ +\\infty,&x\\notin C. \\end{cases}\\]\n\n这种约定将约束 \\(x\\in C\\) 纳入目标函数：在 \\(C\\) 上最小化 \\(f(x)\\)，可以表示为在整个空间上最小化 \\(f(x)+\\delta_C(x)\\)。在 \\(C\\) 之外，无穷大的取值使不可行点无法取得有限的目标函数值。对于非空凸集 \\(C\\)，\\(\\delta_C\\) 是一个凸函数。与通常的指示函数不同，它用零表示属于集合，用无穷大表示不属于集合。(stanford.edu)"
    }
  ],
  "links": [
    "subset",
    "mathematical-function",
    "probability",
    "measure-theory",
    "domain-of-a-function",
    "codomain",
    "real-number",
    "inclusion-exclusion-principle",
    "sigma-algebra",
    "measurable-function",
    "integral",
    "lebesgue-integral",
    "probability-space",
    "random-variable",
    "bernoulli-distribution",
    "expected-value",
    "variance",
    "covariance",
    "statistical-independence",
    "binomial-distribution",
    "convex-optimization",
    "objective-function",
    "convex-set",
    "convex-function"
  ],
  "sources": [
    {
      "title": "ocw.mit.edu/courses/6-436j-fundamentals-of-probability-fall-2018/f6a391ad22d454…",
      "url": "https://ocw.mit.edu/courses/6-436j-fundamentals-of-probability-fall-2018/f6a391ad22d454dea0903bb72eb58728_MIT6_436JF18_lec06.pdf"
    },
    {
      "title": "people.csail.mit.edu/mitras/research/thesis.pdf",
      "url": "https://people.csail.mit.edu/mitras/research/thesis.pdf"
    },
    {
      "title": "statlect.com/fundamentals-of-probability/indicator-functions",
      "url": "https://www.statlect.com/fundamentals-of-probability/indicator-functions"
    },
    {
      "title": "math.mit.edu/~rbm/18.155-F16/Chapter1.pdf",
      "url": "https://math.mit.edu/~rbm/18.155-F16/Chapter1.pdf"
    },
    {
      "title": "ocw.mit.edu/courses/res-6-012-introduction-to-probability-spring-2018/pages/par…",
      "url": "https://ocw.mit.edu/courses/res-6-012-introduction-to-probability-spring-2018/pages/part-i-the-fundamentals/"
    },
    {
      "title": "math.mit.edu/~djk/18.310/Lecture-Notes/SN-Probability.html",
      "url": "https://math.mit.edu/~djk/18.310/Lecture-Notes/SN-Probability.html"
    },
    {
      "title": "stanford.edu/~boyd/cvxbook/bv_cvxbook.pdf",
      "url": "https://www.stanford.edu/~boyd/cvxbook/bv_cvxbook.pdf"
    }
  ],
  "license": "https://creativecommons.org/licenses/by/4.0/"
}