Example 12. There are three urns with balls. The first contains 5 blue and 3 red balls, the second - 4 blue and 4 red, and the third - 8 blue. One of the urns is randomly chosen, and a ball is randomly drawn from it. What is the probability that it will be red (event $A$).
Solution. The ball can be drawn from the first urn, or the second, or the third. Let's denote the selection of the first, second, and third urns by $H_{1}, H_{2}, H_{3}$, respectively.

Since there are equal chances of selecting any of the urns, then

$$
P\left(H_{1}\right)=P\left(H_{2}\right)=P\left(H_{3}\right)=\frac{1}{3}
$$

From the problem statement, it follows that

$$
P\left(A / H_{1}\right)=\frac{3}{8}, \quad P\left(A / H_{2}\right)=\frac{4}{8}=\frac{1}{2}, \quad P\left(A / H_{3}\right)=\frac{0}{8}=0
$$

According to formula (1.9.1), we find the desired probability

$$
P(A)=\frac{1}{3} \cdot \frac{3}{8}+\frac{1}{3} \cdot \frac{1}{2}+\frac{1}{3} \cdot 0=\frac{7}{24}=0.292
$$

## Problems

1: In five boxes lie balls of the same size and weight. In two boxes (composition $H_{1}$) - 6 blue and 4 red balls each. In two other boxes (composition $H_{2}$) - 8 blue and 2 red balls each. In one box (composition $H_{3}$) - 2 blue and 8 red balls. A box is chosen at random and a ball is drawn from it. What is the probability that the drawn ball is blue?

2. At a factory producing bolts, the first machine produces $30 \%$, the second $25 \%$, and the third $45 \%$ of all products. The defect rate in their products is $2 \%$, $1 \%$, and $3 \%$, respectively. Find the probability that a randomly selected bolt is standard.
3. A batch of electric bulbs is $25 \%$ made by the first factory, $35 \%$ by the second, and $40 \%$ by the third. The probabilities of producing defective bulbs are $q_{1}=0.03$, $q_{2}=0.02$, $q_{3}=0.01$, respectively. What is the probability that a randomly selected bulb will be defective?
4. In a group of 21 students, there are 5 excellent students, 10 good students, and 6 poor students. On the upcoming exam, excellent students can only get excellent grades. Good students can get good or excellent grades with equal probability. Poor students can get good, satisfactory, or unsatisfactory grades with equal probability. Three students are randomly invited to take the exam. Find the probability that they will receive grades: excellent, good, satisfactory (in any order).
5. Parts arrive for assembly from three machines. It is known that the first machine produces $0.2 \%$ defective parts, the second $0.3 \%$, and the third $0.4 \%$. Find the probability that a defective part will arrive for assembly if 500 parts come from the first machine, 1000 from the second, and 1500 from the third.
6. A worker services 3 machines, on which similar parts are processed. The probability of a defect for the first machine is 0.01, for the second 0.02, and for the third 0.03. Processed parts are placed in one box. The productivity of the first machine is twice that of the second, and the third is three times less than the second. What is the probability that a randomly selected part will be defective?
7. At a factory, products of a certain type are manufactured on three production lines. The first line produces $45 \%$ of the products, the second $35 \%$, and the third the remaining part. Each line is characterized by the following percentages of good products: $98 \%$, $96 \%$, $94 \%$. Determine the probability that a randomly selected product, produced by the enterprise, will be defective.

## Answers

1. $0.6 \cdot 2 \cdot 0.978 \cdot 3 \cdot 0.0185 \cdot 4 \approx 0.11 \cdot 5 \cdot \approx 0.003 \cdot 6 \cdot 0.015 \cdot 7 \cdot 0.035$.

## § 1.10. Bayes' Formulas

Let $H_{1}, H_{2}, \ldots, H_{n}$ be pairwise mutually exclusive events with probabilities $P\left(H_{i}\right) \neq 0(i=1,2, \ldots, n)$, and let event $A \subset H_{1}+H_{2}+\ldots+H_{n}$, for which the conditional probabilities $P\left(A / H_{i}\right)(i=1,2, \ldots, n)$ are known. An experiment is performed, and as a result, event $A$ occurs. The conditional probabilities of events $H_{1}, H_{2}, \ldots, H_{n}$ relative to event $A$ are determined by the formulas

$$
P\left(H_{k} / A\right)=\frac{P\left(H_{k}\right) P\left(A / H_{k}\right)}{\sum_{i=1}^{n} P\left(H_{i}\right) P\left(A / H_{i}\right)} \quad(k=1,2, \ldots, n)
$$

or

$$
P\left(H_{k} / A\right)=\frac{P\left(H_{k}\right) P\left(A / H_{k}\right)}{P(A)}
$$

where

$$
P(A)=\sum_{i=1}^{n} P\left(H_{i}\right) P\left(A / H_{i}\right)-\text { the formula of total probability. }
$$

Formulas (1.10.1) are called Bayes' formulas.

Remark. The probabilities $P\left(H_{k}\right)(k=1,2, \ldots, n)$ of events $H_{1}, H_{2}, \ldots, H_{n}$ before the experiment are called prior probabilities (from the Latin a priori, which means "first," i.e., in this case, before the experiment was conducted). The probabilities $P\left(H_{k} / A\right)(k=1,2, \ldots, n)$ of the same events are called posterior probabilities (from the Latin a posteriori, which means "after," i.e., in this case, after the experiment).