Trouble with conversion of probability density function

Let X be a uniformly distributed random variable on the interval $(−1, 1)$. Find the pdf of $Y = X^2$.

So far I know the following:

$$Y\le y = X^2 \le y = X \le y^{1\over2}$$

I also know that $f_x(x)={1\over2}$

Now I am confused about two things. Number one, what is the interval of $Y$?

When I replace $x$ with $y^{1\over2}$, this is what happens:

$$-1\le y^{1\over2}\le1$$

$$(-1)^2\le y\le(1)^2$$

$$1\le y\le 1$$

How does this make sense, and where do I proceed from here? Furthermore, the real solution says that the cdf is $y^{1\over2}$ for $0<y<1$. Where did the zero come from?

Number two, to get the pdf I did a change of variables:

$${1\over2} {\big| {d\over dy} y^{1\over2} \big|}$$

$${1\over4} { y^{-{1\over2}} }$$

However, the real solution says ${1\over2} { y^{-{1\over2}} }$ for $0<y<1$.

Any help would be greatly appreciated.

• It would be better to start with something like $Y\le y \iff X^2 \le y \iff X \le y^{1\over2}$ rather than equals signs $=$, except that that is not correct: e.g. with $X=-0.8$ and $y=0.16$ so $X^2=0.64$ and $y^{1\over2}=0.4$, you have $X \le y^{1\over2}$ but not $X^2 \le y$. You actually want $Y\le y \iff X^2 \le y \iff - y^{1\over2} \le X \le y^{1\over2}$ – Henry Aug 16 '18 at 17:20
• As illustrated in the answer from mathcounterexamples.net, the usual process in converting from the PDF $f_X(x)$ of a random variable $X$ into a PDF for $Y = g(X)$, is to first convert into the CDF $F_X(x) = P(X \leq x)$. Then we find $x = g^{-1}(y)$ for any value $y$, and find $F_Y(y) = F_X\left(g^{-1}(y)\right)$, and then take the derivative of $F_Y(y)$ to obtain the PDF $f_Y(y) = \frac{d}{dy}F_Y(y)$. – Brian Tung Aug 16 '18 at 18:44

Let’s find the cumulative distribution function $F_Y$ of $Y$.

We have

$$F_Y(y)=P[Y \le y]= \begin{cases} 0 &\text{for } y <0\\ \int_{-\sqrt{y}}^{\sqrt{y}}f_X(x)\ dx = \sqrt{y} &\text{for } 0\le y <1\\ 1 & \text{for } y \ge 1 \end{cases}$$

as $P[X^2 \le y]= P[-\sqrt{y} \le X \le \sqrt{y}]$.

Therefore $f_Y(y)= \dfrac{1}{2\sqrt{y}}$ for $0\le y \le 1$ by taking the derivative.

• Why did you make the bounds $\sqrt{y}$ and $-\sqrt{y}$? – agblt Aug 16 '18 at 17:20
• Because $X^2 \le y$ is equivalent to $-\sqrt{y} \le X \le \sqrt{y}$. – mathcounterexamples.net Aug 16 '18 at 17:21
• Why is the interval $0\le y <1$, how did you get there from $-1\le x <1$? – agblt Aug 16 '18 at 17:25
• $Y$ is a square and therefore can’t be negative. – mathcounterexamples.net Aug 16 '18 at 17:26
• @agblt: $X$ can be anywhere from $-1$ to $1$ (and nowhere else), so its absolute value $|X|$ can be any value from $0$ to $1$ (and nowhere else), so its square $X^2$ can be any value from $0$ to $1$ also (and nowhere else). Note therefore that $P(X^2 < 0) = 0$. – Brian Tung Aug 16 '18 at 18:48