WhatsApp us
University Maths25 Nov 2026

Bayes' Theorem Examples for University Probability, Step by Step

Five original Bayes' theorem examples at university level, from a noisy communication channel to a continuous prior, with the table method that keeps the working tidy and the slips that cost marks.

Bayes' Theorem Examples for University Probability, Step by Step

Bayes' theorem turns a probability you know, P(evidence | cause), into the one you want, P(cause | evidence): P(A | B) = P(B | A) P(A) / P(B), where P(B) is found by adding P(B | Aᵢ) P(Aᵢ) over every possible cause Aᵢ. Every Bayes question has the same three ingredients: prior probabilities for the causes, the likelihood of the evidence under each cause, and a normalising total.

The examples below go from a two-cause problem to a continuous prior, which is where many first statistics courses take the idea. All the numbers are our own and every answer has been checked by calculation.

Bayes' theorem vs conditional probability

Conditional probability is the definition: P(A | B) = P(A ∩ B) / P(B). Bayes' theorem is that definition used in reverse, when the question hands you the conditional probabilities the "wrong way round".

Conditional probabilityBayes' theorem
What you are givenP(A ∩ B) and P(B), or a table of countsP(A), and P(B given each cause)
What you wantP(A given B) directlyP(cause given the evidence)
Key stepdivide the joint probability by P(B)find P(B) by the law of total probability first
Typical wording"given that the card is red…""a test is positive; what is the chance the person has the condition?"

If the question gives you likelihoods of evidence under several causes and asks about a cause, it is a Bayes question. Our IB conditional probability guide covers the school-level definition if you want to revise it first.

The table method

Write one row per cause, then four columns.

  1. Prior P(Aᵢ): what you believe before the evidence.
  2. Likelihood P(B | Aᵢ): how probable the evidence is under that cause.
  3. Product P(Aᵢ) × P(B | Aᵢ). The column total is P(B).
  4. Posterior P(Aᵢ | B) = product ÷ total. The posteriors add to 1, which is a free check.

This layout stops the most common error, forgetting one of the causes when computing P(B). For guided practice on problem sheets from your own module, our probability and statistics tutoring page explains how sessions with Ajay Vatsyayan work.

Example 1: a noisy binary channel

A transmitter sends 1 with probability 0.4 and 0 with probability 0.6. Noise flips a transmitted 1 into a received 0 with probability 0.1, and a transmitted 0 into a received 1 with probability 0.05. A 1 is received. What is the probability that a 1 was sent?

Causes: S1 (sent 1) and S0 (sent 0). Evidence: R1.

P(R1) = P(R1 | S1) P(S1) + P(R1 | S0) P(S0) = 0.9 × 0.4 + 0.05 × 0.6 = 0.36 + 0.03 = 0.39

P(S1 | R1) = 0.36 / 0.39 = 12/13 ≈ 0.923

The same method for a received 0 gives P(R0) = 0.61 and P(S0 | R0) = 0.57 / 0.61 ≈ 0.934. A receiver that decodes each symbol as the more probable sent value is using exactly this calculation, which is why it appears in digital communications courses.

Example 2: a screening test, then a second test

A condition affects 1.5% of a population. A test detects it with probability 0.92 (sensitivity) and gives a false positive with probability 0.04 for people without it. (a) Someone tests positive. Find the probability they have the condition. (b) An independent second test is also positive. Update the probability.

(a) Let D be "has the condition".

P(+) = 0.92 × 0.015 + 0.04 × 0.985 = 0.0138 + 0.0394 = 0.0532

P(D | +) = 0.0138 / 0.0532 ≈ 0.259

Only about 26% of positives have the condition. The test is accurate, but the condition is rare, so false positives from the large healthy group outnumber the true positives.

(b) Yesterday's posterior becomes today's prior. With prior 0.2594 (keep four figures):

P(D | ++) = (0.92 × 0.2594) / (0.92 × 0.2594 + 0.04 × 0.7406) ≈ 0.890

You get the same answer in one step with prior 0.015 and likelihoods 0.92² and 0.04², which is a good check that the sequential update is right. The jump from 26% to 89% is why screening programmes confirm a positive with a second, independent test.

Also worth knowing: P(D | −) = (0.08 × 0.015) / 0.9468 ≈ 0.0013, so a negative result is very reassuring.

Example 3: three hypotheses, exact fractions

A drawer holds three coins: a fair coin, a two-headed coin, and a bent coin that lands heads with probability ¾. One is picked at random and tossed three times, giving three heads. Find the probability it is the two-headed coin, and the probability that a fourth toss is a head.

CoinPriorP(HHH given coin)ProductPosterior
fair1/31/81/248/99
two-headed1/311/364/99
bent1/327/649/6427/99 = 3/11
total133/641

So P(two-headed | HHH) = 64/99 ≈ 0.646.

For the fourth toss, weight each coin's head probability by its posterior:

P(H₄ | HHH) = (8/99)(½) + (64/99)(1) + (27/99)(¾) = 353/396 ≈ 0.891

That second part is a predictive probability, and it is a common follow-up in exam questions. A frequent mistake is to use the prior 1/3 weights instead of the posterior ones.

Example 4: Bayes with Poisson likelihoods

A web server is in one of two states, each with prior probability ½. In the normal state requests arrive as a Poisson process with mean 2 per second; under load the mean is 5 per second. In one second, 4 requests arrive. Find the probability the server is under load.

The likelihoods are Poisson probabilities of exactly 4 arrivals:

P(4 | normal) = e^(−2) 2⁴ / 4! ≈ 0.0902

P(4 | load) = e^(−5) 5⁴ / 4! ≈ 0.1755

With equal priors the ½ cancels:

P(load | 4) = 0.1755 / (0.1755 + 0.0902) ≈ 0.660

If the prior for "normal" were 0.8 instead, the posterior for load drops to about 0.327. The evidence is the same; only the prior changed. Our worked guide to binomial, Poisson and normal distributions covers the Poisson formula and when to use it.

Example 5: a continuous prior for an unknown probability

A new sensor's success probability p is unknown. Treat p as uniform on [0, 1] before testing. In 12 independent trials it succeeds 7 times. Find the posterior distribution, its mean and its mode.

Bayes' theorem with densities: posterior ∝ prior × likelihood.

posterior(p) ∝ 1 × p⁷ (1 − p)⁵, for 0 ≤ p ≤ 1

That is the shape of a Beta(8, 6) density. For Beta(a, b), the mean is a/(a + b) and the mode is (a − 1)/(a + b − 2), so:

mean = 8/14 = 4/7 ≈ 0.571

mode = 7/12 ≈ 0.583

The mode equals the observed proportion 7/12; the mean is pulled slightly towards ½ by the uniform prior. With more data the two get closer. This is the start of Bayesian statistics, and the same "prior × likelihood, then normalise" rule is the only new idea.

Where students lose marks

  • Confusing P(A | B) with P(B | A). "The test detects 92% of cases" is P(+ | D), not P(D | +). Write each given probability in symbols before you start.
  • Leaving a cause out of P(B). Every cause in the partition needs a row, including "none of the above" if it exists.
  • Using 1 − sensitivity as the false positive rate. They are unrelated numbers. The false positive rate is P(+ | not D).
  • Rounding the posterior too early before a second update. In example 2, rounding 0.2594 to 0.3 gives 0.908 for the second update instead of 0.890. Keep four significant figures until the end.
  • Using priors for a predictive probability. After evidence arrives, weight by posteriors, as in example 3.
  • Forgetting to normalise a continuous posterior. Proportional is not equal; identify the family (here Beta) or integrate to find the constant.

How to spot a Bayes question

  • The question gives several possible causes (machines, coins, states, groups) with known proportions.
  • It gives the probability of the observed evidence for each cause.
  • It asks for the probability of a cause after seeing the evidence, often with "given that" or "if a randomly chosen item is found to be…".

If all three are present, set up the table. If the question instead gives joint counts in a two-way table, it is plain conditional probability and you can divide directly.

Practice set

  1. A firm buys 70% of its laptops from supplier X (2% fail in the first year) and 30% from Y (6% fail). A laptop fails. Find the probability it came from Y.
  2. A rare fault affects 0.5% of units. A diagnostic detects it with probability 0.99 and gives false alarms 2% of the time. A unit triggers an alarm. Find the probability it has the fault.
  3. Urn 1 has 3 red and 2 blue balls; urn 2 has 1 red and 4 blue. A die is rolled and urn 1 is used on a 1 or 2, urn 2 otherwise. A red ball is drawn. Find P(urn 1 | red).
  4. With a uniform prior on p, a process succeeds in 3 of 4 trials. Find the posterior mean of p.
  5. P(A) = 0.3, P(B | A) = 0.5 and P(B | not A) = 0.2. Find P(A | B).

Answers. (1) 0.018/0.032 = 9/16 = 0.5625. (2) 0.00495/0.02485 ≈ 0.199. (3) 3/5. (4) Posterior Beta(4, 2), mean 2/3. (5) 0.15/0.29 = 15/29 ≈ 0.517.

Where Bayes' theorem goes next

The posterior idea leads to Bayesian inference (credible intervals, conjugate priors), to classifiers such as naive Bayes in machine learning, to filtering methods such as the Kalman filter in control engineering, and to decision theory. Students who saw Bayes at school can compare with our IB guide to Bayes and continuous random variables.

How Maths Bodhi helps

We go through your own module's problem sheets, check how you set up the causes and likelihoods, and give extra questions on the parts that trip you up. Our university maths hub lists the other courses we support, and engineering students can see our engineering maths sessions. We explain, practise and review your own attempts; we don't complete graded assignments, quizzes or exams. Home tuition is available in Gurgaon (Gurugram). Students elsewhere in India and abroad learn with us online. You can book a free demo class.

Written and checked by the Maths Bodhi team (November 2026).

Frequently asked questions

What is the difference between Bayes' theorem and conditional probability?
Conditional probability is the definition P(A | B) = P(A ∩ B)/P(B); Bayes' theorem uses it to reverse a conditional, finding P(cause | evidence) from P(evidence | cause).
What is the formula for Bayes' theorem?
P(A | B) = P(B | A) P(A) / P(B), where P(B) is the sum of P(B | Aᵢ) P(Aᵢ) over all causes.
Why is the probability of having a disease after a positive test often low?
When the condition is rare, false positives from the much larger healthy group can outnumber true positives.
What are prior and posterior probabilities?
The prior is your probability for a cause before the evidence; the posterior is the updated probability after it.
Can Bayes' theorem be used with continuous distributions?
Yes: the posterior density is proportional to the prior density times the likelihood, then normalised.
How do I know a question needs Bayes' theorem?
It gives probabilities of evidence under several causes and asks for the probability of a cause given the evidence.
Bayes theoremconditional probabilityprobabilitystatisticsuniversity maths

Related guides

Keep exploring this maths topic

IB DP Maths25 Nov 2026

Proof in IB Maths: Deduction, Counterexamples, Contradiction and Necessary vs Sufficient Conditions

Where proof sits in IB maths AA SL and HL, how to read "if", "only if" and "if and only if", necessary versus sufficient conditions with calculus and algebra examples, LHS to RHS proofs, counterexamples, proof by contradiction and a short look at induction. Worked examples plus a six-question practice set with answers.

IB maths proofnecessary and sufficient conditionsproof by contradictioncounterexample IB maths

By Maths Bodhi Team

Read guide

IB DP Maths25 Nov 2026

IB Maths Problem-Solving Strategies: 7 Ways to Crack Unfamiliar Questions

Seven problem-solving strategies for the unfamiliar parts of IB maths questions, each with a fully worked AA or AI example: breaking a question into parts, small cases, changing the representation, symmetry, invariants, boundary cases and spotting hidden structure.

IB maths problem solvingunfamiliar IB maths questionsIB maths Paper 3 strategiesIB maths AA HL

By Maths Bodhi Team

Read guide

IB DP Maths25 Nov 2026

IB Maths for Economics, Business, Data Science and Engineering: The Skills Each Degree Uses

Which IB maths topics economics, business, data science and engineering degrees actually build on, shown with worked examples from AA and AI: marginal cost, compound growth, expected value, regression, matrices, conditional probability, kinematics and differential equations. Plus a Year 1 plan and the mistakes families make.

IB maths for economicsIB maths for engineeringIB maths for data scienceis IB maths useful

By Maths Bodhi Team

Read guide