Search

Search papers and lessons

Probability

Level 1 · 8 min read

Probability is a number from 0 to 1 that measures how likely an event is, defined over a list of possible outcomes and three simple rules.

On this page

TL;DR

Probability is a way to put a number on uncertainty. You list every outcome an experiment could have, then give each event (a set of outcomes) a weight from 0 (impossible) to 1 (certain). Three simple rules keep those weights consistent, and the rest of probability follows from them.

Where you'll see it: in a weather forecast's chance of rain, in the estimated odds of a server failing, and in the confidence score a classifier attaches to its answer.

Intuition

Start with a die, and you already know the idea. Before you roll, you cannot say which face will come up, but you can say something useful: a fair die shows an even number half the time, and a six one time in six. Probability is the tool for making statements like that precise when the outcome is unknown.

Three words do most of the work.

  • The sample space, written Ω\Omega (capital omega), is the set of all possible outcomes of one run of the experiment. For one die, Ω={1,2,3,4,5,6}\Omega = \{1, 2, 3, 4, 5, 6\}.
  • An event is a yes-or-no question about the outcome. Formally it is a subset of Ω\Omega. "The roll is even" is the event {2,4,6}\{2, 4, 6\}.
  • A probability is a number P(A)P(A) attached to each event AA, saying how likely that event is.
flowchart LR
  E[Experiment] --> O[Sample space: all possible outcomes]
  O --> V[Events: subsets of outcomes]
  V --> P[Probability: a number from 0 to 1 for each event]

Why bother with a formal treatment? Because intuition fails quickly. People routinely get "at least one of three things happens" wrong, and they mix up "A given B" with "B given A". A small set of rules gives you a way to check a calculation, so the answer stops depending on how confident you feel.

The math

Sample space and events

Definition: Probability space

A probability space is a triple (Ω,F,P)(\Omega, \mathcal{F}, P). Here Ω\Omega is the sample space, F\mathcal{F} is the collection of events we are allowed to ask about (each one a subset of Ω\Omega), and PP is a function that assigns each event a number.

For a finite sample space, F\mathcal{F} can simply be every subset of Ω\Omega. The extra conditions on F\mathcal{F} (closed under complement and countable union) only matter for infinite sample spaces, so you can ignore them for now.

Events combine with set operations. For events AA and BB:

  • The union A∪BA \cup B is "A or B or both" happens.
  • The intersection A∩BA \cap B is "A and B both" happen.
  • The complement AcA^c is "A does not happen".

The three axioms

The function PP must obey three rules, the Kolmogorov axioms:

  1. Non-negativity. P(A)≥0P(A) \ge 0 for every event AA.
  2. Normalisation. P(Ω)=1P(\Omega) = 1. Some outcome must occur.
  3. Additivity. If A1,A2,…A_1, A_2, \dots are pairwise disjoint (no two can happen together), then
P(A1∪A2∪⋯ )=P(A1)+P(A2)+⋯P(A_1 \cup A_2 \cup \cdots) = P(A_1) + P(A_2) + \cdots

Three useful consequences follow directly:

  • P(∅)=0P(\emptyset) = 0, where ∅\emptyset is the impossible event with no outcomes.
  • P(Ac)=1−P(A)P(A^c) = 1 - P(A), so 0≤P(A)≤10 \le P(A) \le 1 always.
  • If A⊆BA \subseteq B, then P(A)≤P(B)P(A) \le P(B).

The most useful consequence is the addition rule for events that can overlap. Split A∪BA \cup B into two disjoint pieces, AA and B∩AcB \cap A^c:

P(A∪B)=P(A)+P(B∩Ac)P(B)=P(A∩B)+P(B∩Ac)∴ P(A∪B)=P(A)+P(B)−P(A∩B)\begin{aligned} P(A \cup B) &= P(A) + P(B \cap A^c) \\ P(B) &= P(A \cap B) + P(B \cap A^c) \\ \therefore\ P(A \cup B) &= P(A) + P(B) - P(A \cap B) \end{aligned}

The second line holds because BB splits into the disjoint pieces A∩BA \cap B and B∩AcB \cap A^c. Subtracting the second line from the first removes P(B∩Ac)P(B \cap A^c) and leaves the result.

Equally likely outcomes

When Ω\Omega is finite and every outcome is equally likely, the probability of an event is its share of the outcomes:

P(A)=∣A∣∣Ω∣.P(A) = \frac{|A|}{|\Omega|}.

Here ∣A∣|A| is the number of outcomes in AA. This is where counting comes in: counting principles tell you how large a set is without listing it. The formula is only valid when the equal-likelihood assumption actually holds, and you have to justify that from the physical setup.

Worked examples

Example
A fair die and the complement trick

Roll one fair die. Ω={1,2,3,4,5,6}\Omega = \{1, 2, 3, 4, 5, 6\} and each outcome has probability 1/61/6.

  1. Event AA: the roll is even. A={2,4,6}A = \{2, 4, 6\}, so ∣A∣=3|A| = 3.
  2. P(A)=3/6=1/2P(A) = 3/6 = 1/2.
  3. The complement AcA^c is "the roll is odd", {1,3,5}\{1, 3, 5\}.
  4. Check with the complement rule: P(Ac)=1−P(A)=1−1/2=1/2P(A^c) = 1 - P(A) = 1 - 1/2 = 1/2. This matches the direct count 3/63/6.

Interpretation: over many rolls, an even number comes up about half the time. Computing the answer two ways is a cheap habit that catches arithmetic slips.

Example
Two dice and the overlap

Roll two fair dice. The sample space has 36 equally likely ordered pairs (i,j)(i, j). Let AA be "the first die is even" and BB be "the sum is 7".

  1. AA has 3⋅6=183 \cdot 6 = 18 outcomes: 3 even choices for the first die and 6 for the second. So P(A)=18/36=1/2P(A) = 18/36 = 1/2.
  2. B={(1,6),(2,5),(3,4),(4,3),(5,2),(6,1)}B = \{(1,6), (2,5), (3,4), (4,3), (5,2), (6,1)\}, so P(B)=6/36=1/6P(B) = 6/36 = 1/6.
  3. A∩BA \cap B is "first die even and sum 7": {(2,5),(4,3),(6,1)}\{(2,5), (4,3), (6,1)\}, so P(A∩B)=3/36P(A \cap B) = 3/36.
  4. Apply the addition rule: P(A∪B)=18/36+6/36−3/36=21/36=7/12P(A \cup B) = 18/36 + 6/36 - 3/36 = 21/36 = 7/12.
  5. Check by counting: ∣A∪B∣=18+6−3=21|A \cup B| = 18 + 6 - 3 = 21, so 21/3621/36 again.

Interpretation: adding P(A)P(A) and P(B)P(B) alone would count the three pairs in A∩BA \cap B twice. Subtracting the overlap fixes that.

Example
Three servers, a realistic case

A job runs on three servers. Assume each one fails in a given hour with probability 0.01, and assume the failures are unrelated to each other. What is the chance that at least one fails?

  1. Let FF be "at least one server fails". Its complement FcF^c is "no server fails".
  2. For one specific server, the chance it does not fail is 1−0.01=0.991 - 0.01 = 0.99.
  3. With unrelated failures, the chance that all three survive is 0.99×0.99×0.99=0.9702990.99 \times 0.99 \times 0.99 = 0.970299.
  4. So P(Fc)=0.970299P(F^c) = 0.970299, and P(F)=1−0.970299=0.029701P(F) = 1 - 0.970299 = 0.029701.

Interpretation: in about 3 hours out of 100, some server fails, even though each server on its own fails only 1 hour in 100. Counting the complement is far easier than adding up the one-, two- and three-failure cases. The answer depends on the "unrelated" assumption. If the servers share a power supply, the real risk is higher.

Tradeoffs and failure modes

SituationWhat goes wrongBetter choice
Counting equally likely outcomes for a loaded die or a biased processThe formula gives confident, wrong answersEstimate PP from frequencies over many trials, or build a model with explicit weights
Continuous outcomes, such as a height or a waiting timeEach exact value has probability 0, so PP says nothing useful about a single pointAsk about intervals, and use a [[probability-density-function
Adding probabilities of overlapping eventsThe overlap is counted twiceUse the addition rule and subtract P(A∩B)P(A \cap B)
Multiplying probabilities of events that are actually relatedThe result is too small or too largeModel the dependence explicitly with [[conditional-probability
Sample spaces never written downOutcomes are missed or double-countedList the outcomes first, then count

Probability also has two interpretations. The frequency reading treats P(A)P(A) as the long-run share of trials where AA happens. The belief reading treats it as a degree of confidence. Both obey the same axioms, and the mathematics does not tell you which one to use. Pick the one that matches your question.

History

Gambling was the first motivation. Girolamo Cardano wrote an early analysis of dice games in the 1560s, in Liber de ludo aleae, which was published only long after his death. The analysis counted equally likely outcomes, which is the idea behind the classical formula above.

In 1654, Blaise Pascal and Pierre de Fermat exchanged letters about the "problem of points": how to divide the stakes of a game that was interrupted before it finished. Their answer reasoned about the possible ways the game could have ended.

Christiaan Huygens published one of the first printed treatments of probability in 1657, De ratiociniis in ludo aleae. Jacob Bernoulli's Ars Conjectandi, published in 1713 after his death, proved an early form of the law of large numbers, which links long-run frequencies to probabilities.

The modern axioms came in 1933, when Andrey Kolmogorov published Grundbegriffe der Wahrscheinlichkeitsrechnung. He grounded probability in measure theory, which is the setup the probability space above follows.

Check yourself

QuestionRecall: what are the three axioms of probability?Show answer
Non-negativity: P(A)≥0P(A) \ge 0 for every event. Normalisation: P(Ω)=1P(\Omega) = 1. Additivity: for pairwise disjoint events, the probability of their union is the sum of their probabilities.
QuestionComputation: a fair die is rolled. What is the probability that the roll is greater than 4?Show answer
The outcomes greater than 4 are 5 and 6. That is 2 of the 6 equally likely outcomes, so P=2/6=1/3P = 2/6 = 1/3.
QuestionWhy: when two events overlap, why does the addition rule subtract P(A∩B)P(A \cap B)?Show answer
Outcomes in both events are inside AA and also inside BB. Plain addition counts them twice. Subtracting P(A∩B)P(A \cap B) removes the double count, so every outcome is counted exactly once.
QuestionApplied: a website runs two independent checks. Each one wrongly flags a valid user with probability 0.05. What is the probability that at least one check flags a valid user?Show answer
Use the complement. The chance a single check does not flag is 0.95. The chance neither flags is 0.95×0.95=0.90250.95 \times 0.95 = 0.9025. So the chance at least one flags is 1−0.9025=0.09751 - 0.9025 = 0.0975, about 9.75%. This assumes the checks are independent. If they were correlated, the answer would change.

Sources