Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

If XX is discrete, and gg is a monotone function, then finding the distribution of the random variable Y=g(X)Y = g(X) is straightforward: convert each possible value of XX by applying gg and leave the probabilities alone.

For example, if XX is uniform on the three values 0,1,20, 1, 2, and Y=eXY = e^X, then the you can just augment the distribution table of XX by the possible values of YY:

yy1eee2e^2
xx012
chance13\frac{1}{3}13\frac{1}{3}13\frac{1}{3}

The new random variable YY is uniform on the three values 1,e,e21, e, e^2.

But if XX has a density then both XX and YY have a continuum of values and we have to be more careful.

The method we developed in the previous section for finding the density of a linear function of a random variable can be extended to non-linear functions.

🎥 See More
Loading...

16.2.1Change of Variable Formula for Density: Increasing Function

The function F1F^{-1} is differentiable and increasing. We will now develop a general method for finding the density of such a function applied to any random variable that has a density.

Let XX have density fXf_X. Let gg be a smooth (that is, differentiable) increasing function, and let Y=g(X)Y = g(X). Examples of such functions gg are:

  • g(x)=ax+bg(x) = ax + b for some a>0a > 0. This case was covered in the previous section.

  • g(x)=exg(x) = e^x

  • g(x)=xg(x) = \sqrt{x} on positive values of xx

To develop a formula for the density of YY in terms of fXf_X and gg, we will start with the cdf as we did above.

Let gg be smooth and increasing, and let Y=g(X)Y = g(X). We want a formula for fYf_Y. We will start by finding a formula for the cdf FYF_Y of YY in terms of gg and the cdf FXF_X of XX.

FY(y) = P(Yy)= P(g(X)y)= P(Xg1(y))    because g is increasing= FX(g1(y))\begin{align*} F_Y(y) ~ & = ~ P(Y \le y) \\ &= ~ P(g(X) \le y) \\ &= ~ P(X \le g^{-1}(y)) ~~~~ \text{because } g \text{ is increasing} \\ &= ~ F_X(g^{-1}(y)) \end{align*}

Now we can differentiate to find the density of YY. By the chain rule and the fact that the derivative of an inverse is the reciprocal of the derivative,

fY(y) = fX(g1(y))ddyg1(y)= fX(x)1g(x)     at x=g1(y)\begin{align*} f_Y(y) ~ &= ~ f_X(g^{-1}(y)) \frac{d}{dy} g^{-1}(y) \\ &= ~ f_X(x) \frac{1}{g'(x)} ~~~~~ \text{at } x = g^{-1}(y) \end{align*}

16.2.1.1The Formula

Let gg be a differentiable, increasing function. The density of Y=g(X)Y = g(X) is given by

fY(y) = fX(x)g(x)   at x=g1(y)f_Y(y) ~ = ~ \frac{f_X(x)}{g'(x)} ~~~ \text{at } x = g^{-1}(y)

16.2.2Understanding the Formula

To see what is going on in the calculation, we will follow the same process as we used for linear functions in an earlier section.

  • For YY to be yy, XX has to be g1(y)g^{-1}(y).

  • Since gg need not be linear, the tranformation by gg won’t necessarily stretch the horizontal axis by a constant factor. Instead, the factor has different values at each xx. If gg' denotes the derivative of gg, then the stretch factor at xx is g(x)g'(x), the rate of change of gg at xx. To make the total area under the density equal to 1, we have to compensate by dividing by g(x)g'(x). This is valid because gg is increasing and hence gg' is positive.

This gives us an intuitive justification for the formula.

16.2.3Applying the Formula

Let XX have the exponential (1/2) density and let Y=XY = \sqrt{X}. We can take the square root because XX is a positive random variable.

Let’s find the density of YY by applying the formula we have derived above. We will organize our calculation in four preliminary steps, and then plug into the formula.

  • The density of the original random variable: The density of XX is fX(x)=(1/2)e(1/2)xf_X(x) = (1/2)e^{-(1/2)x} for x>0x > 0.

  • The function being applied to the original random variable: Take g(x)=xg(x) = \sqrt{x}. Then gg is increasing and its possible values are (0,)(0, \infty).

  • The inverse function: Let y=g(x)=xy = g(x) = \sqrt{x}. We will now write xx in terms of yy, to get x=y2x = y^2.

  • The derviative: The derivative of gg is given by g(x)=1/(2x)g'(x) = 1/(2\sqrt{x}).

We are ready to plug this into our formula. Keep in mind that the possible values of YY are (0,)(0, \infty). For y>0y > 0 the formula says

fY(y) = fX(x)g(x)   at x=g1(y)f_Y(y) ~ = ~ \frac{f_X(x)} {g'(x)} ~~~ \text{at } x = g^{-1}(y)

So for y>0y > 0,

fY(y) = (1/2)e12x1/(2x)    at x=y2= xe12x    at x=y2= y2e12y2= ye12y2\begin{align*} f_Y(y) ~ &= ~ \frac{(1/2)e^{-\frac{1}{2}x}}{1/(2\sqrt{x})} ~~~~ \mbox{at } x = y^2 \\ &= ~ \sqrt{x} e^{-\frac{1}{2}x} ~~~~ \mbox{at } x = y^2 \\ &= ~ \sqrt{y^2} e^{-\frac{1}{2}y^2} \\ &= ~ y e^{-\frac{1}{2}y^2} \end{align*}

This is called the Rayleigh density. Its graph is shown below.

<matplotlib.figure.Figure at 0x1a12dc1eb8>

16.2.4Change of Variable Formula for Density: Monotone Function

Let gg be smooth and monotone (that is, either increasing or decreasing). The density of Y=g(X)Y = g(X) is given by

fY(y) = fX(x)g(x)   at x=g1(y)f_Y(y) ~ = ~ \frac{f_X(x)}{\lvert g'(x) \rvert} ~~~ \text{at } x = g^{-1}(y)

We have proved the result for increasing gg. When gg is decreasing, the proof is analogous to proof in the linear case and accounts for gg' being negative. We won’t take the time to write it out.

16.2.4.1Reciprocal of a Uniform Variable

Let UU be uniform on (0,1)(0, 1) and let V=1/UV = 1/U. The distribution of VV is called the inverse uniform but the word “inverse” is confusing in the context of change of variable. So we will simply call VV the reciprocal of UU.

To find the density of VV, start by noticing that the possible values of VV are in (1,)(1, \infty) as the possible values of UU are in (0,1)(0, 1).

The components of the change of variable formula for densities:

  • The original density: fU(u)=1f_U(u) = 1 for 0<u<10 < u < 1.

  • The function: Define g(u)=1/ug(u) = 1/u.

  • The inverse function: Let v=g(u)=1/uv = g(u) = 1/u. Then u=g1(v)=1/vu = g^{-1}(v) = 1/v.

  • The derivative: Then g(u)=u2g'(u) = -u^{-2}.

By the formula, for v>1v > 1 we have

fV(v) = fU(u)g(u)   at u=g1(v)f_V(v) ~ = ~ \frac{f_U(u)}{\lvert g'(u) \rvert} ~~~ \text{at } u = g^{-1}(v)

That is, for v>1v > 1,

fV(v) = 1u2   at u=1/vf_V(v) ~ = ~ 1 \cdot u^2 ~~~ \text{at } u = 1/v

So

fV(v) = 1v2,   v>1f_V(v) ~ = ~ \frac{1}{v^2}, ~~~ v > 1

You should check that fVf_V is indeed a density, that is, it integrates to 1. You should also check that the expectation of VV is infinite.

The density fVf_V belongs to the Pareto family of densities, much used in economics.

<Figure size 432x288 with 1 Axes>