In the previous lesson we learned to assign probabilities to isolated events: the probability that a receipt is paid by card is 0.61; the probability that a survey response comes from a satisfied customer, 0.712. But the questions Marta takes to the management committee combine events: "what percentage of responses are from the app and unsatisfied?", "given that an order arrived late, which carrier most likely delivered it?". This lesson presents the tools for computing combined probabilities: the addition rule, conditional probability, the multiplication rule, the distinction between independence and mutual exclusivity (the source of the most classic mistake in the whole course), and two results that are worth their weight in gold in business: the law of total probability and Bayes' theorem. Our working tools will be contingency tables and tree diagrams.

Contents

  1. The addition rule (with and without mutual exclusivity)
  2. Conditional probability
  3. The multiplication rule
  4. Independence vs dependence (and why it is not the same as mutual exclusivity)
  5. Contingency tables: channel × satisfaction
  6. Tree diagrams and the law of total probability
  7. Bayes' theorem and the base-rate fallacy: fraud in online orders

The addition rule

We want \( P(A \cup B) \): the probability that \( A \) occurs, \( B \) occurs, or both.

Easy case: mutually exclusive events. If \( A \cap B = \varnothing \), simply add (this is Kolmogorov's third axiom):

\[ P(A \cup B) = P(A) + P(B) \]

Example: probability that a euro of sales belongs to fresh food or to beverages: \( 0.38 + 0.14 = 0.52 \).

General case: compatible events. If \( A \) and \( B \) can coincide, adding their probabilities counts the intersection twice (once inside \( P(A) \) and again inside \( P(B) \)), so it has to be subtracted once:

\[ P(A \cup B) = P(A) + P(B) - P(A \cap B) \]

NovaMarket example: we pick a receipt at random. 61% of receipts are paid by card (\( P(T)=0.61 \)), 45% include at least one fresh-food item (\( P(F)=0.45 \) — careful, this is a proportion of receipts, not the 38% share of sales in euros we saw in Module 2), and 29% satisfy both at once (\( P(T \cap F)=0.29 \)). Then:

\[ P(T \cup F) = 0.61 + 0.45 - 0.29 = 0.77 \]

77% of receipts are paid by card, contain fresh food, or both. Had we added without subtracting, we would have got 1.06 — a probability greater than 1, an unmistakable sign that something was counted twice.

Conditional probability

The conditional probability \( P(A \mid B) \) — read "probability of A given B" — is the probability of \( A \) knowing that \( B \) has occurred. The information shrinks the sample space: we no longer consider all possible outcomes, only those in which \( B \) occurs.

\[ P(A \mid B) = \frac{P(A \cap B)}{P(B)} \qquad \text{(provided } P(B) > 0\text{)} \]

The intuition: out of the "pie" of cases in which \( B \) occurs, what slice also belongs to \( A \)?

Quick example: with the receipts above, what is the probability that a receipt contains fresh food given that it was paid by card?

\[ P(F \mid T) = \frac{P(F \cap T)}{P(T)} = \frac{0.29}{0.61} \approx 0.475 \]

Among card receipts, 47.5% contain fresh food — somewhat more than the overall 45%. Conditioning changes the probability because it changes the reference population. Notice also that order matters: \( P(F \mid T) = 0.475 \) is not the same as \( P(T \mid F) = 0.29/0.45 \approx 0.644 \). Confusing \( P(A \mid B) \) with \( P(B \mid A) \) is a mistake so common it has a name (the transposed conditional fallacy), and we will come back to it with Bayes' theorem.

The multiplication rule

Rearranging the previous definition gives the multiplication rule, which is used to compute the probability that two events occur at the same time:

\[ P(A \cap B) = P(B) \cdot P(A \mid B) = P(A) \cdot P(B \mid A) \]

Example: 20% of the survey responses come through the online channel (\( P(O) = 0.20 \)) and, among them, 62.5% are from satisfied customers (\( P(S \mid O) = 0.625 \); we will justify this with the contingency table). Probability that a random response is "online and satisfied":

\[ P(O \cap S) = 0.20 \times 0.625 = 0.125 \]

Independence vs dependence (and vs mutual exclusivity)

Two events are independent when knowing that one has occurred does not change the probability of the other:

\[ A \text{ and } B \text{ independent} \iff P(A \mid B) = P(A) \iff P(A \cap B) = P(A) \cdot P(B) \]

If conditioning changes the probability, the events are dependent (which does not imply causation: only association, a nuance we will develop in correlation analysis).

  • In the receipts example, \( P(F) = 0.45 \) but \( P(F \mid T) = 0.475 \): paying by card and buying fresh food are (slightly) dependent.
  • On the other hand, if the probability that an online order arrives late is the same on Mondays as on any other day, "arriving late" and "being a Monday" are independent.

The classic mistake: confusing independence with mutual exclusivity. They are almost opposite ideas:

Mutually exclusive Independent
Definition They cannot occur together: \( P(A \cap B) = 0 \) One says nothing about the other: \( P(A \cap B) = P(A)P(B) \)
Knowing that \( B \) occurred… …guarantees that \( A \) did not occur …changes nothing about \( A \)
How do they relate? Two mutually exclusive events with positive probability are always dependent (and in the most extreme way!) —
NovaMarket example "In-store response" and "app response" "Card receipt" and "receipt on an even-numbered day"

If \( A \) and \( B \) are mutually exclusive and \( B \) occurs, the probability of \( A \) drops to 0: the information in \( B \) changes everything. Maximum dependence, not independence.

Contingency tables: channel × satisfaction

When we cross two qualitative variables, the contingency table turns all the calculations above into simple divisions. Marta cross-tabulates the 640 survey responses by channel and by satisfaction level (satisfied = score ≥ 8):

Satisfied (≥ 8) Not satisfied (≤ 7) Total
In-store 336 112 448
Online 80 48 128
App 40 24 64
Total 456 184 640

Check: \( 456/640 = 0.7125 \approx 71.2,% \) satisfied, consistent with Module 2. All three types of probability come straight out of the table:

  • Joint (cell / grand total): \( P(\text{Online} \cap \text{Satisfied}) = 80/640 = 0.125 \).
  • Marginal (margin / grand total): \( P(\text{Online}) = 128/640 = 0.20 \).
  • Conditional (cell / its row or column total): \( P(\text{Satisfied} \mid \text{Online}) = 80/128 = 0.625 \).

And the independence question is answered by comparing conditionals with marginals:

\[ P(\text{Satisfied} \mid \text{In-store}) = \frac{336}{448} = 0.75 \qquad P(\text{Satisfied} \mid \text{Online}) = 0.625 \qquad P(\text{Satisfied} \mid \text{App}) = \frac{40}{64} = 0.625 \]

Since these do not match the marginal \( P(\text{Satisfied}) = 0.7125 \), channel and satisfaction are dependent: satisfaction is higher in-store than in the digital channels, in line with the means we already knew (8.3 / 7.6 / 7.9). Whether that dependence is "statistically significant" or attributable to sampling chance is another question, which the chi-square test will answer much later in the course.

Tree diagrams and the law of total probability

When the experiment unfolds in stages (first one thing, then another), the tree diagram is the natural tool: each branch carries its probability, the branches leaving the same node add up to 1, and the probability of a complete path is the product of its branches (the multiplication rule in action).

NovaMarket case: e-commerce deliveries. NovaMarket ships its online orders with two carriers: LogiExpress moves 70% of the shipments and delivers late (outside the 48-hour SLA) 8% of the time; RápidoSur moves the remaining 30% and runs late 15% of the time.

flowchart LR
    R((Order)) -->|0.70| L[LogiExpress]
    R -->|0.30| S[RápidoSur]
    L -->|0.08| LT["Late: 0.70 × 0.08 = 0.056"]
    L -->|0.92| LO["On time: 0.70 × 0.92 = 0.644"]
    S -->|0.15| ST["Late: 0.30 × 0.15 = 0.045"]
    S -->|0.85| SO["On time: 0.30 × 0.85 = 0.255"]

What is the probability that an arbitrary order arrives late? A late order comes through one of two mutually exclusive paths (late with LogiExpress, or late with RápidoSur), so we add the paths:

\[ P(\text{Late}) = P(L),P(\text{Late} \mid L) + P(S),P(\text{Late} \mid S) = 0.70 \times 0.08 + 0.30 \times 0.15 = 0.056 + 0.045 = 0.101 \]

This is the law of total probability: if \( B_1, B_2, \dots, B_k \) form a partition of the sample space (mutually exclusive and jointly covering everything),

\[ P(A) = \sum_{i=1}^{k} P(B_i),P(A \mid B_i) \]

It is a weighted average of the conditionals, with the scenario probabilities as weights — the same logic as the weighted mean from Module 2. Business takeaway: 10.1% of orders late means an SLA compliance of 89.9%, just below the "90% in under 48 h" target. Marta wants to know where to push, and for that she needs to turn the question around.

Bayes' theorem and the base-rate fallacy

So far we have reasoned "forwards": from carrier to delay. Bayes' theorem lets us reason "backwards": having observed the effect (the order arrived late), what probability does each cause (each carrier) carry?

\[ P(B_i \mid A) = \frac{P(B_i),P(A \mid B_i)}{P(A)} = \frac{P(B_i),P(A \mid B_i)}{\sum_j P(B_j),P(A \mid B_j)} \]

The numerator is the tree path we care about; the denominator, the total probability (all the paths that produce \( A \)).

Applied to deliveries: a customer calls because their order arrived late. Probability that RápidoSur delivered it?

\[ P(S \mid \text{Late}) = \frac{0.30 \times 0.15}{0.101} = \frac{0.045}{0.101} \approx 0.446 \]

RápidoSur moves only 30% of the orders, yet it is behind 44.6% of the delays: the information "it arrived late" nearly doubles its probability (from 0.30 prior to 0.446 posterior). That is exactly the kind of belief updating that Bayes formalizes.

Full worked case: fraud detection in online orders

The e-commerce team rolls out a new anti-fraud system. The facts of the problem:

  • 0.5% of online orders are fraudulent: \( P(\text{Fraud}) = 0.005 \) (the base rate).
  • If an order is fraudulent, the system flags it 92% of the time: \( P(\text{Alert} \mid \text{Fraud}) = 0.92 \) (sensitivity).
  • If an order is legitimate, the system gets it wrong and flags it 4% of the time: \( P(\text{Alert} \mid \text{Legitimate}) = 0.04 \) (false-positive rate).

The system flags an order. The head of e-commerce exclaims: "92% sure it's fraud — cancel it!". Let's see what Bayes says. Step 1, total probability of getting an alert:

\[ P(\text{Alert}) = \underbrace{0.005 \times 0.92}{\text{frauds flagged}} + \underbrace{0.995 \times 0.04}{\text{legitimates flagged}} = 0.0046 + 0.0398 = 0.0444 \]

Step 2, Bayes:

\[ P(\text{Fraud} \mid \text{Alert}) = \frac{0.0046}{0.0444} \approx 0.104 \]

Only 10.4% of the alerts are actual fraud. To see it without formulas, picture 10,000 orders:

10,000 orders With alert Without alert Total
Fraudulent 46 4 50
Legitimate 398 9,552 9,950
Total 444 9,556 10,000

Out of 444 alerts, only 46 are fraud: \( 46/444 \approx 0.104 \). The e-commerce head confused \( P(\text{Alert} \mid \text{Fraud}) = 0.92 \) with \( P(\text{Fraud} \mid \text{Alert}) = 0.104 \). Ignoring the fact that fraud is extremely rare to begin with (0.5%) is called the base-rate fallacy: when the event you are hunting for is rare, even a good detector produces mostly false positives. Practical consequence: alerts should not cancel orders automatically, but trigger a cheap additional verification instead (and the good news: with no alert, \( P(\text{Fraud} \mid \text{No alert}) = 4/9{,}556 \approx 0.0004 \), so the system does work as a way of ruling fraud out).

Common Mistakes and Tips

  • Adding probabilities of compatible events without subtracting the intersection. If the result exceeds 1, that is the telltale sign of this error. The general formula \( P(A)+P(B)-P(A \cap B) \) never fails; the short version is only valid for mutually exclusive events.
  • Confusing \( P(A \mid B) \) with \( P(B \mid A) \). "92% of frauds trigger an alert" is not "92% of alerts are fraud". When in doubt, build the 10,000-case table: it makes the mistake impossible.
  • Treating mutually exclusive events as independent. Mutually exclusive with positive probability = extreme dependence. Repeat it until it sinks in.
  • Multiplying \( P(A) \cdot P(B) \) without checking independence. The general multiplication rule uses \( P(A),P(B \mid A) \); the shortcut \( P(A)P(B) \) is only valid when independence is justified (by the design of the process, or verified with data).
  • Forgetting the base rate. Every posterior probability blends two ingredients: the evidence (sensitivity, false positives) and the prior prevalence. Leaving out the second one inflates the result dramatically.
  • Practical tip: faced with any probability problem involving two variables, draw the contingency table or the tree first. 90% of mistakes vanish once you organize the data before calculating.

Exercises

Exercise 1. Using the lesson's channel × satisfaction contingency table, compute: (a) \( P(\text{App} \cup \text{Satisfied}) \); (b) \( P(\text{Not satisfied} \mid \text{App}) \); (c) are "App" and "Satisfied" independent? Justify with numbers.

Exercise 2. At Madrid-Chamberí, 61% of receipts are paid by card. 25% of card receipts exceed €50, while only 10% of non-card receipts exceed that figure. (a) Sketch the tree in your head (or on paper) and compute the probability that an arbitrary receipt exceeds €50. (b) A receipt exceeds €50: what is the probability it was paid by card?

Exercise 3. Marta is building a Club Nova churn-prediction model: 3% of members cancel their membership each year; the model flags 80% of those who will cancel, but also (incorrectly) 9% of those who won't. A member shows up flagged: what is the probability that they will really cancel? Is it worth calling them to offer a retention discount that costs €15, if a retained member contributes €120 a year on average? Reason it out.

Solutions

Solution 1. (a) General addition rule: \( P(\text{App}) + P(\text{S}) - P(\text{App} \cap \text{S}) = \frac{64}{640} + \frac{456}{640} - \frac{40}{640} = \frac{480}{640} = 0.75 \). (b) \( P(\text{Not S} \mid \text{App}) = 24/64 = 0.375 \). (c) No: \( P(\text{S} \mid \text{App}) = 0.625 \neq 0.7125 = P(\text{S}) \). Knowing that the response came from the app lowers the probability of satisfaction, so they are dependent. Common mistake in (a): forgetting to subtract the 40 satisfied app users, who are counted in both terms.

Solution 2. (a) Total probability: \( P(>50) = 0.61 \times 0.25 + 0.39 \times 0.10 = 0.1525 + 0.039 = 0.1915 \), so 19.15% of receipts. (b) Bayes: \( P(\text{Card} \mid >50) = 0.1525 / 0.1915 \approx 0.796 \). Nearly 80% of large receipts are paid by card, versus 61% overall: high amounts "pull" towards the card. Common mistake: answering 0.25 in (b) — that is \( P(>50 \mid \text{Card}) \), the transposed conditional.

Solution 3. Total probability of being flagged: \( P(\text{Flag}) = 0.03 \times 0.80 + 0.97 \times 0.09 = 0.024 + 0.0873 = 0.1113 \). Bayes: \( P(\text{Churn} \mid \text{Flag}) = 0.024/0.1113 \approx 0.216 \). Only 1 in 5 flagged members will actually cancel — the 3% base rate weighs heavily. Is it worth it? Rough calculation per flagged member: a certain cost of €15; expected benefit if the cancellation is averted ≈ \( 0.216 \times 120 = 25.92 \) euros (assuming, for simplicity, that the discount retains the member). Since €25.92 > €15, the call pays off even though 78% of the calls turn out to be "unnecessary". Feedback: we will formalize this "expected value" reasoning in the next lesson; and beware the usual trap of dismissing the model "because it's wrong 78% of the time": with rare events, the yardstick is not the hit rate but whether the posterior probability (21.6%) improves on the base rate (3%) enough to act profitably — here it multiplies it by 7.

Conclusion

We now know how to operate with probabilities: the addition rule (subtracting the intersection when events are compatible), conditional probability as a shrinking of the sample space, the multiplication rule for intersections, and the crucial difference between independence (the information changes nothing) and mutual exclusivity (the information changes everything). With contingency tables and tree diagrams as support, the law of total probability gave us the "forward" view (10.1% of orders arrive late) and Bayes' theorem the "backward" view (a fraud alert is right only 10.4% of the time), with the base-rate fallacy as a standing warning.

Up to here we have worked with events described in words. The next step is to translate chance into numbers: instead of "the order arrives late", define a variable that counts how many orders arrive late or measures how many hours each one takes, and assign probabilities to all of its possible values at once. That is the idea of a random variable, and with it comes expected value — the foundation of the "expected value" reasoning we just used in the retention exercise. We cover it in Random Variables and Probability Distributions.

© Copyright 2026. All rights reserved