# A calculus of the absurd

#### 27.6 Transformations of continuous random variables

Imagine we have a random variable $$X$$, with probability density function

$$f_X(x) = \begin{cases} 4x^3 & 0 < x \leqq 1 \\ 0 & \text {otherwise} \end {cases}$$

and we want to find the probability density function for the random variable

$$Y = \frac {1}{X^4}$$

The first thing to do is to find the cumulative probability function for $$X$$, (by integrating)

\begin{align} F_X(x) & = \begin{cases} 0 & x \leqq 0 \\ \int _0^{x} 4x^3 dx & 0 < x \leqq 1 \\ 1 & x > 1 \end {cases} \\ & = \begin{cases} 0 & x \leqq 0 \\ x^4 & 0 < x \leqq 1 \\ 1 & x > 1 \end {cases} \end{align}

Then, we can find the cumulative probability function for $$Y$$ in terms of the cumulative probability function for $$X$$. From the definition of the cumulative probability function we know that

$$F_Y(y) = P(Y \leqq y)$$

Then as $$Y=\frac {1}{X^4}$$ we can substitute $$X$$ for $$Y$$

$$P(Y \leqq y) = P(\frac {1}{X^4} < y)$$

We can then manipulate this into some function of $$P(X < g(y))$$ (where $$g(y)$$ is a function we need to determine).

\begin{align} P\left (Y \leqq y\right ) & = P\left (\frac {1}{X^4} < y\right ) \\ & = P\left (X^4 > \frac {1}{y}\right ) \\ & = P\left (X > \sqrt [4]{\frac {1}{y}}\right ) \\ & = 1- P\left (X < \sqrt [4]{\frac {1}{y}}\right ) \end{align}

Note that in the second step we flipped the inequality because we took the reciprocal of both functions, and the reciprocal function makes bigger values smaller (and vice-versa) so to keep the inequality true, we had to flip the signs. From here, we plug into $$F_X(x)$$.

\begin{align} P\left (Y \leqq y\right ) & = 1- P\left (X < \sqrt [4]{\frac {1}{y}}\right ) \\ & = 1- F_X\left (\sqrt [4]{\frac {1}{y}}\right ) \\ & = \begin{cases} 1 - 0 & x \leqq 0 \\ 1 - \left (\sqrt [4]{\frac {1}{y}}\right )^4 & 0 < x \leqq 1 \\ 1 - 1 & x > 1 \end {cases} \\ & = \begin{cases} 1 & x \leqq 0 \\ 1- \frac {1}{y} & 0 < x \leqq 1 \\ 0 & x > 1 \end {cases} \end{align}

We also need to rewrite bounds in terms of $$y$$, rather than $$x$$. As $$Y=\frac {1}{X^4}$$ we can write

$$X = Y^{-\frac {1}{4}}$$

And thus that

\begin{align} P\left (Y \leqq y\right ) & = \begin{cases} 1 & y^{-\frac {1}{4}} \leqq 0 \\ 1- \frac {1}{y} & 0 < y^{-\frac {1}{4}} \leqq 1 \\ 0 & y^{-\frac {1}{4}} > 1 \end {cases} \\ & = \begin{cases} 1 & y \geqq \infty \\ 1- \frac {1}{y} & y < \infty \text { and } y \geqq 1 \\ 0 & y < 1 \end {cases} \\ & = \begin{cases} 1- \frac {1}{y} & y \geqq 1 \\ 0 & y < 1 \end {cases} \end{align}

Note that here it is assumed that $$\frac {1}{0} = \infty$$ (it makes it nice and easy to work with the bounds).

As we now have the cumulative probability function for $$Y$$, the final step is to differentiate to get the probability density function.

\begin{align} \frac {d}{dx} \left [P\left (Y \leqq y\right )\right ] & = \begin{cases} \frac {d}{dx} \left [1- \frac {1}{y}\right ] & y \geqq 1 \\ 0 & y < 1 \end {cases} \\ & = \begin{cases} \frac {d}{dx} \left [ - y^{-1} \right ] & y \geqq 1 \\ 0 & y < 1 \end {cases} \\ & = \begin{cases} y^{-2} & y \geqq 1 \\ 0 & y < 1 \end {cases} \\ & = f_Y(y) \end{align}