MHB Transformation of random variable (uniform)

AI Thread Summary
The discussion focuses on finding the density function of a transformed random variable, specifically when \( Y = X^2 \) and \( X \) is uniformly distributed over \( (0,1) \). Participants agree that the correct approach involves transforming the cumulative distribution function (CDF) of \( X \) and differentiating it to obtain the density function of \( Y \). It is clarified that since \( Y \) cannot be negative, the transformation simplifies to \( P[Y \le y] = P[X \le \sqrt{y}] \). The final density function is derived as \( f_Y(y) = \frac{1}{2\sqrt{y}} \) for \( 0 \leq y \leq 1 \). The discussion emphasizes the importance of understanding the relationship between the original and transformed variables in determining the density function correctly.
Jameson
Insights Author
Gold Member
MHB
Messages
4,533
Reaction score
13
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:
Physics news on Phys.org
Re: Transformation of random variable

Jameson said:
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.
 
Re: Transformation of random variable

Jameson said:
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$
 
Re: Transformation of random variable

I like Serena said:
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!
 
Re: Transformation of random variable

Jameson said:
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 $$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 $$P[X \le x] = \frac x {10}$$, we find $$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)$).
 
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:
Re: Transformation of random variable

Jameson said:
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?
 
Re: Transformation of random variable

I like Serena said:
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.
 
Re: Transformation of random variable

Jameson said:
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:
  • #10
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}$$
 
Back
Top