Skip to content

Function of a Random Variable

Definition

Let XX be a random variable and let g ⁣:R→Rg\colon\mathbb{R}\to\mathbb{R} be a Borel-measurable function, meaning that preimages of Borel sets are Borel sets. Continuous and piecewise continuous functions satisfy this condition. The function of a random variable determined by gg is the random variable Y=g(X)Y=g(X).


Interpretation

A function of a random variable is a new quantity computed from the value of XX. On each outcome ω\omega it takes the value g(X(ω))g(X(\omega)), so Y=g(X)Y=g(X) is the composition of XX and gg.

Arrows from the values minus 2 to 2 of X, each with probability 1/5, to the values 0, 1 and 4 of Y = X squared, with the probabilities that collect at each value.

In the figure XX is uniform on {−2,−1,0,1,2}\{-2,-1,0,1,2\}, each value with probability 15\tfrac{1}{5}, and Y=X2Y=X^2. The values −1-1 and 11 are both sent to 11, and −2-2 and 22 both to 44, so their probabilities add: P(Y=0)=15\mathbb{P}(Y=0)=\tfrac{1}{5}, P(Y=1)=25\mathbb{P}(Y=1)=\tfrac{2}{5} and P(Y=4)=25\mathbb{P}(Y=4)=\tfrac{2}{5}. XX is discrete uniform, but YY is not. In general, for discrete XX,

P(Y=y)=∑x ⁣:g(x)=yP(X=x).\mathbb{P}(Y=y)=\sum_{x\colon g(x)=y}\mathbb{P}(X=x).

For a discrete XX this is the whole recipe: list the values of gg, and for each value yy add the masses of all xx with g(x)=yg(x)=y. If gg is one-to-one, no masses merge, and YY has the same masses as XX, placed at new values. In general {Y∈B}\{Y\in B\} is the event {X∈C}\{X\in C\}, where CC is the set of xx with g(x)∈Bg(x)\in B; the condition on gg in the Definition guarantees that {X∈C}\{X\in C\} is an event, so that it has a probability.

Indicators are functions of this kind: the indicator of {X>10}\{X>10\} is g(X)g(X) with g(x)=1g(x)=1 for x>10x>10 and g(x)=0g(x)=0 otherwise. When only the average of g(X)g(X) is needed, LOTUS skips finding the distribution of YY: in the figure E[Y]=0⋅15+1⋅25+4⋅25=2\mathbb{E}[Y]=0\cdot\tfrac{1}{5}+1\cdot\tfrac{2}{5}+4\cdot\tfrac{2}{5}=2.

A common slip is to apply gg to the probabilities instead of the values. The masses of Y=X2Y=X^2 are not the squares of the masses of XX.


Key Results

  • If XX is a random variable and gg is Borel measurable, then g(X)g(X) is again a random variable. For a discrete XX, any real-valued assignment on its finite or countable set of values gives a random variable.
  • The distribution of g(X)g(X) may differ substantially from the distribution of XX.
  • LOTUS can compute expectations of g(X)g(X) without first deriving the full distribution of g(X)g(X).

Examples

  • If XX is temperature in Celsius, then a linear function of XX gives temperature in Fahrenheit.
  • If XX is a return, then X2X^2 measures squared return magnitude.
  • If XX is a waiting time, then an indicator of whether it exceeds ten minutes is a function of XX.

Prerequisites

Sources

Aliases: transformed random variable Keywords: random variable transformation Symbols: element of, omega, real numbers, sum

Last updated: 20 October 2026 03:02