Example 4. Machines $a, b, c$ on a factory produce $20\%, 35\%, 45\%$ of all items respectively. In their production, the defect rate is $3\%, 2\%$, $4\%$. What is the probability that a randomly selected defective item was produced by machines $a, b, c$ respectively?
Solution. Let event $A$ consist in the fact that a randomly selected item is defective, and $H_{1}, H_{2}, H_{3}$ be events that the item is produced by machines $a, b, c$ respectively. Events $H_{1}, H_{2}, H_{3}$ form a complete system of events. The numbers 0.20; 0.35; 0.45 (20%, 35%, 45%) are the probabilities of these events, i.e.,

$$
P\left(H_{1}\right)=0.20 ; \quad P\left(H_{2}\right)=0.35 ; \quad P\left(H_{3}\right)=0.45
$$

Similarly, the numbers 0.03; 0.02; 0.04 (3%, 2%, 4%) are the conditional probabilities of event $A$ given the hypotheses $H_{1}, H_{2}, H_{3}$ respectively, i.e.,

$$
P\left(A / H_{1}\right)=0.03 ; \quad P\left(A / H_{2}\right)=0.02 ; \quad P\left(A / H_{3}\right)=0.04 .
$$

Applying the formula of total probability, we find

$$
P(A)=0.20 \cdot 0.03+0.35 \cdot 0.02+0.45 \cdot 0.04=0.031
$$

Using Bayes' formulas, we get:

$$
\begin{aligned}
& P\left(H_{1} / A\right)=\frac{P\left(H_{1}\right) P\left(A / H_{1}\right)}{P(A)}=\frac{0.20 \cdot 0.03}{0.031}=\frac{0.006}{0.031} \approx 0.1936 \\
& P\left(H_{2} / A\right)=\frac{P\left(H_{2}\right) P\left(A / H_{2}\right)}{P(A)}=\frac{0.35 \cdot 0.02}{0.031}=\frac{0.007}{0.031} \approx 0.2258 \\
& P\left(H_{3} / A\right)=\frac{P\left(H_{3}\right) P\left(A / H_{3}\right)}{P(A)}=\frac{0.45 \cdot 0.04}{0.031}=\frac{0.018}{0.031} \approx 0.5806
\end{aligned}
$$

Remark. The correctness of the calculations is confirmed by the fact that

$$
P\left(H_{1} / A\right)+P\left(H_{2} / A\right)+P\left(H_{3} / A\right)=0.1936+0.2258+0.5806=1
$$