Suppose the time X (in hours) that an ATM outside a bank is in use during a day is a random variable with density function
f(x)= \begin{cases} \frac{x}{9}, \qquad \qquad \quad 0 \leq x \leq 3, \\ -\frac{1}{9}(x-6), \quad ~ 3 \lt x \leq 6, \end{cases}Find the mean time that the machine operates during a day.
In this case, we have to split the range of integration in formula (6.8),
{E(X)=\int_{-\infty}^{\infty}x f(x){\mathrm{d}}x} \qquad \qquad (6.8)because the expression for ƒ(x) given is different in the intervals [0, 3] and (3, 6]. Thus,
we obtain
\mu=E(X)=\int_{-\infty}^{\infty}x f(x)=\int_{0}^{3}{\frac{x}{9}}\;x\mathrm{d}x+\int_{3}^{6}x\left\{-{\frac{1}{9}}(x-6)\right\}\mathrm{d}x={\frac{1}{9}}\left[{\frac{x^{3}}{3}}\right]_{0}^{3}+\left(-{\frac{1}{9}}\right)\left\{\left[{\frac{x^{3}}{3}}\right]_{3}^{6}-6\left[{\frac{x^{2}}{2}}\right]_{3}^{6}\right\}=\frac{1}{9}\cdot\frac{3^{3}-0}{3}-\frac{1}{9}\left(\frac{6^{3}-3^{3}}{3}-6\frac{6^{2}-3^{2}}{2}\right)=3,and so the machine operates on average 3 hours per day.