Learn · Chapter 1

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\).

The clinic's 150 patients by symptom
PatientsCountShare
Fever and fatigue270.18
Fever only540.36
Fatigue only270.18
Neither420.28
All patients1501

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\).

Try this Watch each term of the addition rule light up its part of a Venn diagram and a tree, for the clinic's patients.

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.

The share of heads in 1,000 flips of a fair coin, flip by flip, against the probability of a head

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.

Try this Flip a coin or roll a die one at a time, then in bursts, and watch the relative frequency settle.

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.

Remember: A probability is a share: of equally likely outcomes or, estimated from data, of past cases. When you add, take away the overlap: \(P(A \cup B) = P(A) + P(B) - P(A \cap B)\). And when "at least one" is hard, work out "none" and subtract it from 1.

Quiz

Three questions on the chapter. Your best score is kept in this browser.

1. Of the clinic's 150 patients, 81 have a fever. What is the estimated probability that a patient with the condition does not have a fever?
2. Which pair of events is mutually exclusive?
3. After 20 flips of a fair coin you have seen 14 heads. What does the law of large numbers say about the next 1,000 flips?
Answer every question first.
Probability foundations · step 1 of 10

Experiments, events and probability

Open with questions from the class's own work: will a parcel be late, will a customer buy, is a claim fraudulent? Name the experiment, the sample space and the event in each. Then the two ways to a probability: a share of equally likely outcomes, or a relative frequency from data, as for the clinic's 150 patients.

All steps
An unhandled error has occurred. Reload ๐Ÿ—™

Reconnecting…

Your connection to Introduction to Probability Lab dropped, probably a Wi-Fi blip. Hold on while it reconnects.

The connection could not be restored. The page will reload in a few seconds.