[Math] Finding the probability of exactly one event in a series of independent events, why used (-1)

probability

Learning programming and trying to understand this example.

Given multiple independent events, each with a probability of occurring, what is the probability of just one event occurring?

If we have 2 cases I can understand it this way:

P(exactly one event occurs)  =  P(a and not b) + P(not a and b)

Calculated as:

(Pa)*(1-Pb) + (Pb)*(1-Pa)

Can it be explained why we use (1-probability) here? What does subtracting the prob. from 1 "do"?

Thank you.

Generalized as:

n
∑ pi (1 − p1 )…(1 − pi−1 )(1 − pi+1 )…(1 − pn )
i=1

Coded in R as:

exactlyone <- function(p) {
notp <- 1 - p
tot <- 0.0
for (i in 1:length(p))
tot <- tot + p[i] * prod(notp[-i])
return(tot)
}

Best Answer

In general, if the probability of an event $A$ occurring is $$P(A)$$

then the probability of the event not occurring is $$1-P(A)$$


This is because either $A$ occurs, or it doesn't.

Another way of phrasing this is if $A'$ is "$A$ doesn't happen", then $$P(A) + P(A') = 1$$