Open this lesson in your favourite AI. It'll walk you through the why, explain the demo, and quiz you on the try-it list.
Before any probability calculation, you need a clean answer to two questions: what are the possible outcomes, and which subsets of outcomes do we care about? That is a sample space and an event. I keep meeting smart builders who ship buggy probabilistic reasoning because they never wrote down the sample space — they conflated 'event' with 'outcome' and double-counted, or implicitly assumed equally-likely outcomes when they were not. This is the rebar inside the building. Get this concrete now and the rest of the course will feel like accounting.
A sample space is the set of all possible outcomes of an experiment. An event is any subset of . Roll two distinguishable dice; is the set of ordered pairs with , so . The event 'sum equals 7' is the subset , of size 6.
sum(w) == 11 and verify — the only ordered pairs are and .Use these three in order. Each builds on the one before.
In one paragraph, explain the difference between a sample space, an outcome, and an event using the example of rolling two dice. Why do we usually pick *ordered* pairs as outcomes rather than unordered pairs?
Walk me step by step through how I would define a sample space for an experiment with uncountably many outcomes — say, 'time to failure of a lightbulb in hours.' Where exactly does the finite-set picture break, and what replaces it?
I am modelling a 5-card poker hand from a standard deck. Give me at least two reasonable sample spaces (ordered with suits, unordered with suits, unordered ignoring suits), and for each one state $|\Omega|$ and the number of outcomes in the event 'flush.' Explain how the count of the event changes with the choice of $\Omega$.
repeat=2 with repeat=3 for three dice. Print and the size of the event 'sum equals 10' — it should be 27, not 6.list(...) can hold it — you are already brushing against measure theory.// main.go
package main
import "fmt"
func main() {
// Build the sample space: all ordered pairs (d1, d2) for two dice
type pair struct{ a, b int }
var omega []pair
for d1 := 1; d1 <= 6; d1++ {
for d2 := 1; d2 <= 6; d2++ {
omega = append(omega, pair{d1, d2})
}
}
fmt.Printf("|Omega| = %d\n", len(omega))
// Event A: outcomes where the sum equals 7
var A []pair
for _, w := range omega {
if w.a+w.b == 7 {
A = append(A, w)
}
}
fmt.Printf("|A| = %d -> %v\n", len(A), A)
fmt.Printf("P(sum=7) = %g\n", float64(len(A))/float64(len(omega)))
}
go run main.go