Last modified: 2026-10-27 20:53:54 (PDT)
An indicator function is a mathematical function that signals whether an element belongs to a specified set, or whether a given logical condition is satisfied. In statistics and epidemiology, indicator functions are ubiquitous. They represent:
Despite their conceptual simplicity, notation for indicator functions varies substantially across textbooks, research papers, and subfields. This section summarizes the principal notational conventions.
Definition 1 (Indicator function, set indicator) For any subset \(A \subseteq \Omega\) of a universal set \(\Omega\), the indicator function of \(A\), [1] or set indicator, is the function \(\mathbb{1}_{A} : \Omega\to \{0, 1\}\) defined by:
\[ \mathbb{1}_{A}(x) \stackrel{\text{def}}{=}\begin{cases} 1, & x \in A \\ 0, & x \notin A \end{cases} \]
Definition 2 (Predicate indicator) For any logical proposition or predicate \(P\), the indicator of \(P\), or predicate indicator, takes the value \(1\) when \(P\) is true and \(0\) when \(P\) is false:
\[ {\mathbb{1}\mathopen{}\left(P\right)\mathclose{}} \stackrel{\text{def}}{=}\begin{cases} 1, & \text{if } P \text{ is true} \\ 0, & \text{if } P \text{ is false} \end{cases} \]
Example 1 (Evaluating set and predicate indicators) Consider the real line \(\Omega= \mathbb{R}\), the set of nonnegative numbers \(A = [0, \infty)\), and a continuous random variable \(Y\) (defined in the Morrison Lab’s probability notes).
Definition 3 (Binary variable) A binary variable is a variable that takes only the values \(0\) and \(1\).
Example 2 (A binary variable is an indicator) In a study of \(n\) people, let \(s_i = 1\) if person \(i\) smokes and \(s_i = 0\) otherwise, for \(i \in \mathopen{}\left\{1, \ldots, n\right\}\mathclose{}\). Then \(s_i\) is a binary variable (Definition 3). It is also the predicate indicator (Definition 1) of the proposition “person \(i\) smokes”: \(s_i = {\mathbb{1}\mathopen{}\left(\text{person } i \text{ smokes}\right)\mathclose{}}\).
In the same way, every indicator is a binary variable, and every binary variable \(X\) is the indicator of its own value being \(1\): \(X = {\mathbb{1}\mathopen{}\left(X = 1\right)\mathclose{}}\), since both sides are \(1\) when \(X = 1\) and \(0\) when \(X = 0\).
The vast majority of indicator notations belong to one of two families: set notation or predicate notation.
Definition 4 (Set notation for indicators) An indicator (Definition 1) is written in set notation when the set \(A\) appears as a subscript, as in \(\mathbb{1}_{A}(x)\).
Definition 5 (Predicate notation for indicators) An indicator (Definition 1) is written in predicate notation when a proposition or predicate \(P\) (definition) appears as its argument, as in \({\mathbb{1}\mathopen{}\left(P\right)\mathclose{}}\) or \({\mathbb{1}\mathopen{}\left(x \in A\right)\mathclose{}}\).
Example 3 (One indicator in both notations) Let \(A = [0, \infty)\), the nonnegative real numbers. The indicator of \(A\) is \(\mathbb{1}_{A}(x)\) in set notation, and \({\mathbb{1}\mathopen{}\left(x \in A\right)\mathclose{}}\) or \({\mathbb{1}\mathopen{}\left(x \ge 0\right)\mathclose{}}\) in predicate notation (Definition 4, Definition 5). At \(x = 3.5\), all three equal \(1\); at \(x = -2.1\), all three equal \(0\).
In set notation, the indicator is tied to a set \(A\), which appears as a subscript:
When the function is viewed as a mathematical object in its own right (for instance, as an element of an \(L^p\) function space, the set of functions \(f\) for which \(\int \mathopen{}\left|f(x)\right|\mathclose{}^p \, dx\) is finite), authors often omit the argument \(x\), writing simply \(\mathbf{1}_A\), \(\mathbb{1}_{A}\), or \(I_A\).
In predicate notation, the indicator takes a logical condition, relation, or proposition \(P\) directly as its argument or subscript:
Predicate notation is especially common in applied statistics and survival analysis, where indicators frequently depend on inequalities (definition) involving random variables, such as \({\mathbb{1}\mathopen{}\left(T_i \le t\right)\mathclose{}}\) (an event occurring before time \(t\)) or \({\mathbb{1}\mathopen{}\left(Y_i = 1\right)\mathclose{}}\) (a binary outcome).
The two paradigms are connected by evaluating the predicate indicator at the membership statement \(x \in A\):
\[ \mathbf{1}_A(x) = \mathbb{I}(x \in A) \]
Definition 6 (Support of a distribution) The support of a discrete distribution [2] is the set of values it gives positive probability. The support of a continuous distribution is the set of values where its density is positive.
Example 4 (Supports of two count distributions)
Set notation is more natural when the underlying set \(A\) has a standard name (such as the support of a distribution (Definition 6), or a geometric region). Predicate notation is more natural when the condition involves compound inequalities, such as \({\mathbb{1}\mathopen{}\left(0 \le t \le u\right)\mathclose{}}\).
In 1962, Kenneth Iverson introduced a compact notation in the programming language APL, later popularized in mathematics and computer science by Donald Knuth: the Iverson bracket [3].
Definition 7 (Iverson bracket) For any logical proposition \(P\), the Iverson bracket of \(P\) is [3]
\[ [P] \stackrel{\text{def}}{=}\begin{cases} 1, & \text{if } P \text{ is true} \\ 0, & \text{if } P \text{ is false} \end{cases} \]
Example 5 (Evaluating Iverson brackets)
Remark 1 (The Iverson bracket is the predicate indicator). The Iverson bracket \([P]\) is the predicate indicator \({\mathbb{1}\mathopen{}\left(P\right)\mathclose{}}\) (Definition 1) in different notation. Under this notation, set membership is written \([x \in A]\), so \([x \in A] = \mathbb{1}_{A}(x)\). For example, the values in Example 1 become
\[ \begin{aligned} [7.2 > 5] &= {\mathbb{1}\mathopen{}\left(7.2 > 5\right)\mathclose{}} \\ &= 1 \end{aligned} \]
and, with \(A = [0, \infty)\),
\[ \begin{aligned} [-2.1 \in A] &= \mathbb{1}_{A}(-2.1) \\ &= 0. \end{aligned} \]
Definition 8 (Kronecker delta) For integers \(i\) and \(j\), the Kronecker delta is [4]
\[\delta_{ij} \stackrel{\text{def}}{=}[i = j]\]
that is, \(\delta_{ij} = 1\) when \(i = j\) and \(\delta_{ij} = 0\) when \(i \neq j\) (Definition 7).
Example 6 (Evaluating the Kronecker delta)
\[ \begin{aligned} \delta_{11} &= [1 = 1] \\ &= 1. \end{aligned} \]
\[ \begin{aligned} \delta_{12} &= [1 = 2] \\ &= 0. \end{aligned} \]
\[ \begin{aligned} \delta_{22} &= [2 = 2] \\ &= 1. \end{aligned} \]
\[ \begin{aligned} \delta_{23} &= [2 = 3] \\ &= 0. \end{aligned} \]
The primary advantage of the Iverson bracket is algebraic conciseness: it turns a sum or integral over a subset into a sum or integral over a larger, fixed set. For example, if \(U\) is a finite set that contains \(A\), then:
\[ \sum_{x \in A} f(x) = \sum_{x \in U} f(x) [x \in A] \]
With \(A = \mathopen{}\left\{2, 4\right\}\mathclose{}\), \(f(x) = x\), and \(U = \mathopen{}\left\{1, 2, 3, 4, 5\right\}\mathclose{}\), both sides equal \(2 + 4 = 6\).
However, in statistics and epidemiology, square brackets are already heavily overloaded: they denote closed intervals \([a, b]\), conditional expectations \(\mathbb{E}[Y \mid X]\) (defined in the probability notes), and matrix delimiters. To prevent visual confusion with expectation brackets or intervals, statistical literature predominantly uses \(\mathbb{1}\) or \(I\) rather than the bare Iverson bracket.
Table 1 compares the major notations encountered across the literature.
| Notation style | Typical syntax | Primary fields | Notes and potential ambiguities |
|---|---|---|---|
| Blackboard bold 1 | \(\mathbb{1}_{A}(x)\), \(\mathbb{1}(P)\) | Modern probability, mathematical statistics | Unambiguous; distinct from matrices and scalars; standard in this book. |
| Bold numeral 1 | \(\mathbf{1}_A(x)\), \(\mathbf{1}(P)\) | Probability theory, measure theory | Can be confused with a vector of ones \(\mathbf{1} = (1, \dots, 1)^{\top}\). |
| Blackboard bold I | \(\mathbb{I}(x \in A)\), \(\mathbb{I}(P)\) | Econometrics, machine learning, statistics | Clear predicate notation; avoids confusion with numerals. |
| Letter \(I\) | \(I_A(x)\), \(I(P)\) | Classical statistics, epidemiology | Can be confused with the identity matrix \(I\) or the Fisher information \(\mathcal{I}\), which measures how much a sample tells about a parameter. |
| Iverson bracket | \([P]\), \([x \in A]\) | Computer science, discrete mathematics | Very compact, but square brackets collide with intervals and expectation brackets. |
| Greek letter \(\chi\) | \(\chi_A(x)\) | Real analysis, measure theory | Often termed “characteristic function”; in probability, that name instead means \(t \mapsto \mathbb{E}[e^{itX}]\) for a random variable \(X\). |
In these notes, we standardize on blackboard bold \(\mathbb{1}\) via the macros defined in latex-macros/macros.qmd:
\indic{A} produces \(\mathbb{1}_{A}\) (set subscript)\indicp{P} produces \({\mathbb{1}\mathopen{}\left(P\right)\mathclose{}}\) (predicate in parentheses)\indiccb{P} produces \({\mathbb{1}\mathopen{}\left\{P\right\}\mathclose{}}\) (predicate in curly braces)\1{P} produces \(\text{1}_{P}\) (text numeral with subscript, used in legacy formulas)Blackboard bold \(\mathbb{1}\) is preferred because it avoids all common collisions: it is visually distinct from the scalar \(1\), the identity matrix \(I\), and the observed and expected Fisher information matrices (\(I\), \(\mathcal{I}\)).
Indicator functions translate the logical connectives (definition) “and”, “or”, and “not”, applied to set membership, into ordinary arithmetic on real numbers. One of the identities below uses idempotence:
Example 7 (Idempotent numbers and indicators)
\(0\) and \(1\) are idempotent: \(0 \cdot 0 = 0\) and \(1 \cdot 1 = 1\).
\(2\) is not idempotent: \(2 \cdot 2 = 4 \neq 2\).
Every indicator function \(\mathbb{1}_{A}\) is idempotent, because each of its values is \(0\) or \(1\). For example, with \(A = [0, \infty)\),
\[ \begin{aligned} \mathbb{1}_{A}(3.5) \cdot\mathbb{1}_{A}(3.5) &= 1 \cdot 1 \\ &= 1 \\ &= \mathbb{1}_{A}(3.5). \end{aligned} \]
The idempotent matrices of linear algebra satisfy the same equation with matrix multiplication: \(\mathbf{M}^2 = \mathbf{M}\) for a square matrix \(\mathbf{M}\).
For subsets \(A\) and \(B\) of \(\Omega\), with complement \(A^c \stackrel{\text{def}}{=}\Omega\setminus A\), and for every \(x \in \Omega\):
Intersection (“and”): \(\mathbb{1}_{A \cap B}(x) = \mathbb{1}_{A}(x) \cdot \mathbb{1}_{B}(x)\)
Union (“or”): \(\mathbb{1}_{A \cup B}(x) = \mathbb{1}_{A}(x) + \mathbb{1}_{B}(x) - \mathbb{1}_{A}(x) \cdot \mathbb{1}_{B}(x)\)
Complement (“not”): \(\mathbb{1}_{A^c}(x) = 1 - \mathbb{1}_{A}(x)\)
Idempotence (Definition 9): \((\mathbb{1}_{A}(x))^2 = \mathbb{1}_{A}(x)\)
Expectation gives probability: When \(\Omega\) is a sample space and \(A\) is an event, the expectation of its indicator is the probability of the event (all four terms are defined in the Morrison Lab’s probability notes):
\[ \begin{aligned} \mathbb{E}[\mathbb{1}_{A}] &= 0 \cdot \Pr(A^c) + 1 \cdot \Pr(A) \\ &= \Pr(A) \end{aligned} \]
This identity turns probabilities into expectations. It is the mathematical foundation for: