How do I find the probability for this circuit to run current? The probability of the closing of the ith relay in the circuit below is given by $p_i$, $i$ = 1,2,3,4,5. If all the relays function independently, what is the probability that a current flows between $A$ and $B$ for the circuit below?  

So far, I have broken it down as: the 4 events needed for the current to flow from $A$ to $B$ is: $P(p_1 p_4)$, $P(p_2 p_5)$, $P(p_1p_3p_5)$, and $P(p_2p_3p_4)$. Therefore the probability we're looking for is:
[ $P(p_1 p_4) \bigcup P(p_2 p_5)$] $\bigcup$ [$P(p_1p_3p_5) \bigcup P(p_2p_3p_4)$]
=[$P(p_1 p_4) + P(p_2 p_5)- P(p_1p_4p_2p_5)$] $\bigcup$ $P(p_3)[P(p_1p_5)+P(p_2p_4)-P(p_1p_5p_2p_4)]$
=[$P(p_1 p_4) + P(p_2 p_5)- P(p_1p_4p_2p_5)$] $+$ $P(p_3)[P(p_1p_5)+P(p_2p_4)-P(p_1p_5p_2p_4)]$ - ( [$P(p_1 p_4) + P(p_2 p_5)- P(p_1p_4p_2p_5)$]*$P(p_3)[P(p_1p_5)+P(p_2p_4)-P(p_1p_5p_2p_4)]$ )
Is this correct?
 A: There is an easier way.


*

*Suppose that "3" is closed.
$$p^{(1)}=(p_1\cup p_2) \cap (p_4 \cup p_5) = (p_1+p_2-p_1p_2)(p_4+p_5-p_4p_5)$$

*Suppose that "3" is open.
$$p^{(2)}=(p_1 \cap p_4) \cup (p_2 \cap p_5) = p_1p_4+p_2p_5-p_1p_4p_2p_5$$
Finally, you get
$$p=p_3\cdot p^{(1)} + (1-p_3)p^{(2)}$$
A: There is one more way to find this by splitting on conditional probability two times. This one is a long method but does the job as well-
Let $R_{i}$ be the event that relay $i$ is closed, $i = 1,2,3,4,5$. Let $C$ be the event that the current flows between A and B.
First condition on relay 3 -
$\therefore P(C) = P(C|R_{3})P(R_{3}) + P(C|R_{3}^c)P(R_{3}^c)$
To find $P(C|R_{3})$, i.e., given $R_{3}$ is closed, the probability of flowing current, we can condition on another relay, lets say 4.
Second condition on relay 4 -
Let $P(C|R_{3}) = P(CR)$
$\therefore P(C|R_{3}) = P(CR|R_{4})P(R_{4}) + P(CR|R_{4}^c)P(R_{4}^c)$
Now, $P(CR|R_{4})$ is probability that current flows between A and B given both relay 3 and 4 are closed. Since relay 4 is closed, relay 5's closing or opening does not matter because the current will flow from middle section to B. So if any one of relay 1 or 2 is closed, the current will flow. So,
$P(CR|R_{4}) =$ Probability that either of relay 1 or 2 is closed $= P(R_{1}\cup R_{2})$
$= p_{1} + p_{2} - p_{1}p_{2}$
To find $P(CR|R_{4}^c)$, we see that given relay 4 is open, the only way for current to flow to B will be if relay 5 is closed. So once relay 5 is closed, the current will flow if any of relay 1 or 2 is closed. So,
$P(CR|R_{4}^c) = P(R_{1}\cup R_{2})*P(R_{5}) = (p_{1} + p_{2} - p_{1}p_{2})*p_{5}$
Using the above values, we have
$P(C|R_{3}) =(p_{1} + p_{2} - p_{1}p_{2})p_{4} + [(p_{1} + p_{2} - p_{1}p_{2})*p_{5}](1-p_{4})$
$= (p_{1} + p_{2} - p_{1}p_{2})(p_{4} + p_{5} - p_{4}p_{5})$
which is essentially the same as Haris Gušić's answer.
Also, when relay 3 is open, either relay 1 and 4 should close together or relay 2 and 5 should close together. So
$P(C|R_{3}^c) =P((R_{1}\cap R_{4}) \cup (R_{2}\cap R_{5}))$
$= p_{1}p_{4} + p_{2}p_{5} - p_{1}p_{4}p_{2}p_{5}$
Putting these values in the first equation gives the final probability $P(C)$.
