# 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

## 1 Answer

You missed out the part of the random variable between 0 and 1. The probability the random variable takes a value in that range is (by your calculations) 0.5; adding this to the integral you evaluated for the part between 1 and 2 gives the book's correct answer.

• Oh. Thus for each c.d.f I have to add the previous one? – larry mintz Mar 6 '18 at 15:01
• @larrymintz Yes. – Parcly Taxel Mar 6 '18 at 15:04
• Sof for first 0.5x^2. =1. Plugging in upper limit x=1 CD=1/2+c=1 c=1/2 Next part 2x-0.5x^2-3/2+c=1 Plugging in x=2 cdf=2-3/2+c=c+1/2=1 c=1/2 – larry mintz Mar 6 '18 at 17:20
• @larrymintz Can you accept my answer? What are you talking about? All your working is correct; there are no inconsistencies with the book now. The question is closed. – Parcly Taxel Mar 6 '18 at 17:20