Bayes’ theorem: partition, total probability and examples

NCERT Class 12 Mathematics Chapter 13 Section 13.5

Quick answer

Bayes’ theorem updates the probability of a hypothesis given evidence: if E, E, …, E partition the sample space with P(E) > 0 and P(A) > 0, P(E|A) = P(E) P(A|E)/P(A). The denominator comes from the theorem of total probability, P(A) = P(E) P(A|E) + … + P(E) P(A|E), the sum of all the paths to A on a tree. NCERT calls P(E) the priori and P(E|A) the a posteriori probability of the hypothesis E.

With your textbook

NCERT Mathematics Part II (Class 12), Chapter 13 “Probability”, Section 13.5 “Bayes' Theorem”, pages 423–433.

Open the official NCERT chapter (PDF, 2.9 MB, ncert.nic.in) (opens in a new tab)

Checked against the 2026-27 reprint on .

What is Bayes’ theorem?

Bayes’ theorem

But, can we find the probability that the ball drawn is from a particular bag (say Bag II), if the colour of the ball drawn is given? Here, we have to find the reverse probability of Bag II to be selected when an event occurred after it is known.

NCERT Mathematics Part II (Class 12), Section 13.5, page 423

  • If E, E, …, E form a partition of the sample space and P(A) ≠ 0, then P(E|A) = P(E) P(A|E)/P(A), with P(A) from the theorem of total probability (NCERT pages 424–425).

In plain words: if a ball is drawn from one of two bags, it is easy to find the chance of a red ball from a given bag. Bayes’ theorem answers the reverse question: given that the ball is red, how likely is it that it came from a particular bag (NCERT Section 13.5, page 423)? It rests on two ideas, a partition and the theorem of total probability.

Partition of a sample space

In other words, the events E1, E2, ..., En represent a partition of the sample space S if they are pairwise disjoint, exhaustive and have nonzero probabilities.

NCERT Mathematics Part II (Class 12), Section 13.5.1, page 424

In Class 11 words, the events are mutually exclusive and exhaustive. Any event E with 0 < P(E) < 1 and its complement E′ form a partition, and a partition is not unique (page 424).

NCERT slip (page 424): the book says that “any nonempty event E and its complement E′ form a partition”. If E is the whole sample space, E′ is empty and has probability 0, which a partition does not allow. In an exam, check that every part has a nonzero probability.

Theorem of total probability

If E, E, …, E form a partition of S and A is any event, A splits into the disjoint pieces A ∩ E, and the multiplication rule gives each piece (NCERT Section 13.5.2, pages 424–425):

Theorem of total probability

P(A) = P(E) P(A|E) + P(E) P(A|E) + … + P(E) P(A|E)

NCERT Example 15 (page 425): a strike has probability 0.65; a job is finished on time with probability 0.32 if there is a strike and 0.80 if not. So P(on time) = 0.65 × 0.32 + 0.35 × 0.80 = 0.488.

Bayes’ theorem

If E, …, E partition S and P(A) ≠ 0, then (NCERT page 425):

Bayes’ theorem

P(E|A) = P(E) P(A|E) / [P(E) P(A|E) + … + P(E) P(A|E)]

The proof (NCERT page 425) uses the multiplication rule on top and total probability below:

Proof

P(E|A) = P(A ∩ E)/P(A)

= P(E) P(A|E)/P(A)

= P(E) P(A|E) / Σ P(E) P(A|E)

NCERT’s terms (Remark, page 426): the E are hypotheses, P(E) is the priori (a priori) probability of E, and P(E|A) is its a posteriori probability. The theorem is also called the formula for the probability of “causes”. Here a hypothesis need not be a physical cause: Bayes’ theorem updates probabilities from evidence and does not by itself establish causation.

On a tree, the bottom of the fraction is the sum of all the paths that end in A, and the top is the one path through E.

A tree: machines A, B and C make 25%, 35% and 40% of the bolts, and 5%, 4% and 2% of their bolts are defective; the defective paths give 0.0125, 0.014 and 0.008, so P(B given defective) = 28/69.
NCERT Example 19 (pages 428–429) on a tree: the three defective paths add up to 0.0345 and the path through machine B is 0.014, so P(B | defective) = 0.014/0.0345 = 28/69.

NCERT Example 18 (pages 427–428) shows why the answer can surprise: a test detects 90% of cases and gives a false positive for 1% of healthy people, and 0.1% of people have the disease. Then P(disease | positive) = (0.001 × 0.9)/(0.001 × 0.9 + 0.999 × 0.01) ≈ 0.083, because healthy people are so many more.

NCERT slip (page 423): the text says the problem was solved by “John Bayes”. Beyond the NCERT text (Wikipedia, “Thomas Bayes”, facts in our words): the theorem is named after Thomas Bayes (about 1701–1761), an English Presbyterian minister and statistician. He never published it; after his death his friend Richard Price brought the essay before the Royal Society, which heard it in 1763 and printed it in its Philosophical Transactions. The name does not affect the mathematics.

A random variable

NCERT ends the section with a remark (pages 430–431): a random variable is a real valued function whose domain is the sample space of a random experiment. For two coin tosses, X = the number of heads gives X(HH) = 2, X(HT) = X(TH) = 1 and X(TT) = 0, and Y = heads minus tails gives Y(HH) = 2, Y(HT) = Y(TH) = 0 and Y(TT) = −2: two random variables on the same sample space.

NCERT slip (page 406): the chapter’s Introduction promises a random variable, its probability distribution, mean and variance, and the Binomial distribution. The 2026–27 chapter stops here: Section 13.5 ends with this remark (pages 430–431). In an exam, follow Sections 13.2–13.5. Beyond the NCERT text: the JEE Main syllabus also lists the probability distribution of a random variable (NTA, JEE Main syllabus, Unit 13).

Solved examples

Example 1: Which bag? (NCERT Exercise 13.3, Q2, page 431)

One bag has 4 red and 4 black balls, another 2 red and 6 black. A bag is chosen at random and a ball drawn from it is red. Find the probability that it came from the first bag.

P(red | first) = 1/2 and P(red | second) = 1/4, each bag with prior 1/2.

Answer: (1/2)(1/2) / [(1/2)(1/2) + (1/2)(1/4)] = 2/3.

Example 2: Hostel or day scholar (NCERT Exercise 13.3, Q3, page 431)

60% of the students live in the hostel and 40% are day scholars; 30% of hostellers and 20% of day scholars get an A grade. A student with an A grade is chosen. Find the probability that the student is a hosteller.

The A-grade paths are 0.6 × 0.3 = 0.18 and 0.4 × 0.2 = 0.08.

Answer: 0.18/0.26 = 9/13.

Example 3: Knowing or guessing (NCERT Exercise 13.3, Q4, page 431)

A student knows the answer with probability 3/4 and guesses with probability 1/4; a guess is right with probability 1/4. Given that the answer is correct, find the probability that the student knew it.

The correct-answer paths are 3/4 × 1 and 1/4 × 1/4 = 1/16.

Answer: (3/4)/(3/4 + 1/16) = 12/13.

Example 4: A blood test (NCERT Exercise 13.3, Q5, pages 431–432)

A test is 99% effective when the disease is present and gives a false positive for 0.5% of healthy people; 0.1% of people have the disease. Find the probability of the disease given a positive test.

The positive paths are 0.001 × 0.99 = 0.00099 and 0.999 × 0.005 = 0.004995.

Answer: 0.00099/0.005985 = 22/133, about 0.165.

Example 5: Three coins (NCERT Exercise 13.3, Q6, page 432)

One coin has two heads, one shows heads 75% of the time, and one is fair. A coin chosen at random shows heads. Find the probability that it is the two-headed coin.

Each coin has prior 1/3, and the heads probabilities are 1, 3/4 and 1/2.

Answer: 1/(1 + 3/4 + 1/2) = 4/9.

Example 6: Choose the correct answer (NCERT Exercise 13.3, Q13, pages 432–433)

Assume a fair coin, and that A reports its result correctly with probability 4/5 conditional on either face (otherwise reporting the opposite face). The coin is tossed, and A reports a head. The probability that there actually was a head is (A) 4/5; (B) 1/2; (C) 1/5; (D) 2/5.

The report “head” comes from a head told truly, (1/2)(4/5), or a tail misreported, (1/2)(1/5).

Answer: (2/5)/(2/5 + 1/10) = 4/5: (A).

Common mistakes to avoid

Common mistake

Confusing P(A|E) with P(E|A)

The data give P(defective | machine); the question asks for P(machine | defective). Bayes’ theorem turns one into the other.

NCERT slip (page 429): in Example 20, the book describes P(E|T) as the “Probability that the doctor arriving late comes by train”. That describes P(T|E), the answer being found. P(E|T) = 1/4 is the probability that he is late, given that he comes by train; the value and the final answer, 1/2, are right. In an exam, describe P(E|T) the second way.

Common mistake

Forgetting a path in the denominator

The bottom must include every hypothesis, including those with a small chance. In Example 4, leaving out the healthy people’s false positives would give 1 instead of 22/133.

Common mistake

Using hypotheses that overlap or miss cases

The E must be disjoint and cover S. “Train, bus, scooter” is not a partition if the doctor can also come by other means (NCERT Example 20 adds “other means of transport”).

Quick revision summary

  • A partition: pairwise disjoint, exhaustive events with nonzero probabilities.
  • Total probability: P(A) = P(E) P(A|E) + … + P(E) P(A|E), the sum of the paths to A.
  • Bayes: P(E|A) = P(E) P(A|E) / [P(E) P(A|E) + … + P(E) P(A|E)], one path over all paths to A.
  • A random variable is a real valued function on the sample space.

Formula sheet

  • P(A) = P(E) P(A|E) + … + P(E) P(A|E)
  • P(E|A) = P(E) P(A|E) / Σ P(E) P(A|E)

Questions students ask

What is the difference between conditional probability and Bayes’ theorem?

Conditional probability is the general idea, the chance P(E|A) of an event E once A is known to have occurred, while Bayes’ theorem is a formula for one kind of conditional probability: the reverse one, P(E|A), worked out from the forward probabilities P(A|E) and the prior probabilities P(E) of a partition. Every Bayes answer is a conditional probability, but not every conditional probability needs Bayes’ theorem: the chance of a king given a red card comes straight from counting, while the chance that a red ball came from a particular bag needs it, because what is known is the chance of red from each bag. NCERT calls this the “reverse probability” (page 423).

How do you know whether a question needs total probability or Bayes’ theorem?

A question needs the theorem of total probability when it asks for the overall chance of an outcome A that can come about in several ways, and Bayes’ theorem when it says that A has happened and asks for the chance of one of the ways, a “cause” E. Total probability adds all the paths to A on a tree, and Bayes’ theorem divides one of those paths by that total, so a Bayes answer needs the total first. If plant X makes 90% of a factory’s chips, 2% of them faulty, and plant Y makes 10%, 9% of them faulty, the faulty paths are 0.9 × 0.02 = 0.018 and 0.1 × 0.09 = 0.009, so P(faulty) is 0.027, and a faulty chip came from Y with probability 0.009/0.027 = 1/3.

Which chapter of NCERT Class 12 Maths has Bayes’ theorem?

Bayes’ theorem is in Chapter 13, Probability, of NCERT Mathematics Part II (Class 12), Section 13.5 (pages 423–433), which also covers the partition of a sample space and the theorem of total probability; the theorem itself is stated and proved on page 425. Its worked examples are NCERT Examples 16–21 (pages 426–430), followed by Exercise 13.3 (pages 431–433), and Miscellaneous Examples 22 and 24 use it again. The theorem is named after Thomas Bayes (beyond the NCERT text, whose page 423 has a slip in his first name), so it is written Bayes’ theorem (or Bayes’s theorem).

What are sensitivity and specificity in Bayes’ theorem questions on medical tests?

Beyond the NCERT text, medical statistics calls the chance that a test is positive for someone ill its sensitivity, and the chance that it is negative for a healthy person its specificity, so the false-positive rate is 1 minus the specificity; in NCERT Exercise 13.3, Q5, “99% effective” is a sensitivity. Bayes’ theorem turns them into the chance of disease given a positive result, the “predictive value positive” of the US CDC’s surveillance guidelines, which also depends on how common the disease is. With sensitivity 95%, specificity 90% and 2% of people ill, the positive paths are 0.019 and 0.098, so a positive result means disease with probability 0.019/0.117 = 19/117, about 0.16.

Do the probabilities given by Bayes’ theorem always add up to 1?

Yes, the a posteriori (posterior) probabilities P(E|A), …, P(E|A) of a partition always add up to 1 when P(A) ≠ 0, because they share the denominator P(A), and their numerators P(E) P(A|E) add up to P(A) by the theorem of total probability: once A has happened, exactly one of the partition events has occurred. This gives a check on the working, and the last posterior can be found by subtracting the others from 1. The priors P(E) add up to 1 as well, but the forward probabilities P(A|E) need not: in NCERT Example 17 (page 427) the chances of a gold coin from the three boxes are 1, 0 and 1/2.

Practice questions

Try each question first, then open the answer to check your working.

  1. Q1. An urn has 5 red and 5 black balls. A ball is drawn, its colour noted, and it is returned with 2 more balls of that colour. Find the probability that a second draw gives red (NCERT Exercise 13.3, Q1, page 431).

    Show answerHide answer

    By total probability: (1/2)(7/12) + (1/2)(5/12) = 1/2.

  2. Q2. An insurer covers 2000 scooter drivers, 4000 car drivers and 6000 truck drivers, with accident probabilities 0.01, 0.03 and 0.15. An insured person has an accident. Find the probability that he drives a scooter (NCERT Exercise 13.3, Q7, page 432).

    Show answerHide answer

    Expected accidents: 20, 120 and 900, so the probability is 20/1040 = 1/52.

  3. Q3. Machine A makes 60% of the items and B 40%; 2% of A’s and 1% of B’s items are defective. A defective item is found. Find the probability that B made it (NCERT Exercise 13.3, Q8, page 432).

    Show answerHide answer

    0.4 × 0.01 / (0.6 × 0.02 + 0.4 × 0.01) = 0.004/0.016 = 1/4.

  4. Q4. If A ⊂ B and P(B) ≠ 0, which is correct? (A) P(A|B) = P(B)/P(A); (B) P(A|B) < P(A); (C) P(A|B) ≥ P(A); (D) none of these (NCERT Exercise 13.3, Q14, page 433).

    Show answerHide answer

    P(A|B) = P(A ∩ B)/P(B) = P(A)/P(B) ≥ P(A), since P(B) ≤ 1: (C).

More practice questions

Sources and review

Written by
TopicLamp Editorial Team.
Checked by
TopicLamp Review Team.
NCERT source
NCERT, Mathematics Part II (Class 12), reprint 2026-27. Chapter 13 “Probability”, Section 13.5 “Bayes' Theorem”, pages 423–433. Checked on . Official chapter PDF on ncert.nic.in (opens in a new tab) (2.9 MB).
Dates
First published Checked and updated
Corrections
  • : OpenAI Codex review: read full lesson, FAQs and practice; independently recomputed probabilities and checked hypotheses. Corrected missing assumptions and misleading claims; preserved published content pending review.

Report a mistake on this page How pages are written, reviewed and corrected

Topics in Probability (Class 12)

  1. Conditional probability: definition, properties and examples

    NCERT Section 13.2 9 min read

  2. Multiplication theorem on probability

    NCERT Section 13.3 7 min read

  3. Independent events in probability

    NCERT Section 13.4 10 min read

  4. Bayes’ theorem: partition, total probability and examples

    NCERT Section 13.5 You are reading this topic

  5. Probability distribution of a random variable

    10 min read