Wiki
Core12 min read

Random variables and their distributions

A random variable assigns a number to each outcome; its distribution says how the probability is laid out across those numbers.

An outcome like "the coin came up heads" is hard to integrate. A number like "the number of heads in ten tosses" is not. A random variable is the bridge: a function that reads an outcome and returns a number, so that probability becomes a distribution over the number line.

A random variable is a measurement, not a variable

The randomness lives in the outcome, not in the variable. Once the outcome is fixed, the random variable is a perfectly ordinary number. What we study is the distribution of those numbers across the sample space.

Switch between the binomial, Poisson and normal laws below. The bars or curve are the pmf or pdf; the shaded area is the probability up to the threshold.

Pick a law, set its parameters, slide the threshold

mean
4.000
variance
2.400
σ
1.549
P(X ≤ 4)
0.6331

Binomial and Poisson are discrete — the height of each bar is a probability and the bars sum to one. The normal is continuous, so it uses a density and only areas are probabilities; the shaded area is P(X ≤ threshold). The mean and variance readouts are computed from the distribution itself, which is the point: parameters control shape, and shape controls the summaries.

Discrete and continuous

A discrete random variable takes a countable set of values. Its probability mass function (pmf) gives p(k)=P(X=k)p(k) = P(X = k), with

∑kp(k)=1.\sum_k p(k) = 1.

A continuous random variable takes values in an interval. Its probability density function (pdf) f(x)f(x) satisfies f(x)≥0f(x) \ge 0 and

∫−∞∞f(x) dx=1.\int_{-\infty}^{\infty} f(x)\,dx = 1.

For continuous variables, P(X=x)=0P(X = x) = 0 for every single point; only intervals have non-zero probability, given by the integral. This is the single biggest conceptual break from the discrete case, and it is why the normal distribution is drawn as a density rather than a set of bars.

Both kinds share the cumulative distribution function (cdf)

F(x)=P(X≤x),F(x) = P(X \le x),

which is non-decreasing, goes from 0 to 1, and works identically for both. The widget's threshold readout is a cdf value.

The named distributions

Three laws cover an enormous amount of ground:

  • Binomial. XX is the number of successes in nn independent trials with success probability pp. The widget computes P(X=k)=(nk)pk(1−p)n−kP(X=k) = \binom{n}{k} p^k (1-p)^{n-k}, with mean npnp and variance np(1−p)np(1-p). The shape is symmetric when p=0.5p = 0.5 and skews as pp moves to the extremes.
  • Poisson. XX counts events in a fixed interval when they occur independently at constant rate λ\lambda. Then P(X=k)=e−λλk/k!P(X=k) = e^{-\lambda}\lambda^k / k!, and — the famous fact — mean and variance are both λ\lambda. It is the limit of the binomial when nn grows and np→λnp \to \lambda.
  • Normal. The bell curve, with density f(x)=1σ2πe−(x−μ)2/2σ2f(x) = \frac{1}{\sigma\sqrt{2\pi}} e^{-(x-\mu)^2 / 2\sigma^2}, mean μ\mu and variance σ2\sigma^2. It is the limit in the central limit theorem, which is why it appears whenever many small independent effects are added.

Density is not probability

A density can exceed 1 for a narrow distribution, because it measures probability per unit of x. Only the area under it is a probability, and only intervals have non-zero area. Never report a value of a pdf as a probability.

Standardization

Subtracting the mean and dividing by the standard deviation gives a standardized variable with mean 0 and variance 1:

Z=X−μσ.Z = \frac{X - \mu}{\sigma}.

This is how a normal table or a computer cdf can serve every normal distribution at once: transform to ZZ, then look up. It is also why standardizing features is a standard first step in machine learning — many estimators behave as if the inputs were already on a common scale.

Illustrative vs real

The widget draws tidy named distributions with a handful of parameters. Real data rarely matches a textbook law exactly; the value of the named distributions is as models and as limits, not as literal descriptions. The binomial's assumption of independent, identically distributed trials is the one most often violated, and it is the one to check before trusting a result.

Check yourself

Eduspheria wiki · Mathematics for AI, Probability

0 / 5 answered

  1. 1X is Binomial(n = 20, p = 0.3). What is E[X]?
    Numeric answer
  2. 2X is Poisson with λ = 4. What is P(X = 0)? Give four decimals.
    Numeric answer
  3. 3Which function gives P(X ≤ x) for both discrete and continuous random variables?
    Multiple choice
  4. 4For a continuous random variable, P(X = 5) = 0.
    True / false
  5. 5What is the operation called that subtracts the mean and divides by the standard deviation?
    Short answer

Where next: expectation and variance — the two numbers that summarize a distribution.