7. Consider the electrical circuit shown in the figure. Each of the relays $A, B, C, D$ and $E$, operating independently, is either in the open (i.e., non-working) state (and thus does not allow the electrical signal to pass), or in the closed (working) state (and then the signal is passed) with probabilities $p$ and $q$ respectively. What is the probability that the signal, input at the "input", will be received at the "output"? What is the conditional probability that relay $E$ was open if the signal was received at the "output"?

![](https://cdn.mathpix.com/cropped/2024_05_22_fdc8637a08cd99f091cag-059.jpg?height=220&width=418&top_left_y=1634&top_left_x=816)
Solution. Let events $A, B, C, D$ and $E$ denote the open (non-working) state of the corresponding relay, and let event $S$ consist of the signal, input at the "input," being received at the "output." Using the inclusion-exclusion principle and the independence of the relays' operation, we get

$$
\begin{gathered}
\mathrm{P}(S \mid E)=\mathrm{P}(\bar{A} \bar{B} \cup \bar{C} \bar{D})=\mathrm{P}(\bar{A} \bar{B})+\mathrm{P}(\bar{C} \bar{D})-\mathrm{P}(\bar{A} \bar{B} \bar{C} \bar{D})= \\
=\mathrm{P}(\bar{A}) \mathrm{P}(\bar{B})+\mathrm{P}(\bar{C}) \mathrm{P}(\bar{D})-\mathrm{P}(\bar{A}) \mathrm{P}(\bar{B}) \mathrm{P}(\bar{C}) \mathrm{P}(\bar{D})=2 q^{2}-q^{4} \\
\mathrm{P}(S \mid \bar{E})=1-\mathrm{P}(\bar{S} \mid \bar{E})=1-\mathrm{P}(A C \cup B D)= \\
=1-\mathrm{P}(A C)-\mathrm{P}(B D)+\mathrm{P}(A B C D)= \\
=1-\mathrm{P}(A) \mathrm{P}(C)-\mathrm{P}(B) \mathrm{P}(D)+\mathrm{P}(A) \mathrm{P}(B) \mathrm{P}(C) \mathrm{P}(D)=1-2 p^{2}+p^{4}
\end{gathered}
$$

By the law of total probability

$$
\begin{aligned}
& \mathrm{P}(S)=\mathrm{P}(S \mid E) \mathrm{P}(E)+\mathrm{P}(S \mid \bar{E}) \mathrm{P}(\bar{E})= \\
& \quad=\left(2 q^{2}-q^{4}\right) p+\left(1-2 p^{2}+p^{4}\right) q=q\left(1-p^{2}\right)^{2}+p q^{2}\left(2-q^{2}\right)
\end{aligned}
$$

By Bayes' theorem

$$
\begin{aligned}
\mathrm{P}(E \mid S) & =\frac{\mathrm{P}(S \mid E) \mathrm{P}(E)}{\mathrm{P}(S)}=\frac{\left(2 q^{2}-q^{4}\right) p}{q\left(1-p^{2}\right)^{2}+p q^{2}\left(2-q^{2}\right)} \\
\mathrm{P}(\bar{E} \mid S) & =\frac{\mathrm{P}(S \mid \bar{E}) \mathrm{P}(\bar{E})}{\mathrm{P}(S)}=\frac{\left(1-p^{2}\right)^{2} q}{q\left(1-p^{2}\right)^{2}+p q^{2}\left(2-q^{2}\right)}= \\
& =\frac{\left(1-p^{2}\right)^{2}}{\left(1-p^{2}\right)^{2}+p q\left(2-q^{2}\right)}
\end{aligned}
$$