Skip to main content

Discrete and continuous random variables

Short answer

A discrete random variable takes countable values (e.g., number of heads); a continuous random variable takes any value in an interval (e.g., height). For both, mean μ = E(X) is sum (or integral) of x*pdf/pmf; variance σ^2 = E(X^2)-μ^2, where E(X^2) is sum (or integral) of x^2*pdf/pmf.

Define discrete and continuous random variable. Also describe the procedure to compute mean and variance for both variables.

Discrete random variable

A random variable that takes a finite or countably infinite set of separate values, usually obtained by counting. Example: number of defective chips in a sample, number of heads in 3 tosses. It is described by a pmf p(x) with p(x) ≥ 0 and Σ p(x) = 1.

Continuous random variable

A random variable that can take any value in an interval of real numbers, usually obtained by measuring. Example: height, time to failure, voltage. It is described by a pdf f(x) with f(x) ≥ 0 and ∫ f(x) dx = 1 over the whole range; P(a ≤ X ≤ b) = ∫ₐᵇ f(x) dx, and P(X = c) = 0 for any single point.

Procedure for mean and variance

StepDiscreteContinuous
Mean μ = E(X)Σ x · p(x)∫ x · f(x) dx
E(X²)Σ x² · p(x)∫ x² · f(x) dx
Variance σ²E(X²) − [E(X)]²E(X²) − [E(X)]²
Standard deviation√σ²√σ²

Steps:

  1. Check that the pmf or pdf is valid (total probability 1).
  2. Compute E(X) by the sum or integral above.
  3. Compute E(X²) in the same way.
  4. Variance = E(X²) − μ² (equivalently E[(X − μ)²]).

The sum or integral is taken over all values of x for which p(x) or f(x) is non-zero.

✓ Answer checked by Claude Sonnet 5.5

All Probability and Statistics chapter 2 questions →