Functions of a R.V. - Transformations

Example

say \(X\sim U[0,1]\) and \(\lambda>0\). What is the pdf of the random variable \(Y=-\lambda \log(X)\)?

Solution: we first find the cdf and then the pdf as follows:

if y>0. For y<0 note that \(P(-\log X<y) = 0\) because \(0<X<1\), so \(\log X<0\), so \(-\log X>0\) always.

This is an example of a function (or transformation) of a random variable. These transformations play a major role in probability and statistics. We will see how to find their pdf’s on a few examples.

Example

Say X is the number of roles of a fair die until the first six. We have already seen that \(P(X=x) = 1/6*(5/6)^{x-1}\), x=1,2,.. Let Y be 1 if X is even, 0 otherwise. Find the of Y.

Note: here both X and Y are discrete.

let’s do this a little more general, with p instead of 1/6. Also let q=1-p=5/6. Then

\[ \begin{aligned} &P(Y=0) = P(X \in \{1, 3, 5, ..\}) =\\ &\sum_{k=0}^\infty pq^{(2k+1)-1} = p \sum_{k=0}^\infty q^{2k} = \\ &p \sum_{k=0}^\infty (q^2)^{k} = p\frac1{1-q^2} =\\ &p\frac1{(1+q)(1-q)} = \frac1{1+q} \end{aligned} \] so \(P(Y=0) = 1/(1+5/6) = 6/11\) and \(P(Y=1) = 1 - P(Y=1) = 5/11\).

Example

Say we have a fair coin. We flip the coin until the first “Heads”. What is the probability this will happen on an even-numbered flip?

Now we have the same as above, with p=0.5, so

P(Y=0)=0.5/(1+0.5)=1/3.

Is there a loaded coin with probability of heads p so that the probability of “first heads on even-numbered flip” is 1/2?

Now P(Y=1)=q/(1+q)=1/2, so 2q=1+q or q=1 or p=0, but if p=0 we never get “heads”, so no such coin exists!

Example

say X is a continuous r.v with pdf \(f_X(x) = 1/2\exp(-|x|)\). This is called a double exponential random variable. Let \(Y=I_{[-1,1]}(X)\). Find the of Y.

Note: here X is continuous and Y is discrete.

Example

again let X have pdf \(f_X(x) = 1/2\exp(-|x|)\). Let \(Y =X^2\). Then for \(y<0\) we have \(P(Y \le y) = 0\). So let \(y>0\). Then

Next up some examples of functions of random vectors:

Example

say (X,Y) is a bivariate standard normal r.v, that is it has joint given by

\[f(x,y)=\frac1{2\pi}\exp\left\{-\frac12(x^2+y^2) \right\} \]

Let the r.v. (U,V) be defined by U = X+Y and V = X-Y. Find the joint pdf of (U,V)

To start let’s define the functions \(g_1(x,y) = x+y\) and \(g_2(x,y) = x-y\), so that \(U=g_1(X,Y)\) and \(V = g_2(X,Y)\).

For what values of u and v is \(f_{(U,V)}(u,v)\) positive? Well, for any values for which the system of 2 linear equations in two unknowns u=x+y and u=x-y has a solution.

These solutions are

\[x = h_1(u,v) = (u + v)/2\] \[y = h_2(u,v) = (u - v)/2\]

From this we find that for any (u,v) there is a unique (x,y) such that u=x+y and v=x-y. So the transformation \((x,y) \rightarrow.png) (u,v)\) is one-to-one and therefore has a Jacobian given by

Now from multivariable calculus we have the following:

Note that the factors into a function of u and a function of v. This is not only a necessary but also a sufficient condition for U and V to be independent.

Example

say X and Y are independent standard normal r.v.’s. Let Z = X + Y. Find the pdf of Z.

Note: Z = X + Y = U in the example above, so the pdf of Z is just the marginal of U and we find

Say X and Y are two continuous independent r.v with pdf f’s f_X and f_Y, and let Z = X+Y. If we repeat the above calculations we can show that in general the pdf of Z is given by

\[f_Z(z)=\int_{-\infty}^\infty f_X(t)f_Y(z-t)dt \]

This is called the convolution formula.

There is a second method for deriving the convolution formula which is useful. It uses a continuous analog to the law of total probability:

In the setup from above we have

\[ \begin{aligned} &F_{X+Y}(z) = P(X+Y\le z) =\\ &\int_{-\infty}^\infty P(X+Y\le z|Y=y)f_Y(y)dy = \\ &\int_{-\infty}^\infty (X\le z-y|Y=y)f_Y(y)dy = \\ &\int_{-\infty}^\infty F_{X|Y=y}(z-y|y)f_Y(y)dy \\ &f_Z(z) = \frac{d}{dz} F_Z(z) =\\ &\frac{d}{dz} \int_{-\infty}^\infty F_{X|Y=y}(z-y|y)f_Y(y)dy =\\ &\int_{-\infty}^\infty \frac{d}{dz} F_{X|Y=y}(z-y|y)f_Y(y)dy = \\ &\int_{-\infty}^\infty f_{X|Y=y}(z-y|y)f_Y(y)dy = \\ &\int_{-\infty}^\infty f_{X}(z-y)f_Y(y)dy \\ \end{aligned} \]

and here we used the independence only at the very end, the formula above also holds in general.

The tricky part of this is the interchange of the derivative and the integral. Working with densities and cdfs usually means they are ok.

Example

Say \(X_1, .., X_n\) are iid U[0,1]. Let \(M=\max\{X_1, .., X_n\}\). Find \(f_M\).