# 2.6 A Sample Problem

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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 \le x \le 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{align} 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 56\right) \end{align}

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{align} F(x) &= \int_{-\infty}^{x} f(t) dt \\ &= \int_{-\infty}^{x} 0 dt \\ &=0 \end{align}

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

\begin{align} F(x) &= \int_{-\infty}^{x} f(t) dt \\ &= \int_{-\infty}^{0} f(t) dt + \int_{0}^{x} f(t) dt \\ &= 0 + \frac 65 \Big(\frac{x^3}{3}+\frac{x^2}{2}\Big) \\ &= \frac 65 \Big(\frac{x^3}{3}+\frac{x^2}{2}\Big) \\ \end{align}

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

\begin{align} 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 65 \Big(\frac{x^3}{3}+\frac{x^2}{2}\Big)\Big|_0^1 + 0 \\ &= \frac{6}{5}\cdot\frac{5}{6}\\ &= 1 \end{align}

The CDF is therefore given by

$F(x) = \begin{cases} 0 & \text{if } x < 0,\\ \frac 65 \Big(\frac{x^3}{3}+\frac{x^2}{2}\Big) & \text{if } 0 \le x \le 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 65 \Big(\frac{0.5^3}{3}+\frac{0.5^2}{2}\Big) = \frac 65 \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{align} \mathbb{E}(X) &= \int_{-\infty}^{\infty}xf(x) dx\\ &= \frac 65 \int_0^1 x(x^2+x) dx\\ &= \frac 65 \int_0^1 x^3 + x^2 dx\\ &= \frac 65 \left(\frac {x^4}{4} + \frac {x^3}{3}\right)\Big|_0^1\\ &= \frac 65 \left(\frac 14 + \frac 13\right)\\ &= \frac {7}{10} \end{align}

### Part 6

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

\begin{align} \text{Var}(X) &= \mathbb{E}(X^2) - [\mathbb{E}(X)]^2\\ &= \int_{-\infty}^{\infty} x^2f(x) dx - \left(\frac {7}{10}\right)^2\\ &= \frac 65 \int_0^1 x^2(x^2+x) dx - \frac {49}{100}\\ &= \frac 65 \int_0^1 x^4 + x^3 dx - \frac {49}{100}\\ &= \frac 65 \left(\frac {x^5}{5} + \frac {x^4}{4}\right)\Big|_0^1 - \frac {49}{100}\\ &= \frac 65 \left(\frac 15 + \frac 14\right) - \frac {49}{100}\\ &= \frac {54}{100} - \frac {49}{100}\\ &= \frac {1}{20} \end{align}

Finally, we see that the standard deviation of X is

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