Probability and events
Sample spaces and events, the complement and addition rules, and the law of large numbers.
Experiments, outcomes and events
Probability starts with an experiment: anything with an uncertain result that could, at least in principle, be repeated. Rolling a die, a customer deciding whether to open an e-mail and a doctor examining a patient are all experiments. Each possible result is an outcome, and the set of all the outcomes is the sample space, written \(S\).
An event is a set of outcomes: something that either happens or does not once the experiment is over. For one roll of a die, \(S = \{1, 2, 3, 4, 5, 6\}\), and "an even number" is the event \(E = \{2, 4, 6\}\). Business questions are about events: "the parcel arrives late", "at least one of the ten bulbs is faulty", "the customer buys".
Probability as a share of equally likely outcomes
When every outcome is equally likely, the probability of an event is the share of the outcomes it contains:
For a fair die, \(P(\text{even}) = \tfrac{3}{6} = 0.5\) and \(P(\text{5 or 6}) = \tfrac{2}{6} = 0.3333\). Every probability lies between 0, for an event that cannot happen, and 1, for one that is certain, and the probabilities of all the outcomes add up to 1.
Probability from data
Most business outcomes are not equally likely, so their probabilities are estimated from data as a relative frequency: the share of past cases in which the event happened. A clinic has records of 150 patients with the same condition: 81 have a fever, 54 feel fatigue, and 27 have both. The probability that a patient with the condition has a fever is estimated as \(\tfrac{81}{150} = 0.54\), and fatigue as \(\tfrac{54}{150} = 0.36\).
| Patients | Count | Share |
|---|---|---|
| Fever and fatigue | 27 | 0.18 |
| Fever only | 54 | 0.36 |
| Fatigue only | 27 | 0.18 |
| Neither | 42 | 0.28 |
| All patients | 150 | 1 |
The complement rule
The complement of an event \(A\), written \(A^c\), is every outcome that is not in \(A\). Exactly one of the two happens, so their probabilities add up to 1:
The complement is often the easy way in. The chance of at least one six in four rolls of a die covers four cases (one six, two, three or four), but its complement, no six at all, is a single case. The rolls do not affect each other, so their chances multiply (chapter 2): \(\left(\tfrac{5}{6}\right)^4 = 0.4823\), and the chance of at least one six is \(1 - 0.4823 = 0.5177\).
The addition rule
The event "\(A\) or \(B\)", the union \(A \cup B\), happens when at least one of them does. Adding \(P(A)\) and \(P(B)\) counts the outcomes in both twice, so the overlap, the intersection \(A \cap B\), is taken away once:
For the clinic, \(P(\text{fever or fatigue}) = 0.54 + 0.36 - 0.18 = 0.72\): 108 of the 150 patients have at least one of the two symptoms. Adding 0.54 and 0.36 without the correction gives 0.9, because the 27 patients with both symptoms are counted twice.
Two events are mutually exclusive when they cannot happen together, like a 1 and a 6 on the same roll. Then \(P(A \cap B) = 0\) and the rule loses its last term: \(P(\text{1 or 6}) = \tfrac{1}{6} + \tfrac{1}{6} = 0.3333\).
The law of large numbers
A relative frequency from a handful of cases is a rough guide; from many cases it is a good one. The law of large numbers says that when an experiment is repeated independently, the relative frequency of an event settles towards its probability. After ten flips of a fair coin, 3 or 7 heads is unremarkable; after 10,000 flips, the share of heads will very probably be within a percentage point of 0.5.
It says nothing about the next flip. After five heads in a row a tail is no more likely than before: the coin has no memory. An early run of heads is not paid back by tails; it is diluted by the many flips that follow.
In code
| What it computes | Python (scipy.stats) | Excel |
|---|---|---|
| The chance of a 5 or a 6 on a fair die | randint.sf(4, 1, 7) |
=2/6 |
| The relative frequency of fever | 81 / 150 |
=81/150 |
| The addition rule for fever or fatigue | 0.54 + 0.36 - 0.18 |
=0.54+0.36-0.18 |
| At least one six in four rolls | 1 - (5/6)**4 |
=1-(5/6)^4 |
| Simulate 1,000 coin flips and take the share of heads | np.random.default_rng(7).integers(0, 2, 1000).mean() |
=AVERAGE(RANDARRAY(1000, 1, 0, 1, TRUE)) |
numpy and Excel draw different random numbers from the lab's, so their share of heads differs from the chart's; it settles towards 0.5 all the same.
Quiz
Three questions on the chapter. Your best score is kept in this browser.