Skip to content
BIASED

Functions of random variables

Block 1 of 7~2 min

New variables from old ones

The topic Continuous distributions gave us densities and CDFs for a few named families: uniform, exponential, normal. Real pipelines rarely stop at a named family. We standardize features, take the log of a latency, square an error, push a score through a sigmoid. Each time, a new random variable Y=g(X)Y = g(X) is built from an old one. This topic answers one question: if we know the distribution of XX, what is the distribution of YY?

That topic already gave a hint. Switching from centimetres to metres, Y=X/100Y = X/100, made the density 100 times taller while every probability stayed put. Here we turn the hint into a general rule.

Start with a discrete XX, where the answer is bookkeeping. Each value xx carries its probability to g(x)g(x). When several values land on the same yy, their probabilities add up:

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

The set of all xx with g(x)=yg(x) = y is the preimage of yy.

Take a fair die XX and Y=(X−3)2Y = (X - 3)^2. The value Y=1Y = 1 has two preimages, X=2X = 2 and X=4X = 4, so P(Y=1)=2/6P(Y = 1) = 2/6. The value Y=9Y = 9 has one, X=6X = 6, so P(Y=9)=1/6P(Y = 9) = 1/6. Nothing is lost and nothing is created: the probabilities of YY still add up to 1. They are just regrouped.

Answers are saved on the server and tied to this browser until you sign in.