# 2.6 A Sample 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

$f(x)={\begin{cases}k(x^{2}+x)&{\text{if }}0\leq x\leq 1,\\0&{\text{elsewhere}}\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. Find the probability that that a randomly selected student will finish the exam in less than half an hour
5. Find the mean time needed to complete a 1 hour exam
6. Find the variance and standard deviation of X

## Solution

### Part 1

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

{\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. Notice also that the PDF is nonnegative everywhere.

### Part 2

The CDF, F(x), is the 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

{\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

{\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

{\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}} The CDF is therefore given by

$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

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) it is equivalent to calculate Pr(x ≤ 0.5). This is precisely F(0.5):

$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 5

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

{\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 6

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

{\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

$\sigma (X)={\sqrt {\frac {1}{20}}}={\frac {1}{2{\sqrt {5}}}}$ 