Example 8. The probability density function of a random variable $X$ is given by

$$
p(x)=a x^{2} e^{-k x} \quad(k>0, \quad 0 \leq x<+\infty)
$$

Find the value of the coefficient $a$. Find the distribution function $F(x)$ of the variable $X$.
Solution. The value of the coefficient $a$ is determined from the equalities:

$$
\begin{aligned}
& \int_{0}^{+\infty} a x^{2} e^{-k x} d x=1 \\
& a=1 / \int_{0}^{+\infty} x^{2} e^{-k x} d x
\end{aligned}
$$

By integrating by parts twice, we find:

$$
\begin{aligned}
& \int_{0}^{+\infty} x^{2} e^{-k x} d x=-\left.\frac{1}{k} x^{2} e^{-k x}\right|_{0} ^{\infty}+\frac{2}{k} \int_{0}^{\infty} x e^{-k x} d x= \\
& =0-\left.\frac{2}{k^{2}} x e^{-k x}\right|_{0} ^{\infty}+\frac{2}{k^{2}} \int_{0}^{+\infty} e^{-k x} d x=-\left.\frac{2}{k^{3}} e^{-k x}\right|_{0} ^{+\infty}=\frac{2}{k^{3}}
\end{aligned}
$$

Therefore, $a=k^{3} / 2$ and the probability density function is given by $p(x)=k^{3} x^{2} e^{-k x} / 2$.

The distribution function $F(x)$ is given by

$$
F(x)=\int_{0}^{x} \frac{k^{3}}{2} t^{2} e^{-k t} d t=1-\frac{k^{2} x^{2}+2 k x+2}{2} e^{-k x}
$$