Programming lesson
Mastering Probability with Set Card Game & Geometric Intuition: A MATH154 Tutorial
Learn probability through the Set card game (81 cards, 4 dimensions) and geometric problems (hitting spheres in cubes). Includes conditional probability, prime twins, and coin puzzles.
Probability Meets the Game of Set: A 4D Vector Space in Your Hands
The card game Set uses 81 cards, each with four attributes: color, number, shape, and shading. Each attribute has three possibilities, making the deck a model of the finite field GF(81) or a 4-dimensional vector space over GF(3). A "set" is three cards where, for each attribute, the values are either all the same or all different. This structure is a beautiful example of how probability and linear algebra intersect. In this tutorial, we'll explore probability problems inspired by Set and other classic puzzles, building intuition for geometric probability and conditional probability.
Problem 1.2: Probability of Drawing a Set from 81 Cards
You randomly pick 3 cards from the 81. What is the probability that they form a set? Let's break it down. First, total ways to choose 3 cards: C(81,3) = 81*80*79/6 = 85,320. Now, count the number of sets. For any two cards, there is exactly one third card that completes a set. Why? Because given two cards, for each attribute, the third card's attribute is forced: if the two agree, the third must match; if they differ, the third must be the remaining one. So for each pair of cards, exactly one third card yields a set. However, each set is counted three times (once for each pair). Number of sets = (number of pairs) / 3 = C(81,2)/3 = (81*80/2)/3 = 3240/3 = 1080. Thus probability = 1080 / 85,320 = 1/79 ≈ 0.01266. This is a neat result: about 1.27% chance.
Geometric Probability: Hitting a Sphere Inside a Cube
Problem 1.1 explores the probability that a randomly chosen point in a cube also lies inside the inscribed sphere. This is a classic geometric probability problem that scales with dimension.
a) Square [-1,1] × [-1,1] (2D)
The region is a square of side length 2 (area 4). The condition x² + y² ≤ 1 defines a unit circle (radius 1) of area π. Probability = area of circle / area of square = π/4 ≈ 0.7854.
b) Cube [-1,1]³ (3D)
The cube volume = 2³ = 8. The sphere of radius 1 has volume (4/3)π. Probability = (4/3)π / 8 = π/6 ≈ 0.5236.
c) 1000-Dimensional Cube
In high dimensions, the volume of a sphere of radius 1 is V_d = π^(d/2) / Γ(d/2+1). For d=1000, this is extremely small. The cube volume is 2^1000. The probability is V_d / 2^1000, which is astronomically tiny. In fact, for large d, the sphere's volume tends to zero relative to the cube. This illustrates the "curse of dimensionality": most of the volume of a high-dimensional cube is near its corners.
Prime Twins: Expected Count Below n
Problem 1.3 uses the prime number theorem: the density of primes near n is about 1/ln(n). The probability that both n and n+2 are prime is roughly 1/(ln(n) * ln(n+2)) ~ 1/(ln n)². Summing from 1 to n gives the expected number of twin primes: ∫₂ⁿ dx/(ln x)². This integral is approximately n/(ln n)². So expected twin primes below n ~ n/(ln n)². For n=10^6, that's about 10^6/(13.8)² ≈ 5200, close to actual count 8169? Wait actual twin primes below 10^6 is 8169, but the simple formula gives about 5200, so it's a rough estimate. The refined Hardy-Littlewood conjecture includes a constant factor.
Conditional Probability: Kids and Coins
Problem 1.4: Alex's Three Kids
a) Given at least one girl, what's P(all three girls)? Sample space: 2³ = 8 equally likely outcomes. Condition: at least one girl removes the one all-boys outcome. So 7 outcomes remain, only one is all girls. Probability = 1/7.
b) Given the oldest is a girl, what's P(all three girls)? Now the oldest is fixed as girl. The other two can be any of 2² = 4 outcomes, only one is two girls. So probability = 1/4.
Problem 1.5: The Three Boxes and a Gold Coin
Boxes: GG, SS, GS. You pick a box at random, then a coin at random. You see it's gold. What's P(other coin gold)? This is a classic conditional probability puzzle. Use Bayes' theorem. Prior: each box equally likely (1/3). Probability of drawing gold from GG = 1, from GS = 1/2, from SS = 0. Given gold, posterior for GG = (1/3 * 1) / (1/3*1 + 1/3*1/2 + 1/3*0) = (1/3) / (1/2) = 2/3. So probability other coin is gold = 2/3.
Connecting to Current Trends: AI and High-Dimensional Spaces
High-dimensional geometry isn't just academic. In machine learning, data is often represented in high-dimensional spaces (e.g., word embeddings with hundreds of dimensions). The "curse of dimensionality" affects nearest neighbor search and clustering. Understanding that most volume is near the surface helps in designing algorithms. Also, the game Set has inspired AI research: playing Set requires pattern recognition and combinatorial reasoning, a benchmark for AI.
Summary
We've covered probability from card games to geometry to number theory. Key takeaways: counting combinations, geometric probability scaling with dimension, conditional probability with Bayes. These concepts are foundational for statistics, data science, and AI.