# Transformation of Random Variables

Suppose X is a random variable with PDF f_{X} and CDF F_{X}. Let Y = r(X) be a function of X, then we call Y = r(X) a transformation of X.

In discrete case, the mass function of Y is given by

f_{Y}(y) = P(Y = y) = P(r(X) = y) = P({x; r(x) = y}) = P(X ∈ r^{-1}(y))

Example: Let us take the following mass function –

x | f_{X}(x) |

-1 | 1/4 |

0 | 1/2 |

1 | 1/4 |

Let Y = X^{2}. Then, P(Y = 0) = P(X = 0) = 1/2 and P(Y = 1) = P(X = 1) + P(X = -1) = 1/2. Summarizing:

y | f_{Y}(y) |

0 | 1/2 |

1 | 1/2 |

For continuous case, there are three steps for transformation

1. For each For each y, find the set A_{y}= {x : r(x) ≤ y}.

2. Find the CDF

F_{y}(y) = P(Y ≤ y) = P(r(X) ≤ y)

= P({x; r(x) ≤ y}) = ∫_{Ay }f_{x}(x)dx

3. The PDF is f_{Y}(y) = F’_{Y}(y).

**Example**: Let f_{X}(x) = e^{−x} for x > 0.

Hence, F_{X}(x) = ∫_{0}^{x} f_{X}(s)ds = 1 − e^{−x} …(i)

Let Y = r(X) = logX …(ii)

Then, A_{y} = {x : x ≤ e^{y}} and

F_{Y}(y) = P(Y ≤ y) = P(logX ≤ y) …using eqn(ii)

= P(X ≤ e^{y}) = F_{X}(e^{y}) = 1 − e^{−ey} … using eqn(i)

Therefore, f_{Y}(y) = e^{y}e^{−ey} for y ∈ R.