Probability Mass and Density Functions Explained Simply
The probability mass function (PMF) and the probability density function (PDF) are the two ways of describing how probability is spread over a random variable's values. For a discrete variable, the PMF gives p(x) = P(X = x), the actual probability of each value. For a continuous variable, the PDF gives f(x), a height whose area over an interval equals the probability of landing in that interval. Same job, different machinery: sums for the discrete case, integrals for the continuous one.
These functions matter because they completely describe a random variable's behaviour. From the PMF or PDF you can compute any probability, the mean, and the variance. Each function has signature properties that act as checks: if your candidate PMF sums to something other than 1, it is not a PMF.
Key Concepts
- PMF p(x) = P(X = x): defined on the discrete values; satisfies p(x) ≥ 0 and Σ p(x) = 1 over all values.
- PDF f(x): defined on the continuous range; satisfies f(x) ≥ 0 and total area ∫ f(x) dx = 1.
- Probability from PDF: P(a ≤ X ≤ b) = ∫ from a to b of f(x) dx, the area under the curve between a and b.
- Density is not probability: f(x) can exceed 1; only areas under f are probabilities, and single points have probability 0.
- Units: if X is in metres, f(x) is per metre so that f(x) × dx is unit-free probability; p(x) is always unit-free.
Formulas
PMF properties: p(x) ≥ 0 and Σ p(x) = 1. PDF properties: f(x) ≥ 0 and ∫ f(x) dx = 1 over the whole range. Interval probability: P(a ≤ X ≤ b) = ∫ (a to b) f(x) dx. Mean from PMF: E(X) = Σ x·p(x); mean from PDF: E(X) = ∫ x·f(x) dx. A valid PMF or PDF must satisfy its total-probability condition exactly.
Worked Example
First the PMF: toss two fair coins, X = number of heads. Values 0, 1, 2 have p(0) = 1/4, p(1) = 1/2, p(2) = 1/4. Check: all non-negative and 1/4 + 1/2 + 1/4 = 1, so it is valid, and P(X ≥ 1) = 1/2 + 1/4 = 3/4. Now the PDF: let X be uniform on [0, 2], so f(x) = 1/2 for 0 ≤ x ≤ 2 and 0 elsewhere. Check: f(x) ≥ 0 and total area = (1/2) × 2 = 1, valid. Then P(1 < X < 1.5) = (1/2) × 0.5 = 0.25, the rectangle's area. Note f(x) = 1/2 is not a probability; the probability comes from multiplying by the interval width.
Common Misconceptions
- f(x) is the probability that X = x: Wrong for continuous variables; f(x) is a density and P(X = x) = 0 always. Probabilities come from areas.
- A density cannot exceed 1: It can. A PDF concentrated on a tiny interval must rise high so the total area stays 1; height is not probability.
- PMF values must be decimals: They are exact probabilities, so fractions like 1/4 are fine and often clearer than 0.25.
Real-World Applications
PMFs model count data: goals per match, calls per hour and defects per batch, described by binomial or Poisson mass functions. PDFs model measurements: heights, lifetimes and errors follow normal or exponential densities, and engineers compute failure probabilities as areas under them. Machine learning uses both constantly: classification outputs are PMFs over classes, while generative models learn PDFs of images or audio.
Densities are not probabilities and can exceed 1; single points of a continuous variable always have probability 0. Together they are the complete blueprint of a random variable, feeding every mean, variance and interval probability you will compute.
Related blogs
- Random Experiments & Sample Space: Probability Start
- Types of Events in Probability: Simple, Compound & More
- Classical Definition of Probability: Explained with Examples
- Axiomatic Approach to Probability: Explained with Examples
- Addition Theorem of Probability: Explained with Examples
- Multiplication Theorem of Probability Explained Simply