Random Variables and Probability Distributions

How many offspring of a heterozygous cross will show the recessive phenotype? How many red blood cells fall in a 1-µL grid square under a hemocytometer? What fraction of a population has a cholesterol level above 240 mg/dL? Each question asks about a number that varies by chance. Each is answered using the same mathematical scaffold. That scaffold is a random variable and its probability distribution. Biology is full of quantities that are not fixed. Instead, they scatter around according to predictable rules. Examples include clutch sizes, mutation counts, enzyme reaction times, litter sex ratios, and blood pressure readings. A random variable turns a chancy biological outcome into a number. A probability distribution tells you exactly how the chances are spread. It shows the spread across the possible values that number can take. This is the conceptual bridge between the raw probability rules. Those rules were covered in Probability Basics and the Frequentist View and Conditional Probability. This bridge leads to the specific named distributions — binomial, Poisson, normal. These distributions dominate applied biostatistics. The big picture is this: first, know whether a variable is discrete or continuous. Then write down or approximate its distribution. Once you do, you can compute an expected value (a long-run average). You can also compute a variance (how much it scatters). You can compute probabilities for entire ranges of outcomes too. You can do all this without re-deriving anything from first principles. This holds for every new experiment. This is why geneticists can predict Mendelian ratios. Epidemiologists can compute disease risk thresholds. Ecologists can model species counts. All of them use the same handful of formulas. This article builds random variables from the ground up. It covers the distinction between discrete and continuous types. It explains the probability mass function (pmf) and probability density function (pdf). It also covers the cumulative distribution function (CDF). Finally, it covers two summary numbers. These are the expected value E[X]E[X] and variance Var(X)\mathrm{Var}(X). Every biologist needs to use these fluently. It closes by pointing toward three named distributions. These distributions inherit this machinery: the binomial, the Poisson, and the normal.

Key takeaways
  • A random variable assigns a number to each outcome of a chance process; it is discrete (countable values) or continuous (any value in an interval).
  • Discrete variables have a probability mass function (pmf), p(x)=P(X=x)p(x) = P(X=x); continuous variables have a probability density function (pdf), f(x)f(x), where probability is area under the curve, not height.
  • The cumulative distribution function, F(x)=P(X≤x)F(x) = P(X \le x), works for both types and gives probabilities for ranges.
  • Expected value E[X]E[X] is the probability-weighted average outcome; variance Var(X)=E[(X−E[X])2]\mathrm{Var}(X) = E[(X-E[X])^2] measures spread.
  • All valid distributions must satisfy two rules: probabilities are non-negative, and they sum (or integrate) to exactly 1.
  • These tools set up the three workhorse distributions of biology: the Binomial Distribution, the Poisson Distribution, and the Normal Distribution.
The core insight

A random variable converts an uncertain biological outcome into a number, and its distribution tells you exactly how probability is spread across every value that number could take — from which everything else (mean, variance, risk) follows by calculation.

The core idea

A random variable is a function that assigns a numerical value to every possible outcome of a chance process. It is not the outcome itself — "heads" is not a number — but a rule for turning outcomes into numbers. Conventionally written with a capital letter (XX, YY), a random variable becomes a specific realized number (lowercase, xx) once the experiment happens. If you count the number of albino offspring in a litter of 6 mice from a heterozygous cross, XX is "number of albino pups," and it can realize as x=0,1,2,…,6x = 0, 1, 2, \dots, 6. Random variables split into two families based on what values they can take. A discrete random variable takes on a countable set of values — often (but not always) non-negative integers: number of mutations in a genome, number of surviving seedlings, number of colonies on a plate. A continuous random variable can take any value in an interval of the real line — height, enzyme velocity, time to death, blood glucose concentration. The distinction matters enormously for probability: for a discrete variable, individual values can have positive probability, but for a continuous variable, any single exact value has probability zero — probability only accumulates over intervals. This single fact explains why continuous distributions are described by density curves rather than lists of probabilities. The complete description of a random variable's behavior is its probability distribution — the full mapping from values (or intervals) to probabilities. For discrete variables this is the probability mass function (pmf), p(x)=P(X=x)p(x) = P(X = x), satisfying p(x)≥0p(x) \ge 0 for all xx and ∑xp(x)=1\sum_x p(x) = 1. For continuous variables it is the probability density function (pdf), f(x)≥0f(x) \ge 0, satisfying ∫−∞∞f(x) dx=1\int_{-\infty}^{\infty} f(x)\,dx = 1, where probability corresponds to area under f(x)f(x) over an interval, P(a≤X≤b)=∫abf(x) dxP(a \le X \le b) = \int_a^b f(x)\,dx. Both types also have a cumulative distribution function (CDF), F(x)=P(X≤x)F(x) = P(X \le x), which is non-decreasing, starts at 0, and approaches 1 — the CDF is the single most useful tool for reading off probabilities of ranges directly, whether the underlying variable is discrete or continuous.

Mechanism — how distributions are built and used

Step 1: Define the sample space and the random variable's rule. Start from the underlying chance process (a cross, a count in a volume of blood, a measurement of an organism) and specify exactly which number XX reports. Precision matters: "number of red-eyed flies in a vial of 40" is a well-defined discrete random variable; "eye color" alone is not numerical and is not a random variable until you code it (e.g., X=1X=1 for red, X=0X=0 for white).

Step 2: Assign probabilities consistently with the two axioms. For a discrete variable, every possible value xix_i gets a probability p(xi)p(x_i), and these must sum to 1 across the whole support (the set of possible values). For a continuous variable, a smooth density f(x)f(x) is proposed (often derived from a mechanistic model — a genetic ratio, a rate process, a limiting Gaussian) and normalized so total area is 1. This normalization step is not optional: any function used as a pmf or pdf must be checked or scaled so probabilities are internally consistent.

Step 3: Compute the expected value — the probability-weighted center. For discrete XX:

E[X]=∑xx p(x)E[X] = \sum_x x \, p(x)

For continuous XX:

E[X]=∫−∞∞x f(x) dxE[X] = \int_{-\infty}^{\infty} x \, f(x)\,dx

E[X]E[X] is often called μ\mu. It is not necessarily a value XX can actually take — the expected number of albino pups from a 3:1 cross of litter size 4 is 1.01.0, achievable, but the expected number of heads in 3 coin flips is 1.51.5, which a single litter can never show. E[X]E[X] describes the long-run average over many repetitions, consistent with the frequentist interpretation of probability introduced alongside conditional probability.

Step 4: Compute the variance — the probability-weighted spread around the mean.

Var(X)=E[(X−μ)2]=∑x(x−μ)2p(x)(discrete)\mathrm{Var}(X) = E[(X-\mu)^2] = \sum_x (x-\mu)^2 p(x) \quad \text{(discrete)}
Var(X)=∫(x−μ)2f(x) dx(continuous)\mathrm{Var}(X) = \int (x-\mu)^2 f(x)\,dx \quad \text{(continuous)}

A computationally convenient identity, used constantly in practice, is:

Var(X)=E[X2]−(E[X])2\mathrm{Var}(X) = E[X^2] - (E[X])^2

The square root of the variance is the standard deviation, σ=Var(X)\sigma = \sqrt{\mathrm{Var}(X)}, expressed in the original units of XX (variance itself is in squared units, which is why it is harder to interpret directly — a variance of "4 pups²" is awkward, but σ=2\sigma = 2 pups is intuitive).

Step 5: Use the CDF to answer range questions. Biological questions rarely ask "what is the probability of exactly this value" for continuous data — they ask "what fraction of patients have LDL above 160?" or "what is the probability of 3 or fewer mutant colonies?" The CDF answers this directly:

P(a<X≤b)=F(b)−F(a)P(a < X \le b) = F(b) - F(a)

This is the operational bridge to named distributions: once biologists recognize a process fits a binomial, Poisson, or normal pattern, they use tabulated or software-computed CDFs rather than deriving sums or integrals from scratch every time.

Step 6: Recognize linear transformations and their effect on mean and variance. If Y=aX+bY = aX + b (e.g., converting a cell count XX to a concentration YY by scaling and shifting):

E[Y]=aE[X]+b,Var(Y)=a2Var(X)E[Y] = aE[X]+b, \qquad \mathrm{Var}(Y) = a^2 \mathrm{Var}(X)

Note variance scales by a2a^2, not aa — doubling a measurement scale quadruples the variance, a fact that matters when biologists change units (e.g., mg/dL to mmol/L) and need to recompute spread correctly.

Figure
Discrete pmf vs. continuous pdf: mass at points vs. area under a curve
Discrete: pmf (mass at points) 0 x = number of albino pups (0–4) 0.316 0.422 0.211 0.047 0.004 0 1 2 3 4 Continuous: pdf (area = probability) x = fasting glucose (mg/dL) shaded = P(100<X<110) 100 110
Figure
Cumulative distribution function (CDF): a step function vs. a smooth curve
Discrete CDF: F(x) = P(X ≤ x) 0 1 x (pups affected, 0–4) Continuous CDF: smooth, non-decreasing 0 1 x (blood glucose, mg/dL)

The evidence — how this framework was established and validated

Unlike a single landmark wet-lab experiment (Meselson–Stahl, Hershey–Chase), the theory of random variables and probability distributions was validated through a convergence of mathematical proof and a century of applied biological testing, most visibly in genetics. Three episodes show the framework earning its keep.

Gregor Mendel's pea crosses (1856–1863) as the first large-scale test of a discrete probability model in biology. Mendel crossed true-breeding pea plants differing in traits like seed shape and color, then counted offspring phenotypes across thousands of plants. For a monohybrid cross (Aa×AaAa \times Aa), Mendel predicted a discrete random variable — number of recessive offspring among nn trials — should follow ratios of 3:1 for dominant:recessive phenotypes. In one of his largest experiments, counting seed shape in 7,324 seeds from self-fertilized hybrids, he observed 5,474 round and 1,850 wrinkled — a ratio of 2.96 : 1, extremely close to the predicted 3:1. This was among the earliest demonstrations that a biological outcome could be modeled as a random variable with a known pmf (what would later be formalized as the binomial distribution), and that large samples converge toward theoretical probabilities — an empirical confirmation of the frequentist idea that relative frequencies approach true probabilities as nn grows.

R.A. Fisher's 1936 statistical re-analysis of Mendel's data. Fisher computed a chi-square goodness-of-fit statistic across Mendel's pooled experiments and found the aggregate fit to expected ratios was suspiciously good — closer to the theoretical 3:1 (and other predicted ratios) than random sampling variance should typically allow. This became known as the "too good to be true" problem. Fisher's analysis is itself powerful evidence for the framework: it shows that once a probability distribution is specified (the binomial pmf implied by Mendelian ratios), deviations from it are quantifiable, and even a goodness of fit that is too perfect is statistically detectable — proof that variance is a real, expected feature of any correctly specified random process, not an artifact to be minimized away. This episode is frequently revisited in biostatistics as a caution: an absence of expected scatter is itself informative, illustrating that Var(X)>0\mathrm{Var}(X) > 0 is a prediction, not a nuisance.

Adolphe Quetelet and Francis Galton's demonstration that continuous biological measurements follow smooth density curves (1840s–1880s). Quetelet measured chest circumferences of 5,738 Scottish soldiers and showed the frequency histogram closely tracked a bell-shaped curve — the earliest clear empirical case for treating a continuous biological trait as a random variable governed by a probability density rather than a fixed value. Galton extended this to human height and to sweet-pea seed diameters, showing that continuous variation in a biological trait clusters symmetrically around a mean with a characteristic spread — a phenomenon later formalized as the normal distribution. The critical empirical point these studies established, and which underlies this whole chapter, is that variability itself is lawful: biological measurement scatter is not noise to be dismissed, but obeys a describable, quantifiable, and predictable mathematical density. Together, these three lines of evidence show the two branches of the framework validated independently: discrete counting processes (Mendel) match pmf predictions, deviations from those predictions are themselves statistically tractable (Fisher), and continuous biological measurements match smooth density curves (Quetelet, Galton) — exactly the discrete/continuous split this article opened with.

Worked examples

Example 1 — A genetics cross with an asymmetric, non-Mendelian twist (discrete random variable). A geneticist studies a gene in mice where the heterozygote is not a simple dominant/recessive case but shows incomplete penetrance: individuals with genotype AaAa display the mutant phenotype with probability 0.6 (not 1.0), while aaaa individuals always show it and AAAA individuals never do. A cross Aa×AaAa \times Aa gives genotypes in the classic ratio 1 AAAA : 2 AaAa : 1 aaaa. Let X=1X = 1 if a randomly chosen offspring shows the mutant phenotype, X=0X = 0 otherwise. Compute the pmf of XX by conditioning on genotype (a direct application of the law of total probability, extending Conditional Probability):

P(X=1)=P(AA)⋅0+P(Aa)⋅0.6+P(aa)⋅1.0P(X=1) = P(AA)\cdot 0 + P(Aa)\cdot 0.6 + P(aa)\cdot 1.0
P(X=1)=14(0)+24(0.6)+14(1.0)=0+0.30+0.25=0.55P(X=1) = \tfrac{1}{4}(0) + \tfrac{2}{4}(0.6) + \tfrac{1}{4}(1.0) = 0 + 0.30 + 0.25 = 0.55

So P(X=1)=0.55P(X=1) = 0.55, P(X=0)=0.45P(X=0) = 0.45. This is a Bernoulli random variable with p=0.55p = 0.55 — not the naive 0.75 a student might guess from "3/4 show the phenotype," because incomplete penetrance shrinks the effective probability.

E[X]=1(0.55)+0(0.45)=0.55E[X] = 1(0.55) + 0(0.45) = 0.55
Var(X)=E[X2]−(E[X])2=0.55−0.552=0.55−0.3025=0.2475\mathrm{Var}(X) = E[X^2] - (E[X])^2 = 0.55 - 0.55^2 = 0.55 - 0.3025 = 0.2475

So across many offspring, 55% are expected to show the phenotype, with variance 0.2475 per individual — this single-offspring Bernoulli variable is exactly the building block that, summed over nn independent offspring, produces the Binomial Distribution.

Example 2 — A continuous physiological variable and a clinical threshold (continuous random variable). Suppose resting heart rate XX (beats per minute) in a population of adult patients is modeled with the density

f(x)=120,50≤x≤70f(x) = \frac{1}{20}, \quad 50 \le x \le 70

(a uniform distribution — a simplification, since real heart rate is closer to normal, but it is analytically transparent and satisfies both pdf axioms: f(x)≥0f(x) \ge 0, and ∫5070120 dx=2020=1\int_{50}^{70}\frac{1}{20}\,dx = \frac{20}{20}=1.)

Expected value:

E[X]=∫5070x⋅120 dx=120[x22]5070=120⋅4900−25002=240020=60 bpmE[X] = \int_{50}^{70} x \cdot \frac{1}{20}\,dx = \frac{1}{20}\left[\frac{x^2}{2}\right]_{50}^{70} = \frac{1}{20}\cdot\frac{4900-2500}{2} = \frac{2400}{20}=60 \text{ bpm}

(For a uniform distribution this matches the simple midpoint, (50+70)/2=60(50+70)/2 = 60, as expected.)

Variance, using Var(X)=(b−a)212\mathrm{Var}(X) = \dfrac{(b-a)^2}{12} for a uniform variable on [a,b][a,b]:

Var(X)=(70−50)212=40012≈33.3 bpm2,σ≈5.77 bpm\mathrm{Var}(X) = \frac{(70-50)^2}{12} = \frac{400}{12} \approx 33.3 \text{ bpm}^2, \qquad \sigma \approx 5.77 \text{ bpm}

Clinical question: what is the probability a randomly selected patient has a resting heart rate above 65 bpm (a common "watch" threshold)?

P(X>65)=∫6570120 dx=70−6520=520=0.25P(X > 65) = \int_{65}^{70}\frac{1}{20}\,dx = \frac{70-65}{20} = \frac{5}{20}=0.25

So 25% of this patient population is expected to have resting heart rate above 65 bpm — computed directly from the density without needing a table, because for a uniform distribution probability is just proportional interval length. This same logic — probability as an area, computed via the CDF, F(70)−F(65)F(70)-F(65) — generalizes directly to the Normal Distribution, where the density is not flat but bell-shaped and the areas must be read from a standardized table or computed numerically.

Common misconceptions & traps

MisconceptionWhy it's wrong
"The pdf value f(x)f(x) is the probability of xx."For continuous variables P(X=x)=0P(X=x)=0 exactly; f(x)f(x) is a density, and only areas (∫f(x) dx\int f(x)\,dx) are probabilities.
"E[X]E[X] is the most likely outcome."E[X]E[X] is a probability-weighted average, which need not equal the mode and need not even be an achievable value (e.g., E[X]=1.5E[X]=1.5 heads).
"A larger variance means the calculation is wrong."Variance is a real, predicted property of a random process; even a perfectly specified model has Var(X)>0\mathrm{Var}(X)>0 unless XX is constant.
"Discrete variables must be non-negative integers, like counts."Discrete just means countable values — could include {−1,0,2.5,10}\{-1, 0, 2.5, 10\}; counts are the common biological case but not the definition.
"Doubling a measurement doubles its variance."Variance scales by the square of the multiplier: Var(aX)=a2Var(X)\mathrm{Var}(aX)=a^2\mathrm{Var}(X), so doubling quadruples variance.
"If probabilities in a table don't sum to 1, just proceed anyway."An invalid pmf/pdf makes every downstream calculation (mean, variance, CDF) meaningless; normalization must be checked first.

The scientist behind it

The modern axiomatic treatment of random variables and probability distributions was formalized by Andrey Nikolaevich Kolmogorov, the Soviet mathematician who in 1933 published Grundbegriffe der Wahrscheinlichkeitsrechnung (Foundations of the Theory of Probability), placing probability on a rigorous measure-theoretic footing for the first time. Before Kolmogorov, probability calculations in biology (Mendel's ratios, Quetelet's and Galton's curves) worked empirically and intuitively but lacked a unifying axiomatic base; after Kolmogorov, the pmf/pdf/CDF machinery used throughout biostatistics could be derived from three simple axioms (non-negativity, total probability 1, and additivity over disjoint events) rather than assumed piecemeal for each new problem. Kolmogorov was not a biologist, but his framework became the mathematical substrate on which R.A. Fisher, Sewall Wright, and J.B.S. Haldane — the founders of population genetics and biometrical genetics — built quantitative models connecting Mendelian inheritance to continuous trait variation, unifying the discrete world of gene counting and the continuous world of measured phenotypes into the single theory presented in this article.

Origins · 1 minAndrey Nikolaevich Kolmogorov and how this was discovered
AN
Andrey Nikolaevich Kolmogorov
1903–1987 · Soviet mathematician, Moscow State University, founder of modern axiomatic probability theory

History
- 1866 — Gregor Mendel publishes pea-plant crossing ratios, an early empirical discrete probability model in biology.
- 1877 — Adolphe Quetelet's earlier soldier-chest-measurement work (1840s) is extended by successors showing continuous traits follow bell-shaped curves.
- 1889 — Francis Galton publishes Natural Inheritance, formalizing regression and continuous trait distributions in heredity.
- 1933 — Andrey Kolmogorov publishes the axiomatic foundations of probability theory, unifying discrete and continuous cases.
- 1936 — R.A. Fisher statistically re-examines Mendel's data, showing the aggregate fit is implausibly close to expectation.

Where this matters today

Clinical diagnostics and reference ranges. Laboratory test results (blood glucose, cholesterol, hemoglobin) are treated as continuous random variables with population-specific densities; "normal range" cutoffs are literally computed as CDF percentiles (commonly the 2.5th and 97.5th) of a fitted distribution, directly using the F(x)=P(X≤x)F(x)=P(X\le x) machinery in this article.

Genetic counseling and carrier-risk calculation. Predicting the probability a couple's child will inherit a recessive disorder uses discrete random variables built from pedigree-conditioned probabilities, extending the Bernoulli-and-binomial logic of the worked cross example to real clinical risk communication.

Quality control in biomanufacturing. Counts of contaminant colonies on a plate, defective cells in a bioreactor batch, or viral particles in a vaccine lot are modeled as discrete random variables (often Poisson-like, foreshadowed here), with acceptance thresholds set from the pmf/CDF.

Ecology and conservation. Species abundance counts in quadrat sampling, number of nesting pairs observed, or mutation counts across a genome are discrete random variables whose expected value and variance drive population viability estimates and extinction-risk models.

Epidemiology and public health. Prevalence and incidence calculations, vaccine efficacy trials, and dose-response curves for toxicology all rest on correctly distinguishing discrete case-counts from continuous exposure measurements, and on computing means, variances, and probabilities from properly normalized distributions — the exact toolkit this article establishes before moving to the binomial, Poisson, and normal distributions used to name specific real-world processes.

:::quiz[A Bernoulli random variable XX has P(X=1)=0.55P(X=1)=0.55 (mutant phenotype shown) due to incomplete penetrance. What is E[X]E[X]?]

  • 1.0
  • 0.6
  • 0.55 ✓
  • 0.3025

Ask the tutor: How do I decide, for a new biological measurement, whether to model it as discrete or continuous — and does that choice change how I compute risk thresholds?

What is the difference between a probability and a random variable?

A probability is a number between 0 and 1 describing how likely an event is. A random variable is a function that assigns a numerical outcome to each result of a chance process, and its probability distribution is the full mapping from those numerical outcomes (or ranges of outcomes) to their probabilities. So "P(heads)=0.5P(\text{heads})=0.5" is a probability statement, while "XX = number of heads in 3 flips" defines a random variable whose distribution assigns a probability to each value XX can take (0, 1, 2, or 3).

Why can't a continuous random variable have P(X=x)>0P(X=x)>0 for a specific value?

A continuous random variable can take infinitely many possible values within any interval, however small. If each individual value had some positive probability p>0p>0, then summing over the uncountably many values in even a tiny interval would produce infinite total probability, violating the requirement that total probability equals 1. So probability must be spread as density over intervals rather than concentrated at points; only areas under the density curve (via integration) correspond to actual, computable probabilities.

Is expected value the same as the average of a data sample?

They are conceptually related but not identical. The sample mean (xˉ\bar{x}) is calculated from actual observed data. The expected value (E[X]E[X]) is a theoretical, probability-weighted average defined by the underlying distribution, before any data are collected. The Law of Large Numbers (a consequence of the frequentist framework) guarantees that as sample size grows, the sample mean converges toward the true expected value — which is exactly why Mendel's large pea counts approached the theoretical 3:1 ratio.

Why does variance use squared deviations instead of just averaging the deviations?

If you averaged the raw deviations (x−μ)(x-\mu) directly, positive and negative deviations would cancel out algebraically, always yielding zero regardless of actual spread. Squaring removes the sign, so every deviation contributes positively to the measure of spread, and larger deviations are weighted more heavily (a value 3 units from the mean contributes 9, not 3). The trade-off is that variance is in squared units, which is why the standard deviation — the square root of variance — is usually reported for direct biological interpretation.

Can a variable be treated as either discrete or continuous depending on context?

Yes, and biologists do this deliberately. Body mass is fundamentally continuous, but if measured only to the nearest kilogram, it may be treated as effectively discrete for a table of frequencies. Conversely, a count variable like population size (discrete by nature) is often approximated by a continuous density (like the normal distribution) when numbers are large, because the discrete steps become negligibly small relative to the overall range — this approximation underlies much of applied biostatistics, including how the binomial distribution is approximated by the normal for large sample sizes.

What are the two non-negotiable rules any valid pmf or pdf must satisfy?

First, non-negativity: p(x)≥0p(x) \ge 0 for every value in a pmf, and f(x)≥0f(x) \ge 0 everywhere for a pdf — probability density can never be negative. Second, total probability must equal exactly 1: ∑xp(x)=1\sum_x p(x) = 1 for discrete variables, or ∫−∞∞f(x) dx=1\int_{-\infty}^{\infty} f(x)\,dx = 1 for continuous variables. Any proposed distribution that fails either rule is invalid and cannot be used to compute expected values, variances, or probabilities until it is corrected or properly normalized.

How does this chapter connect to the binomial, Poisson, and normal distributions?

This article builds the general vocabulary — random variable, pmf/pdf, CDF, expected value, variance — that every named distribution is a specific instance of. The binomial distribution is the pmf for counting successes in a fixed number of independent Bernoulli trials (like the genetics cross example). The Poisson distribution is the pmf for counting rare, independent events in a fixed interval of time or space (like colonies on a plate). The normal distribution is the classic bell-shaped pdf for continuous, symmetrically distributed traits (like height or blood pressure). Each has its own formula for E[X]E[X] and Var(X)\mathrm{Var}(X), but all are read, summarized, and used exactly the way described here.

Before this

Where this leads