NIMCET, GATE, CUET & CBSE test series are live — start practicing free
syllabuzAI

Bayes' Theorem and Law of Total Probability | NIMCET

Learn the law of total probability, Bayes' theorem for finding reverse probabilities, how to set up partitions and tree diagrams, and standard urn and test-accuracy problems for NIMCET.

5 min read

SP

SHIVAM PRADHAN

Updated 25 October 2026

On this page

Quick answer: If E1,E2,…,EnE_1, E_2, \ldots, E_n are mutually exclusive and exhaustive events (a partition) and A is any event, the law of total probability gives P(A)=∑P(Ei) P(A∣Ei)P(A) = \sum P(E_i)\,P(A \mid E_i). Bayes' theorem then reverses the condition: P(Ei∣A)=P(Ei) P(A∣Ei)∑jP(Ej) P(A∣Ej)P(E_i \mid A) = \frac{P(E_i)\,P(A \mid E_i)}{\sum_j P(E_j)\,P(A \mid E_j)}. Use it when you know the result and want the probability of the cause.

This uses conditional probability and the multiplication theorem.

The two results

ResultFormulaAnswers
Total probabilityP(A)=∑iP(Ei) P(A∣Ei)P(A) = \sum_i P(E_i)\,P(A \mid E_i)"What is the overall chance of A?"
Bayes' theoremP(Ei∣A)=P(Ei) P(A∣Ei)P(A)P(E_i \mid A) = \frac{P(E_i)\,P(A \mid E_i)}{P(A)}"Given A happened, which cause?"
TermMeaning
P(Ei)P(E_i)Prior probability of each cause
P(A∣Ei)P(A \mid E_i)Likelihood of the result under each cause
P(Ei∣A)P(E_i \mid A)Posterior probability of the cause

The posteriors add up to 1.

Method

Step 1: Identify the causes E1,E2,…E_1, E_2, \ldots (they must form a partition) and the observed result A.

Step 2: Write the priors P(Ei)P(E_i) and likelihoods P(A∣Ei)P(A \mid E_i).

Step 3: Multiply each pair to get P(Ei∩A)P(E_i \cap A).

Step 4: Add them for P(A)P(A), then divide the required product by P(A)P(A).

A table keeps this organised:

CausePriorLikelihoodProduct
E1E_1P(E1)P(E_1)P(A∣E1)P(A \mid E_1)P(E1)P(A∣E1)P(E_1)P(A \mid E_1)
E2E_2P(E2)P(E_2)P(A∣E2)P(A \mid E_2)P(E2)P(A∣E2)P(E_2)P(A \mid E_2)
Total1P(A)P(A)

Worked examples

Example 1: two bags

Bag I has 3 red and 2 black balls; Bag II has 2 red and 4 black. A bag is chosen at random and a ball drawn is red. Find the probability it came from Bag I.

Step 1: Priors 12\frac{1}{2} each. Likelihoods: P(R∣I)=35P(R \mid I) = \frac{3}{5}, P(R∣II)=13P(R \mid II) = \frac{1}{3}.

Step 2: Products: 310\frac{3}{10} and 16\frac{1}{6}. Total P(R)=930+530=1430P(R) = \frac{9}{30} + \frac{5}{30} = \frac{14}{30}.

Step 3: P(I∣R)=9/3014/30=914P(I \mid R) = \frac{9/30}{14/30} = \frac{9}{14}.

Example 2: three machines

Machines A, B, C make 50%, 30% and 20% of the items, with defect rates 1%, 2% and 3%. An item is defective. Find the probability it came from C.

MachinePriorDefect rateProduct
A0.50.010.005
B0.30.020.006
C0.20.030.006
Total0.017

P(C∣D)=0.0060.017=617P(C \mid D) = \frac{0.006}{0.017} = \frac{6}{17}.

Example 3: a medical test

A disease affects 1% of people. A test detects it 99% of the time and gives a false positive 5% of the time. A person tests positive. Find the probability they have the disease.

Step 1: Products: 0.01×0.99=0.00990.01 \times 0.99 = 0.0099 and 0.99×0.05=0.04950.99 \times 0.05 = 0.0495.

Step 2: P(+)=0.0594P(+) = 0.0594.

Step 3:

P(D∣+)=0.00990.0594=16≈0.167P(D \mid +) = \frac{0.0099}{0.0594} = \frac{1}{6} \approx 0.167

So even a positive result leaves only about a 17% chance, because the disease is rare.

Example 4: truth-telling

A speaks the truth 3 out of 4 times. A die is thrown and A reports a six. Find the probability that it really was a six.

Step 1: Six and truth: 16⋅34=324\frac{1}{6} \cdot \frac{3}{4} = \frac{3}{24}. Not six and lie: 56⋅14=524\frac{5}{6} \cdot \frac{1}{4} = \frac{5}{24}.

Step 2: P=33+5=38P = \frac{3}{3 + 5} = \frac{3}{8}.

(This assumes that when A lies, A reports a six; some versions spread the lie over the 5 other faces, which changes the answer.)

Summary table

IdeaKey point
PartitionCauses must be mutually exclusive and exhaustive
Total probabilitySum of prior × likelihood
BayesOne product ÷ the total
PosteriorsAdd up to 1
Rare causesCan stay unlikely even after positive evidence

Exam tips

  • Always build the prior-likelihood-product table; it prevents most errors.
  • Check that your priors add up to 1.
  • Read truth-telling questions carefully to see how a lie is reported.

For more solved questions, see NIMCET probability and statistics: Bayes' theorem and distributions and the NIMCET Probability and Statistics chapter.

Common mistakes

  • Using P(A∣Ei)P(A \mid E_i) when the question asks for P(Ei∣A)P(E_i \mid A).
  • Forgetting to divide by the total probability.
  • Using causes that overlap or do not cover all cases.
  • Mixing percentages and decimals in one calculation.

Frequently Asked Questions

What is Bayes' theorem?

P(Eᵢ | A) = P(Eᵢ)P(A | Eᵢ) / Σ P(Eⱼ)P(A | Eⱼ). It gives the probability of a cause given an observed result.

What is the law of total probability?

For a partition E₁, …, Eₙ, P(A) = Σ P(Eᵢ)P(A | Eᵢ).

When should Bayes' theorem be used?

When the outcome is known and the question asks for the probability of one of the possible causes.

What are prior and posterior probabilities?

The prior is the probability of a cause before the evidence; the posterior is its probability after the evidence is taken into account.

Do the posterior probabilities add up to 1?

Yes, because the causes form a partition.

Concept Check

MEDIUM

At what angle do the curves y=x2y = x^2 and y=2−x2y = 2 - x^2 intersect at point (1,1)(1, 1)?

Suggested for you