# Get CDF from given PDF

I have the following PFD:

$f_x(x) = \begin{cases} bx^2, & 0 < x < 2, \\ 5b-bx & 2 \le x < 3, \\ 0 & \text{otherwise}. \end{cases}$

I already calculated $b = \frac{6}{31}$.

However, I am unsure about the CDF:

$F_x(x) = \begin{cases} 0 & x \le 0, \\ 0 + \int_{0}^{x} bt^2 dt = bx^3 * \frac{1}{3} & 0 < x < 2, \\ 0 + \int_{0}^{2} bt^2dt + \int_{2}^{x}(5b-bt)dt = \frac{8}{3}b - \frac{b}{2}(x^2-10x+16) & 2 \le x < 3, \\ 1 & x \ge 3. \end{cases}$

Can this be true? I am unsure about how to get $F_x(x)$ for the interval $2\le x < 3$... A comment would be nice!

EDIT

$F_x(x)$ is correcty. To verify correctness $F_x(x)$ can be derivated piecewise. This should give $f_x(x)$ then.

• Thank you. Another question: What would happen if I integrate $\int_{2}^{3}(5b-bt)dt$? I mean would something special happen? Like 1 as the result? Or shouldn't $\int_{2}^{3}(5b-bt)dt$ + $\int_{0}^{2}(bt^2)dt$ give 1? – 今天春天 Dec 16 '15 at 22:27
• To to summarize it: In order to check whether $F_x(x)$ is right I can: (1) Derivate $Fx_x(x)$ piecewise: this should give $f_x(x)$ (2) Calculate $\int_{2}^{3}(5b-bt)dt$ + $\int_{0}^{2}(bt^2)dt$ and check whether this gives 1. – 今天春天 Dec 16 '15 at 22:32
• @今天春天 That can be used a heuristic. It wouldn't guarantee correctness, but these are standard integrals so it would be clear if a mistake was made. $\int_{-\infty}^x\text{pdf}(t)dt = \text{cdf}(x)$ will always work. – Nicholas Pipitone Dec 16 '15 at 22:33
That's correct. You can verify by plugging in $x=3$ for the $2 \le x < 3$ case and noting that you successfully obtain $1$. However, in order to give a proper piece-wise function, you should substitute $b$ back into the equation and get it in terms of only $x$.