Law of Total Probability Calculator

Compute unconditional probabilities using partition of sample space and conditional probabilities

About the Law of Total Probability Calculator

The Law of Total Probability Calculator is a specialized tool designed to determine the absolute probability of an event based on several distinct, mutually exclusive scenarios. In complex systems, we often do not know the direct probability of an outcome, but we do know how that outcome behaves under specific conditions. This calculator allows users to input the probability of various 'paths' or 'states' and the conditional likelihood of an event occurring within each, resulting in the aggregate probability across the entire sample space.

This tool is frequently utilized by data scientists, actuaries, and students of statistics to solve multi-stage probability problems. For example, a quality control engineer might use it to find the total defect rate of a factory that uses three different machines with varying error rates. By partitioning the production into these three source machines, the user can calculate a single, weighted probability that represents the entire facility's output. It effectively acts as a weighted average of conditional probabilities, ensuring that every possible segment of the population is accounted for.

Formula

P(B) = Σ [P(B | Ai) * P(Ai)]

The total probability of event B, denoted as P(B), is the sum of the conditional probabilities of B given each partition event Ai, multiplied by the probability of that specific partition event occurring. The summation (Σ) covers all i segments that make up the entire sample space.

In this formula, P(Ai) represents the prior probability of the i-th scenario, and P(B | Ai) represents the likelihood of event B happening specifically within that scenario. For the calculation to be valid, all P(Ai) values must sum to exactly 1.0, representing a complete partition of the sample space.

Worked examples

Example 1: A factory has two machines. Machine A produces 60% of parts with a 2% defect rate. Machine B produces 40% of parts with a 3.75% defect rate.

P(A) = 0.60, P(Defect|A) = 0.02
P(B) = 0.40, P(Defect|B) = 0.0375
Calculation: (0.60 * 0.02) + (0.40 * 0.0375)
= 0.012 + 0.015 = 0.027

Result: 0.027 or 2.7%. The total probability of a defect across all production is 2.7%.

Example 2: In a city, 70% of residents live in the North (where 60% support a policy) and 30% live in the South (where 40% support the policy).

P(North) = 0.70, P(Support|North) = 0.60
P(South) = 0.30, P(Support|South) = 0.40
Calculation: (0.70 * 0.60) + (0.30 * 0.40)
= 0.42 + 0.12 = 0.54

Result: 0.54 or 54%. A randomly selected citizen has a 54% chance of supporting the policy.

Common use cases

Pitfalls and limitations

Frequently asked questions

can i use the law of total probability if events overlap

No, the partition sets (A1, A2, etc.) must be mutually exclusive, meaning they cannot overlap, and collectively exhaustive, meaning they must cover 100% of the sample space. If these conditions are not met, the sum will not correctly represent the total probability of the event.

when do you use law of total probability vs conditional probability

The Law of Total Probability is used when you want to find the overall probability of an event but only have data about its likelihood under different, specific scenarios. It bridges the gap between conditional 'if-then' probabilities and the general 'anytime' probability.

is the law of total probability always less than 1

Yes, because the events A forming the partition must sum to 1.0 (or 100%), and each conditional probability P(B|A) is also between 0 and 1, the resulting total probability P(B) will mathematically always fall within the 0 to 1 range.

how does total probability relate to bayes theorem

While the Law of Total Probability finds the total likelihood of an outcome, Bayes' Theorem goes a step further to find the probability of a specific cause given that the outcome has already occurred. In fact, the Law of Total Probability is often the denominator used in the Bayes' Theorem formula.

how many events can be in a partition for total probability

The number of partitions is theoretically infinite, provided they are discrete and their probabilities sum to one. In practical calculation, most problems involve 2 to 5 partitions, such as different factory machines or different demographic groups.

Related calculators

5 Number Summary Calculator
Calculate the five-number summary (min, Q1, median, Q3, max) and visualize with a box plot
Absolute Uncertainty Calculator
Calculate absolute and relative uncertainty for measurements and experimental data
Average Rating Calculator
Calculate the weighted average star rating from individual vote counts for reviews and feedback
Accuracy Calculator
Calculate accuracy, precision, and error rates for statistical analysis
Adjusted R-Squared Calculator
Calculate adjusted R² to account for the number of predictors in regression models
AIC/BIC Calculator
Compare statistical models using Akaike and Bayesian Information Criteria for model selection
Accuracy Calculator
Calculate accuracy, precision, and error rates for statistical analysis
ANOVA Calculator
Perform one-way Analysis of Variance to test if group means differ significantly