In mathematics, the indicator function (sometimes also called characteristic function) of a subset A of a set X is a function from A into to {0,1} defined as follows:
The indicator function is a basic tool in probability theory: if X is a probability space with probability measure P and A is a measurable set, then IA becomes a random variable whose expected value is equal to the probability of A: