Monday, November 09, 2026

Indicator Variables and Sequences & Series in Probability: Deriving Expectation, Variance, and Distributions


A rigorous mathematical and computational guide to indicator random variables, infinite series expansions, tail-sum expectations, and moments across classical discrete distributions.


When computing expectations and variances in discrete probability, direct evaluation using definitions often requires complicated combinatorial algebra. Indicator random variables (or Bernoulli indicators) and sequences & series techniques dramatically simplify these calculations. By decomposing arbitrary counts into binary components and applying tools like geometric series, Maclaurin expansions, and tail-sum formulas, high-dimensional probability problems reduce to tractable algebraic operations.

This guide explores the foundational algebra of indicator variables, reviews essential infinite series tools, derives exact moments for canonical distributions, and implements automated verification in Python.


1. Mathematical Foundations of Indicator Variables

Let (Ω, ℱ, P) be a probability space. For any event A ⊆ Ω, the indicator random variable IA (or 1A) is defined as:

IA(ω) = 1 if ω ∈ A, and 0 if ω ∉ A

Fundamental Properties

  • Expectation equals Probability: 피[IA] = 1 ⋅ P(A) + 0 ⋅ P(Ac) = P(A)
  • Idempotence: IAk = IA for all integers k ≥ 1, which implies 피[IA2] = 피[IA] = P(A).
  • Variance: Var(IA) = 피[IA2] − (피[IA])2 = P(A)(1 − P(A)).
  • Joint Indicators (Intersection): IA ∩ B = IA ⋅ IB, which yields 피[IA IB] = P(A ∩ B).
  • Covariance: Cov(IA, IB) = 피[IA IB] − 피[IA]피[IB] = P(A ∩ B) − P(A)P(B).

Decomposing Compound Counts

Let X be a non-negative integer random variable representing the total occurrences of events {A1, A2, …, An}. We decompose X into a finite sum of indicators:

X = ∑i=1n IAi

By the linearity of expectation (which holds regardless of whether the events are independent or mutually dependent):

피[X] = ∑i=1n 피[IAi] = ∑i=1n P(Ai)

Similarly, the variance expansion accounts for pairwise dependencies:

Var(X) = ∑i=1n Var(IAi) + 2 ∑1 ≤ i < j ≤ n Cov(IAi, IAj)

Var(X) = ∑i=1n P(Ai)(1 − P(Ai)) + 2 ∑1 ≤ i < j ≤ n [P(Ai ∩ Aj) − P(Ai)P(Aj)]


2. Essential Sequences and Series in Probability

Evaluating moments of discrete variables with infinite support (e.g., Geometric, Poisson, Negative Binomial) relies on core series identities:

Series Type Closed Form Formula Primary Application
Geometric Series ∑k=0∞ rk = 1 / (1 − r),   |r| < 1 Geometric PMF normalization, Survival function
Differentiated Geometric (First Order) ∑k=1∞ k rk−1 = 1 / (1 − r)2 Expected value of Geometric / Negative Binomial
Differentiated Geometric (Second Order) ∑k=2∞ k(k − 1) rk−2 = 2 / (1 − r)3 Factorial moments and variance derivations
Exponential Maclaurin Series ∑k=0∞ λk / k! = eλ Poisson PMF normalization and moment generating functions
Binomial Series Expansion ∑k=0n C(n, k) pk qn−k = (p + q)n Binomial distribution moments

The Tail-Sum Formula for Expectation

For any discrete random variable X supported on non-negative integers {0, 1, 2, …}, the expectation can be rewritten as an infinite series over the survival function using indicator decomposition:

Express X as an infinite sum of threshold indicators: X = ∑k=1∞ I{X ≥ k}. Taking expectations on both sides yields:

피[X] = ∑k=1∞ 피[I{X ≥ k}] = ∑k=1∞ P(X ≥ k)

For the second moment:

피[X2] = ∑k=1∞ (2k − 1) P(X ≥ k)


3. Deriving Moments Across Canonical Distributions

A. Binomial Distribution: X ∼ Bin(n, p)

Rather than evaluating ∑k=0n k C(n, k) pk (1 − p)n−k, write X = ∑i=1n Ii, where Ii = 1 if trial i succeeds and 0 otherwise.

  • Since trials are independent, Cov(Ii, Ij) = 0 for i ≠ j.
  • 피[X] = ∑i=1n 피[Ii] = ∑i=1n p = np.
  • Var(X) = ∑i=1n Var(Ii) = ∑i=1n p(1 − p) = np(1 − p).

B. Hypergeometric Distribution: X ∼ Hypergeom(N, K, n)

In sampling without replacement, trials are dependent. Let Ii = 1 if the i-th drawn item is a success:

  • P(Ii = 1) = K / N ⇒ 피[X] = n(K / N).
  • For i ≠ j: P(Ii = 1 ∩ Ij = 1) = [K / N] ⋅ [(K − 1) / (N − 1)].
  • Cov(Ii, Ij) = −[K(N − K)] / [N2 (N − 1)].
  • Summing over all n(n − 1) pairs yields the classic finite population correction factor:
    Var(X) = n (K / N) (1 − K / N) [(N − n) / (N − 1)].

C. Geometric Distribution (Tail-Sum Method): X ∼ Geom(p)

For support k ∈ {1, 2, 3, …}, the survival probability is P(X ≥ k) = (1 − p)k−1 = qk−1.

Applying the tail-sum formula with geometric series convergence:

피[X] = ∑k=1∞ qk−1 = 1 + q + q2 + … = 1 / (1 − q) = 1 / p


4. Computational Implementation in Python

import numpy as np

def verify_hypergeometric_moments(N=100, K=30, n=20, n_simulations=200_000):
    """
    Empirical verification of indicator expectation, variance, and covariance
    for sampling without replacement.
    """
    # Population: K ones (successes) and N-K zeros
    population = np.zeros(N)
    population[:K] = 1

    # Simulate drawing n items without replacement
    rng = np.random.default_rng(seed=42)
    draws = np.array([rng.choice(population, size=n, replace=False) for _ in range(n_simulations)])

    # Indicators for draw 1 and draw 2
    I_1 = draws[:, 0]
    I_2 = draws[:, 1]
    X_total = np.sum(draws, axis=1)

    # Theoretical values
    p = K / N
    e_x_theory = n * p
    fpc = (N - n) / (N - 1)
    var_x_theory = n * p * (1 - p) * fpc
    cov_theory = - (K * (N - K)) / (N**2 * (N - 1))

    print(f"E[X] Theoretical:   {e_x_theory:.4f} | Simulated: {np.mean(X_total):.4f}")
    print(f"Var(X) Theoretical: {var_x_theory:.4f} | Simulated: {np.var(X_total):.4f}")
    print(f"Cov(I_1, I_2) Theoretical: {cov_theory:.6f} | Simulated: {np.cov(I_1, I_2)[0, 1]:.6f}")

if __name__ == "__main__":
    verify_hypergeometric_moments()

5. Key Insights and Modeling Takeaways

  1. Linearity Requires No Independence: The expansion 피[∑ Ii] = ∑ P(Ai) holds under arbitrary correlation, making indicators the preferred tool for permutation problems, urn models, and coupon collector dynamics.
  2. Tail-Sum Bypasses Complex Sums: When the PMF contains factorials or binomial coefficients that complicate direct moment evaluation, reformulating 피[X] via ∑ P(X ≥ k) often converts the problem into a simple geometric or telescoping series.
  3. Covariance Structure Determines Dispersion: In dependent indicator systems, positive pairwise covariance produces overdispersion (Var(X) > np(1 − p), as seen in cluster sampling), while negative covariance yields underdispersion (as in hypergeometric sampling).

No comments: