# Error in calculating cdf of a random variable

This problem comes out of Mathematical Statistics by Freud, 6th edition.

Either the book has many errors or I can’t figure out where I am wrong.

Find the cdf of $X$ whose pdf is $$f(x)=\begin{cases}x&0<x<1\\ 2-x&1\le x<2\\0&\text{else}\end{cases}$$

Integrating $x$ from 0 to 1: $0.5x^2$. That is correct with the book.

Integrating from 1 to 2: $[2x-x^2/2]_1^2=2x-\frac{x^2}2-\frac32$. The book gives $2x-\frac{x^2}2-1$ for $1\le x<2$.

• does $2x-x^2/2|x=2$ to $x=x$ mean $2y-\frac{y^2}2\big|_{y=2}^x$? if yes then this is an issue. Also your distribution function better satisfy $F(2) = 1$, right? Yours gives $4 - 2 - 3/2 ≠ 1$. – Calvin Khor Mar 6 '18 at 13:48
• One way of looking at it: the CDF is an antiderivative of the PDF, so in $[1,2]$ the CDF must be of the form $2x-x^2/2+C$. But the $C$ must be chosen appropriately, in this case so that $F$ is continuous at $1$. Simply computing $\int_1^x f(y) dy$ is wrong because the CDF is $\int_{-\infty}^x f(y) dy$, which also includes a positive contribution from $\int_0^1 f(y) dy$. – Ian Mar 6 '18 at 14:01
• 2y-0.5y^2| y=1 to y=Y. my mistake.Ans: 2y-0.5y^2-3/2 – larry mintz Mar 6 '18 at 15:05
• I was thinking that too – larry mintz Mar 6 '18 at 15:07