Example 2. Find the variance of a discrete random variable distributed according to the binomial law.
Solution. The random variable $X$ - "the number of occurrences of event $A$ in $n$ trials" can be represented as the sum $X=X_{1}+X_{2}+\ldots+X_{n}$, where $X_{k}$ is "the number of occurrences of event $A$ in the $k$-th trial $(k=1,2, \ldots, n)$". According to formula (2.5.9), we have

$$
D(X)=D\left(X_{1}\right)+D\left(X_{2}\right)+\ldots+D\left(X_{n}\right)
$$

Using formula (2.5.10), we will compute $D\left(X_{k}\right)$ for $k=1,2, \ldots, n$. The random variable $X_{k}$ takes only two values: $x_{1}=1$ with probability $p$ and $x_{2}=0$ with probability $q=1-p$. The random variable $\left(X_{k}-M\left(X_{k}\right)\right)^{2}$ also takes only two values: $(1-p)^{2}=q^{2}$ with probability $p$ and $(0-p)^{2}=p^{2}$ with probability $q$. Taking into account the equality $M\left(X_{k}\right)=p$ (see example 1), by formula (2.5.10), we get

$$
\begin{gathered}
D\left(X_{k}\right)=M\left(\left(X_{k}-M\left(X_{k}\right)\right)^{2}\right)=q^{2} p+p^{2} q=p q(p+q)=p q \\
D\left(X_{k}\right)=p q \quad(k=1,2, \ldots, n) .
\end{gathered}
$$

Therefore,

$$
D(X)=D\left(X_{1}\right)+D\left(X_{2}\right)+\ldots+D\left(X_{n}\right)=p q+p q+\ldots+p q
$$

$$
D(X)=n p q .
$$

Thus, the variance of a random variable distributed according to the binomial law with parameters $n$ and $p$ is equal to the product $n p q$.