StatsDrillFree guides

Intro statistics · Free practice

Bayes theorem practice problems with answers

Bayes theorem helps when a question gives the chance of an observation from a group, then asks which group an observed item came from. Work out every route to the observation before you divide. The examples and five practice problems below use made-up campus numbers, so you can focus on the method.

When do you use Bayes theorem?

Suppose 30% of print jobs use printer B, and 8% of B jobs jam. The 8% is P(jam | B): among B jobs, how many jam? If you see a jam and want to know whether it came from B, you need P(B | jam). The condition after the vertical bar has changed, so the denominator must change too.

For an event B and an observation J with P(J) > 0:

P(B | J) = P(J | B) × P(B) / P(J).

If every job uses either A or B, then P(J) = P(J | A)P(A) + P(J | B)P(B). The two products count the two disjoint paths to a jam. This is the law of total probability; Bayes theorem uses its total as the denominator. For three or more groups, add one product for every group.

  1. Name the group you want and the observation you already know.
  2. Multiply along the wanted path to get the joint probability.
  3. Add all paths that produce the observation.
  4. Divide the wanted path by that total. Check that your answer is between 0 and 1.

Worked example 1: Which printer jammed?

A campus print center sends 70% of jobs to printer A and 30% to printer B. A jams on 2% of its jobs; B jams on 8%. A randomly selected job jammed. What is the chance it used B?

Step 1: Find both paths to a jam. P(A and jam) = 0.70 × 0.02 = 0.014. P(B and jam) = 0.30 × 0.08 = 0.024.

Step 2: Find all jams. P(jam) = 0.014 + 0.024 = 0.038.

Step 3: Restrict attention to jammed jobs. P(B | jam) = 0.024 / 0.038 = 12/19 ≈ 0.632, or 63.2%. Printer B handles fewer jobs, yet it produces more jams because its jam rate is higher.

Prefer counts? Imagine 100,000 jobs. This frequency table reaches the same answer without memorizing a formula:

Expected job counts from the stated rates
PrinterJobsJammedNot jammed
A70,0001,40068,600
B30,0002,40027,600
Total100,0003,80096,200

Among the 3,800 jammed jobs, 2,400 used B: 2,400/3,800 = 12/19. The table is often the fastest check for an intro-class problem.

Worked example 2: A class-email flag

One fifth of messages in a student's inbox are from a class. A mail rule flags 90% of class messages and 10% of other messages. A message was flagged. What is the chance it is from a class?

The class-and-flag path is 0.20 × 0.90 = 0.18. The other-and-flag path is 0.80 × 0.10 = 0.08. Therefore P(flag) = 0.26 and P(class | flag) = 0.18/0.26 = 9/13 ≈ 0.692, or 69.2%. A 90% flag rate for class messages does not mean 90% of flagged messages are from class: other messages are four times as common before the flag.

The common mistake: reversing the condition

In the printer example, P(jam | B) = 8%, while P(B | jam) ≈ 63.2%. They share the same overlap (B and jam), but divide by different groups. A quick language check prevents the swap: “given B” means use all B jobs; “given a jam” means use only jammed jobs. Another frequent error is to use 0.024, the joint probability, as the answer; it is the numerator, not the conditional probability.

Five Bayes theorem practice problems

Try each one before opening its answer. All rates here are hypothetical, and the answer fractions were recalculated independently.

  1. Late campus shuttle. Forty percent of trips use route East. Thirty percent of East trips and 10% of West trips are late. A trip is late. What is P(East | late)?
    Show worked answer 1

    East and late: 0.40 × 0.30 = 0.12. West and late: 0.60 × 0.10 = 0.06. Divide 0.12 by all late trips, 0.12 + 0.06 = 0.18. Answer: 2/3 ≈ 66.7%. The 30% figure is P(late | East), the reversed condition.

  2. Library return reminder. One quarter of borrowed items are short loans. A reminder is sent for 80% of short loans and 20% of standard loans. Given a reminder, what is the chance the item is a short loan?
    Show worked answer 2

    Short and reminder: 0.25 × 0.80 = 0.20. Standard and reminder: 0.75 × 0.20 = 0.15. Thus P(short | reminder) = 0.20/(0.20 + 0.15) = 4/7 ≈ 57.1%. Equal reminder rates are not assumed; weight each rate by the group size.

  3. Three printers. Printers A, B, and C handle 50%, 30%, and 20% of jobs. Their jam rates are 2%, 10%, and 5%. A job jammed. What is the chance it used B?
    Show worked answer 3

    The three jam paths are 0.50 × 0.02 = 0.01, 0.30 × 0.10 = 0.03, and 0.20 × 0.05 = 0.01. All jams total 0.05. The B share is 0.03/0.05 = 3/5 = 60%. Do not leave C out of the denominator.

  4. Reverse the question. In worked example 1, what is P(jam | B)? Then compare it with P(B | jam).
    Show worked answer 4

    Among jobs using B, 8% jam, so P(jam | B) = 0.08. Among all jammed jobs, 12/19 ≈ 0.632 used B. These are different because the first denominator is all B jobs and the second is all jammed jobs.

  5. All flagged messages. In worked example 2, what is P(flag), and what fraction of flagged messages are not from a class?
    Show worked answer 5

    P(flag) = 0.20 × 0.90 + 0.80 × 0.10 = 0.26. The other-message share is 0.08/0.26 = 4/13 ≈ 30.8%. Check: 9/13 from class plus 4/13 other equals 1.

Keep practicing in StatsDrill

Work through the free Chapter 1 before moving to the conditional probability chapter. Chapter 1 needs no login.

Try a practice problem now

Sources and fact checks

The definitions of conditional probability, total probability, and Bayes theorem were checked against Penn State STAT 414, Lesson 6: Bayes’ Theorem. The frequency-table and tree-diagram method was checked against OpenStax Introductory Statistics 2e, §3.5. Scenarios and numbers are original; no real campus data are implied.