An indicator function is a function that encodes membership in a subset using the values zero and one. For a subset of a set , its indicator equals one at elements belonging to 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)
Definition and notation
For , the indicator function is defined by
Common alternative notations are and . Its domain is the ambient set , not merely ; its codomain may be taken as or as the real numbers. The ambient set matters because it determines where the function takes the value zero. (people.csail.mit.edu)
For example, on the outcomes of a die, the indicator of the event “an even number appears” is one at and zero at . This definition records whether the event occurs; probabilities enter only when a probability model is supplied. (statlect.com)
Algebra of sets
Indicators express set operations through pointwise arithmetic. For subsets , with ,
and
The 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 and . (ocw.mit.edu)
For finitely many sets,
Expanding 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)
Measurability and integration
On a measurable space , where is a sigma-algebra, the real-valued function is a measurable function exactly when . Thus a set’s measurability can be expressed as measurability of a numerical function. (math.mit.edu)
If is a measure and is measurable, its integral satisfies
More generally, for a nonnegative measurable function , or an integrable function ,
Multiplication by an indicator therefore restricts integration to a selected region without changing the ambient domain. (math.mit.edu)
Indicators are the building blocks of simple functions, which take only finitely many values. A nonnegative measurable simple function can be written
where the are disjoint measurable sets and . Its integral is
Every 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)
Indicator random variables
On a probability space , an event determines the random variable . If , it has the Bernoulli distribution:
Its expected value and variance are
The variance identity follows from , since both zero and one equal their own squares. (ocw.mit.edu)
For two events, the covariance is
Consequently, 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)
Indicators also simplify the analysis of counts. If counts how many events occur, then
The expectation formula requires no independence assumption. When the indicators are independent and share the same success probability , their sum has the binomial distribution with parameters . (ocw.mit.edu)
A different convention in optimization
In convex optimization, “indicator function” often denotes a different, extended-real-valued function:
This convention incorporates a constraint into an objective function: minimizing over can be represented by minimizing over the ambient space. Outside , the infinite value excludes infeasible points from any finite objective value. For a nonempty convex set , is a convex function. Unlike the ordinary indicator, it uses zero to represent membership and infinity to represent nonmembership. (stanford.edu)