QUESTION: Let $X$ be a random variable with density function given by $f(x)=2x\chi_{[0,1]}(x)$, for all $x\in \mathbb{R}$ (where $\chi_{[0,1]}$ is the indicator function). Calculate the density function of $Y=X^2$.
MY ATTEMPTY: First of all, let's check that $f$ is a density function.
- Clearly we have $f(x)\geq 0$ once the indicator function is give by $\chi_{[0,1]}(x)= 1$ if $x\in [0,1]$, and $\chi_{[0,1]}(x)= 0$ otherwise. Then $f(x)=2x$ if $x\in [0,1]$ and $f(x)= 0$ otherwise. Thus, indeed $f(x)\geq 0$, for all $x\in \mathbb{R}$.
- $\int_{-\infty}^{\infty} f(x)dx=\int_{0}^{1} 2x dx= 1$
From 1 and 2 it follows that f is a density function.
Now, we are going to calculate $Y=X^2$. We have that $f_Y(y)=F'_Y(y)$ if $F'_Y$ exists. Hence,
\begin{align*} F_Y(y)&=P(Y\leq y)\\ &=P(X^2\leq y)\\ &=P(X\leq \sqrt{y}) \end{align*} $\implies F_Y(y)=F_X(\sqrt{y})$ this means that the diferenciability of Y works where X works.
Now, defining, $h(y)=\sqrt{y}$ we have that $h'(y)=\frac{1}{2\sqrt{y}}, \; \forall y\in \mathbb{R}.$
By the chain rule follows
\begin{align*} F'_Y(y)&=F'_X(y)\cdot \frac{1}{2\sqrt{y}}, \; \forall y \in \mathbb{R}\\ &=\frac{1}{2\sqrt{y}} f_X(\sqrt{y}) \end{align*}
where $$ f_X(h(y))=\left\{\begin{array}{cc} 1 &\;\mbox{if}\; y \in [0,1]\\ 0&\;\mbox{otherwise} \end{array} \right. $$ $$\iff 0\leq \sqrt{y}\leq 1 \iff 0\leq y \leq 1$$
Therefore, $Y$ is a continuous function and its density is given by $$ f_Y(y) = f_X(h(y)). |h'(y)|=\left\{\begin{array}{cc} \frac{1}{2\sqrt{y}} &\;\mbox{if}\; y \in [0,1]\\ 0&\;\mbox{otherwise} \end{array} \right. $$
MY DOUBT: Is my answer right? Would you please check it for me? My question is precisely because I don't understand where I have to use $f(x)=2x$ when I'm calculating $Y=X^2$.
It's incorrect. Since $f_X(x) = 2x \cdot \chi_{[0,1]}(x) \ \forall x \in \mathbb{R}$ and $h(y) = \sqrt{y}$, it follows that $$ \begin{aligned} f_Y(y) = f_X( \sqrt{y} ) \cdot \frac{1}{2 \sqrt{y}} = 1 \ \forall y \in [0,1] \ \end{aligned}$$
and $f_Y(y) = 0$ otherwise, therefore $f_Y = \chi_{[0,1]}$.