The indicator function of an event is a random variable that takes:
value 1 when the event happens;
value 0 when the event does not happen.
Indicator functions are also called indicator random variables.
To understand the following definition, you need to remember that a
random variable
is a function:
from the sample
space
(the set of all possible random outcomes)
to the set of real numbers.
If
is one of the possible outcomes, then
is the value taken by
when the realized
outcome is
.
Also remember that an event
is a subset of the sample space
.
Here is the definition.
Definition
Let
be a sample space and
be an event. The indicator function of
,
denoted by
,
is the random variable defined as
Sometimes we also use the
notationwhere
is the Greek letter Chi.
We toss a die and one of the six numbers from 1 to 6 can appear face up.
The sample space
is
Define the event
described
by the sentence "An even number appears face up".
A random variable that takes value 1 when an even number appears face up and
value 0 otherwise is an indicator of the event
.
The case-by-case definition of this indicator
is
From the above definition, it can easily be seen that
is a discrete random
variable with
support
and
probability mass
function
Indicator functions enjoy the following properties.
The
-th
power of
is equal to
:
This is a consequence of the facts that
can be either
or
,
and
The expected value of
is equal to
The proof is as follows:
The variance of
is equal to
Thanks to the usual
variance formula and the powers
property above, we
obtain
If
and
are two events,
then
If
,
then
and
If
,
then
and
Let
be a zero-probability event and
an integrable random
variable.
Then,
While a rigorous proof of this fact is
beyond the scope of this introductory exposition, this property should be
intuitive. The random variable
is equal to zero for all the sample points
,
except possibly for the points
.
The expected value is a weighted average of the values
can take on, where each value is weighted by its respective probability. The
non-zero values
can take on are weighted by zero probabilities, so
must be zero.
In probability theory and statistics, there are two important concepts that are almost identical to that of an indicator variable:
the dummy variable.
Below you can find some exercises with explained solutions.
Consider a random variable
and another random variable
defined as a function of
.
Express
using the indicator functions of the events
and
.
Denote by
the
indicator of the event
and denote by
the
indicator of the event
.
We can write
as
Let
be a positive random variable, that is, a random variable that can take on
only positive values.
Let
be a constant.
Prove that
where
is the indicator of the event
.
First note that the sum of the indicators
and
is always equal to
:
As
a consequence, we can
write
Now,
note that
is a positive random variable and that the
expected value of a positive random
variable is
positive:
Thus,
Let
be an event and denote its indicator function by
.
Let
be the complement of
and denote its indicator function by
.
Can you express
as a function of
?
The sum of the two indicators is always
equal to
:
Therefore,
Please cite as:
Taboga, Marco (2021). "Indicator function", Lectures on probability theory and mathematical statistics. Kindle Direct Publishing. Online appendix. https://www.statlect.com/fundamentals-of-probability/indicator-functions.
Most of the learning materials found on this website are now available in a traditional textbook format.