Unit 5, lesson 32

Indicator Random Variables

How an indicator turns an event into a zero-one random variable whose expectation is its probability, and how combining indicators gives expected counts, the indicator of a union and expected numbers of distinct categories.

  • Video 32
  • Linearity and Indicators

Five positions on a manufactured part are inspected, and a single fault in the machine can spoil several positions at once. How many defects should you expect per part? The full distribution of the count would need the joint behavior of all five positions. Indicators avoid that work. Each yes-or-no question becomes a variable equal to 11 or 00, the count becomes a sum of these variables, and linearity turns its expectation into a sum of probabilities, with no independence assumption.

Key terms

Indicator random variable

Definition Let AA be an event in a probability model with sample space Ω\Omega. The indicator of AA is the random variable IAI_A defined on each outcome ω\omega by

IA(ω)={1,ω∈A,0,ω∉A.I_A(\omega) = \begin{cases} 1, & \omega \in A, \\ 0, & \omega \notin A. \end{cases}

It takes only the values 00 and 11, and event operations become arithmetic. The complement has indicator IAc=1−IAI_{A^{c}} = 1 - I_A, for a second event BB the intersection has indicator IA∩B=IAIBI_{A \cap B} = I_A I_B, and IA2=IAI_A^2 = I_A because 02=00^2 = 0 and 12=11^2 = 1. The notation 1A\mathbf{1}_A is also common.

In plain words An indicator records whether the event happened on this particular run of the experiment, with 11 for yes and 00 for no. It is a random variable, not a probability. The probability of AA is one fixed number, while the value of IAI_A depends on the outcome.

Example A label is drawn at random from a box in which two fifths of the labels are blue, and AA is the event that the drawn label is blue. Then IA=1I_A = 1 with probability 25\frac25 and IA=0I_A = 0 with probability 35\frac35. If BB is the event that the label is large, the product IAIBI_A I_B equals 11 exactly when the drawn label is both blue and large, so it is the indicator of A∩BA \cap B.

Expectation of an indicator

Definition For every event AA,

E[IA]=P(A).E[I_A] = P(A).

The indicator takes the value 11 with probability P(A)P(A) and the value 00 with probability 1−P(A)1 - P(A), so its expectation is 1⋅P(A)+0⋅(1−P(A))1 \cdot P(A) + 0 \cdot (1 - P(A)). Since 0≤IA≤10 \le I_A \le 1, this expectation is always finite.

In plain words The indicator IAI_A puts weight P(A)P(A) on the value 11 and the rest on 00, so its weighted average is exactly P(A)P(A). The probability of any event is the expectation of a random variable, its indicator, and that is what lets the rules for expectations work on probabilities.

Example For the blue label, E[IA]=1⋅25+0⋅35=25E[I_A] = 1 \cdot \frac25 + 0 \cdot \frac35 = \frac25. Ten repeated draws with replacement need not produce exactly four blue labels. The value 25\frac25 belongs to the model, and it is not a promised frequency in a finite run.

Sum of indicators

Definition Let A1,…,AnA_1, \dots, A_n be events in one probability model, and let NN be the number of them that occur. Then

N=IA1+IA2+⋯+IAnN = I_{A_1} + I_{A_2} + \cdots + I_{A_n}

on every outcome, because each event that occurs contributes 11 to the sum and each event that does not occur contributes 00. The identity is exact, holds before any averaging and needs no assumption about how the events are related.

In plain words To count, give each thing that might be counted its own zero-one switch and add the switches. The definition of each indicator decides what is counted, so state its yes-or-no question first and check that the sum matches the intended count on every outcome.

Example Let AjA_j be the event that position jj of the inspected part is defective, for j=1,…,5j = 1, \dots, 5. If positions 22 and 55 are defective and the others are sound, then IA2=IA5=1I_{A_2} = I_{A_5} = 1, the other three indicators are 00, and the sum is 22, the number of defective positions. If every position is sound, all five indicators are 00 and so is the count.

Expected count

Definition If N=IA1+⋯+IAnN = I_{A_1} + \cdots + I_{A_n} counts how many of the events A1,…,AnA_1, \dots, A_n occur, then linearity and the expectation of an indicator give

E[N]=∑j=1nP(Aj).E[N] = \sum_{j=1}^{n} P(A_j).

The events may be dependent. Each indicator is bounded, so each term has finite expectation and linearity applies. The formula uses only the individual probabilities and gives the mean of the count, not its distribution.

In plain words The expected number of events that happen is the sum of their probabilities. Whether the events tend to happen together can change how the count is spread out, but not its mean. An expected count need not be a possible value of the count.

Example Suppose the five positions have defect probabilities 0.100.10, 0.200.20, 0.050.05, 0.100.10 and 0.150.15. The expected number of defects is 0.10+0.20+0.05+0.10+0.15=0.600.10 + 0.20 + 0.05 + 0.10 + 0.15 = 0.60, even if a shared fault makes defects occur together. For a second case, draw three tokens at random without replacement from a bag of ten, four of them blue, and let BjB_j be the event that draw jj is blue. Each draw position is equally likely to hold any of the ten tokens, so P(Bj)=410P(B_j) = \frac{4}{10} for each jj, and the expected number of blue tokens is 3⋅410=653 \cdot \frac{4}{10} = \frac{6}{5}. The draws are dependent, and the law of total probability confirms the value for the second draw,

P(B2)=410⋅39+610⋅49=3690=25.\begin{aligned} P(B_2) &= \frac{4}{10} \cdot \frac{3}{9} + \frac{6}{10} \cdot \frac{4}{9} \\[0.4em] &= \frac{36}{90} = \frac{2}{5}. \end{aligned}

Indicator of a union

Definition For events AA and BB in one probability model,

IA∪B=IA+IB−IA∩BI_{A \cup B} = I_A + I_B - I_{A \cap B}

on every outcome. Taking expectations gives the addition rule

P(A∪B)=P(A)+P(B)−P(A∩B).\begin{aligned} P(A \cup B) &= P(A) + P(B) \\[0.4em] &\quad - P(A \cap B). \end{aligned}

The plain sum IA+IBI_A + I_B counts how many of the two events occur. It equals 22 on A∩BA \cap B, so it is the indicator of the union on every outcome exactly when A∩B=∅A \cap B = \varnothing. In the same way, if NN counts how many of A1,…,AnA_1, \dots, A_n occur, then the indicator that at least one occurs is never larger than NN, so P(N≥1)≤E[N]P(N \ge 1) \le E[N], with equality exactly when P(N≥2)=0P(N \ge 2) = 0.

In plain words Adding two indicators counts an outcome in both events twice, and subtracting the indicator of the overlap brings it back to one. That outcome-by-outcome correction is where the overlap term of the addition rule comes from. A sum of probabilities is an expected count, and it can exceed the probability that at least one of the events occurs.

Example Roll a fair die. Let A={2,4,6}A = \{2, 4, 6\} be the event of an even result and B={5,6}B = \{5, 6\} the event of a result of at least 55. On the outcome 66 the sum IA+IBI_A + I_B is 22, while IA∪BI_{A \cup B} is 11. The expected number of these two events that occur is 12+13=56\frac12 + \frac13 = \frac56, but

P(A∪B)=12+13−16=23,P(A \cup B) = \tfrac12 + \tfrac13 - \tfrac16 = \tfrac23,

which matches the four favorable faces 22, 44, 55 and 66.

Expected number of distinct categories

Definition Suppose each of nn draws falls into one of the categories 1,…,k1, \dots, k. For each category cc, let JcJ_c be the indicator that cc appears at least once among the draws. The number of distinct categories seen is D=J1+⋯+JkD = J_1 + \cdots + J_k, so

E[D]=∑c=1kP(Jc=1),E[D] = \sum_{c=1}^{k} P(J_c = 1),

where each term is 11 minus the probability that category cc never appears. If the draws are independent and each draw falls into each category with probability 1k\frac1k, a given category is missed by all nn draws with probability (1−1k)n(1 - \frac1k)^n, and

E[D]=k(1−(1−1k)n).E[D] = k\Bigl(1 - \bigl(1 - \tfrac{1}{k}\bigr)^{n}\Bigr).

The indicators J1,…,JkJ_1, \dots, J_k are usually dependent. In the equal-probability model with k≥2k \ge 2 and n≥1n \ge 1, for instance, each of them equals 00 with positive probability, yet they cannot all equal 00 at once, because every draw falls into some category. Linearity does not need their independence, and independence of the draws is used only to find each probability P(Jc=1)P(J_c = 1).

In plain words To count distinct kinds rather than items, give each kind its own indicator for being seen at least once. A category that appears twice still contributes 11. The chance that a category appears usually comes most easily from the complement, the chance that every draw misses it.

Example Two stickers are drawn independently, each in one of four equally likely colors. A given color is missed by both with probability (34)2=916(\frac34)^2 = \frac{9}{16}, so it appears with probability 716\frac{7}{16}, and E[D]=4⋅716=74E[D] = 4 \cdot \frac{7}{16} = \frac74. A direct check agrees. The two colors match with probability 14\frac14, giving one distinct color, and differ with probability 34\frac34, giving two, so E[D]=1⋅14+2⋅34=74E[D] = 1 \cdot \frac14 + 2 \cdot \frac34 = \frac74.

Check yourself

  1. A bag holds five tokens, two blue and three white, and two are drawn at random without replacement. Find the expected number of blue tokens drawn and the probability that at least one blue token is drawn. Why are the two answers different?
Show the answer

Let B1B_1 and B2B_2 be the events that the first and the second draw are blue. Each has probability 25\frac25, so the expected number of blue tokens is 2⋅25=452 \cdot \frac25 = \frac45. Both draws are white with probability 35⋅24=310\frac35 \cdot \frac24 = \frac{3}{10}, so at least one blue token is drawn with probability 1−310=7101 - \frac{3}{10} = \frac{7}{10}.

The count can equal 22, which happens with probability 25⋅14=110\frac25 \cdot \frac14 = \frac{1}{10}. Such an outcome adds 22 to the count but only 11 to the indicator of at least one blue, and indeed 45−710=110\frac45 - \frac{7}{10} = \frac{1}{10}. An expected count equals the probability of at least one occurrence only when the count is 00 or 11 with probability one.

  1. The cards numbered 11 to nn, with n≥1n \ge 1, are shuffled so that all n!n! orders are equally likely. A match is a card that lands in the position carrying its own number. Find the expected number of matches.
Show the answer

Let IjI_j be the indicator of the event that card jj lands in position jj. Card jj is equally likely to be in any of the nn positions, so E[Ij]=1nE[I_j] = \frac1n. The number of matches is I1+⋯+InI_1 + \cdots + I_n, so its expectation is n⋅1n=1n \cdot \frac1n = 1 for every nn. For n≥2n \ge 2 the indicators are dependent. If the first n−1n - 1 cards are all matches, the last card must be a match too. Linearity does not need independence, so this dependence leaves the answer unchanged.

  1. A fair die is rolled three times. Find the expected number of distinct faces that appear, and check the answer by finding the distribution of that number.
Show the answer

Let DD be the number of distinct faces, written as the sum of six indicators, one for each face being seen at least once. A given face is missed by all three independent rolls with probability (56)3=125216(\frac56)^3 = \frac{125}{216}, so it appears with probability 91216\frac{91}{216}. Adding over the six faces gives

E[D]=6⋅91216=9136,E[D] = 6 \cdot \frac{91}{216} = \frac{91}{36},

about 2.532.53. For the check, all three rolls agree with probability 6216=136\frac{6}{216} = \frac{1}{36}, and all three differ with probability 6⋅5⋅4216=2036\frac{6 \cdot 5 \cdot 4}{216} = \frac{20}{36}. Exactly two distinct faces appear with the remaining probability 1536\frac{15}{36}. Then E[D]=1⋅136+2⋅1536+3⋅2036=9136E[D] = 1 \cdot \frac{1}{36} + 2 \cdot \frac{15}{36} + 3 \cdot \frac{20}{36} = \frac{91}{36}, as before.

How this lesson connects