Skip to content

Random Variable

  • Represents numeric outcomes produced by a random process.
  • Comes in two main types: discrete (finite or countably infinite values) and continuous (uncountably many values over ranges).
  • Described by a probability mass function (PMF) for discrete variables and a probability density function (PDF) / cumulative distribution function (CDF) for continuous variables.

A random variable is a variable that takes on different values depending on the outcome of a random event; in other words, it is a variable whose value is determined by chance.

Random variables map outcomes of random events to numerical values. There are two main categories:

  • Discrete random variables can assume a finite or countably infinite set of distinct values. Their probability distribution is given by a probability mass function (PMF), which assigns a probability to each possible value.

  • Continuous random variables can take on an infinite (uncountable) number of values within a range. Their distribution is described by a probability density function (PDF). The PDF is the derivative of the cumulative distribution function (CDF). For continuous variables, the probability of any single exact value is 0; probabilities are defined over intervals using the PDF (or the CDF).

Consider the random variable X that represents the number of heads that come up when flipping a coin. The possible values of X are 0, 1, or 2, and the probability of each value occurring is 0.5, 0.5, and 0, respectively. This can be written as:

P(X=0)=0.5,P(X=1)=0.5,P(X=2)=0P(X=0)=0.5,\quad P(X=1)=0.5,\quad P(X=2)=0

Consider the random variable Y that represents the weight of an object. The possible values of Y are any value within a certain range, such as 0 to 100 pounds. The probability of a specific value occurring is 0, since there are an infinite number of values within the range. The probability of Y falling within an interval (for example, 25 to 50 pounds) can be calculated using a PDF.

An example PDF given for a continuous variable is:

f(y)=2y for values of y between 0 and 1,f(y)=0 for all other valuesf(y)=2y \text{ for values of } y \text{ between } 0 \text{ and } 1,\quad f(y)=0 \text{ for all other values}
  • For continuous random variables, the probability of any specific exact value is 0 because there are infinitely many possible values within the range; probabilities are meaningful only for intervals.
  • Probability mass function (PMF)
  • Probability density function (PDF)
  • Cumulative distribution function (CDF)
  • Discrete random variable
  • Continuous random variable