Probability theory
A random variable is a rule that assigns a numerical value to each outcome of a random experiment, allowing uncertain phenomena to be described mathematically. Despite its name, it is not a variable that randomly changes in the ordinary sense: it is a function whose input is an outcome and whose output is a number.
A random variable converts outcomes into numbers, making probability questions amenable to algebra and analysis. If a coin is tossed twice, the outcome space can be written as {HH, HT, TH, TT}; a random variable might assign the number of heads, producing values 0, 1, or 2. The underlying outcome remains an element of the sample space, while the random variable is the mapping applied to it.1
Formally, a random variable is a measurable function from a sample space to the real numbers, usually written X. Measurability ensures that statements such as X ≤ x correspond to well-defined events with probabilities. This framework permits one probability model to describe measurements, counts, waiting times, financial returns, errors, and many other uncertain quantities.
The distinction between discrete and continuous random variables concerns how probability is distributed over possible values. A discrete random variable has a finite or countably infinite set of possible outcomes, such as the number of defective items in a batch. Its probability mass function gives each value x a probability P(X = x), and the probabilities across all possible values sum to 1.2
A continuous random variable is commonly represented by a probability density function, or PDF. Individual points have probability zero in the continuous model, while intervals have probabilities obtained by integrating the density over those intervals. The cumulative distribution function, F(x) = P(X ≤ x), applies to both types and provides a unified description of their distributions. Some variables are mixed: for example, a measurement may have a positive probability of being exactly zero and a continuous distribution above zero.
A probability distribution specifies how likely the values of a random variable are. Standard distributions include the Bernoulli and binomial distributions for binary outcomes and counts, the Poisson distribution for certain event counts, the normal distribution for continuous measurements, and the exponential distribution for some waiting-time models.2
The expected value, written E[X], is a probability-weighted average rather than a guarantee that the variable will take that value. Variance, Var(X), measures average squared deviation from the mean, while standard deviation is its square root and is expressed in the same units as X. Quantiles, medians, skewness, and tail probabilities can reveal features that mean and variance conceal. For a discrete variable, expectations are computed by summation; for a continuous variable, they are generally computed by integration.
Functions of random variables create new random variables and allow complex quantities to be analyzed from simpler components. If X records a person's height, then X², log(X), or an indicator of whether X exceeds a threshold are also random variables, provided the transformations are suitably measurable. Their distributions can sometimes be derived directly and sometimes require approximation or simulation.
Several random variables may be studied jointly through a joint distribution. Independence means that knowing one variable provides no probabilistic information about another; it is stronger than merely having zero correlation. Sums of independent variables are especially important: the central limit theorem explains why suitably normalized sums often approach a normal distribution under broad conditions.4 Conditional distributions describe uncertainty about one variable after information about another has been observed, forming the basis of regression, Bayesian inference, filtering, and statistical prediction.3
Random variables need not represent physical measurements, and their numerical labels need not have a direct meaning. A categorical outcome can be encoded numerically for modeling, but arithmetic on those codes may be meaningless unless the encoding preserves a relevant structure. Conversely, a random variable can be vector-valued, matrix-valued, or function-valued; multivariate random variables are collections of jointly defined scalar variables, while stochastic processes can be viewed as families of random variables indexed by time or another parameter.
The same experiment can support many different random variables, each emphasizing a different feature of the outcome. In a card draw, one variable might record the card's rank, another its color, and another whether it belongs to a specified suit. A variable can also be almost surely constant, taking one value except on an event of probability zero. Probability theory distinguishes such almost-sure behavior from pointwise behavior, a distinction that becomes essential in measure-theoretic probability and modern stochastic analysis.3
Notation and definitions follow the standard measure-theoretic formulation used in modern probability theory; introductory treatments often present the same ideas through finite or countable sample spaces.
Help improve the encyclopedia. Reports go straight to the site manager.