Finding CDF from given piecewise PDF
Cheers, I have the following PDF $f_X(x) = \frac{2|x|}{5}, \quad -1 \leq x \leq 2,$ and I am asked to find the distribution function $F_X(x)$.
I know that to find it I must solve the following integral: $F_X(x) = \int_{-\infty}^x f(t)dt = \int_{-1}^x\frac{2|t|dt}{5}$. However, I know that if $x > 0$ then the integral will change completely, and I can't quite understand what I should do at this point.
My thought was to try and split the CDF approprietly:
$\bullet$ If $-1< x < 0$ then: $\int_{-1}^x\frac{-2t}{5}dt = \frac{-2}{5}\begin{bmatrix}\frac{t^2}{2}\end{bmatrix}^x_{-1} = \frac{-1}{5}(x^2-1)$
$\bullet$ If $0 < x < 2$ then $\int_{-1}^0\frac{-2t}{5}dt + \int_{0}^x\frac{2t}{5}dt = \frac{1}{5} + \frac{1}{5}x^2$.
Would something like that be correct? I have not seen this before so I wouldn't know for sure, but It seems like this is going somewhere right, as the condition $\frac{dF_X(x)}{dx} = f_X(x)$ holds.
Also, let's suppose we have a random variable $Y, Y = X^2$, and I want to find its CDF, then I would say: $F_Y(y) = \mathbb{P}(Y\leq y) = \mathbb{P}(X^2 \leq y) = \mathbb{P}(-\sqrt y \leq X \leq \sqrt y) = F_X(\sqrt y) - F_X(-\sqrt y)$. Then I thought of saying that $ \sqrt y \geq 0$ and $- \sqrt y \leq 0$ and then choose the appropriate piece of the function, for example: as $ \sqrt y \geq 0, F_X( \sqrt y ) = \frac{1}{5} + \frac{1}{5}|y|$ and the other way for $ -\sqrt y $. Am I going the right way here? Thanks =)
Solution 1:
Yes your work is correct and for $Y = X^2$, $Y$ is always positive.
So, For $0 \lt y \lt 1$,
$ \displaystyle F_Y(y) = P(- \sqrt y \lt X \lt \sqrt y) =\frac{1 + y}{5} - \frac{1-y}{5} = \frac {2y}{5}$
For $1 \leq y \lt 4$,
$ \displaystyle F_Y(y) = P(X \lt \sqrt y) = \frac{1+y}{5}$