In mathematics, an indicator function or a characteristic function of a subset of a set is a function that maps elements of the subset to one, and all other elements to zero. That is, if A is a subset of some set X, then the indicator function of A is the function 1 A {\displaystyle \mathbf {1} _{A}} defined by 1 A ( x ) = 1 {\displaystyle \mathbf {1} _{A}\!(x)=1} if x ∈ A , {\displaystyle x\in A,} and 1 A ( x ) = 0 {\displaystyle \mathbf {1} _{A}\!(x)=0} otherwise. Other common notations are 𝟙A and χ A . {\displaystyle \chi _{A}.}
The indicator function of A is the Iverson bracket of the property of belonging to A; that is,
1 A ( x ) = [ x ∈ A ] . {\displaystyle \mathbf {1} _{A}(x)=\left[\ x\in A\ \right].}
For example, the Dirichlet function is the indicator function of the rational numbers as a subset of the real numbers.