Maths for Machines
0 of 5 lessons done100 questions

Lesson 1 of 5

Outcomes, sample spaces, and events

Probability starts by listing what could happen and circling the outcomes we care about.

Core lesson · about 5 minutes · 3 guided parts

Imagine a bag of colored marbles. The whole bag is the sample space; the colors that win a game form an event.

Your learning route

Build the idea one piece at a time

  1. From an experiment to a sample space
  2. Probability rules and complements
  3. Build and audit a real event model
Outcomes, sample spaces, and events, made visible
ABC

From an experiment to a sample space

A random experiment has an uncertain result, but its possible results can still be described precisely.

Write the sample space Ω before calculating. For one die, Ω = {1,2,3,4,5,6}.

An outcome is one member of Ω. An event is a set of outcomes, such as E = {2,4,6} for an even roll.

For equally likely outcomes, probability is favorable outcomes divided by all outcomes.

Start with the action, such as rolling a die, and separate it from the result. The action is the experiment; the single number that appears is one outcome.

A sample space must include every possible outcome exactly as finely as the question needs. For two coin tosses, {HH, HT, TH, TT} works, while merely writing {head, tail} loses the order and cannot answer questions about two tosses.

An event can contain one outcome, many outcomes, every outcome, or no outcomes. Thinking of an event as a set makes words such as 'or', 'and', and 'not' become union, intersection, and complement.

Fairness is what permits counting. If all eight spinner sectors have equal area, three winning sectors mean probability 3/8; if their areas differ, add the actual sector probabilities instead of counting labels.

In symbolsP(A)=|A|/|Ω| (equally likely outcomes)

Worked example

A fair spinner has eight equal sectors numbered 1 to 8. What is the probability of landing above 5?

  1. Write Ω = {1,2,3,4,5,6,7,8}, so |Ω| = 8.
  2. The event is A = {6,7,8}, so |A| = 3.
  3. Divide favorable outcomes by total outcomes: P(A) = 3/8.

Answer: 3/8

Probability rules and complements

All probability mass is one whole pie. The part outside an event is whatever remains.

Every probability lies from 0 to 1, and P(Ω)=1.

The complement Aᶜ means A does not happen, so P(Aᶜ)=1−P(A).

For events that cannot happen together, add their probabilities. For overlapping events, subtract the overlap once.

Picture probability as one full litre of paint spread over the sample space. If an event uses 0.28 litre, its complement must use the remaining 0.72 litre because nothing can sit outside the whole space.

For 'A or B', first add both event probabilities. The shared region A∩B was then included twice, so subtraction removes exactly one duplicate and leaves every qualifying outcome counted once.

A quick reasonableness check catches many errors: a probability cannot be negative or exceed 1, a larger event cannot have smaller probability than an event inside it, and an event plus its complement must total 1.

This is used in monitoring systems by defining events such as 'server is slow' and 'server returns an error'. The union estimates how often users see either problem, while the intersection reveals requests suffering both, so engineers do not double-count incidents.

In symbolsP(A∪B)=P(A)+P(B)−P(A∩B)

Worked example

In a class, 18 students play football, 12 play chess, and 5 play both. How many play at least one?

  1. Adding 18 + 12 counts the five students in both groups twice.
  2. Subtract that overlap once: 18 + 12 − 5.
  3. The union contains 25 students.

Answer: 25 students

Practical deep dive for this lesson

Build and audit a real event model

A probability answer is trustworthy only when the experiment, outcomes, event, and weighting rule all describe the same real question.

Suppose a delivery app records each order as on time, late, or cancelled. Those three labels form a sample space only if every order receives exactly one label and no relevant outcome is missing.

To measure 'service problem', define the event {late, cancelled}; then estimate each outcome from comparable historical orders. If peak-hour orders behave differently, equal counting over labels is wrong and the sample should be split or weighted.

Finally check totals, time window, and denominator. Probability answers operational questions only when definitions are stable enough that yesterday's recorded frequencies represent the orders being planned for today.

In symbolsP(service problem)=P(late)+P(cancelled) when labels are disjoint

Worked example

Out of 200 comparable orders, 150 are on time, 35 are late, and 15 are cancelled. Estimate P(service problem) and P(no service problem).

  1. Confirm the three disjoint labels total 200 orders.
  2. Service problem contains 35+15=50 orders.
  3. Estimate P(problem)=50/200=0.25.
  4. Use the complement for P(no problem)=1−0.25=0.75 and check the pair totals 1.

Answer: P(problem)=0.25 and P(no problem)=0.75

Check your picture

If P(rain)=0.28, what is P(no rain)?

Reveal answer

0.72

This lesson versus the whole chapter

Your topic-specific practical example is above.

The final lesson collects five longer chapter-wide workflows for machine learning, LLMs, trading, physics, and everyday decisions.

Formula shelf

Symbols with meaning

ComplementP(Aᶜ)=1−P(A)

Everything outside A has the probability mass left over.

Addition ruleP(A∪B)=P(A)+P(B)−P(A∩B)

Combine events without double-counting overlap.

Conditional probabilityP(A|B)=P(A∩B)/P(B)

Measure A inside the reduced world B.

IndependenceP(A∩B)=P(A)P(B)

One event does not change the probability of the other.

Total probabilityP(A)=ΣᵢP(A|Bᵢ)P(Bᵢ)

Add every disjoint route to A.

Bayes' ruleP(B|A)=P(A|B)P(B)/P(A)

Update a prior belief after evidence.

Before moving on

You are ready when you can…

  • Define experiments, outcomes, sample spaces, and events
  • Use complement, union, intersection, and counting rules
  • Distinguish conditional probability from its reverse
  • Test independence and handle without-replacement dependence
  • Use total probability and Bayes' rule with base rates