Premium problem28. Total Probability Over a Complement

Medium Locked

The most common form splits on an event and its complement, which together always form a partition:

P(A)=P(A∣B)P(B)+P(A∣Bc)(1−P(B))P(A) = P(A \mid B)P(B) + P(A \mid B^c)\bigl(1 - P(B)\bigr)

Return P(A)P(A).

Input

p_a_given_b = 0.95
p_a_given_not_b = 0.05
p_b = 0.01

Output

0.059000000000000004

Premium problem

This one's part of Premium. Unlock the full Probability track plus every other premium problem on the site.

Implement solve(...)