Practice Bayes' Theorem in Math

Use these practice problems to test your method after reviewing the concept explanation and worked examples.

Quick Recap

Bayes' theorem gives the posterior probability of a hypothesis given evidence: P(H∣E)=P(E∣H)⋅P(H)P(E).

Start with a prior belief, then reweight it by how likely the evidence is under each hypothesis.

Showing a random 20 of 50 problems.

Example 1

medium
A spam filter: 40% of email is spam. 'Free' appears in 80% of spam and 10% of non-spam. An email contains 'free'. Find P(spam∣free).

Example 2

hard
Drug testing: P(user)=0.05. Test sensitivity P(+∣user)=0.99. Specificity P(−∣non-user)=0.95 (so P(+∣non-user)=0.05). Find P(user∣+).

Example 3

hard
You have three biased coins with P(H)=0.2,0.5,0.9 chosen uniformly at random, flipped once, lands heads. Find the posterior probability that the chosen coin has P(H)=0.9.

Example 4

medium
A coin is fair with prior 0.5 or two-headed with prior 0.5. It is flipped once and lands heads. Find P(two-headed∣H).

Example 5

medium
A rare disease has prior 0.001. The test is 99% sensitive (P(+∣D)=0.99) and 95% specific (P(+∣Dc)=0.05). Find P(D∣+).

Example 6

medium
A box has 70% fair coins (P(H)=0.5) and 30% biased coins (P(H)=0.9). A drawn coin flips heads. Find P(biased∣H).

Example 7

easy
If the prior P(H)=0, what is the posterior P(H∣E) (for any evidence with P(E)>0)?

Example 8

easy
Compute P(E) by the law of total probability if P(E∣H)=0.6, P(H)=0.5, P(E∣Hc)=0.2, P(Hc)=0.5.

Example 9

medium
Email spam filter: P(spam)=0.3. The word 'free' appears in 80% of spam emails and 10% of legitimate emails. An email contains 'free'. Find P(spam∣free) using Bayes' theorem.

Example 10

hard
A taxi is in a hit-and-run. 85% of city cabs are Green, 15% Blue. A witness identifies a Blue cab and is right 80% of the time. Find P(actually Blue∣witness says Blue).

Example 11

challenge
You suspect a coin is biased toward heads. Prior: P(biased)=0.1 with P(H∣biased)=0.75; otherwise fair. You observe 8 heads in 10 flips. Find the posterior probability the coin is biased.

Example 12

easy
Are P(A∣B) and P(B∣A) generally equal?

Example 13

medium
A communication channel sends 0 with probability 0.6 and 1 with probability 0.4. Each bit is flipped with probability 0.1. The receiver sees 1. Find P(sent 1∣received 1).

Example 14

medium
At a school, 30% of students play sports. Among sport-players, 70% own gym shoes; among non-players, 20% own gym shoes. A student owns gym shoes. Find P(plays sports∣gym shoes).

Example 15

medium
A test is 90% sensitive (P(+∣D)=0.9) and the disease prior is P(D)=0.2. Also P(+∣Dc)=0.1. Find P(D∣+).

Example 16

medium
Prior odds of H to Hc are 1:3. The likelihood ratio P(E∣H)P(E∣Hc)=6. Find the posterior odds, then P(H∣E).

Example 17

medium
A test with sensitivity 100% always tests positive on disease carriers. Does this guarantee P(D∣+)=1?

Example 18

hard
A coin is either fair (p=0.5, probability 0.7) or biased (p=0.8, probability 0.3). You flip it once and get heads. Update the probability that the coin is biased using Bayes' theorem.

Example 19

medium
A patient's prior probability of disease is 10%. A test has sensitivity 80% and specificity 80%. Find P(D∣+).

Example 20

easy
In Bayes' theorem, which term is the 'prior'?