Welcome to our community

Be a part of something great, join today!

[SOLVED] Transformation of random variable (uniform)

  • Thread starter
  • Admin
  • #1

Jameson

Administrator
Staff member
Jan 26, 2012
4,052
This is something that when I see the work done it makes sense, but I find it difficult to do myself. I'm also aware there is an explicit formula for doing this but that involves Jacobians and a well-defined inverse, so I think it's more intuitive to do it step-by-step.

Problem: Suppose $X \text{ ~ } U(0,1)$. Find the density function of $Y=X^2$.

My attempt: I believe we should start by transforming the CDF and then differentiate to find the density function.

$P[Y \le y]=P[X^2 \le y]=P[X \le \sqrt{y}]$

Is this the direction I should be heading? From here should I try differentiating?

EDIT: I found some material on this question. It's important to note that $Y$ cannot be less than 0 so it seems that:
$$P[X \le \sqrt{y}]=P[-\sqrt{y} \le X \le \sqrt{y}]$$

Correct? Do the square roots look strange to anyone else? On my computer they look horrible.
 
Last edited:

Klaas van Aarsen

MHB Seeker
Staff member
Mar 5, 2012
8,885
Re: Transformation of random variable

This is something that when I see the work done it makes sense, but I find it difficult to do myself. I'm also aware there is an explicit formula for doing this but that involves Jacobians and a well-defined inverse, so I think it's more intuitive to do it step-by-step.

Problem: Suppose $X \text{ ~ } U(0,1)$. Find the density function of $Y=X^2$.

My attempt: I believe we should start by transforming the CDF and then differentiate to find the density function.

$P[Y \le y]=P[X^2 \le y]=P[X \le \sqrt{y}]$

Is this the direction I should be heading? From here should I try differentiating?

EDIT: I found some material on this question. It's important to note that $Y$ cannot be less than 0 so it seems that:
$$P[X \le \sqrt{y}]=P[-\sqrt{y} \le X \le \sqrt{y}]$$

Correct? Do the square roots look strange to anyone else? On my computer they look horrible.
Hi Jameson!

There is no probability for X being negative, so there's no need to include the negative part.
It is important to note that Y cannot be negative, because otherwise its square root would not be defined for part of the X domain.

And yes, that is the right direction.
Write $P[X \le \sqrt{y}]$ as an integral first, then differentiate.


Btw, the square root looks passable (but slightly inconsistent) on my monitor. ;)
However, the square brackets look pretty bad, especially the right one.
 

chisigma

Well-known member
Feb 13, 2012
1,704
Re: Transformation of random variable

This is something that when I see the work done it makes sense, but I find it difficult to do myself. I'm also aware there is an explicit formula for doing this but that involves Jacobians and a well-defined inverse, so I think it's more intuitive to do it step-by-step.

Problem: Suppose $X \text{ ~ } U(0,1)$. Find the density function of $Y=X^2$.

My attempt: I believe we should start by transforming the CDF and then differentiate to find the density function.

$P[Y \le y]=P[X^2 \le y]=P[X \le \sqrt{y}]$

Is this the direction I should be heading? From here should I try differentiating?

EDIT: I found some material on this question. It's important to note that $Y$ cannot be less than 0 so it seems that:
$$P[X \le \sqrt{y}]=P[-\sqrt{y} \le X \le \sqrt{y}]$$

Correct? Do the square roots look strange to anyone else? On my computer they look horrible.
Excellent!... differentiating the probability You obtain the p.d.f. of $Y=X^{2}$... it is important to say that You arrive to the same result if X is uniformley distributed in [0,1] or X is uniformly distributed in [-1,1]...


Kind regards


$\chi$ $\sigma$
 
  • Thread starter
  • Admin
  • #4

Jameson

Administrator
Staff member
Jan 26, 2012
4,052
Re: Transformation of random variable

Hi Jameson!

There is no probability for X being negative, so there's no need to include the negative part.
It is important to note that Y cannot be negative, because otherwise its square root would not be defined for part of the X domain.

And yes, that is the right direction.
Write $P[X \le \sqrt{y}]$ as an integral first, then differentiate.
I think that's the bit that was confusing me. I've seen a few solutions to this that all contain the $P[-\sqrt{y} \le X]$ term and it somehow disappears, but that's just because $P[X] \ge 0$.

So for the domain of $X$, this becomes $P[X \le \sqrt{y}]$ and after differentiating I think we end up with $\frac{1}{2 \sqrt{y}}$ however, I have seen an explanation that say the derivative is in fact:
$$f_{X}(\sqrt{y}) \cdot \frac{1}{2 \sqrt{y}}$$
Is that a more general way to think of it? How do I apply $f_{X}(\sqrt{y})$? I don't think I understand at how how we used that $X \text{ ~ } U(0,1)$. What if $X \text{ ~ } U(0,10)$?

I'm getting closer, thank you both!
 

Klaas van Aarsen

MHB Seeker
Staff member
Mar 5, 2012
8,885
Re: Transformation of random variable

I think that's the bit that was confusing me. I've seen a few solutions to this that all contain the $P[-\sqrt{y} \le X]$ term and it somehow disappears, but that's just because $P[X] \ge 0$.

So for the domain of $X$, this becomes $P[X \le \sqrt{y}]$ and after differentiating I think we end up with $\frac{1}{2 \sqrt{y}}$ however, I have seen an explanation that say the derivative is in fact:
$$f_{X}(\sqrt{y}) \cdot \frac{1}{2 \sqrt{y}}$$
Is that a more general way to think of it? How do I apply $f_{X}(\sqrt{y})$? I don't think I understand at how how we used that $X \text{ ~ } U(0,1)$. What if $X \text{ ~ } U(0,10)$?

I'm getting closer, thank you both!
If $X \text{ ~ } U(0,10)$, then with $0 \le x \le 10$ you get \(\displaystyle P[X \le x] = \int_0^x f_X(x)dx = \int_0^x \frac 1 {10-0} dx = \frac x {10}\).

And by differentiating \(\displaystyle P[X \le x] = \frac x {10}\), we find \(\displaystyle f_X(x) = \frac 1 {10}\), what we already expected of course.

So you need to differentiate after replacing $x$ with $\sqrt y$ (and of course you need to use $U(0,1)$ instead of $U(0,10)$).
 
  • Thread starter
  • Admin
  • #6

Jameson

Administrator
Staff member
Jan 26, 2012
4,052
Re: Transformation of random variable

Ok, that makes sense. The range of $X$ will affect the density so it will add some scaling factor to the answer.

$$ P[X \le \sqrt{y}]=F_{X}(\sqrt{y})=\int_{0}^{\sqrt{y}}\frac{1}{1-0}dx$$

$$ f_{X}(\sqrt{y})=F'_{X}(\sqrt{y})=\frac{1}{2 \sqrt{y}}$$

Look good? :)

EDIT: I see another way to do it now. I was right before that the answer is also $f_{X}(\sqrt{y}) \cdot \frac{1}{2 \sqrt{y}}$. Now I should just apply the fact that the PDF is 1 in the given region and I get the same answer.
 
Last edited:

Klaas van Aarsen

MHB Seeker
Staff member
Mar 5, 2012
8,885
Re: Transformation of random variable

Ok, that makes sense. The range of $X$ will affect the density so it will add some scaling factor to the answer.

$$ P[X \le \sqrt{y}]=F_{X}(\sqrt{y})=\int_{0}^{\sqrt{y}}\frac{1}{1-0}dx$$

$$ f_{X}(\sqrt{y})=F'_{X}(\sqrt{y})=\frac{1}{2 \sqrt{y}}$$

Look good? :)
Excellent!
(Learning from $\chi$ $\sigma$. ;))

Did you verify that the integral of $f_Y(y)$ for all possible values of y is equal to 1?
 
  • Thread starter
  • Admin
  • #8

Jameson

Administrator
Staff member
Jan 26, 2012
4,052
Re: Transformation of random variable

Excellent!
(Learning from $\chi$ $\sigma$. ;))

Did you verify that the integral of $f_Y(y)$ for all possible values of y is equal to 1?
Hmm, I actually don't know how to find $f_Y(y)$. All of this maneuvering has been to find $f_X(y)$. If I knew $F_Y(y)$ then I could just differentiate that though, but I don't know that.
 

Klaas van Aarsen

MHB Seeker
Staff member
Mar 5, 2012
8,885
Re: Transformation of random variable

Hmm, I actually don't know how to find $f_Y(y)$. All of this maneuvering has been to find $f_X(y)$. If I knew $F_Y(y)$ then I could just differentiate that though, but I don't know that.
You already found it.
$$F_Y(y) = P(Y \le y) = P(X \le \sqrt y)$$
(Thanks for removing the superfluous new line!)


I guess you should add the condition that $0 \le y \le 1$, since for other values of $y$ it is zero.
 
Last edited:

Klaas van Aarsen

MHB Seeker
Staff member
Mar 5, 2012
8,885
Oops. Just noticed something wrong.

It should be:
$$\begin{array}{lcll}f_X(x)&=&1 & \qquad \text{ if } 0 \le x \le 1 \\
P(X \le x) &=& F_X(x) = x & \qquad \text{ if } 0 \le x \le 1 \\
f_X(\sqrt y)&=&1 &\qquad \text{ if } 0 \le y \le 1 \\
P(X \le \sqrt y)&=&F_Y(y)=F_X(\sqrt y)=\sqrt y &\qquad \text{ if } 0 \le y \le 1 \\
f_Y(y)&=&\frac 1 {2 \sqrt y} &\qquad \text{ if } 0 \le y \le 1
\end{array}$$