From the free course Introductory Statistics on Lykke

Discrete Random Variables

Key concepts: Binomial Distribution · Expected Value · Poisson Distribution · Probability Distribution Function (PDF)

Studying variables that have a countable number of outcomes and their associated probability distributions.

Discrete Random Variables

In the study of probability and statistics, a Random Variable serves as a functional mapping from the sample space of a stochastic process to the set of real numbers. When the set of possible outcomes is countable—meaning the values can be listed as a finite sequence or an infinite sequence like the integers—we define this as a Discrete Random Variable (DRV).

Unlike continuous variables, which represent measurements along a continuum (like height or time), discrete variables represent "counts." They are the fundamental building blocks for modeling digital systems, queuing theory, and categorical data analysis. Whether quantifying the number of defective microchips in a production batch or the number of packets arriving at a network router, DRVs provide the mathematical framework for predicting long-term behavior in uncertain environments.

The Probability Distribution Function (PDF)

For a discrete random variable $X$, the Probability Distribution Function (PDF)—often more precisely called the Probability Mass Function (PMF) in discrete contexts—is a mathematical description of the probabilities associated with each possible value of $X$.

1. What it is

The PDF, denoted as $P(X = x)$ or $f(x)$, maps each outcome $x$ in the support of the distribution to a probability $p$. For a function to qualify as a valid PDF for a discrete random variable, it must satisfy two rigorous conditions:

  1. Non-negativity: $0 \le P(X = x) \le 1$ for all $x$.
  2. Normalization: The sum of all probabilities over the entire sample space must equal exactly one: $\sum P(x) = 1$.

2. Why it matters

The PDF is the "DNA" of the random variable. It allows us to calculate not just the likelihood of a single event, but the likelihood of ranges (e.g., "What is the probability of having at least 3 successes?"). Without a well-defined PDF, we cannot derive the moments of the distribution, such as the mean or variance.

3. Formal Properties and Structure

The relationship between the variable and its probability is often represented in a distribution table.

Outcome ($x$) Probability $P(X=x)$ Cumulative Probability $P(X \le x)$
$x_1$ $p_1$ $p_1$
$x_2$ $p_2$ $p_1 + p_2$
$x_n$ $p_n$ $1.0$

Expected Value and Variance

The Expected Value ($E[X]$ or $\mu$) represents the theoretical long-term average of a discrete random variable if the experiment were repeated an infinite number of times. It is the "center of mass" of the distribution.

1. Mechanics of Calculation

The expected value is a weighted average where each outcome is weighted by its probability:

Definition: $E[X] = \mu = \sum_{i} x_i P(x_i)$

While the expected value provides the location of the distribution, the Variance ($\sigma^2$) measures its spread—how much the outcomes typically deviate from the mean.

Definition: $Var(X) = \sigma^2 = \sum_{i} (x_i - \mu)^2 P(x_i)$

2. Comparison of Central Tendency and Dispersion

It is a common pitfall to assume the expected value must be one of the possible outcomes of the variable. For instance, the expected value of a fair six-sided die is 3.5, a value that is impossible to actually roll.

Metric Formula Interpretation
Mean ($\mu$) $\sum x P(x)$ The "balance point" of the distribution.
Variance ($\sigma^2$) $E[X^2] - (E[X])^2$ The average squared distance from the mean.
Std Dev ($\sigma$) $\sqrt{Var(X)}$ Dispersion expressed in the same units as $X$.

3. Mathematical Derivation

The relationship between the raw moments and the variance is a critical identity in statistics.

\begin{aligned}
\text{Let } \mu &= E[X] \\
Var(X) &= E[(X - \mu)^2] \\
&= E[X^2 - 2X\mu + \mu^2] \\
&= E[X^2] - 2\mu E[X] + \mu^2 \\
&= E[X^2] - 2\mu^2 + \mu^2 \\
&= E[X^2] - (E[X])^2
\end{aligned}

The Binomial Distribution

The Binomial Distribution is the most widely used discrete distribution for modeling a fixed number of independent "success/failure" trials. It is the foundation of quality control, A/B testing in software engineering, and clinical trial analysis.

1. What it is: The Bernoulli Trial

A Binomial experiment consists of $n$ identical trials, known as Bernoulli Trials, which meet four specific criteria:

  1. There are a fixed number of trials ($n$).
  2. There are only two possible outcomes (Success or Failure).
  3. The probability of success ($p$) is constant for every trial.
  4. The trials are independent (the outcome of one does not affect the next).

2. The Probability Mass Function

The probability of achieving exactly $k$ successes in $n$ trials is given by:

$P(X = k) = \binom{n}{k} p^k q^{n-k}$ Where $q = 1 - p$ and $\binom{n}{k} = \frac{n!}{k!(n-k)!}$

3. Parameters and Characteristics

The behavior of a Binomial distribution is entirely determined by $n$ and $p$.

Parameter Symbol Effect on Distribution
Trials $n$ Increases the range of possible outcomes; as $n \to \infty$, the distribution approaches Normal.
Success Prob $p$ Determines skewness; $p=0.5$ is perfectly symmetric.
Mean $\mu = np$ The average number of successes.
Variance $\sigma^2 = npq$ The spread of successes.

4. Real-World Usage Example

Consider a DevOps scenario: A microservice has a 99% success rate ($p=0.99$). If 100 requests are sent, what is the probability that exactly 2 fail? This is a Binomial problem where $n=100$, $k=98$ (successes), and $p=0.99$.

The Poisson Distribution

While the Binomial distribution counts successes in a fixed number of trials, the Poisson Distribution models the number of events occurring within a fixed interval of time or space.

1. What it is

The Poisson distribution is used when events occur independently at a constant average rate. It is often referred to as the "Law of Rare Events." Examples include the number of emails received per hour, the number of typos per page, or the number of radioactive decays per second.

2. The Poisson PMF

The probability of observing $k$ events in an interval is:

$P(X = k) = \frac{\lambda^k e^{-\lambda}}{k!}$ Where $\lambda$ (lambda) is the average number of events in the given interval.

3. Key Properties

A unique property of the Poisson distribution is that its mean is equal to its variance:

  • $E[X] = \lambda$
  • $Var(X) = \lambda$

This makes the Poisson distribution highly restrictive but mathematically elegant for modeling arrival processes (Poisson Processes).

4. Poisson vs. Binomial: The Approximation

The Poisson distribution can be viewed as the limiting case of the Binomial distribution as $n \to \infty$ and $p \to 0$, while the product $np = \lambda$ remains constant. In practice, if $n \ge 100$ and $np \le 10$, the Poisson distribution is an excellent approximation for the Binomial.

Feature Binomial Distribution Poisson Distribution
Nature of Trials Fixed number of trials ($n$) Continuous interval (time/space)
Outcomes Binary (Success/Failure) Discrete counts (0, 1, 2, ...)
Upper Bound $n$ Theoretically infinite
Parameters $n, p$ $\lambda$

5. Common Pitfalls in Poisson Modeling

  • Non-constant rate: If the rate of arrival changes (e.g., more customers at lunch than at 3 PM), a simple Poisson model fails. This requires a Non-Homogeneous Poisson Process.
  • Clumping: Poisson assumes events are independent. If events occur in clusters (like "bursty" network traffic), the variance will exceed the mean (Overdispersion), and a Negative Binomial distribution may be more appropriate.

Practical Application: Choosing the Right Distribution

Selecting the correct distribution is the most critical step in statistical modeling. The following pipeline represents the decision matrix used by data scientists.

Decision Flow:

  1. Is the data discrete? (Counts of items/events)
    • If No $\to$ Continuous (Normal, Exponential, etc.)
  2. Is there a fixed number of trials ($n$)?
    • If Yes $\to$ Binomial (e.g., "Out of 20 tosses...")
  3. Are we looking for the first success?
    • If Yes $\to$ Geometric (e.g., "How many tries until...")
  4. Is the interval fixed (time/area) rather than trials?
    • If Yes $\to$ Poisson (e.g., "Hits per minute...")

Comparative Summary Table

Scenario Distribution Key Formula Parameters
Binary outcomes, fixed trials Binomial $\binom{n}{k} p^k q^{n-k}$ $n, p$
Events in time/space interval Poisson $\frac{\lambda^k e^{-\lambda}}{k!}$ $\lambda$
Trials until first success Geometric $p(1-p)^{k-1}$ $p$
Sampling without replacement Hypergeometric $\frac{\binom{r}{k}\binom{N-r}{n-k}}{\binom{N}{n}}$ $N, r, n$

Advanced Concept: The Moment Generating Function (MGF)

For senior engineers and statisticians, defining a DRV by its PMF is often less efficient than using its Moment Generating Function. The MGF is a functional representation that encapsulates all moments (mean, variance, skewness, etc.) of a distribution.

M_X(t) = E[e^{tX}] = \sum_{x} e^{tx} P(X=x)

By taking the $n$-th derivative of $M_X(t)$ and evaluating it at $t=0$, one can derive the $n$-th raw moment of the variable. This is particularly useful when summing independent random variables, as the MGF of the sum is simply the product of the individual MGFs.

Discrete Random Variables - Introductory Statistics - diagram 1
Discrete Random Variables - Introductory Statistics - diagram 1
Discrete Random Variables - Introductory Statistics - diagram 2
Discrete Random Variables - Introductory Statistics - diagram 2
Discrete Random Variables - Introductory Statistics - diagram 3
Discrete Random Variables - Introductory Statistics - diagram 3

Source Materials

Study Introductory Statistics on Lykke

This course page is free to open: signed out, you can read its first two sections, and signing in, on any plan, opens the rest. The free Lykke Chrome extension syncs your own Canvas courses, so ChatGPT, Claude and Muse can answer from your classes and deadlines. It only reads Canvas.

Add the free extensionSign in to open every section

All sections of Introductory Statistics · Browse more course pages

Discrete Random Variables — Introductory Statistics | Lykke