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?

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)}$$