28. Total Probability Over a Complement

Medium

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

P(A)=P(AB)P(B)+P(ABc)(1P(B))P(A) = P(A \mid B)P(B) + P(A \mid B^c)\bigl(1 - P(B)\bigr)

Return P(A)P(A).

solve(0.95, 0.05, 0.01)  ->  0.059
# A test with 95% sensitivity and a 5% false-positive rate, disease prevalence 1%.
# This is the denominator Bayes' theorem needs.

Sign in to write and run your own code.

Implement solve(...)