# Finding the probability density function of a function of a continuous random variable

Let $$f_X(x)=\begin{cases}c \cdot x&\text{for }0 \leq x \leq 1\\ 0&\text{otherwise }\end{cases}$$ with $$c > 0$$ be the probability density function of the random variable $$X$$. Find the probability density function of $$Y:= X^2.$$

First we find $$c:$$

$$\int_{-\infty}^\infty {f_X(x) \text{ }dx = 1} = \int_{0}^1 cx \text{ } dx \Rightarrow c = 2.$$

Since $$f_Y(y)$$ is the derivative of the cumulative distribution function $$F_Y(y)$$, we first need to calculate $$F_Y(y):$$

$$F_Y(y) = P(Y \leq y) = P(X^2 \leq y) = P(X \leq \sqrt{y}) = F_X(\sqrt{y}).$$

Now to find $$F_X(t):$$

$$F_X(t) = \int_{0}^t 2x \text{ } dx = t^2 \Rightarrow F_X(t)=\begin{cases}0&\text{for }t \in ]-∞, 0[ \\ t^2&\text{for } t \in [0, 1] \\ 1 &\text{for } t \in ]1, ∞[\end{cases}$$

$$\Rightarrow F_Y(y) = P(X \leq \sqrt{y}) = y$$ if $$0 \leq \sqrt{y} \leq 1$$ and $$1$$ if $$\sqrt{y} > 1$$.

$$\Rightarrow f_Y(y) = F_Y(y)' = 1$$ if $$0 \leq y \leq 1$$ and $$0$$ if $$y > 1$$.

Can you please check my work? I'm not sure about the last part since $$F_Y(y)$$ is not defined for all $$y \in R$$ (it's undefined for $$y < 0$$). Thank you.

That's pretty ok. You found that

$$f_Y(y)=\mathbb{1}_{[0;1]}(y)$$

In other words

$$Y\sim U[0;1]$$

$$F_Y(y)$$ is not defined for all y∈R (it's undefined for y < 0). Thank you.

Yes it is. $$F_Y(y)=0$$ $$\forall y<0$$

$$F_Y(y) = \begin{cases} 0, & \text{if y<0 } \\ y, & \text{if 0\leq y<1 } \\ 1, & \text{if y \geq 1 } \end{cases}$$

In this kind of exercise it is easier to directly find $$f_Y(y)$$ without passing by its CDF:

$$\bbox[5px,border:2px solid black] { f_Y(y)=f_X[g^{-1}(y)]\bigg|\frac{d}{dy}g^{-1}(y)\Bigg| \ }$$

Substituting you get immediately

$$f_Y(y)=2\sqrt{y}\frac{1}{2\sqrt{y}}=1$$

$$y \in[0;1]$$ (and $$0$$ elsewhere)