Probability

Find the mean and variance for the probability density function $f \left(x\right) = \begin{cases} x e^{- x}, & x > 0 \\ & \\ 0, & \text{ otherwise} \end{cases}$


By definition, mean $= E \left(X\right) = \int \limits_{- \infty}^{\infty} x \; f \left(x\right) \; dx$

$\left[\text{Note: } \int \limits_{0}^{\infty} x^{n} e^{- \alpha x} \; dx = \dfrac{n!}{\alpha^{n + 1}} \;\;\; \text{ n is a positive integer}\right]$

$\begin{aligned} \text{Here, } E \left(X\right) & = \int \limits_{0}^{\infty} x \times \left(x \; e^{- x}\right) \; dx\\\\ & = \int \limits_{0}^{\infty} x^2 e^{- x} \; dx \\\\ & = \dfrac{2!}{1^{2 + 1}} \\\\ & = 2 \end{aligned}$

By definition, mean $= E \left(X^2\right) = \int \limits_{- \infty}^{\infty} x^2 \; f \left(x\right) \; dx$

$\begin{aligned} \text{Here, } E \left(X^2\right) & = \int \limits_{0}^{\infty} x^2 \times \left(x \; e^{- x}\right) \; dx \\\\ & = \int \limits_{0}^{\infty} x^3 \; e^{- x} \; dx \\\\ & = \dfrac{3!}{1^{3 + 1}} \\\\ & = 6 \end{aligned}$

$\begin{aligned} \text{Now, variance } & = E \left(X^2\right) - \left[E \left(X\right)\right]^2 \\\\ & = 6 - \left(2\right)^2 = 2 \end{aligned}$