# Indicator function

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.

## Things to remember

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 .

## Definition

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.

## Example

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

## Indicators are discrete variables

From the above definition, it can easily be seen that is a discrete random variable with support and probability mass function

## Properties

Indicator functions enjoy the following properties.

### Powers

The -th power of is equal to :

Proof

This is a consequence of the facts that can be either or , and

### Expected value

The expected value of is equal to

Proof

The proof is as follows:

### Variance

The variance of is equal to

Proof

Thanks to the usual variance formula and the powers property above, we obtain

### Intersections

If and are two events, then

Proof

If , then andIf , thenand

### Indicators of zero-probability events

Let be a zero-probability event and an integrable random variable. Then,

Proof

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.

## Very similar concepts

In probability theory and statistics, there are two important concepts that are almost identical to that of an indicator variable:

1. the dummy variable.

## Solved exercises

Below you can find some exercises with explained solutions.

### Exercise 1

Consider a random variable and another random variable defined as a function of .

Express using the indicator functions of the events and .

Solution

Denote by the indicator of the event and denote by the indicator of the event . We can write as

### Exercise 2

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 .

Solution

First note that the sum of the indicators and is always equal to :As a consequence, we can writeNow, note that is a positive random variable and that the expected value of a positive random variable is positive:Thus,

### Exercise 3

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 ?

Solution

The sum of the two indicators is always equal to :Therefore,