# Having trouble with a pdf to cdf

I have a pdf where it is kx for 0 < x < 1 and k for 1 < x < 2

I am having trouble doing the cdf and not sure when I am going wrong. I calculated k as equal to 1. Then I got x^2/2 for 0 < x < 1 and ((x^2) + 2x - 2 )/ 2 for 1 < x < 2

Anyone see where I have gone wrong?

## 2 Answers

Guide:

Find $k$ on base of: $$\int_0^1kxdx+\int_1^2kdx=1$$

(Notice that $k=1$ cannot be correct since $\int_0^1 xdx+\int_1^2 dx>1$)

Then find $F$ on base of $$F(x)=\int^x_\infty f(y)dy$$ where $f$ denotes the PDF. Be aware of the fact that $f$ takes value $0$ outside the interval $[0,2]$.

• So I get 2/3 for k, but when I check the formula $\frac{(x^2)+2x-2}{3}$ it doesn't add up if I substitute x with 2. I feel I am missing something so obvious. – kitkat1224 May 2 '18 at 5:00
• $k=\frac23$ is correct. If $x<0$ then $F(x)=0$. If $0\leq x\leq1$ then $F(x)=\frac23\int_0^xydy=\frac13x^2$ so that $F(1)=\frac13$. If $1<x\leq2$ then $F(x)=F(1)+\frac23\int_1^xdy=\frac13+\frac23(x-1)=\frac23x-\frac13$ so that $F(2)=1$. If $x>2$ then $F(x)=1$. – drhab May 2 '18 at 6:50

Hint: The integrals are $\int_0^1 kx \mathrm{d}x = \tfrac{1}{2}k$ and $\int_1^2 k \mathrm{d}x = k.$ Therefore $\int_0^2 f(k,x) \mathrm{d}x = \tfrac{3}{2}k.$ So what is the value of $k?$ Can you continue?