{
  "id": "indicator-function",
  "title": "Indicator Function",
  "lang": "en",
  "source_lang": "en",
  "summary": "An indicator function represents membership in a set by assigning one to its elements and zero to all other elements.",
  "category": "mathematics",
  "subcategory": "discrete-logic",
  "type": "concept",
  "aliases": [
    "Characteristic function of a set",
    "Indicator variable",
    "Indicator random variable"
  ],
  "generated_at": "2026-10-04",
  "model": "pro/gpt-6.1-sol",
  "url": "https://aiwiki.page/en/indicator-function/",
  "translations": {
    "zh-Hans": {
      "url": "https://aiwiki.page/zh/indicator-function/",
      "json": "https://aiwiki.page/zh/indicator-function.json"
    }
  },
  "sections": [
    {
      "heading": "",
      "text": "An indicator function is a function that encodes membership in a subset using the values zero and one. For a subset \\(A\\) of a set \\(X\\), its indicator equals one at elements belonging to \\(A\\) and zero elsewhere. Indicators translate statements about sets or events into numerical expressions, making them useful in probability, measure theory, and counting arguments. In probability, the indicator of an event is also called an indicator random variable. (ocw.mit.edu)"
    },
    {
      "heading": "Definition and notation",
      "text": "For \\(A\\subseteq X\\), the indicator function is defined by\n\n\\[\\mathbf 1_A(x)= \\begin{cases} 1,&x\\in A,\\\\ 0,&x\\notin A. \\end{cases}\\]\n\nCommon alternative notations are \\(I_A\\) and \\(\\chi_A\\). Its domain is the ambient set \\(X\\), not merely \\(A\\); its codomain may be taken as \\(\\{0,1\\}\\) or as the real numbers. The ambient set matters because it determines where the function takes the value zero. (people.csail.mit.edu)\n\nFor example, on the outcomes \\(\\{1,2,3,4,5,6\\}\\) of a die, the indicator of the event “an even number appears” is one at \\(2,4,6\\) and zero at \\(1,3,5\\). This definition records whether the event occurs; probabilities enter only when a probability model is supplied. (statlect.com)"
    },
    {
      "heading": "Algebra of sets",
      "text": "Indicators express set operations through pointwise arithmetic. For subsets \\(A,B\\subseteq X\\), with \\(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\nand\n\n\\[\\mathbf 1_{A\\cup B} =\\mathbf 1_A+\\mathbf 1_B-\\mathbf 1_A\\mathbf 1_B.\\]\n\nThe subtraction in the union formula corrects the double counting of elements belonging to both sets. These identities can be checked separately at each point by considering its membership in \\(A\\) and \\(B\\). (ocw.mit.edu)\n\nFor finitely many sets,\n\n\\[\\mathbf 1_{\\bigcup_{j=1}^{n}A_j} =1-\\prod_{j=1}^{n}(1-\\mathbf 1_{A_j}).\\]\n\nExpanding the product gives the inclusion–exclusion principle in functional form. If the sets are pairwise disjoint, their union indicator is simply the sum of their indicators, because no point contributes more than one nonzero term. Taking expectations turns these functional identities into corresponding probability formulas. (ocw.mit.edu)"
    },
    {
      "heading": "Measurability and integration",
      "text": "On a measurable space \\((X,\\mathcal F)\\), where \\(\\mathcal F\\) is a sigma-algebra, the real-valued function \\(\\mathbf 1_A\\) is a measurable function exactly when \\(A\\in\\mathcal F\\). Thus a set’s measurability can be expressed as measurability of a numerical function. (math.mit.edu)\n\nIf \\(\\mu\\) is a measure and \\(A\\) is measurable, its integral satisfies\n\n\\[\\int_X\\mathbf 1_A\\,d\\mu=\\mu(A).\\]\n\nMore generally, for a nonnegative measurable function \\(f\\), or an integrable function \\(f\\),\n\n\\[\\int_A f\\,d\\mu=\\int_X f\\mathbf 1_A\\,d\\mu.\\]\n\nMultiplication by an indicator therefore restricts integration to a selected region without changing the ambient domain. (math.mit.edu)\n\nIndicators are the building blocks of simple functions, which take only finitely many values. A nonnegative measurable simple function can be written\n\n\\[s=\\sum_{k=1}^{m}a_k\\mathbf 1_{A_k},\\]\n\nwhere the \\(A_k\\) are disjoint measurable sets and \\(a_k\\geq0\\). Its integral is\n\n\\[\\int_Xs\\,d\\mu=\\sum_{k=1}^{m}a_k\\mu(A_k).\\]\n\nEvery nonnegative measurable function is the increasing pointwise limit of such functions. This approximation underlies the construction of the Lebesgue integral, extending integration from weighted measurements of sets to general measurable functions. (math.mit.edu)"
    },
    {
      "heading": "Indicator random variables",
      "text": "On a probability space \\((\\Omega,\\mathcal F,\\mathbb P)\\), an event \\(A\\in\\mathcal F\\) determines the random variable \\(\\mathbf 1_A\\). If \\(p=\\mathbb P(A)\\), it has the Bernoulli distribution:\n\n\\[\\mathbb P(\\mathbf 1_A=1)=p,\\qquad \\mathbb P(\\mathbf 1_A=0)=1-p.\\]\n\nIts expected value and variance are\n\n\\[\\mathbb E[\\mathbf 1_A]=p,\\qquad \\operatorname{Var}(\\mathbf 1_A)=p(1-p).\\]\n\nThe variance identity follows from \\(\\mathbf 1_A^2=\\mathbf 1_A\\), since both zero and one equal their own squares. (ocw.mit.edu)\n\nFor two events, the covariance is\n\n\\[\\operatorname{Cov}(\\mathbf 1_A,\\mathbf 1_B) =\\mathbb P(A\\cap B)-\\mathbb P(A)\\mathbb P(B).\\]\n\nConsequently, these two indicators have zero covariance exactly when the events satisfy statistical independence. This equivalence is specific to event indicators; zero covariance does not generally imply independence for arbitrary random variables. (math.mit.edu)\n\nIndicators also simplify the analysis of counts. If \\(N\\) counts how many events \\(A_1,\\ldots,A_n\\) occur, then\n\n\\[N=\\sum_{j=1}^{n}\\mathbf 1_{A_j},\\qquad \\mathbb E[N]=\\sum_{j=1}^{n}\\mathbb P(A_j).\\]\n\nThe expectation formula requires no independence assumption. When the indicators are independent and share the same success probability \\(p\\), their sum has the binomial distribution with parameters \\(n,p\\). (ocw.mit.edu)"
    },
    {
      "heading": "A different convention in optimization",
      "text": "In convex optimization, “indicator function” often denotes a different, extended-real-valued function:\n\n\\[\\delta_C(x)= \\begin{cases} 0,&x\\in C,\\\\ +\\infty,&x\\notin C. \\end{cases}\\]\n\nThis convention incorporates a constraint \\(x\\in C\\) into an objective function: minimizing \\(f(x)\\) over \\(C\\) can be represented by minimizing \\(f(x)+\\delta_C(x)\\) over the ambient space. Outside \\(C\\), the infinite value excludes infeasible points from any finite objective value. For a nonempty convex set \\(C\\), \\(\\delta_C\\) is a convex function. Unlike the ordinary indicator, it uses zero to represent membership and infinity to represent nonmembership. (stanford.edu)"
    }
  ],
  "links": [
    "mathematical-function",
    "subset",
    "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/"
}