Bayes' Theorem & Total Probability
The definitive master guide incorporating all 7 Bayes' Theorem problems found across your semester exam papers, class tests, and assignments with complete mathematical derivations.
01. What Problem Does Bayes' Theorem Solve?
Standard conditional probability asks: "If a product came from Line A, what is the chance it is defective?" → $P(D \mid A)$. Bayes' Theorem answers the reverse forensic question: "We observed a defective item. What is the probability it was produced by Line A?" → $P(A \mid D)$.
$P(B_i)$ — Baseline Share
The initial production volume or baseline population prevalence before examining sample items or running diagnostic tests.
$P(B_i \mid A)$ — Updated Attribution
The revised probability attributing the observed symptom/defect $A$ to origin $B_i$, balancing its defect rate against its production volume.
02. Mathematical Statement & Formal Theorem
Let $B_1, B_2, \dots, B_k$ be a set of mutually exclusive ($B_i \cap B_j = \emptyset$ for $i \ne j$) and exhaustive ($\bigcup_{i=1}^k B_i = S$) events forming a partition of the sample space $S$, with prior probabilities $P(B_i) > 0$.
For any observed event $A$ with $P(A) > 0$, the posterior probability of cause $B_i$ given evidence $A$ is:
Law of Total Probability (The Denominator)
The denominator $P(A)$ represents the overall probability of event $A$ occurring across all sources:
In the exam, write this expanded summation explicitly before plugging in numeric values. University rubrics allocate specific step-marks to this formula.
03. Notation Decoding Matrix
Avoid losing marks to reversed conditional symbols. Always match the problem statement to this table:
| Symbol | Role | Definition | Industrial Example |
|---|---|---|---|
| $B_i$ | Hypothesis | $i$-th origin/source | Line B produced the component. |
| $A$ (or $D$) | Evidence | Observed condition | Selected component is defective. |
| $P(B_i)$ | Prior | Baseline probability | Line B produces 35% of total output ($0.35$). |
| $P(A \mid B_i)$ | Likelihood | Evidence chance given cause | Defect rate of Line B is 3% ($0.03$). |
| $P(A)$ | Total Prob | Marginal defect rate | Overall factory defect rate ($0.0310$). |
| $P(B_i \mid A)$ | Posterior | Attribution to origin | Given defective, chance from Line B ($33.87\%$). |
$P(D \mid B) = 0.03$ is the line's quality rating (known before inspection).
$P(B \mid D) \approx 0.3387$ is the diagnostic attribution (computed after finding a defect).
04. The 6-Step Exam Problem-Solving Protocol
Define Events Clearly
Write: "Let $B_1, B_2, B_3$ denote the events that the item is manufactured by Source 1, 2, 3 respectively. Let $D$ denote the event that the item is defective."
Tabulate Priors and Likelihoods
State all values in decimal format. Verify that priors form a complete partition: $\sum P(B_i) = 1.00$.
Write Total Probability Formula
State $P(D) = \sum_{j=1}^k P(B_j)P(D \mid B_j)$ before any calculation. Show each product term individually.
Compute Denominator $P(D)$
Sum the individual product terms to find total probability. Check that $P(D)$ lies reasonably between minimum and maximum defect rates.
Apply Bayes' Theorem Formula
Write $P(B_i \mid D) = \frac{P(B_i)P(D \mid B_i)}{P(D)}$, substitute the numerator product and denominator, and evaluate.
State Fraction & Percentage Conclusion
Provide the final result as both a simplified fraction and a percentage with a complete conclusion sentence.
05. 6 Deadly Exam Traps & Common Student Mistakes
Writing $P(D \mid B_i)$ instead of $P(B_i \mid D)$
The problem gives you $P(D \mid B_i)$ (the defect rate). Never write this as your final answer. You are solving for $P(B_i \mid D)$.
Forgetting the Summation in $P(A)$
The denominator MUST sum the contributions of every source. If there are 3 machines, the denominator must have 3 products added together.
Treating 2% as 0.2 instead of 0.02
Always convert percentages carefully: $2\% = 0.02$, $0.5\% = 0.005$, $10\% = 0.10$. A single misplaced decimal destroys the entire computation.
Ignoring Combination Reductions
When drawing 2 items from a finite lot of size $N$, use combinations $\binom{d}{2}/\binom{N}{2}$ or sequential products $\frac{d}{N} \times \frac{d-1}{N-1}$, not simply $(d/N)^2$.
Failing the Sanity Check $\sum P(B_i) = 1$
Check that prior production shares add up to exactly $1.00$ ($0.40 + 0.35 + 0.25 = 1.00$). If they do not, re-read the question carefully.
Leaving Bare Decimals with No Final Sentence
Examiners deduct 1-2 marks if you stop at `0.4032`. Always add: "Therefore, Line C is the most likely origin with probability 40.32%."
06. The Complete University Question Bank (All 7 Questions Solved)
Every single Bayes' Theorem question from your course syllabus, class tests (CT-1), assignments (LLT), and semester papers (May 2025, Nov 2025, Dec 2024):
Question 1: Two Boxes with Bulbs Drawn Without Replacement (20 Marks)
Question Statement:
"Explain Baye's theorem with its usefulness. Also solve the following problem. Box 1 contains 1000 bulbs of which 10% are defective. Box 2 contains 2000 bulbs of which 5% are defective. Two bulbs are drawn (without replacement) from a randomly selected box.
(i) Find the probability that both bulbs are defective.
(ii) Assuming that both are defective, find the probability that they came from Box 1."
View Complete Step-by-Step Solution & Examiner Rubric
Part 1: Statement and Usefulness of Bayes' Theorem (6 Marks)
Statement: Let $B_1, B_2, \dots, B_k$ be mutually exclusive and exhaustive events with $P(B_i) > 0$. For any event $A$ with $P(A) > 0$:
$$\begin{aligned} P(B_i \mid A) = \frac{P(B_i)P(A \mid B_i)}{\sum_{j=1}^k P(B_j)P(A \mid B_j)} \end{aligned}$$Usefulness: Inverts conditional probabilities to infer hidden root causes from empirical symptoms, underpinning quality assurance, diagnostic screening, and Bayesian classifiers.
Part 2: Numerical Derivation (14 Marks)
1. Events & Priors: Box 1 selected: $P(B_1) = 0.5$; Box 2 selected: $P(B_2) = 0.5$. Let $D$ = both drawn bulbs are defective.
2. Conditional Likelihoods (Sampling Without Replacement):
- Box 1 ($N_1 = 1000$, Defective = $100$): $$\begin{aligned} P(D \mid B_1) &= \frac{\binom{100}{2}}{\binom{1000}{2}} = \frac{100 \times 99}{1000 \times 999} \\[4pt] &= \frac{11}{1110} \approx \mathbf{0.009910} \end{aligned}$$
- Box 2 ($N_2 = 2000$, Defective = $100$): $$\begin{aligned} P(D \mid B_2) &= \frac{\binom{100}{2}}{\binom{2000}{2}} = \frac{100 \times 99}{2000 \times 1999} \\[4pt] &= \frac{99}{39980} \approx \mathbf{0.002476} \end{aligned}$$
3. Part (i) Total Probability $P(D)$:
$$\begin{aligned} P(D) &= P(B_1)P(D \mid B_1) + P(B_2)P(D \mid B_2) \\[4pt] &= 0.5(0.009910) + 0.5(0.002476) \\[4pt] &= 0.004955 + 0.001238 \\[4pt] &= \mathbf{0.006193} \quad (\mathbf{0.6193\%}) \end{aligned}$$In exact fraction form: $P(D) = \frac{54,967}{8,875,560} \approx 0.006193$.
(Binomial approx: $P(D) = 0.5(0.10^2) + 0.5(0.05^2) = \mathbf{0.00625}$).
4. Part (ii) Posterior Probability $P(B_1 \mid D)$:
$$\begin{aligned} P(B_1 \mid D) &= \frac{P(B_1)P(D \mid B_1)}{P(D)} \\[6pt] &= \frac{0.004955}{0.006193} = \frac{3,998}{4,997} \\[6pt] &\approx \mathbf{0.8001} \quad (\mathbf{80.01\%}) \end{aligned}$$(Under binomial approximation: $P(B_1 \mid D) = \frac{0.00500}{0.00625} = \frac{4}{5} = \mathbf{80.00\%}$).
Question 2: Production Lines A, B, and C Defect Attribution (10 Marks)
Question Statement:
"A manufacturing company operates three production lines: Line A, Line B, and Line C. The proportion of total products manufactured by the three lines is 40%, 35%, and 25%, respectively. The probabilities that a product manufactured by each line is defective are 2%, 3%, and 5%, respectively. A product is randomly selected from the company's production and is found to be defective. Using Bayes' theorem, calculate the probability that the defective product was manufactured by Line A, Line B, and Line C. Based on your calculations, identify which production line is most likely to have produced the defective product. (10 Marks)"
View Complete Step-by-Step Solution & Managerial Insight
1. Priors and Likelihoods:
- Priors: $P(A) = 0.40, \; P(B) = 0.35, \; P(C) = 0.25$ ($\sum = 1.00$)
- Likelihoods: $P(D \mid A) = 0.02, \; P(D \mid B) = 0.03, \; P(D \mid C) = 0.05$
2. Law of Total Probability $P(D)$:
$$\begin{aligned} P(D) &= P(A)P(D \mid A) + P(B)P(D \mid B) + P(C)P(D \mid C) \\[4pt] &= (0.40 \times 0.02) + (0.35 \times 0.03) + (0.25 \times 0.05) \\[4pt] &= 0.0080 + 0.0105 + 0.0125 = \mathbf{0.0310} \quad (\mathbf{3.10\%}) \end{aligned}$$3. Posterior Probabilities via Bayes' Theorem:
- Line A: $$P(A \mid D) = \frac{0.0080}{0.0310} = \frac{8}{31} \approx \mathbf{0.2581 \ (25.81\%)}$$
- Line B: $$P(B \mid D) = \frac{0.0105}{0.0310} = \frac{21}{62} \approx \mathbf{0.3387 \ (33.87\%)}$$
- Line C: $$P(C \mid D) = \frac{0.0125}{0.0310} = \frac{25}{62} \approx \mathbf{0.4032 \ (40.32\%)}$$
Check: $25.81\% + 33.87\% + 40.32\% = 100.00\%$.
Comparing posterior probabilities: $P(C \mid D) = 40.32\% > P(B \mid D) = 33.87\% > P(A \mid D) = 25.81\%$.
Line C is most likely to have produced the defective product. Even though Line A has the highest production share (40%), Line C's higher defect rate (5%) causes it to generate the largest share of defective goods.
Question 3: Garment Factory Shirt Styles Defect Attribution (10 Marks)
Question Statement:
"A garment factory manufactures three styles of shirts: Regular ($S_1$), Slim-fit ($S_2$), and Loose-fit ($S_3$). Production shares are 50%, 30%, and 20% respectively. The percentage of defective shirts produced by each style is 4%, 6%, and 5% respectively. A shirt is chosen at random and found to be defective. Find which style is most likely to be the defective shirt."
View Complete Step-by-Step Solution
1. Given Data:
| Style ($S_i$) | Prior $P(S_i)$ | Defect Rate | Joint $P(S_i \cap D)$ |
|---|---|---|---|
| Regular ($S_1$) | $0.50$ | $0.04$ | $0.50 \times 0.04 = \mathbf{0.020}$ |
| Slim ($S_2$) | $0.30$ | $0.06$ | $0.30 \times 0.06 = \mathbf{0.018}$ |
| Loose ($S_3$) | $0.20$ | $0.05$ | $0.20 \times 0.05 = \mathbf{0.010}$ |
| Total | $1.00$ | - | $P(D) = 0.048$ |
2. Total Probability of a Defect:
$$\begin{aligned} P(D) &= \sum_{i=1}^3 P(S_i)P(D \mid S_i) \\[4pt] &= 0.020 + 0.018 + 0.010 = \mathbf{0.048 \ (4.8\%)} \end{aligned}$$3. Posterior Probabilities:
- $P(S_1 \mid D) = \frac{0.020}{0.048} = \frac{5}{12} \approx \mathbf{0.4167 \ (41.67\%)}$
- $P(S_2 \mid D) = \frac{0.018}{0.048} = \frac{3}{8} = \mathbf{0.3750 \ (37.50\%)}$
- $P(S_3 \mid D) = \frac{0.010}{0.048} = \frac{5}{24} \approx \mathbf{0.2083 \ (20.83\%)}$
Question 4: Automobile Vehicle Defect Model Identification (10 Marks)
Question Statement:
"A vehicle assembly plant produces Sedan ($M_1$), SUV ($M_2$), and Coupe ($M_3$) models. Their production shares are 30%, 40%, and 30% respectively. Defect rates are 2% for Sedan, 5% for SUV, and 3% for Coupe. If a defective vehicle is discovered during pre-delivery inspection, which model is most likely responsible?"
View Complete Step-by-Step Solution
1. Given Data:
- Priors: $P(M_1) = 0.30, \; P(M_2) = 0.40, \; P(M_3) = 0.30$
- Likelihoods: $P(D \mid M_1) = 0.02, \; P(D \mid M_2) = 0.05, \; P(D \mid M_3) = 0.03$
2. Total Probability of a Defect:
$$\begin{aligned} P(D) &= (0.30 \times 0.02) + (0.40 \times 0.05) + (0.30 \times 0.03) \\[4pt] &= 0.006 + 0.020 + 0.009 = \mathbf{0.035 \ (3.5\%)} \end{aligned}$$3. Posterior Probabilities via Bayes' Theorem:
- Sedan: $P(M_1 \mid D) = \frac{0.006}{0.035} = \frac{6}{35} \approx \mathbf{0.1714 \ (17.14\%)}$
- SUV: $P(M_2 \mid D) = \frac{0.020}{0.035} = \frac{4}{7} \approx \mathbf{0.5714 \ (57.14\%)}$
- Coupe: $P(M_3 \mid D) = \frac{0.009}{0.035} = \frac{9}{35} \approx \mathbf{0.2571 \ (25.71\%)}$
Question 5: Beverage Types Defect Identification
Question Statement (Verbatim from LLT Assignment):
"A company produces three types of beverages: A, B, and C. The probability of a beverage being defective is as follows: The probability of a beverage being defective for A is 0.02, for B is 0.05, and for C is 0.01. The conditional probabilities that a defective beverage comes from each type are: The probability that a defective beverage is of type A is 0.2, of type B is 0.3, and of type C is 0.35. If a defective beverage is discovered, what is the most likely type of beverage (A, B, or C) that it is?"
View Complete Step-by-Step Solution & Dual Interpretations
Interpretation A: Literal Question Phrasing (MAP Decision)
The question prompt states: "The conditional probabilities that a defective beverage comes from each type are: A is 0.2, B is 0.3, C is 0.35". These are the posterior probabilities $P(\text{Type} \mid D)$:
- $P(A \mid D) = 0.20 \ (20\%)$
- $P(B \mid D) = 0.30 \ (30\%)$
- $P(C \mid D) = 0.35 \ (35\%)$
Comparing these directly: $P(C \mid D) = 0.35 > P(B \mid D) = 0.30 > P(A \mid D) = 0.20$.
Conclusion A: Under literal reading, Type C is the most likely defective beverage ($35\%$).
Interpretation B: Standard Assignment Key (Priors as Production Shares)
If the percentages ($0.20, 0.30, 0.35$) represent the prior production shares of the three lines ($P(A) = 0.20, P(B) = 0.30, P(C) = 0.35$):
- Likelihoods: $P(D \mid A) = 0.02, \; P(D \mid B) = 0.05, \; P(D \mid C) = 0.01$.
- Total Defect Probability: $$\begin{aligned} P(D) &= (0.20 \times 0.02) + (0.30 \times 0.05) + (0.35 \times 0.01) \\[4pt] &= 0.0040 + 0.0150 + 0.0035 = \mathbf{0.0225} \end{aligned}$$
- Bayes' Posterior Probabilities:
- $P(A \mid D) = \frac{0.0040}{0.0225} = \frac{8}{45} \approx \mathbf{17.78\%}$
- $P(B \mid D) = \frac{0.0150}{0.0225} = \frac{2}{3} \approx \mathbf{66.67\%}$
- $P(C \mid D) = \frac{0.0035}{0.0225} = \frac{7}{45} \approx \mathbf{15.56\%}$
Conclusion B: Under the production share model, Type B is overwhelmingly the most likely defective beverage ($66.67\%$).
Question 6: Electronic Devices Posterior Comparison & Prior Derivation
Question Statement:
"Let X, Y, Z represent events that a produced device is of Type X, Type Y, or Type Z. Conditional defect probabilities are: $P(D \mid X) = 0.01, P(D \mid Y) = 0.04, P(D \mid Z) = 0.02$. The posterior probabilities of device type given a defective is found are: $P(X \mid D) = 0.5, P(Y \mid D) = 0.3, P(Z \mid D) = 0.2$. If a defective device is picked up from the factory, what is the most likely type of device?"
View Complete Dual-Interpretation Solution
Interpretation A: Direct Posterior Comparison (MAP Decision)
We are given the condition that a defective device has been found. We compare the posterior probabilities directly:
$$P(X \mid D) = 0.50 \ (50\%), \quad P(Y \mid D) = 0.30 \ (30\%), \quad P(Z \mid D) = 0.20 \ (20\%)$$Conclusion A: Type X is the most likely type of device among defectives ($50\%$).
Interpretation B: Deriving the Unknown Production Volume (Priors)
If the examiner intended to ask "What is the most produced device type by the factory overall?", we apply Bayes' Theorem in reverse:
$$P(k) = \frac{P(k \mid D) \cdot P(D)}{P(D \mid k)}$$Let $c = P(D)$ be the constant marginal defect rate:
- $P(X) = \frac{0.5 \cdot c}{0.01} = 50c$
- $P(Y) = \frac{0.3 \cdot c}{0.04} = 7.5c$
- $P(Z) = \frac{0.2 \cdot c}{0.02} = 10c$
Since $\sum P(k) = 1$:
$$\begin{aligned} 50c + 7.5c + 10c = 67.5c &= 1 \\[4pt] \implies c = \frac{1}{67.5} &= \frac{2}{135} \end{aligned}$$Substituting $c$ yields exact factory production shares:
- $P(X) = 50 \times \frac{2}{135} = \frac{20}{27} \approx \mathbf{74.07\%}$
- $P(Y) = 7.5 \times \frac{2}{135} = \frac{1}{9} \approx \mathbf{11.11\%}$
- $P(Z) = 10 \times \frac{2}{135} = \frac{4}{27} \approx \mathbf{14.81\%}$
Question 7: Food Products Quality Control Analysis
Question Statement:
"Let D, E, F represent food products of Type D, E, F. Conditional defect probabilities are: $P(\text{Def} \mid D) = 0.03, P(\text{Def} \mid E) = 0.01, P(\text{Def} \mid F) = 0.04$. The conditional probabilities that a defective product is of each type are: $P(D \mid \text{Def}) = 0.2, P(E \mid \text{Def}) = 0.5, P(F \mid \text{Def}) = 0.3$. If a defective product is selected, what is the most likely type of food product it belongs to?"
View Complete Step-by-Step Solution
Interpretation A: Direct Posterior Comparison
Comparing given conditional probabilities given a defective item:
$$P(E \mid \text{Def}) = 0.50 > P(F \mid \text{Def}) = 0.30 > P(D \mid \text{Def}) = 0.20$$Conclusion A: Type E is the most likely food product among defectives ($50\%$).
Interpretation B: Deriving Baseline Factory Production Shares
Using $P(k) = \frac{P(k \mid \text{Def}) \cdot c}{P(\text{Def} \mid k)}$ where $c = P(\text{Def})$:
- $P(D) = \frac{0.2 \cdot c}{0.03} = \frac{20}{3}c = \frac{80}{12}c$
- $P(E) = \frac{0.5 \cdot c}{0.01} = 50c = \frac{600}{12}c$
- $P(F) = \frac{0.3 \cdot c}{0.04} = \frac{30}{4}c = \frac{90}{12}c$
Summing: $\left(\frac{80 + 600 + 90}{12}\right) c = \frac{770}{12}c = 1 \implies c = \frac{12}{770} = \frac{6}{385}$.
Substituting back:
- $P(D) = \frac{80}{770} = \frac{8}{77} \approx \mathbf{10.39\%}$
- $P(E) = \frac{600}{770} = \frac{60}{77} \approx \mathbf{77.92\%}$
- $P(F) = \frac{90}{770} = \frac{9}{77} \approx \mathbf{11.69\%}$
Dynamic Bayes Theorem Calculator (3 Sources)
Use this widget to verify textbook problems or create custom practice scenarios:
07. Interactive Self-Test Quiz (Active Recall)
Test your conceptual and calculation readiness before moving to Normal Distribution. Attempt all 4 questions:
A manufacturing plant finds a defective bolt in the warehouse. You are asked to determine the probability that it was produced on Line B. What is the correct formal notation?
The fact that the bolt is defective is the given condition (placed after the vertical bar). The origin (Line B) is the hypothesis we wish to evaluate.
Line A produces 40% with 2% defect, Line B produces 35% with 3% defect, and Line C produces 25% with 5% defect. What is the total probability of selecting a defective item, $P(D)$?
$P(D) = (0.40 \times 0.02) + (0.35 \times 0.03) + (0.25 \times 0.05) = 0.0080 + 0.0105 + 0.0125 = 0.0310$.
In Question 2, given that an item is defective, what is the probability it came from Line C, $P(C \mid D)$?
$P(C \mid D) = \frac{P(C)P(D \mid C)}{P(D)} = \frac{0.25 \times 0.05}{0.0310} = \frac{0.0125}{0.0310} = \frac{25}{62} \approx 0.4032$ ($40.32\%$).
A box has 1000 items, with 100 defectives. If 2 items are drawn without replacement, what is the exact probability of both being defective?
Without replacement, the first draw has probability $100/1000$, and the second draw has probability $99/999$. Product: $\frac{9900}{999000} = \frac{11}{1110} \approx 0.00991$. In the May 2025 semester exam, writing this combination formula is explicitly required for full marks.
Self-Test Progress
08. Exam Hall Answer Sheet Presentation Checklist
When solving a Bayes' Theorem question in the semester exam, follow this exact structure to guarantee maximum marks even if arithmetic errors occur:
- Define the Events: Let $B_1, B_2, \dots$ be the sources and $D$ be the observed condition.
- State the Prior Probabilities: $P(B_1) = \dots, P(B_2) = \dots$ (Check: sum must equal $1.0$).
- State the Likelihoods: $P(D \mid B_1) = \dots, P(D \mid B_2) = \dots$.
- Write the Law of Total Probability Formula: $P(D) = \sum P(B_i)P(D \mid B_i)$ and show the denominator calculation.
- State Bayes' Theorem Formula: $P(B_k \mid D) = \frac{P(B_k)P(D \mid B_k)}{P(D)}$.
- Substitute & Simplify: Write the simplified fraction and final decimal percentage.
- Conclude with a Plain-Text Sentence: "Therefore, the probability that the defective item came from Line C is 40.32%."