an indicator random variable
Picture a tally clicker that you press exactly once when a particular thing happens, and not at all when it does not. To count how many times something occurs across many trials, you give each trial its own clicker and add up the clicks. An indicator random variable is that single-event clicker turned into math: it is 1 when an event happens and 0 when it does not.
Precisely: for an event A, the indicator X_A is defined by X_A = 1 if A occurs and X_A = 0 otherwise. Its key feature is that its expected value equals the probability of the event: E[X_A] = 1 times Pr[A] + 0 times Pr[not A] = Pr[A]. This makes a powerful three-step recipe for counting things on average. Step one: write the quantity you care about as a sum of indicators, X = X_1 + X_2 + ... + X_n, one per possible occurrence. Step two: by linearity of expectation, E[X] = sum of E[X_i] = sum of Pr[event i]. Step three: compute each small probability and add. For example, to find the expected number of people who get their own hat back when n hats are returned at random: let X_i indicate person i getting their hat, so E[X_i] = 1/n, and E[X] = n times 1/n = 1.
Indicators are the workhorse behind nearly every clean randomized analysis — expected comparisons in quicksort (X_ij indicates that elements i and j are ever compared), expected collisions in hashing, expected number of empty bins. They matter because they convert a hard global count into a bag of trivial local probabilities you can compute one at a time. The honest caveat: an indicator only gives you the mean. To say the count is close to its mean with high probability you need a tail bound, and if the events are dependent you may need extra care (Chebyshev with covariances, or independence for Chernoff).
Flip a fair coin 100 times; let X_i = 1 if flip i is heads. The number of heads is X = X_1 + ... + X_100, and E[X] = sum of E[X_i] = 100 times (1/2) = 50. No combinatorics needed — just one indicator per flip and one addition.
E[indicator] = Pr[event]: the bridge that turns counting into adding probabilities.
The magic is that summing indicators uses linearity, which never needs independence — so you can compute an expected count even for tangled, dependent events. Independence only becomes necessary later, when you want a tail bound on that count.