# Calculating CDF from PDF

I tried to graph the PDF and calculate the CDF of this function from the PDF, can anyone tell me if my two answers are correct or not? Thanks!

I also graphed (c).

• (b) since $c = \frac{1}{12}$ the second line should be at $\frac 1 6$ but i guess you know that (c) is not completely correct, try to sketch the CDF as well – user303913 May 3 '16 at 6:12
• Hello could you tell me /why/ (c) is not completely correct? – NookLines May 3 '16 at 6:37
• Several points, for $x \le 0$ and $0 < x < 2$ it is correct. For $2 \le x \le 5$ it is not defined in your solution, it should be $\frac 1 6$, though. If you plug in $5$ you get $\frac{5 -5}{6} = 0$. However, a CDF is a monotone increasing function which yours isn't. Also, if you plug in $10$ you get $\frac{10 -5}{6} = \frac 5 6$ but you should get $1$. The sketch of the CDF you postet does not correspond to your CDF. Also consider the answer of @Math1000. – user303913 May 3 '16 at 6:46

For $f$ to be a probability density function, we must have $\int_{\mathbb R}f(t)\ \mathsf dt = 1$. It follows then that $$1 = \int_0^2 c\ \mathsf dt + \int_5^{10} 2c\ \mathsf dt = 12c,$$ and so $c=\frac1{12}$. To find the distribution function $F(t)=\mathbb P(X\leqslant t)$, we need only to integrate the density. For $0<t<2$ we have $$F(t) = \int_0^t f(x)\ \mathsf dx = \int_0^t \frac1{12}\ \mathsf dx = \frac1{12}t.$$ For $2<t<5$ the density is zero so $F(t) = F(2) = \frac16$. For $5<t<10$ we have $$F(t) = \int_0^t f(x)\ \mathsf dx = F(2) + \int_5^t f(x)\ \mathsf dx = \frac16 + \int_5^t\frac16\ \mathsf dx =\frac16(t-4).$$ More succinctly, $$F(t) = \frac16t\cdot\mathsf 1_{(0,2)}(t) + \frac16\cdot\mathsf1_{(2,5)}(t) + \frac16(t-4)\cdot\mathsf 1_{(5,10)}(t) + \mathsf 1_{[10,\infty)}(t).$$
• Shouldn't your next-to-last integral be $\int_5^t$? – Riccardo Orlando May 3 '16 at 6:46