Measure uncertainty, combine events correctly and understand the probability ideas behind simulation, reliability, randomized algorithms and machine-learning predictions.
๐ฏ 1. Learning Objectives
After completing this topic, you should be able to:
Identify experiments, outcomes, sample spaces and events.
Calculate probability for equally likely outcomes.
Use complements and addition rules.
Distinguish mutually exclusive, independent and dependent events.
Calculate conditional probability and simple expected values.
Use theoretical and experimental probability in programs.
๐งฉ 2. Experiment, Outcome, Sample Space and Event
Random Experiment
A repeatable process whose exact result is uncertain, such as tossing a coin or generating a random number.
Outcome
One possible result. A die roll may produce the outcome 4.
Sample Space S
The set of all possible outcomes.
Die: S = {1,2,3,4,5,6}
Event A
A selected group of outcomes from S.
Even die result: A = {2,4,6}
๐ 3. Basic Probability
When all outcomes are equally likely:
P(A) = Number of favourable outcomes / Total number of outcomes
0 Impossible
0.25 Unlikely
0.5 Even chance
0.75 Likely
1 Certain
Example: Probability of an even die result = 3/6 = 1/2.
๐ 4. Complement of an Event
The complement Aโฒ contains every outcome where A does not occur.
P(Aโฒ) = 1 โ P(A)
Useful for โat least oneโ: P(at least one success) = 1 โ P(no successes).
โ 5. Addition Rule
General Rule
P(A โช B) = P(A) + P(B) โ P(A โฉ B)
Subtract the overlap because it was counted twice.
Mutually Exclusive Events
P(A โช B) = P(A) + P(B)
These events cannot occur together, so P(A โฉ B) = 0.
โ๏ธ 6. Independent Events
Events A and B are independent when one event does not change the probability of the other.
P(A โฉ B) = P(A) ร P(B)
Example: Two heads in two fair coin tosses = 1/2 ร 1/2 = 1/4.
๐ 7. Conditional Probability
P(A|B) means the probability of A after knowing that B occurred.
P(A|B) = P(A โฉ B) / P(B), P(B) > 0
Without replacement: probabilities usually change after each selection, so the events are dependent.
๐ฏ 8. Common Probability Models
Experiment
Total outcomes
Example event
Probability
One fair coin
2
Head
1/2
One fair die
6
Number > 4
2/6 = 1/3
One standard card
52
Ace
4/52 = 1/13
Two fair coins
4
Exactly one head
2/4 = 1/2
๐งฎ 9. Counting and Probability
Permutations and combinations help count large sample spaces without listing every outcome.
Card Hands
The number of unordered 5-card hands is โตยฒCโ .
2,598,960 hands
Exactly k Successes
Choose which k trials succeed, then multiply the appropriate probabilities.
โฟCโ pแต(1โp)โฟโปแต
INTERACTIVE EXPLORER
๐งช 10. Probability Explorer
Select a probability model, enter the requested values and click Calculate Probability. Changing inputs hides the old result.
Select a model or example, then click Calculate Probability.
Result
๐ป 11. Probability in Programming
Randomized Algorithms
Random choices can simplify algorithms, balance data structures and reduce predictable worst-case inputs.
Simulation
Programs repeat random experiments to estimate probabilities when direct calculation is difficult.
Reliability and Testing
Component failure probabilities help estimate system reliability and prioritize test scenarios.
AI and Machine Learning
Models often return class probabilities or confidence scores that support decisions under uncertainty.
๐ 12. Expected Value
Expected value is the long-run average obtained by weighting every value by its probability.
E(X) = ฮฃ x ยท P(X=x)
Fair die: E(X) = (1+2+3+4+5+6)/6 = 3.5. A single roll cannot be 3.5; it is the long-run average.
๐งพ 13. Solved Problems
Problem 1: Die
Problem: Find P(number divisible by 3) on one die.
Solution: Favourable outcomes {3,6}: P = 2/6 = 1/3.
Problem 2: At Least One Head
Problem: Toss two fair coins.
Solution: P(at least one H) = 1 โ P(TT) = 1 โ 1/4 = 3/4.
Problem 3: Without Replacement
Problem: A bag has 3 red and 2 blue balls. Find P(two red).
Solution: 3/5 ร 2/4 = 3/10.
Problem 4: Reliability
Problem: Two independent components each work with probability 0.9.
Solution: P(both work) = 0.9ร0.9 = 0.81.
โ๏ธ 14. Practice Problems
Solve each problem first, then use Show Solution to verify your method.
1. A fair die is rolled. Find P(odd number).
Odd outcomes are {1,3,5}. P = 3/6 = 1/2.
2. If P(A)=0.42, find P(Aโฒ).
P(Aโฒ)=1โ0.42=0.58.
3. Independent events have probabilities 0.6 and 0.5. Find P(both).
P(both)=0.6ร0.5=0.30.
4. A card is drawn from a standard deck. Find P(king or queen).
Kings and queens are mutually exclusive: (4+4)/52=8/52=2/13.
5. Three fair coins are tossed. Find P(at least one head).
P(at least one H)=1โP(TTT)=1โ1/8=7/8.
๐ 15. Quick Revision
0 โค P(A) โค 1; impossible events have probability 0 and certain events have probability 1.
For equally likely outcomes, probability = favourable/total.
Complement: P(Aโฒ)=1โP(A).
Addition: P(AโชB)=P(A)+P(B)โP(AโฉB).
Independent both: P(AโฉB)=P(A)P(B).
Conditional probability: P(A|B)=P(AโฉB)/P(B).
Experimental probability approaches theoretical probability as trials increase.
Expected value is a weighted long-run average.
INTERACTIVE PRACTICE
๐ฒ Probability Practice
Complete 20 questions from easy to hard. Your score, every option, correct answers and explanations appear after final submission.