Example. A die is thrown. Let $m$ be the number of points that come up. Then $m$ shots are fired at a target with the probability of hitting the target in a single shot being $p$.

1. Find the probability that the target will be hit.
2. Given that the target is hit, find the probability that $m=6$.
Solution. Problem 1.

The first random experiment is the rolling of a die. Let us introduce random events $H_{m}=$ \{the number $m$ of points appears $\}, m=1, \ldots, 6$. These events do not intersect and uniquely describe all possible outcomes of the first experiment. The second random experiment is $m$ Bernoulli trials with the probability of success $p$ (success - hitting the target). Consider the random event $A=\{$ the target is hit $\}$, associated with the second experiment. By the formula of total probability

$$
\mathrm{P}(A)=\sum_{m=1}^{6} \mathrm{P}\left(H_{m}\right) \mathrm{P}\left(A \mid H_{m}\right)
$$

Obviously, $\mathrm{P}\left(H_{m}\right)=1 / 6$ for all $m=1, \ldots, 6$. The probability $\mathrm{P}\left(A \mid H_{m}\right)$ is the probability that in $m$ Bernoulli trials with the probability of success $p$ the number of successes will be at least one, therefore, by passing to the opposite event, we obtain that

$$
\mathrm{P}\left(A \mid H_{m}\right)=1-\mathrm{P}\left(\bar{A} \mid H_{m}\right)=1-q^{m}
$$

where $q=1-p$. Thus,

$$
\mathrm{P}(A)=\sum_{m=1}^{6} \frac{1}{6}\left(1-(1-p)^{m}\right)
$$