# If $X$ has a $U[-1, 3]$ distribution and $Y = X^2$, find the probability density function of $Y$ .

The continuous random variable $X$ has a $\text{Uniform}[-1, 3]$ distribution and let $Y = X^2$ .

Find the probability density function of $Y$.

My attempt.

I know that it has to be between $0 < y < 1$. So $F(Y = y) = P(Y \leq y) = P(X^2 \leq y) = P(-\sqrt{y} \leq X \leq \sqrt{y}) = \frac{2\sqrt{y}}{3+1} = \frac{\sqrt{y}}{2}$

I'm not sure how to go forward from this

• which is the typo? the $X\leq 3$ or $y\leq 1$? – LinAlg Jul 5 '18 at 23:05
• In fact $0 \le Y \le 9$ though when $1 \lt y \le 9$, you have $P(Y \le y)=P(X \le \sqrt y)$ – Henry Jul 5 '18 at 23:06
• Similar question:math.stackexchange.com/questions/1531572/…. – StubbornAtom Jul 19 '18 at 20:08

Let $f_X$ and $f_Y$ denote the densities of $X$ and $Y$ respectively.

$$f_X(x)=\frac{1}{4}\mathbf1_{-1<x<3}$$

We have $y=g(x)$ where $g(x)=x^2$. So the function $g$ must be such that

$$g:(-1,3)\mapsto(0,9)$$

We define $g_i(x)=x^2$ for $i=1,2$ such that $g_1:(-1,0)\mapsto(0,1)$ and $g_2:(0,3)\mapsto (0,9)$.

(I have excluded the end-points in the supports of the random variables as it does not make a difference for continuous distributions)

So, $y=g_1(x)\implies x=g_1^{-1}(y)=-\sqrt y$ and $y=g_2(x)\implies x=g_2^{-1}(y)=\sqrt y$

To directly apply the transformation formula, we have

\begin{align}f_Y(y)&=f_X(-\sqrt y)\left|\frac{d}{dy}(-\sqrt y)\right|\mathbf1_{0<y<1}+f_X(\sqrt y)\left|\frac{d}{dy}(\sqrt y)\right|\mathbf1_{0<y<9} \\&=\frac{1}{4}\cdot\frac{1}{2\sqrt y}\mathbf1_{0<y<1}+\frac{1}{4}\cdot\frac{1}{2\sqrt y}\mathbf1_{0<y<9} \\&=\frac{1}{4\sqrt y}\mathbf1_{0<y<1}+\frac{1}{8\sqrt y}\mathbf1_{1<y<9} \end{align}

• @herbsteinberg It is pretty clear and straightforward to me at least, as it is. – StubbornAtom Jul 6 '18 at 17:58
• A clearer approach to the solution can be made using $U=|X|$ as an intermediate, since $U$ and $Y$ are one-to-one. The density function for $X.\ f_X(x)=\frac{1}{4}$. Therefore the density function for $U,\ f_U(u)=\frac{1}{2}$ for $0\le u\le 1$ and $=\frac{1}{4}$ for $1\lt u\le 3$. Thus the distribution function $F_U(u)=\frac{u}{2}$ for $0\le u\le 1$ and $=\frac{1}{2}+\frac{1}{4}(u-1)=\frac{1+u}{4}$ for $1\lt u\lt 3$. Since $U=\sqrt{Y}$ the final result is $F_Y(y)=\frac{\sqrt{y}}{2}$ for $0\le y\le 1$ and $=\frac{1+\sqrt{y}}{4}$. – herb steinberg Jul 6 '18 at 18:00

You need to consider it in 2 parts $|X|\lt 1,\ X \ge 1$. For the first part alone $P( |X| \lt \sqrt{y})=\sqrt{y}$. For the second part alone $P(1\le X \le \sqrt{y})=\frac{1}{2}(\sqrt{y}-1)$. Since each part has probability $=\frac{1}{2}$, they combine to get $P(Y\le y)=\frac{1}{2}\sqrt{y}$ for $0\le y\le 1$ and $P(Y\le y)=\frac{1}{4}+\frac{1}{4}\sqrt{y}$ for $y\gt 1$.

• @StubbornAtom My approach avoids taking unnecessary derivative for $\sqrt{y}$, by getting the density function first and putting $\sqrt{y}$ at the very end. – herb steinberg Jul 6 '18 at 18:06
• What you call 'unnecessary' is baffling. You found the distribution function, I found the density directly. BTW, you cannot ping me by tagging me in a post I haven't commented on. – StubbornAtom Jul 6 '18 at 18:18
• @StubbornAtom I was just looking over your post and you have expressions involving the derivative of $\sqrt{y}$. Also it was quite lengthy. I just feel my approach is more transparent. – herb steinberg Jul 6 '18 at 20:44
• Well, the density has the derivative of $\sqrt y$. Regarding the length, I have nothing to say. You feel your approach is 'more transparent', that's absolutely finel! But please raise questions on others' posts on valid grounds. – StubbornAtom Jul 6 '18 at 21:07