Back to homeMathematics · 2nd Bach. Social Sciences · Change subject
Start for free
BAC2 ss · Mathematics
Chance and probability · Probability

Bayes' Theorem

"The test came back positive: what is the probability that they really have the allergy?" This is not answered by looking at the tree going forwards, as in total probability, but by reversing it: you already know that the effect has occurred, and you are asking about the cause. That reversal is Bayes' theorem, and it is, by a long way, the type of probability problem that appears most often in the EvAU.

Before you start, make sure you know: Conditional probability (1st Bachillerato)
Before you start, make sure you know: Tree diagrams (4th ESO)

Bayes' theorem

Tree diagram showing how Bayes' theorem reverses the direction to calculate the probability of the cause from the observed effect. P(B₁)P(B₂) P(A|B₁)P(A|B₂) Bayes question: ← from A, which branch is most likely to have happened?
Practice★☆☆Not started
To get to the centre, a student can go by bus ($80\,\%$ of the time) or by bicycle ($20\,\%$). When travelling by bus, they arrive late $10\,\%$ of the time due to…

To get to the centre, a student can go by bus ($80\,\%$ of the time) or by bicycle ($20\,\%$). When travelling by bus, they arrive late $10\,\%$ of the time due to traffic. When travelling by bicycle, they only arrive late $5\,\%$ of the time. If on a given day the student arrives late for class, calculate the probability that they travelled by bus.

Solve
Practice★☆☆Not started
A trainer brand manufactures its models in two different factories: $70\,\%$ in factory $A$ and $30\,\%$ in factory $B$. Quality control has detected that $2\,\%$ of the…

A trainer brand manufactures its models in two different factories: $70\,\%$ in factory $A$ and $30\,\%$ in factory $B$. Quality control has detected that $2\,\%$ of the trainers from factory $A$ have a stitching defect, whereas in factory $B$ defects appear in $5\,\%$ of production. A customer buys a pair of trainers and discovers that they have a stitching defect. Calculate the probability that they were manufactured in factory $B$.

Solve

The exam strategy, step by step

Diagram of ordered steps for solving Bayes' theorem problems: define the complete system, calculate the total probability in the denominator and find the posterior probability. 1. causes 2. effect A 3. tree → P(A) 4. Bayes
Practice★☆☆Not started
An email filter automatically classifies messages as spam. The filter correctly marks $98\,\%$ of emails that are truly spam as spam. However, it also sends $4\,\%$ of…

An email filter automatically classifies messages as spam. The filter correctly marks $98\,\%$ of emails that are truly spam as spam. However, it also sends $4\,\%$ of legitimate emails to the spam folder. It is estimated that $10\,\%$ of incoming email to an inbox is spam. If a randomly chosen email has been marked as spam, calculate the probability that it is actually spam.

Population True Status Outcome Joint Probability 0,10 0,90 0,98 0,02 0,04 0,96 Spam (S) Normal (N) Flagged (+) Clean (-) Flagged (+) Clean (-) P(S ∩ +) = 0,10 × 0,98 P(S ∩ -) = 0,10 × 0,02 P(N ∩ +) = 0,90 × 0,04 P(N ∩ -) = 0,90 × 0,96 P(Spam | Marcado) = ? Bayes' theorem
Solve
Practice★★☆Not started
At a health centre, a study is being conducted on the efficacy of a diagnostic test for a food allergy that affects $8\,\%$ of the youth population. Clinical data…

At a health centre, a study is being conducted on the efficacy of a diagnostic test for a food allergy that affects $8\,\%$ of the youth population. Clinical data indicate that if a person suffers from the allergy, the test gives a positive result in $95\,\%$ of cases. On the other hand, if the person does not suffer from the allergy, the test gives a "false positive" (positive result without being ill) in $4\,\%$ of instances. If a young person is chosen at random and their test result is positive, calculate the probability that they actually suffer from that allergy.

Allergy (A) Healthy (A') Test + Test - Test + Test - 0,08 0,92 0,95 0,05 0,04 0,96 0,08 × 0,95 = 0,076 0,92 × 0,04 = 0,0368
Solve
Practice★★☆Not started
In a city, $70\,\%$ of citizens use a mobile app to pay for public transport, whereas the rest use a physical card. It is observed that $15\,\%$ of those using the app…

In a city, $70\,\%$ of citizens use a mobile app to pay for public transport, whereas the rest use a physical card. It is observed that $15\,\%$ of those using the app have reading issues at the ticket validator, compared to $5\,\%$ of those using a physical card. If a validator emits a reading error signal, what is the probability that the user is trying to pay with the mobile app?

Solve

Three or more causes: "which is the most likely?"

Diagram showing how the Bayes calculation for several causes shares a single total probability in the denominator. P(A) (just once, with total probability) P(B₁|A) P(B₂|A) P(B₃|A) same denominator in all three; only the numerator changes
Practice★★☆Not started
A manufacturer of electronic components for smartphones has three production lines: A, B, and C. Line A produces $45\,\%$ of the components, line B produces $30\,\%$,…

A manufacturer of electronic components for smartphones has three production lines: A, B, and C. Line A produces $45\,\%$ of the components, line B produces $30\,\%$, and line C produces $25\,\%$. It is known that the probability of a component being defective is $1\,\%$ on line A, $2\,\%$ on line B, and $3\,\%$ on line C. If a component is selected at random and turns out to be defective, determine with justification which production line is most likely to have manufactured it.

Solve
Practice★★☆Not started
A last-mile logistics company delivers packages in a city using three types of vehicles: electric vans ($60\,\%$), motorbikes ($30\,\%$), and cargo bicycles ($10\,\%$).…

A last-mile logistics company delivers packages in a city using three types of vehicles: electric vans ($60\,\%$), motorbikes ($30\,\%$), and cargo bicycles ($10\,\%$). The probability that a package arrives late is $2\,\%$ if delivered by van, $5\,\%$ if by motorbike, and $8\,\%$ if by bicycle. If a customer calls to complain because their package has arrived late, what is the probability that the courier was on a cargo bicycle?

Solve

Diagnostic tests: the case that causes the most confusion

Stacked bar chart showing that, with a prevalence of 8 %, roughly a third of the test's positives are false positives. population: 8% with allergy, 92% without allergy true positives 7.6 % (≈ 67 % of positives) false positives 3.68 % (≈ 33 %) total test positives: 11.28 % of the population
Practice★★☆Not started
A social network uses an artificial intelligence algorithm to detect hate speech comments. It is known that $5\,\%$ of published comments are actually inappropriate. The…

A social network uses an artificial intelligence algorithm to detect hate speech comments. It is known that $5\,\%$ of published comments are actually inappropriate. The algorithm correctly identifies $98\,\%$ of comments that are truly inappropriate as "inappropriate". However, it wrongly labels $3\,\%$ of respectful comments as "inappropriate". If the system has just blocked a comment for marking it as "inappropriate", what is the probability that the comment was actually respectful?

Solve
Practice★★★Not started
A tech multinational uses three different suppliers for the microchips in its new gaming laptops. Supplier $A$ supplies $45\%$ of the chips, supplier $B$ supplies…

A tech multinational uses three different suppliers for the microchips in its new gaming laptops. Supplier $A$ supplies $45\%$ of the chips, supplier $B$ supplies $35\%$, and the remainder come from supplier $C$. It is known from previous quality checks that $1\%$ of the chips from $A$ are defective, whereas for $B$ and $C$ these percentages are $2\%$ and $3\%$, respectively. A user buys a laptop and, after a month of use, suffers a critical failure due to the microchip. Calculate the probability that the defective chip was supplied by supplier $B$.

A B C Defective Non-defective Defective Non-defective Defective Non-defective 0,45 0,35 0,20 0,01 0,99 0,02 0,98 0,03 0,97
Solve

Summary

See all the exercises in this section