Lesson 4 / 13 · 12 min read
Probability Basics
Sample spaces, independence, conditional probability, expected value.
Sample spaces and events
The sample space S is the set of all possible outcomes. An event is a subset of S.
If all outcomes are equally likely:
P(event)=total outcomes in Snumber of outcomes in event
Example. Roll a fair 6-sided die. S={1,2,3,4,5,6}. The event "even" is {2,4,6}, so P(even)=3/6=1/2.
Probability axioms (the rules of the game)
- 0≤P(A)≤1
- P(S)=1
- If A and B are mutually exclusive: P(A or B)=P(A)+P(B)
Complements
P(not A)=1−P(A)
Often easier to compute the complement than the event itself.
Independent events
Events A and B are independent if knowing one happened doesn't change the probability of the other. For independent events:
P(A and B)=P(A)⋅P(B)
Example. Flip a fair coin twice. P(HH)=21⋅21=41.
Conditional probability
The probability of A given B already happened:
P(A∣B)=P(B)P(A and B)
Example. Draw one card from a standard deck. What's the probability it's a king given it's a face card? There are 12 face cards, 4 of which are kings: P(King∣Face)=4/12=1/3.
Expected value
For a random variable X taking values x1,x2,… with probabilities p1,p2,…:
E[X]=∑ixi⋅pi
Example — a $1 bet on a die roll. You pay $1 to play. If you roll a 6, you win $5 (net +4). Otherwise you lose your $1 (net −1).
E[profit]=(1/6)(4)+(5/6)(−1)=4/6−5/6=−1/6
You lose about 17 cents per play on average — don't take this bet.
Key takeaways
- Probability for equally likely outcomes = favorable / total.
- P(not A)=1−P(A) — the complement trick saves time.
- Independent: multiply. Mutually exclusive (and not both can happen): add.
- Expected value tells you the average outcome over many trials.