# Science:MATH105 Probability/Lesson 2 CRV/2.12 Example

## Problem

The length of time X, needed by students in a particular course to complete a 1 hour exam is a random variable with PDF given by

${\displaystyle f(x)={\begin{cases}k(x^{2}+x)&{\text{if }}0\leq x\leq 1,\\0&{\text{else}}\end{cases}}}$

For the random variable X,

1. Find the value k that makes f(x) a probability density function (PDF)
2. Find the cumulative distribution function (CDF)
3. Graph the PDF and the CDF
4. Use the CDF to find
1. Pr(X ≤ 0)
2. Pr(X ≤ 1)
3. Pr(X ≤ 2)
5. find the probability that that a randomly selected student will finish the exam in less than half an hour
6. Find the mean time needed to complete a 1 hour exam
7. Find the variance and standard deviation of X

## Solution

### Part 1

The given PDF must integrate to 1. Thus, we calculate

{\displaystyle {\begin{aligned}1&=\int _{-\infty }^{\infty }f(x)dx\\&=k\int _{0}^{1}(x^{2}+x)dx\\&=k{\Big (}{\frac {x^{3}}{3}}+{\frac {x^{2}}{2}}{\Big )}{\Big |}_{0}^{1}\\&=k\left({\frac {5}{6}}\right)\end{aligned}}}

Therefore, k = 6/5.

### Part 2

The CDF, F(x), is area function of the PDF, obtained by integrating the PDF from negative infinity to an arbitrary value x.

If x is in the interval (-∞, 0), then

{\displaystyle {\begin{aligned}F(x)&=\int _{-\infty }^{x}f(t)dt\\&=\int _{-\infty }^{x}0dt\\&=0\end{aligned}}}

If x is in the interval [0, 1], then

{\displaystyle {\begin{aligned}F(x)&=\int _{-\infty }^{x}f(t)dt\\&=\int _{-\infty }^{0}f(t)dt+\int _{0}^{x}f(t)dt\\&=0+{\frac {6}{5}}{\Big (}{\frac {x^{3}}{3}}+{\frac {x^{2}}{2}}{\Big )}\\&={\frac {6}{5}}{\Big (}{\frac {x^{3}}{3}}+{\frac {x^{2}}{2}}{\Big )}\\\end{aligned}}}

If x is in the interval (1, ∞) then

{\displaystyle {\begin{aligned}F(x)&=\int _{-\infty }^{x}f(t)dt\\&=\int _{-\infty }^{0}f(t)dt+\int _{0}^{1}f(t)dt+\int _{1}^{x}f(t)dt\\&=0+{\frac {6}{5}}{\Big (}{\frac {x^{3}}{3}}+{\frac {x^{2}}{2}}{\Big )}{\Big |}_{0}^{1}+0\\&={\frac {6}{5}}\cdot {\frac {5}{6}}\\&=1\end{aligned}}}

Note that the PDF f is equal to zero for x > 1. The CDF is therefore given by

${\displaystyle F(x)={\begin{cases}0&{\text{if }}x<0,\\{\frac {6}{5}}{\Big (}{\frac {x^{3}}{3}}+{\frac {x^{2}}{2}}{\Big )}&{\text{if }}0\leq x\leq 1,\\1&{\text{if }}x>1.\end{cases}}}$

### Part 3

The PDF and CDF of X are shown below.

### Part 4

These probabilities can be calculated using the CDF:

{\displaystyle {\begin{aligned}{\text{Pr}}(X\leq 0)&=F(0)={\frac {6}{5}}{\Big (}{\frac {0^{3}}{3}}+{\frac {0^{2}}{2}}{\Big )}=0\\{\text{Pr}}(X\leq 1)&=F(1)={\frac {6}{5}}{\Big (}{\frac {1^{3}}{3}}+{\frac {1^{2}}{2}}{\Big )}={\frac {6}{5}}{\frac {5}{6}}=1\\{\text{Pr}}(X\leq 2)&=1\\\end{aligned}}}

Note that we could have evaluated these probabilities by using the PDF only, integrating the PDF over the desired event.

### Part 5

The probability that a student will complete the exam in less than half an hour is Pr(X < 0.5). Note that since Pr(X = 0.5) = 0, since X is a continuous random variable, we an equivalently calculate Pr(x ≤ 0.5). This is now precisely F(0.5):

${\displaystyle F(0.5)={\frac {6}{5}}{\Big (}{\frac {0.5^{3}}{3}}+{\frac {0.5^{2}}{2}}{\Big )}={\frac {6}{5}}{\Big (}{\frac {1}{24}}+{\frac {1}{8}}{\Big )}={\frac {6}{5}}\cdot {\frac {1}{6}}={\frac {1}{5}}}$

### Part 6

The mean time to complete a 1 hour exam is the expected value of the random variable X. Consequently, we calculate

{\displaystyle {\begin{aligned}\mathbb {E} (X)&=\int _{-\infty }^{\infty }xf(x)dx\\&={\frac {6}{5}}\int _{0}^{1}x(x^{2}+x)dx\\&={\frac {6}{5}}\int _{0}^{1}x^{3}+x^{2}dx\\&={\frac {6}{5}}\left({\frac {x^{4}}{4}}+{\frac {x^{3}}{3}}\right){\Big |}_{0}^{1}\\&={\frac {6}{5}}\left({\frac {1}{4}}+{\frac {1}{3}}\right)\\&={\frac {7}{10}}\end{aligned}}}

### Part 7

To find the variance of X, we use our alternate formula to calculate

{\displaystyle {\begin{aligned}{\text{Var}}(X)&=\mathbb {E} (X^{2})-[\mathbb {E} (X)]^{2}\\&=\int _{-\infty }^{\infty }x^{2}f(x)dx-\left({\frac {7}{10}}\right)^{2}\\&={\frac {6}{5}}\int _{0}^{1}x^{2}(x^{2}+x)dx-{\frac {49}{100}}\\&={\frac {6}{5}}\int _{0}^{1}x^{4}+x^{3}dx-{\frac {49}{100}}\\&={\frac {6}{5}}\left({\frac {x^{5}}{5}}+{\frac {x^{4}}{4}}\right){\Big |}_{0}^{1}-{\frac {49}{100}}\\&={\frac {6}{5}}\left({\frac {1}{5}}+{\frac {1}{4}}\right)-{\frac {49}{100}}\\&={\frac {54}{100}}-{\frac {49}{100}}\\&={\frac {1}{20}}\end{aligned}}}

Finally, we see that the standard deviation of X is

${\displaystyle {\text{StdDev}}(X)={\sqrt {\frac {1}{20}}}={\frac {1}{2{\sqrt {5}}}}}$