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])

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

  • $\begingroup$ Great answer, thank you. $\endgroup$ – Benzle Oct 11 '14 at 2:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.