Probability — step-by-step proofs with the spam filter: from the axioms to Bayes (and the union that came out as 1.15)

In a class mock exam I added the probabilities of two events and got 1.15, and that is when I learnt that properties are not recited, they are proved. I had written P(A∪B)=P(A)+P(B) P(A \cup B) = P(A) + P(B) for two events that overlapped. Had I known where the union formula comes from, I would have seen at once that I was missing a subtraction.

This article is the second part of the probability topic. In the theory you saw the results and how to use them with the email spam filter; here you see why they are true, which is what the “prove that” questions in the exam ask for. Every proof follows the same pattern: what we want to prove, what we start from, the steps one by one with the rule that justifies each, where people usually get stuck, the result for the cheat sheet and a check in R using the data from the week of 400 emails. At the end there are three for you to do, with the solution folded away.

Before you start: the rules we will use

Every proof in this article comes from very few pieces. We number them so we can cite them at each step (“by R3”):

  • R1 (axiom 1). P(A)≥0 P(A) \ge 0 for every event A.
  • R2 (axiom 2). P(Ω)=1 P(\Omega) = 1 .
  • R3 (axiom 3). If A1,A2,… A_1, A_2, \dots are pairwise disjoint, P(⋃iAi)=∑iP(Ai) P\left( \bigcup_i A_i \right) = \sum_i P(A_i) . In particular, for two: if A∩B=∅ A \cap B = \emptyset , P(A∪B)=P(A)+P(B) P(A \cup B) = P(A) + P(B) .
  • R4 (set algebra). A∪Ac=Ω A \cup A^c = \Omega , A∩Ac=∅ A \cap A^c = \emptyset , the distributive law (A∪B)∩C=(A∩C)∪(B∩C) (A \cup B) \cap C = (A \cap C) \cup (B \cap C) and De Morgan’s laws (A∪B)c=Ac∩Bc (A \cup B)^c = A^c \cap B^c , (A∩B)c=Ac∪Bc (A \cap B)^c = A^c \cup B^c .
  • R5 (conditional). If P(B)>0 P(B) > 0 , P(A∣B)=P(A∩B)/P(B) P(A \mid B) = P(A \cap B)/P(B) , and therefore P(A∩B)=P(A∣B) P(B) P(A \cap B) = P(A \mid B)\,P(B) .
  • R6 (multiplication principle). A task of p p steps with n1,…,np n_1, \dots, n_p options can be done in n1⋯np n_1 \cdots n_p ways.

The strategy behind almost all of them is the same, and it is worth having it in mind before starting: write the set you care about as a union of pieces that do not overlap and apply R3. If the pieces overlapped, R3 could not be used.

In the exam, cite the rule at each step even if it looks obvious (“by axiom 3, since they are disjoint…”). That is what makes a proof different from a calculation, and it is what gets marked.

Proof 1: the complement, the empty set and monotonicity

Where we are going. To derive from the axioms the three rules you will use in every exercise: the complement (the quick route for “at least one”), that the empty set has probability 0 and that a bigger event cannot be less likely. None of them is an axiom, and that is why they have to be proved. Monotonicity also gives P(A)≤1 P(A) \le 1 , the piece Bonferroni needs in proof 3.

What we want to prove. Three properties used all the time:

  1. P(Ac)=1−P(A) P(A^c) = 1 – P(A) .
  2. P(∅)=0 P(\emptyset) = 0 .
  3. If A⊂B A \subset B , then P(A)≤P(B) P(A) \le P(B) (and in particular P(A)≤1 P(A) \le 1 ).

What we start from. Only the axioms (R1, R2, R3) and R4.

Splitting Ω into disjoint piecesLeft: Ω split into A and its complement, disjoint and together equal to Ω. Right: A inside B, and B split into A and B without A.AAᶜΩA ∪ Aᶜ = Ω, A ∩ Aᶜ = ∅→ P(A) + P(Aᶜ) = 1AB ∩ AᶜB = A ∪ (B ∩ Aᶜ)→ P(B) = P(A) + something ≥ 0ComplementA ⊂ B
The trick behind almost every property: write a set as a union of pieces that do not overlap and apply axiom 3.

Step by step (1). The left drawing is the idea: A and its complement split Ω \Omega in two pieces.

  1. By R4, A∪Ac=Ω A \cup A^c = \Omega and A∩Ac=∅ A \cap A^c = \emptyset : they are disjoint and together they make Ω \Omega .
  2. Since they are disjoint, by R3: P(A∪Ac)=P(A)+P(Ac) P(A \cup A^c) = P(A) + P(A^c) .
  3. But A∪Ac=Ω A \cup A^c = \Omega , and by R2 P(Ω)=1 P(\Omega) = 1 . So P(A)+P(Ac)=1 P(A) + P(A^c) = 1 .
  4. Solving: P(Ac)=1−P(A) P(A^c) = 1 – P(A) .

Step by step (2). A special case of (1).

  1. The complement of Ω \Omega is ∅ \emptyset (there is nothing outside Ω \Omega ).
  2. By (1) with A=Ω A = \Omega : P(∅)=P(Ωc)=1−P(Ω)=1−1=0 P(\emptyset) = P(\Omega^c) = 1 – P(\Omega) = 1 – 1 = 0 .

Step by step (3). Now the right drawing: A is inside B, and what A is missing to become B is B∩Ac B \cap A^c .

  1. Since A⊂B A \subset B , we can write B=A∪(B∩Ac) B = A \cup (B \cap A^c) : B is A plus “the part of B that is not in A”.
  2. Those two pieces are disjoint: A∩(B∩Ac)=(A∩Ac)∩B=∅∩B=∅ A \cap (B \cap A^c) = (A \cap A^c) \cap B = \emptyset \cap B = \emptyset (R4).
  3. By R3: P(B)=P(A)+P(B∩Ac) P(B) = P(A) + P(B \cap A^c) .
  4. By R1, P(B∩Ac)≥0 P(B \cap A^c) \ge 0 . So P(B)≥P(A) P(B) \ge P(A) .
  5. Since every event is inside Ω \Omega , P(A)≤P(Ω)=1 P(A) \le P(\Omega) = 1 .

Notice that step 3 gives something stronger than the inequality: P(B∩Ac)=P(B)−P(A) P(B \cap A^c) = P(B) – P(A) when A⊂B A \subset B . You will use it in the next proof.

Writing P(B)=P(A)+P(B) P(B) = P(A) + P(B) or “B=A∪B B = A \cup B ” and applying R3. Axiom 3 only works for disjoint pieces; A and B overlap (A is entirely inside B). That is why B must be split into A and B∩Ac B \cap A^c .

Result for the cheat sheet. P(Ac)=1−P(A) P(A^c) = 1 – P(A) · P(∅)=0 P(\emptyset) = 0 · if A⊂B A \subset B : P(A)≤P(B) P(A) \le P(B) and P(B∖A)=P(B)−P(A) P(B \setminus A) = P(B) – P(A) · 0≤P(A)≤1 0 \le P(A) \le 1 .

Check it with R. With the week of 400 emails: the event A = “spam and free” is inside B = “spam”.

n <- 400
p_spam <- 100 / n; p_legitimate <- 300 / n
c(complement = 1 - p_spam, counted = p_legitimate)        # must match: 0.75
p_A <- 60 / n                                            # A = spam and free (inside B)
p_B <- 100 / n                                           # B = spam
c(P_A = p_A, P_B = p_B, difference = p_B - p_A, spam_not_free = 40 / n)

Output:

complement    counted 
      0.75       0.75 
          P_A           P_B    difference spam_not_free 
         0.15          0.25          0.10          0.10 

The first line confirms that 1−0.25=0.75 1 – 0.25 = 0.75 is exactly the proportion of legitimate emails counted. The second, that P(B)−P(A)=0.25−0.15=0.10 P(B) – P(A) = 0.25 – 0.15 = 0.10 matches the 40 spam without “free” out of 400: it is P(B∩Ac) P(B \cap A^c) , the piece A was missing.

Check you’ve got it: at which step of monotonicity do we use that A is inside B? Try A = “spam” and B = “free”, which do not satisfy it.

In the first one, when writing B=A∪(B∩Ac) B = A \cup (B \cap A^c) . If A is not inside B, that right-hand side is no longer B but A∪B A \cup B . With the week: A is 100 emails and B∩Ac B \cap A^c is the 15 legitimate emails with “free”; the right-hand side has 115 emails and B only 75. That is why here P(A)=0.25 P(A) = 0.25 can be larger than P(B)=0.1875 P(B) = 0.1875 without contradicting anything.

Proof 2: the probability of the union

Where we are going. To the union formula when the events overlap, which is exactly what went wrong in my mock exam. Axiom 3 only works for pieces that do not overlap; here we will see how to split A∪B A \cup B so we can use it anyway. Bonferroni, the union of three events and the first “Prove it yourself” all come from this formula.

What we want to prove. For any two events (whether they overlap or not):

P(A∪B)=P(A)+P(B)−P(A∩B) P(A \cup B) = P(A) + P(B) – P(A \cap B)

What we start from. R3, R4 and the result from step 3 of proof 1.

The intersection is counted twiceTwo overlapping circles A and B, split into three disjoint pieces: A without B, the intersection and B without A. Adding P of A and P of B, the intersection goes in twice.A ∩ BᶜA∩Bcounted twice!Aᶜ ∩ BP(A) + P(B) = P(A∩Bᶜ) + 2·P(A∩B) + P(Aᶜ∩B)so P(A ∩ B) is subtracted once
A ∪ B is three pieces that do not overlap; P(A) + P(B) counts the middle one twice.

The idea. In the drawing, A∪B A \cup B is three pieces that do not overlap: A without B, the intersection, and B without A. When we add P(A)+P(B) P(A) + P(B) , the middle piece goes in twice. We have to subtract it once.

Step by step.

  1. We split the union into two disjoint pieces: A∪B=A∪(B∩Ac) A \cup B = A \cup (B \cap A^c) . That is, “all of A, plus the part of B that is not in A”. They are disjoint for the same reason as in proof 1: A∩(B∩Ac)=∅ A \cap (B \cap A^c) = \emptyset .
  2. By R3: P(A∪B)=P(A)+P(B∩Ac) P(A \cup B) = P(A) + P(B \cap A^c) .
  3. Now we split B: B=(B∩A)∪(B∩Ac) B = (B \cap A) \cup (B \cap A^c) , also disjoint (one is inside A and the other outside). This follows from R4: B=B∩Ω=B∩(A∪Ac)=(B∩A)∪(B∩Ac) B = B \cap \Omega = B \cap (A \cup A^c) = (B \cap A) \cup (B \cap A^c) by the distributive law.
  4. By R3: P(B)=P(B∩A)+P(B∩Ac) P(B) = P(B \cap A) + P(B \cap A^c) , so P(B∩Ac)=P(B)−P(A∩B) P(B \cap A^c) = P(B) – P(A \cap B) .
  5. Substituting into step 2: P(A∪B)=P(A)+P(B)−P(A∩B) P(A \cup B) = P(A) + P(B) – P(A \cap B) .

Where people get stuck. In step 1. The temptation is to write A∪B A \cup B as “A plus B” and be done. But A and B are not disjoint, and axiom 3 cannot be used. The whole trick of the proof is finding a split into pieces that are disjoint.

In the exam, stating the union formula “by definition”. It is not a definition: it is a consequence of the axioms, and in a “prove that” question it has to be derived.

Result for the cheat sheet. P(A∪B)=P(A)+P(B)−P(A∩B) P(A \cup B) = P(A) + P(B) – P(A \cap B) ; if they are disjoint, P(A∪B)=P(A)+P(B) P(A \cup B) = P(A) + P(B) . With three: P(A∪B∪C)=P(A)+P(B)+P(C)−P(A∩B)−P(A∩C)−P(B∩C)+P(A∩B∩C) P(A \cup B \cup C) = P(A) + P(B) + P(C) – P(A \cap B) – P(A \cap C) – P(B \cap C) + P(A \cap B \cap C) .

Check it with R. With S = spam and F = free: the formula against counting directly the emails that are spam or say free.

n <- 400
p_S <- 100 / n; p_F <- 75 / n; p_SF <- 60 / n
formula <- p_S + p_F - p_SF                     # P(S) + P(F) - P(S and F)
counted <- (60 + 40 + 15) / n                   # the spam cells (60 + 40) plus legitimate with free (15)
c(formula = formula, counted = counted, no_subtraction = p_S + p_F)

Output:

       formula        counted no_subtraction 
        0.2875         0.2875         0.4375 

The formula and the count both give 0.2875. The no_subtraction column (0.4375) is my mock exam mistake: the 60 emails in the intersection counted twice.

Check you’ve got it: if A and B are disjoint, what is left of the formula, and at which step of the proof do you notice it?

You are left with P(A∪B)=P(A)+P(B) P(A \cup B) = P(A) + P(B) , axiom 3: the term being subtracted is P(∅)=0 P(\emptyset) = 0 (proof 1). In the proof you notice it at the first step: if they do not overlap, the part of B that is not in A is the whole of B, B∩Ac=B B \cap A^c = B , and the partition is directly A and B. The general formula contains the axiom as a special case.

Proof 3: Bonferroni and the union bound

Where we are going. Sometimes you know P(A) P(A) and P(B) P(B) but not how they are related, and without P(A∩B) P(A \cap B) the union formula cannot be used. These two inequalities say what can still be stated: a minimum for the intersection (Bonferroni) and a maximum for the union (Boole). With many alarms, Boole guarantees that the probability of at least one going off never exceeds the sum.

What we want to prove. Two inequalities:

  1. Bonferroni: P(A∩B)≥P(A)+P(B)−1 P(A \cap B) \ge P(A) + P(B) – 1 .
  2. Boole (union bound): for any n≥1 n \ge 1 , P(⋃i=1nAi)≤∑i=1nP(Ai) P\left( \bigcup_{i=1}^{n} A_i \right) \le \sum_{i=1}^{n} P(A_i) .

What we start from. The union formula (proof 2) and the fact that every probability is at most 1 (proof 1). For the second, induction.

Step by step (1).

  1. By proof 2: P(A∩B)=P(A)+P(B)−P(A∪B) P(A \cap B) = P(A) + P(B) – P(A \cup B) (the union formula with the intersection isolated).
  2. By proof 1, P(A∪B)≤1 P(A \cup B) \le 1 , so −P(A∪B)≥−1 -P(A \cup B) \ge -1 .
  3. Adding P(A)+P(B) P(A) + P(B) to both sides: P(A∩B)≥P(A)+P(B)−1 P(A \cap B) \ge P(A) + P(B) – 1 .

What is it for? It bounds the intersection without knowing anything about how A and B are related. If the ULPGC filter stops 90 % of the spam and Gmail’s 80 %, at least 0.90+0.80−1=0.70 0.90 + 0.80 – 1 = 0.70 of the spam is stopped by both, whether they are independent or not.

The union boundThree overlapping circles. Zones shared by two carry a 2 and the center a 3: the sum of the three probabilities counts those zones several times, so it is greater than or equal to the probability of the union.A₁A₂A₃3222The numbers:how many times thesum counts eachzone, ΣP(Aᵢ)P(A₁ ∪ A₂ ∪ A₃) ≤ P(A₁) + P(A₂) + P(A₃)
The union counts each zone once; the sum, as many times as circles cover it. So the sum overshoots (or ties if they are disjoint).

Step by step (2). The drawing gives the intuition: the union counts each zone once; the sum of probabilities, as many times as circles cover it. The formal proof is by induction on n n .

  1. Base case, n=2 n = 2 . By proof 2, P(A1∪A2)=P(A1)+P(A2)−P(A1∩A2)≤P(A1)+P(A2) P(A_1 \cup A_2) = P(A_1) + P(A_2) – P(A_1 \cap A_2) \le P(A_1) + P(A_2) , because P(A1∩A2)≥0 P(A_1 \cap A_2) \ge 0 (R1). (For n=1 n = 1 it is a trivial equality.)
  2. Induction hypothesis. We assume it is true for n−1 n – 1 events: P(⋃i=1n−1Ai)≤∑i=1n−1P(Ai) P\left( \bigcup_{i=1}^{n-1} A_i \right) \le \sum_{i=1}^{n-1} P(A_i) .
  3. Step. Call B=⋃i=1n−1Ai B = \bigcup_{i=1}^{n-1} A_i . The union of the n n events is B∪An B \cup A_n : two events. By the base case: P(B∪An)≤P(B)+P(An) P(B \cup A_n) \le P(B) + P(A_n) .
  4. By the induction hypothesis, P(B)≤∑i=1n−1P(Ai) P(B) \le \sum_{i=1}^{n-1} P(A_i) . Substituting: P(⋃i=1nAi)≤∑i=1n−1P(Ai)+P(An)=∑i=1nP(Ai) P\left( \bigcup_{i=1}^{n} A_i \right) \le \sum_{i=1}^{n-1} P(A_i) + P(A_n) = \sum_{i=1}^{n} P(A_i) .
  5. Since it holds for n=2 n = 2 and, if it holds for n−1 n – 1 , it holds for n n , it holds for every n≥2 n \ge 2 .

Why the base case works for a whole union

The step people skip most is applying the base case to B∪An B \cup A_n . The base case does not say “for two simple events” but “for any two events”, and B is an event like any other even though it is the union of the first n−1 n – 1 . Then the two inequalities chain because they point the same way: P(B∪An)≤P(B)+P(An) P(B \cup A_n) \le P(B) + P(A_n) , and P(B) P(B) is at most the sum of the first n−1 n – 1 . If one were ≤ \le and the other ≥ \ge , they could not be combined.

Where people get stuck. In step 3: seeing that the union of n n events can be treated as the union of two (the first n−1 n – 1 together, and the last one). That is the trick of almost every induction with unions.

In an induction, checking the base case and “generalising” without writing the hypothesis or the step from n−1 n – 1 to n n . Without step 4 there is no proof.

Result for the cheat sheet. Bonferroni: P(A∩B)≥P(A)+P(B)−1 P(A \cap B) \ge P(A) + P(B) – 1 . Boole: P(⋃Ai)≤∑P(Ai) P\left( \bigcup A_i \right) \le \sum P(A_i) , with equality if the Ai A_i are disjoint.

Check it with R. We simulate 10,000 emails with three spam “signals” that sometimes coincide (a link, “free” and an unknown sender) and compare the proportion of emails with some signal with the sum of the three proportions.

set.seed(2026)
n <- 10000
link    <- runif(n) < 0.40
free    <- runif(n) < 0.20
unknown <- (runif(n) < 0.30) | (free & runif(n) < 0.5)   # overlaps with "free" on purpose
union <- mean(link | free | unknown)                     # | is the logical "or": some signal
total <- mean(link) + mean(free) + mean(unknown)
c(union = union, sum = total, holds = union <= total)
bonferroni <- c(intersection = mean(link & free), bound = mean(link) + mean(free) - 1)
bonferroni

Output:

 union    sum  holds 
0.6617 0.9727 1.0000 
intersection        bound 
      0.0828      -0.3949 

The union (0.6617) stays below the sum (0.9727), as Boole says: the difference is the emails with two or three signals, counted more than once in the sum. The 1 under holds is a TRUE: c() puts numbers and logicals in one vector and turns TRUE into 1. In the second output, the Bonferroni bound is negative: it is true but says nothing. Bonferroni is only useful when P(A)+P(B) P(A) + P(B) is clearly above 1, as in the example of the two filters.

Check you’ve got it: with the week of 400 emails, what bound does Bonferroni give for P(spam and free)? Is it any use?

P(S)+P(F)−1=0.25+0.1875−1=−0.5625 P(S) + P(F) – 1 = 0.25 + 0.1875 – 1 = -0.5625 . It is true, because the real intersection is 60/400=0.15 60/400 = 0.15 , which is larger, but it says nothing: we already knew a probability cannot go below 0 (R1). Bonferroni only helps when the two probabilities add up to clearly more than 1, as with the two filters (0.90+0.80−1=0.70 0.90 + 0.80 – 1 = 0.70 ).

Proof 4: the number of combinations and Pascal’s identity

Where we are going. To see where (nr) \binom{n}{r} comes from without memorising it: by counting the same thing in two ways. It matters because, with equally likely outcomes, probability is favourable over possible, and counting them almost always needs this formula. Pascal shows the other counting trick: split into piles that do not overlap and add.

What we want to prove.

  1. The number of ways to choose r r objects out of n n , without order and without repetition, is (nr)=n!r! (n−r)! \dbinom{n}{r} = \dfrac{n!}{r!\,(n-r)!} .
  2. Pascal’s identity: if 1≤r≤n−1 1 \le r \le n – 1 , (nr)=(n−1r−1)+(n−1r) \dbinom{n}{r} = \dbinom{n-1}{r-1} + \dbinom{n-1}{r} .

What we start from. The multiplication principle (R6) and the number of ordered lists without repetition, n(n−1)⋯(n−r+1) n(n-1)\cdots(n-r+1) .

From ordered lists to groupsThe 24 ordered lists of 3 different letters taken from a, b, c and d, split into 4 columns, one per unordered group: abc, abd, acd and bcd. Each column has 6 lists, 3 factorial.3 blacklist words from {a, b, c, d}: 24 ordered lists, 4 groups{a, b, c}abcacbbacbcacabcba{a, b, d}abdadbbadbdadabdba{a, c, d}acdadccadcdadacdca{b, c, d}bcdbdccbdcdbdbcdcb24 = 4 · 3! → C(4, 3) = 24 / 3! = 4
Each group appears 3! = 6 times among the ordered lists: that is why we divide by r!.

Step by step (1). We count the ordered lists in two ways and set them equal.

  1. First way (directly). For an ordered list of r r distinct objects, the first is chosen from n n , the second from n−1 n – 1 , …, the last from n−r+1 n – r + 1 . By R6 there are n(n−1)⋯(n−r+1)=n!(n−r)! n(n-1)\cdots(n-r+1) = \dfrac{n!}{(n-r)!} lists.
  2. Second way (in two steps). An ordered list can be built by first choosing which r r objects go in (an unordered group: (nr) \binom{n}{r} ways, which is what we want to count) and then in which order (r! r! ways to order r r objects). By R6 there are (nr)⋅r! \binom{n}{r} \cdot r! lists.
  3. Both count the same thing, so (nr)⋅r!=n!(n−r)! \binom{n}{r} \cdot r! = \dfrac{n!}{(n-r)!} .
  4. Solving: (nr)=n!r! (n−r)! \dbinom{n}{r} = \dfrac{n!}{r!\,(n-r)!} .

The why behind the first equality, n(n−1)⋯(n−r+1)=n!/(n−r)! n(n-1)\cdots(n-r+1) = n!/(n-r)! : n! n! contains every factor from n down to 1, and dividing by (n−r)! (n-r)! cancels those from n−r n – r down to 1. The first r are left. With n=4 n = 4 and r=3 r = 3 : 4!/1!=24=4⋅3⋅2 4!/1! = 24 = 4 \cdot 3 \cdot 2 . And the r! r! ways of ordering a group are R6 again: r options for the first place, r−1 r – 1 for the second, and so on down to 1.

In the drawing, with n=4 n = 4 blacklist words and r=3 r = 3 : there are 4⋅3⋅2=24 4 \cdot 3 \cdot 2 = 24 ordered lists, which group into 4 columns of 3!=6 3! = 6 , one per unordered group. That is why (43)=24/6=4 \binom{4}{3} = 24/6 = 4 .

Pascal’s identity by countingThe groups of r emails out of n split in two: those that contain email number n, which are C of n minus 1 and r minus 1, and those that do not, which are C of n minus 1 and r. Example: 10 equals 4 plus 6.Groups of r out of n emailsC(n, r)email n IS inr − 1 more from the other n − 1C(n − 1, r − 1)email n is NOT inall r from the other n − 1C(n − 1, r)C(n, r) = C(n − 1, r − 1) + C(n − 1, r)Example: C(5, 2) = C(4, 1) + C(4, 2) = 4 + 6 = 10
A yes-or-no question about one element splits the groups into two piles that do not overlap.

Step by step (2). It can be done with factorials, but the counting proof is shorter and easier to understand. Look at one of the n n emails, the last one.

  1. The groups of r r emails out of n n split into two piles that do not overlap: those that contain email n n and those that do not.
  2. If email n n is in, r−1 r – 1 more must be chosen from the other n−1 n – 1 : there are (n−1r−1) \binom{n-1}{r-1} groups.
  3. If it is not, all r r are chosen from the other n−1 n – 1 : there are (n−1r) \binom{n-1}{r} groups.
  4. Since each group is in one and only one pile, the total is the sum: (nr)=(n−1r−1)+(n−1r) \binom{n}{r} = \binom{n-1}{r-1} + \binom{n-1}{r} .

With numbers: (52)=10 \binom{5}{2} = 10 , and (41)+(42)=4+6=10 \binom{4}{1} + \binom{4}{2} = 4 + 6 = 10 .

If you are asked to do it with factorials, the way is to add the two fractions over the common denominator r! (n−r)! r!\,(n-r)! :

(n−1)!(r−1)! (n−r)!+(n−1)!r! (n−r−1)!=r (n−1)!+(n−r) (n−1)!r! (n−r)!=n (n−1)!r! (n−r)!=n!r! (n−r)! \frac{(n-1)!}{(r-1)!\,(n-r)!} + \frac{(n-1)!}{r!\,(n-r-1)!} = \frac{r\,(n-1)! + (n-r)\,(n-1)!}{r!\,(n-r)!} = \frac{n\,(n-1)!}{r!\,(n-r)!} = \frac{n!}{r!\,(n-r)!}

In the first term we multiplied top and bottom by r r (because r⋅(r−1)!=r! r \cdot (r-1)! = r! ); in the second, by n−r n – r (because (n−r)(n−r−1)!=(n−r)! (n-r)(n-r-1)! = (n-r)! ).

Where people get stuck. In the factorial version, in seeing why we multiply by r r and by n−r n – r . If you get stuck, write down what is missing for both denominators to be equal: the first one lacks an r r to have r! r! ; the second, an (n−r) (n-r) to have (n−r)! (n-r)! .

Dividing by r! r! “just because”. You have to say why: each unordered group appears exactly r! r! times among the ordered lists.

Result for the cheat sheet. (nr)=n!r!(n−r)! \binom{n}{r} = \frac{n!}{r!(n-r)!} · (n0)=(nn)=1 \binom{n}{0} = \binom{n}{n} = 1 · (nr)=(nn−r) \binom{n}{r} = \binom{n}{n-r} · Pascal: (nr)=(n−1r−1)+(n−1r) \binom{n}{r} = \binom{n-1}{r-1} + \binom{n-1}{r} · ∑k=0n(nk)=2n \sum_{k=0}^{n} \binom{n}{k} = 2^n .

Check it with R. combn() actually generates every group; ncol() counts them. So we can compare the formula with the full list.

groups <- combn(20, 3)                      # every group of 3 words out of 20, one per column
ncol(groups)                                # how many there are, counted one by one
factorial(20) / (factorial(3) * factorial(17))   # the formula
choose(5, 2) == choose(4, 1) + choose(4, 2)      # Pascal with n = 5, r = 2
n <- 12
all(choose(n, 0:n) == choose(n, n:0))            # symmetry for every r at once
sum(choose(n, 0:n)) == 2^n                       # the sum of a row of Pascal's triangle

Output:

[1] 1140
[1] 1140
[1] TRUE
[1] TRUE
[1] TRUE

The 1140 groups generated one by one match the formula, Pascal holds, and so does symmetry for the thirteen values of r r from 0 to 12. The last line is the cheat sheet result ∑(nk)=2n \sum \binom{n}{k} = 2^n : the total number of subsets of 12 words.

Check you’ve got it: with 20 words and groups of 3, which two piles do you get by looking at the last word, and how many groups does each one have?

The ones that contain it: 2 more are needed from the other 19, (192)=171 \binom{19}{2} = 171 . The ones that do not: all 3 come from the 19, (193)=969 \binom{19}{3} = 969 . Each group is in exactly one pile, so the total is 171+969=1140 171 + 969 = 1140 , what combn() counted. By the first part: 20⋅19⋅18=6840 20 \cdot 19 \cdot 18 = 6840 lists divided by 3!=6 3! = 6 orders, 1140 again.

Proof 5: conditional probability is a probability

Where we are going. To prove that, once you know B has happened, the new probabilities are still a real probability. It matters because it saves work: if it satisfies the three axioms, everything in proofs 1 to 3 holds with “∣B \mid B ” after it without proving it again.

What we want to prove. If P(B)>0 P(B) > 0 , the function Q(A)=P(A∣B) Q(A) = P(A \mid B) satisfies the three axioms. That is, conditioning on B gives another probability, and therefore every property from proofs 1 and 2 also holds with “∣B \mid B ” after it.

What we start from. The definition R5 and the axioms for P P .

Step by step. We check the three axioms for Q Q .

  1. Axiom 1. Q(A)=P(A∩B)/P(B) Q(A) = P(A \cap B)/P(B) . The numerator is ≥0 \ge 0 by R1 and the denominator is >0 > 0 by hypothesis. So Q(A)≥0 Q(A) \ge 0 .
  2. Axiom 2. Q(Ω)=P(Ω∩B)/P(B)=P(B)/P(B)=1 Q(\Omega) = P(\Omega \cap B)/P(B) = P(B)/P(B) = 1 , because Ω∩B=B \Omega \cap B = B .
  3. Axiom 3. Let A1,A2,… A_1, A_2, \dots be pairwise disjoint. By the distributive law (R4), (⋃iAi)∩B=⋃i(Ai∩B) \left( \bigcup_i A_i \right) \cap B = \bigcup_i (A_i \cap B) . The pieces Ai∩B A_i \cap B are also disjoint (if two Ai A_i do not touch, neither do their pieces inside B). By R3:
Q(⋃iAi)=P(⋃i(Ai∩B))P(B)=∑iP(Ai∩B)P(B)=∑iP(Ai∩B)P(B)=∑iQ(Ai) Q\left( \bigcup_i A_i \right) = \frac{P\left( \bigcup_i (A_i \cap B) \right)}{P(B)} = \frac{\sum_i P(A_i \cap B)}{P(B)} = \sum_i \frac{P(A_i \cap B)}{P(B)} = \sum_i Q(A_i)

Each equality in that line, with its why:

  • The first: definition of Q (R5) and distributivity, (⋃iAi)∩B=⋃i(Ai∩B) \left( \bigcup_i A_i \right) \cap B = \bigcup_i (A_i \cap B) .
  • The second: R3, because the Ai∩B A_i \cap B are disjoint (shown in “Where people get stuck”).
  • The third: dividing a sum by P(B) P(B) is dividing each term.
  • The fourth: each P(Ai∩B)/P(B) P(A_i \cap B)/P(B) is Q(Ai) Q(A_i) .
  1. Since Q Q satisfies the three axioms, it is a probability.

Direct consequences. Being a probability, everything proved so far holds “conditionally”:

  • P(Ac∣B)=1−P(A∣B) P(A^c \mid B) = 1 – P(A \mid B) .
  • P(A1∪A2∣B)=P(A1∣B)+P(A2∣B)−P(A1∩A2∣B) P(A_1 \cup A_2 \mid B) = P(A_1 \mid B) + P(A_2 \mid B) – P(A_1 \cap A_2 \mid B) .
  • If A1⊂A2 A_1 \subset A_2 , P(A1∣B)≤P(A2∣B) P(A_1 \mid B) \le P(A_2 \mid B) .

With the filter: if P(spam∣flagged)=0.9375 P(\text{spam} \mid \text{flagged}) = 0.9375 , then P(legitimate∣flagged)=0.0625 P(\text{legitimate} \mid \text{flagged}) = 0.0625 with no extra calculation.

Where people get stuck. In axiom 3, in justifying that the Ai∩B A_i \cap B are disjoint. One line is enough: (Ai∩B)∩(Aj∩B)=(Ai∩Aj)∩B=∅∩B=∅ (A_i \cap B) \cap (A_j \cap B) = (A_i \cap A_j) \cap B = \emptyset \cap B = \emptyset .

Writing P(Ac∣B)=1−P(A∣Bc) P(A^c \mid B) = 1 – P(A \mid B^c) or 1−P(Ac∣Bc) 1 – P(A^c \mid B^c) . The complement goes to the left of the bar; what is on the right (B) is not touched, because it is the universe you are in.

Result for the cheat sheet. For a fixed B with P(B)>0 P(B) > 0 , P(⋅∣B) P(\cdot \mid B) is a probability: P(Ac∣B)=1−P(A∣B) P(A^c \mid B) = 1 – P(A \mid B) and the union formula holds with “∣B \mid B “.

Check it with R. Conditioning on a column with prop.table(..., margin = 2) must give columns that add up to 1 (axiom 2 for Q Q ), and the conditional complement is 1 minus the conditional.

emails <- matrix(c(60, 40, 15, 285), nrow = 2, byrow = TRUE,
                 dimnames = list(type = c("spam", "legitimate"), word = c("free", "no free")))
q <- prop.table(emails, margin = 2)   # Q(·) = P(· | column)
colSums(q)                            # axiom 2: each column adds up to 1
c(legitimate_given_free = q["legitimate", "free"], one_minus = 1 - q["spam", "free"])

Output:

   free no free 
      1       1 
legitimate_given_free             one_minus 
                  0.2                   0.2 

Both columns add up to exactly 1, and P(legitimate∣free)=0.2 P(\text{legitimate} \mid \text{free}) = 0.2 matches 1−P(spam∣free)=1−0.8 1 – P(\text{spam} \mid \text{free}) = 1 – 0.8 .

Check you’ve got it: if you keep the event on the left fixed and change the one on the right, is P(spam∣⋅) P(\text{spam} \mid \cdot) a probability?

No, and one axiom is enough to see it. With Ω \Omega on the right, P(spam∣Ω)=P(spam)=0.25 P(\text{spam} \mid \Omega) = P(\text{spam}) = 0.25 , and axiom 2 required 1. With “free” and “no free”, which are complements: P(spam∣free)+P(spam∣no free)=0.8+0.12=0.92 P(\text{spam} \mid \text{free}) + P(\text{spam} \mid \text{no free}) = 0.8 + 0.12 = 0.92 , which has no reason to be 1. The proof only works with B fixed on the right, which is why the complement is taken on the left of the bar.

Proof 6: total probability and Bayes’ theorem

Where we are going. To two formulas that go in opposite directions. Total probability computes P(A) P(A) when A can come through several paths and you know what happens on each one. Bayes turns the condition around: the filter knows P(spam∣source) P(\text{spam} \mid \text{source}) , but when you see a spam email what you want is P(source∣spam) P(\text{source} \mid \text{spam}) .

What we want to prove. Let B1,…,Bn B_1, \dots, B_n be a partition of Ω \Omega (pairwise disjoint, with union Ω \Omega ) with P(Bi)>0 P(B_i) > 0 . Then, for any event A:

  1. Total probability: P(A)=∑i=1nP(A∣Bi) P(Bi) P(A) = \sum_{i=1}^{n} P(A \mid B_i)\,P(B_i) .
  2. Bayes: if also P(A)>0 P(A) > 0 , P(Bj∣A)=P(A∣Bj) P(Bj)∑i=1nP(A∣Bi) P(Bi) P(B_j \mid A) = \dfrac{P(A \mid B_j)\,P(B_j)}{\sum_{i=1}^{n} P(A \mid B_i)\,P(B_i)} .

What we start from. R3, R4 and R5.

A partition cuts A into piecesRectangle Ω split into three strips B1, B2 and B3. An ellipse A crosses all three and is cut into A intersect B1, B2 and B3, disjoint pieces whose sum is P of A.B₁B₂B₃A ∩ B₁A ∩ B₂A ∩ B₃P(A) = P(A∩B₁) + P(A∩B₂) + P(A∩B₃) = Σ P(A | Bᵢ)·P(Bᵢ)
The Bᵢ do not overlap and cover Ω, so the pieces of A do not overlap either and together they are A.

Step by step (1). In the drawing, the strips B1,B2,B3 B_1, B_2, B_3 cut A into pieces that do not overlap.

  1. Since the Bi B_i cover Ω \Omega : A=A∩Ω=A∩(⋃iBi) A = A \cap \Omega = A \cap \left( \bigcup_i B_i \right) .
  2. By the distributive law (R4): A∩(⋃iBi)=⋃i(A∩Bi) A \cap \left( \bigcup_i B_i \right) = \bigcup_i (A \cap B_i) .
  3. The pieces A∩Bi A \cap B_i are pairwise disjoint, because the Bi B_i are: (A∩Bi)∩(A∩Bj)=A∩(Bi∩Bj)=A∩∅=∅ (A \cap B_i) \cap (A \cap B_j) = A \cap (B_i \cap B_j) = A \cap \emptyset = \emptyset .
  4. By R3: P(A)=∑iP(A∩Bi) P(A) = \sum_i P(A \cap B_i) .
  5. By the multiplication rule (R5), P(A∩Bi)=P(A∣Bi) P(Bi) P(A \cap B_i) = P(A \mid B_i)\,P(B_i) . Substituting: P(A)=∑iP(A∣Bi) P(Bi) P(A) = \sum_i P(A \mid B_i)\,P(B_i) .

Step by step (2). Bayes follows in two lines from the above.

  1. By the definition of conditional probability (R5): P(Bj∣A)=P(Bj∩A)P(A) P(B_j \mid A) = \dfrac{P(B_j \cap A)}{P(A)} .
  2. The numerator, by the multiplication rule the other way round: P(Bj∩A)=P(A∣Bj) P(Bj) P(B_j \cap A) = P(A \mid B_j)\,P(B_j) .
  3. The denominator, by the total probability of part (1).
  4. Putting it together: P(Bj∣A)=P(A∣Bj) P(Bj)∑iP(A∣Bi) P(Bi) P(B_j \mid A) = \dfrac{P(A \mid B_j)\,P(B_j)}{\sum_i P(A \mid B_i)\,P(B_i)} .

With the theory example (sources campus, lists and external): P(spam)=0.5⋅0.02+0.3⋅0.10+0.2⋅0.60=0.16 P(\text{spam}) = 0.5 \cdot 0.02 + 0.3 \cdot 0.10 + 0.2 \cdot 0.60 = 0.16 and P(external∣spam)=0.12/0.16=0.75 P(\text{external} \mid \text{spam}) = 0.12 / 0.16 = 0.75 .

The example’s calculation, branch by branch

The line above squeezes in six calculations. Spelled out, with A = spam and the partition into the three sources:

Source Bi B_i P(Bi) P(B_i) P(spam∣Bi) P(\text{spam} \mid B_i) P(spam∩Bi) P(\text{spam} \cap B_i) P(Bi∣spam) P(B_i \mid \text{spam}) Why
campus0.50.020.5⋅0.02=0.01 0.5 \cdot 0.02 = 0.01 0.01/0.16=0.0625 0.01 / 0.16 = 0.0625 Product rule (R5) and then Bayes
lists0.30.100.3⋅0.10=0.03 0.3 \cdot 0.10 = 0.03 0.03/0.16=0.1875 0.03 / 0.16 = 0.1875 The same, with the lists branch
external0.20.600.2⋅0.60=0.12 0.2 \cdot 0.60 = 0.12 0.12/0.16=0.75 0.12 / 0.16 = 0.75 The same, with the outside branch
Total10.161The product column adds up to P(spam) P(\text{spam}) : that is total probability

Bayes is not a new calculation: each row of the second-to-last column is its product divided by that column’s total. External sends only 20 % of the emails but takes 75 % of the spam, because its branch has the highest rate.

Where people get stuck. In step 3 of total probability: forgetting to justify that the pieces are disjoint, without which axiom 3 cannot be used. And in Bayes, in step 2: you have to flip the intersection (Bj∩A=A∩Bj B_j \cap A = A \cap B_j ) to be able to write the conditional we know, P(A∣Bj) P(A \mid B_j) .

Using total probability with events that do not form a partition (they overlap or do not cover everything). If the P(Bi) P(B_i) do not add up to 1, it is not a partition and the formula does not hold.

Result for the cheat sheet. With {Bi} \{B_i\} a partition: P(A)=∑P(A∣Bi)P(Bi) P(A) = \sum P(A \mid B_i)P(B_i) and P(Bj∣A)=P(A∣Bj)P(Bj)∑P(A∣Bi)P(Bi) P(B_j \mid A) = \frac{P(A \mid B_j)P(B_j)}{\sum P(A \mid B_i)P(B_i)} . With two: P(B∣A)=P(A∣B)P(B)P(A∣B)P(B)+P(A∣Bc)P(Bc) P(B \mid A) = \frac{P(A \mid B)P(B)}{P(A \mid B)P(B) + P(A \mid B^c)P(B^c)} .

Check it with R. We simulate 100,000 emails: first the source, then whether it is spam according to its source. The proportion of external emails among the spam should get close to 0.75.

set.seed(2026)
n <- 100000
source <- sample(c("campus", "lists", "external"), n, replace = TRUE, prob = c(0.5, 0.3, 0.2))
rate   <- c(campus = 0.02, lists = 0.10, external = 0.60)
spam   <- runif(n) < rate[source]                 # each email uses its own source's rate
round(mean(spam), 4)                              # total probability: close to 0.16
round(prop.table(table(source[spam])), 4)         # Bayes: which source the spam comes from

Output:

[1] 0.1625

  campus external    lists 
  0.0626   0.7525   0.1849 

The simulation gives a spam proportion of 0.1625, very close to 0.16, and among the spam 75.25 % external, 18.49 % from the lists and 6.26 % from the campus, against 0.75, 0.1875 and 0.0625 in the theory’s Bayes table. The line rate[source] is the R trick that builds the tree: it gives each email the spam probability of its branch.

Check you’ve got it: why do the three Bayes probabilities, 0.0625, 0.1875 and 0.75, add up to exactly 1?

With numbers: the numerators are the products in the table and the denominator is their sum, so (0.01+0.03+0.12)/0.16=1 (0.01 + 0.03 + 0.12)/0.16 = 1 . With the proofs: P(⋅∣spam) P(\cdot \mid \text{spam}) is a probability (proof 5) and the three sources are disjoint and cover Ω \Omega , so by R3 and R2 they add up to P(Ω∣spam)=1 P(\Omega \mid \text{spam}) = 1 . If they do not add up to 1 in the exam, check the denominator.

Prove it yourself

Three proofs to practice with the same rules. Try them on paper before opening the solution.

1. De Morgan with probabilities. Prove that P(Ac∩Bc)=1−P(A)−P(B)+P(A∩B) P(A^c \cap B^c) = 1 – P(A) – P(B) + P(A \cap B) . Use it to compute the probability that an email from the week is neither spam nor says “free”.

See the solution to 1

By De Morgan (R4), Ac∩Bc=(A∪B)c A^c \cap B^c = (A \cup B)^c . By proof 1 (complement), P((A∪B)c)=1−P(A∪B) P\big((A \cup B)^c\big) = 1 – P(A \cup B) . By proof 2 (union), P(A∪B)=P(A)+P(B)−P(A∩B) P(A \cup B) = P(A) + P(B) – P(A \cap B) . Substituting: P(Ac∩Bc)=1−P(A)−P(B)+P(A∩B) P(A^c \cap B^c) = 1 – P(A) – P(B) + P(A \cap B) .

With the week: 1−0.25−0.1875+0.15=0.7125 1 – 0.25 – 0.1875 + 0.15 = 0.7125 , which matches the cell of legitimate emails without “free”: 285/400 = 0.7125.

2. Independence of the complements. Prove that if A and B are independent, so are A and Bc B^c (and, applying it twice, Ac A^c and Bc B^c ).

See the solution to 2

We split A into two disjoint pieces: A=(A∩B)∪(A∩Bc) A = (A \cap B) \cup (A \cap B^c) (R4). By R3, P(A)=P(A∩B)+P(A∩Bc) P(A) = P(A \cap B) + P(A \cap B^c) , so P(A∩Bc)=P(A)−P(A∩B) P(A \cap B^c) = P(A) – P(A \cap B) .

Since A and B are independent, P(A∩B)=P(A) P(B) P(A \cap B) = P(A)\,P(B) . Substituting: P(A∩Bc)=P(A)−P(A) P(B)=P(A)(1−P(B))=P(A) P(Bc) P(A \cap B^c) = P(A) – P(A)\,P(B) = P(A)\big(1 – P(B)\big) = P(A)\,P(B^c) , using the complement (proof 1) in the last step. That is exactly the definition of A and Bc B^c being independent.

For Ac A^c and Bc B^c : apply the same to the pair Bc B^c and A (we already know they are independent), swapping roles: it follows that Bc B^c and Ac A^c are independent.

With the filters: if “the ULPGC filter stops it” and “Gmail’s stops it” are independent, so are “it escapes ULPGC” and “it escapes Gmail”, and that is why in the theory we could multiply 0.10⋅0.20 0.10 \cdot 0.20 .

3. The union of three events. Prove that P(A∪B∪C)=P(A)+P(B)+P(C)−P(A∩B)−P(A∩C)−P(B∩C)+P(A∩B∩C) P(A \cup B \cup C) = P(A) + P(B) + P(C) – P(A \cap B) – P(A \cap C) – P(B \cap C) + P(A \cap B \cap C) .

See the solution to 3

We group A∪B∪C=(A∪B)∪C A \cup B \cup C = (A \cup B) \cup C and apply the two-event formula (proof 2) with D=A∪B D = A \cup B :

P(D∪C)=P(D)+P(C)−P(D∩C) P(D \cup C) = P(D) + P(C) – P(D \cap C) .

The first term, again by proof 2: P(D)=P(A)+P(B)−P(A∩B) P(D) = P(A) + P(B) – P(A \cap B) .

The last one: by the distributive law, D∩C=(A∪B)∩C=(A∩C)∪(B∩C) D \cap C = (A \cup B) \cap C = (A \cap C) \cup (B \cap C) . Applying the two-event formula to these two events: P(D∩C)=P(A∩C)+P(B∩C)−P(A∩C∩B∩C) P(D \cap C) = P(A \cap C) + P(B \cap C) – P(A \cap C \cap B \cap C) , and A∩C∩B∩C=A∩B∩C A \cap C \cap B \cap C = A \cap B \cap C .

Substituting everything and tidying up: P(A∪B∪C)=P(A)+P(B)+P(C)−P(A∩B)−P(A∩C)−P(B∩C)+P(A∩B∩C) P(A \cup B \cup C) = P(A) + P(B) + P(C) – P(A \cap B) – P(A \cap C) – P(B \cap C) + P(A \cap B \cap C) . The triple intersection is added at the end because subtracting the three pairs removed it once too often.

When to use each result

If you are asked for…UseWatch out for…
The probability of “not A” or “at least one”Complement: 1−P(A) 1 – P(A) “At least one” = 1 − P(none)
The probability of “A or B”Union: P(A)+P(B)−P(A∩B) P(A) + P(B) – P(A \cap B) Only add without subtracting if they are disjoint
A bound without knowing how A and B relateBonferroni or BooleBonferroni says nothing if P(A)+P(B)≤1 P(A) + P(B) \le 1
Counting unordered groups(nr) \binom{n}{r} If order matters, it is an ordered selection
Properties of P(⋅∣B) P(\cdot \mid B) Proof 5: everything holds “conditionally”The complement goes to the left of the bar
The probability of A when there are several “paths”Total probabilityThe Bi B_i must form a partition
“Given A, where does it come from?”BayesDo not mix up P(A∣B) P(A \mid B) and P(B∣A) P(B \mid A)
Independence of “not A” and “not B”Prove it yourself 2Independent ≠ mutually exclusive

Common mistakes when proving

  • Applying axiom 3 to overlapping events. You always have to split into disjoint pieces and say so.
  • Using the formula you want to prove. In the union proof you cannot use the three-event union; in Bayes you cannot use Bayes.
  • Skipping the “why”. “It is obvious” gets no marks. Every step, with its rule.
  • Induction without a hypothesis. Write the base case, the hypothesis for n−1 n – 1 and the step to n n .
  • Mixing up the side of the bar. In P(A∣B) P(A \mid B) , B is the universe; the complement is taken of A.
  • Not checking with numbers. A good proof must give the same as counting in an example. If the 400-email table does not add up, something is off.

Try it in the R playground

Open the site’s R playground and paste this script. It checks this article’s results with the week of 400 emails; change the numbers in the table and see that they still hold.

# The week of 400 emails: rows type, columns word
t <- matrix(c(60, 40, 15, 285), nrow = 2, byrow = TRUE,
            dimnames = list(type = c("spam", "legitimate"), word = c("free", "no free")))
p <- t / sum(t)                                   # joint probabilities
p_S <- sum(p["spam", ]); p_F <- sum(p[, "free"]); p_SF <- p["spam", "free"]

p_S + p_F - p_SF                                  # union (proof 2)
1 - p_S - p_F + p_SF                              # neither spam nor free (Prove it yourself 1)
p["legitimate", "no free"]                        # counted: must match
p_SF >= p_S + p_F - 1                             # Bonferroni (proof 3)
colSums(prop.table(t, margin = 2))                # the conditional adds up to 1 (proof 5)

What to look at:

  1. In Environment, the matrix t and the three probabilities p_S, p_F, p_SF.
  2. The second and third outputs must be the same number (0.7125).
  3. Change the 60 to 70 and the 40 to 30 (still 100 spam): the union changes, but both calculations of “neither spam nor free” still match.
  4. Try choose(10, 3) == choose(9, 2) + choose(9, 3) in the console: Pascal with other numbers.

Summary

ProofResultThe idea
1P(Ac)=1−P(A) P(A^c) = 1 – P(A) , P(∅)=0 P(\emptyset) = 0 , monotonicityΩ=A∪Ac \Omega = A \cup A^c and B=A∪(B∩Ac) B = A \cup (B \cap A^c)
2P(A∪B)=P(A)+P(B)−P(A∩B) P(A \cup B) = P(A) + P(B) – P(A \cap B) The intersection goes in twice
3Bonferroni and BooleUnion ≤ 1 and induction
4(nr)=n!r!(n−r)! \binom{n}{r} = \frac{n!}{r!(n-r)!} , PascalCount the same thing in two ways
5P(⋅∣B) P(\cdot \mid B) is a probabilityCheck the three axioms
6Total probability and BayesPartition + multiplication rule

Three ideas to keep:

  1. Almost everything comes from splitting into disjoint pieces and applying axiom 3.
  2. Counting the same thing twice is the shortest way to prove counting formulas.
  3. Conditioning gives another probability: everything you know holds with “∣B \mid B ” after it.

With the proofs clear, move on to the R practice: we simulate a week of the filter, count repeated codes and build Bayes in a table. And in the probability exercises there is a short proof inside an exam-style problem, as in the continuous assessment.

Next step: practiceProbability — R practice with the spam filter: simulate a week, count repeated codes and Bayes in a table (and the prob I wrote backwards)

Did this article help you? Here is how you can support SergioLearns →