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(HE)=P(EH)P(H)P(E)P(H|E) = \frac{P(E|H) \cdot 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(spamfree)P(\text{spam}\mid \text{free}).

Example 2

hard
Drug testing: P(user)=0.05P(\text{user})=0.05. Test sensitivity P(+user)=0.99P(+|\text{user})=0.99. Specificity P(non-user)=0.95P(-|\text{non-user})=0.95 (so P(+non-user)=0.05P(+|\text{non-user})=0.05). Find P(user+)P(\text{user}|+).

Example 3

hard
You have three biased coins with P(H)=0.2,0.5,0.9P(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.9P(H)=0.9.

Example 4

medium
A coin is fair with prior 0.50.5 or two-headed with prior 0.50.5. It is flipped once and lands heads. Find P(two-headedH)P(\text{two-headed}\mid H).

Example 5

medium
A rare disease has prior 0.0010.001. The test is 99% sensitive (P(+D)=0.99P(+\mid D)=0.99) and 95% specific (P(+Dc)=0.05P(+\mid D^c)=0.05). Find P(D+)P(D\mid +).

Example 6

medium
A box has 70% fair coins (P(H)=0.5P(H)=0.5) and 30% biased coins (P(H)=0.9P(H)=0.9). A drawn coin flips heads. Find P(biasedH)P(\text{biased}\mid H).

Example 7

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

Example 8

easy
Compute P(E)P(E) by the law of total probability if P(EH)=0.6P(E\mid H)=0.6, P(H)=0.5P(H)=0.5, P(EHc)=0.2P(E\mid H^c)=0.2, P(Hc)=0.5P(H^c)=0.5.

Example 9

medium
Email spam filter: P(spam)=0.3P(\text{spam})=0.3. The word 'free' appears in 80% of spam emails and 10% of legitimate emails. An email contains 'free'. Find P(spamfree)P(\text{spam}|\text{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 Bluewitness says Blue)P(\text{actually Blue}|\text{witness says Blue}).

Example 11

challenge
You suspect a coin is biased toward heads. Prior: P(biased)=0.1P(\text{biased})=0.1 with P(Hbiased)=0.75P(H|\text{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(AB)P(A\mid B) and P(BA)P(B\mid 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 1received 1)P(\text{sent 1}|\text{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 sportsgym shoes)P(\text{plays sports}|\text{gym shoes}).

Example 15

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

Example 16

medium
Prior odds of HH to HcH^c are 1:31:3. The likelihood ratio P(EH)P(EHc)=6\frac{P(E\mid H)}{P(E\mid H^c)}=6. Find the posterior odds, then P(HE)P(H\mid E).

Example 17

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

Example 18

hard
A coin is either fair (p=0.5p=0.5, probability 0.7) or biased (p=0.8p=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+)P(D|+).

Example 20

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