# How do I know to find the density for $X^2$ for $0\lt y \lt 1$

Suppose $X$ has a uniform $[-1,2]$ distribution. Find he density of $X^2$.... What I did was the change of variables, (and I know I'm supposed to do it because it's that section of the textbook) and I first found the range of $Y$ which is $[1,4]$ because were assuming $Y=X^2$ and $x$'s domain is from $-1$ to $4$ and the range would just be the end points. Next I found $f_Y(y)=\frac{f_X(x)}{|\frac{dy}{dx}|}$ which is pretty simple, it came out to be$$f_Y(y)=\frac{1}{6\sqrt y}\quad \forall \quad 1\le y \le 4$$ I know that this is correct because in the back of the book it lists this as the brief answer. However, there is also another part to it that says $$f_Y(y)=\frac{1}{3\sqrt y}\quad \forall \quad 0\lt y \lt 1$$ and I'm not sure where that second part came from. The interval [0,1] isn't even in the range of $Y$ so why would I be looking for it?

-
What is the value of $Y$ if $X = 0.1$? –  Dilip Sarwate Nov 5 '12 at 13:09
Sketch the plane with coordinate axes $x$ and $y$. Mark on it the points $(−1,0)$ and $(2,0)$, and then sketch the parabola$y=x^2$ between these points. The point $(X,Y)$ always lies on this segment of the parabola. Then ask yourself: for fixed $y in [0,1]$, what values of the random variable $X$ result in the occurrence of the event $\{Y\leq y\}$? Can you find the probability $P\{Y\leq y\}$ which is $F_Y(y)$ for $y \in [0,1]$? Repeat for fixed $y \in (1,4]$ and note that the values of $X$ that result in $\{Y\leq y\}$ have a different form... Do not rely on magical formulas.... –  Dilip Sarwate Nov 5 '12 at 13:10
I see, thank you for that. I just remembered my professor mentioned this in lecture. –  TheHopefulActuary Nov 5 '12 at 13:32

The range of $Y$ is $[0,4]$, not $[1,4]$! As $x \mapsto x^2$ isn't monotonic on $[-1,2]$ you cannot just square the endpoints of the interval, you have to square all points in $[-1,2]$. So let's compute the distribution of $Y$ (to me, this seems often more direct to approach in contrast with the density), for $y \in [0,4]$ we have \begin{align*} P(Y \le y) &= P(X^2 \le y)\\ &= P(X \in [-\sqrt y, \sqrt y])\\ &= P(X \in [-\min\{\sqrt y, 1\}, \min\{\sqrt y, 1\}]) + P(X \in [1, \max\{\sqrt y, 1\}])\\ &= \frac 23 \cdot \min\{\sqrt y, 1\} + \frac 13\max\{\sqrt y - 1, 0\}\\ &= \begin{cases} \frac 23 \sqrt y, & y \le 1\3mm] \frac 13 + \frac 13\sqrt y & y \ge 1 \end{cases} \end{align*} Taking the derivative gives Y's density \[ f_Y(y) = \begin{cases} \frac 1{3\sqrt y}, & y \in [0,1]\\[3mm] \frac 1{6\sqrt y}& y \in (1,4]. \end{cases}
could you explain the 3rd line of how you did that? I can kind of see what you did. Why did you use $[-min{\sqrt y,1}]$, etc.? –  TheHopefulActuary Nov 6 '12 at 16:21