The amount of time it takes a person to be served at a given restaurant is a random variable with the probability density

$$ \begin{aligned} f(x) = \frac{1}{4}e^{-\frac{x}{4}}, x>0 \end{aligned} $$

Find the mean and the variance of this random variable.

Solution

The mean of $X$ is

$$ \begin{aligned} E(X) &= \int_0^\infty x\frac{1}{4} e^{-x/4}\; dx\\ &= \frac{1}{4}\int_0^\infty x^{2-1}e^{-x/4}\; dx\\ &= \frac{1}{4} (4^2)\Gamma(2)\\ & \quad (\text{Using }\int_0^\infty x^{n-1}e^{- x/\theta}\; dx = \theta^n\Gamma(n))\\ &= 4 \end{aligned} $$

The variance of random variable $X$ is given by

$$ \begin{aligned} V(X) = E(X^2) - [E(X)]^2. \end{aligned} $$

Let us find the expected value of $X^2$.

$$ \begin{aligned} E(X^2) &= \int_0^\infty x^2\frac{1}{4}e^{-x/4}\; dx\\ &= \frac{1}{4}\int_0^\infty x^{3-1}e^{-x/4}\; dx\\ &= \frac{1}{4} (4^3)\Gamma(3)\\ & \quad (\text{Using }\int_0^\infty x^{n-1}e^{- x/\theta}\; dx = \theta^n\Gamma(n))\\ &= 2\times 4^2=32 \end{aligned} $$

Thus, variance of $X$ is

$$ \begin{aligned} V(X) &= E(X^2) -[E(X)]^2\\ &= 32-(4)^2\\ &= 32-16 = 16. \end{aligned} $$

Further Reading