Lesson 4
RL 11-13
These are my original lecture notes, kept as they were. They're being rebuilt into the Reinforcement learning course.
1. Starting from Scratch: What Even is a "Game"?
1.1 Forget Board Games for a Moment
When mathematicians and economists say "game," they don't just mean chess or Monopoly. They mean any situation where:
- Multiple people (or entities) are making decisions
- What happens to you depends on what others decide
- Everyone is trying to do well for themselves
That's it. A "game" is just a situation with strategic interaction.
1.2 Games Are Everywhere
Let's see some examples that you might not think of as "games":
Driving through an intersection:
- Players: You and the other driver
- Decisions: Go or wait
- What happens to you depends on both choices (if both go → crash!)
Negotiating salary:
- Players: You and the employer
- Decisions: What number to ask for / offer
- Outcome depends on both (if you ask too high and they won't budge → no job)
Choosing a restaurant with friends:
- Players: You and your friends
- Decisions: What to suggest / agree to
- Everyone's satisfaction depends on the group choice
Setting prices for your product:
- Players: You and your competitors
- Decisions: What price to charge
- Your profit depends on your price AND their prices
1.3 Why This Matters for Reinforcement Learning
Throughout this course, we've studied a single agent learning in an environment. The agent takes actions, gets rewards, and figures out the best policy.
But here's the problem: We've been treating everything except our agent as "the environment"—as if other decision-makers are just like weather or random noise.
The Reality: Other agents aren't random. They have goals. They're watching you. They adapt.
| What We Assumed | What's Actually True |
|---|---|
| Environment is fixed or random | Other agents are strategic |
| My best action depends on states | My best action depends on what others will do |
| There's an "optimal policy" | "Optimal" depends on others' choices |
Game theory gives us the mathematical tools to handle this.
1.4 The Key Insight
The fundamental challenge of strategic interaction: My best choice depends on your choice. But your best choice depends on my choice. How do we untangle this?
This circular dependence is what makes games interesting—and hard.
2. The Building Blocks: Players, Actions, and Payoffs
2.1 The Ingredients of Any Game
Every game has these components:
Players
The decision-makers. Could be:
- People (you, opponent, customers)
- Companies (competitors)
- Countries (in international relations)
- AI agents (robots, software)
- Even animals (in evolutionary biology)
We typically call them Player 1, Player 2, ... or Player A, Player B, ... or use names like "Alice" and "Bob."
Actions (or Moves)
What each player can choose to do. Examples:
- In rock-paper-scissors: Rock, Paper, or Scissors
- In pricing: Set price at 15, $20, ...
- In negotiation: Accept, reject, counteroffer
Important: Different players might have different action sets!
Payoffs (or Utilities)
What each player gets for each possible outcome. This is the "score" that players are trying to maximize.
Payoffs can represent:
- Money (profit, cost)
- Years in prison (negative payoff)
- Happiness/satisfaction
- Anything the player cares about
Key point: Payoffs depend on the combination of everyone's actions, not just your own.
2.2 A Super Simple Example: The Handshake Game
Let's build intuition with the simplest possible game.
Situation: Two people meet. Each can either extend their hand for a handshake or keep it at their side.
Players: Person A, Person B
Actions:
- A can: Extend or Keep
- B can: Extend or Keep
Payoffs (let's say satisfaction points):
- Both extend: Successful handshake! Both happy. (+2, +2)
- Both keep: Nothing happens. Neutral. (0, 0)
- One extends, other keeps: Awkward! Extended person feels embarrassed.
- A extends, B keeps: (-1, 0)
- A keeps, B extends: (0, -1)
Notice: A's payoff depends on BOTH what A does AND what B does. That's what makes it a game!
2.3 Information: What Do Players Know?
Another crucial ingredient: What does each player know when making their decision?
Perfect information: Everyone knows everything—the full history of the game, what state we're in, etc.
- Chess: You can see the whole board
- Tic-tac-toe: All moves are visible
Imperfect information: Some things are hidden.
- Poker: You don't see opponents' cards
- Battleship: You don't see where ships are placed
- Real life: You don't know what competitors are planning
2.4 Timing: Who Moves When?
Simultaneous games: Players choose at the same time (or at least without seeing the other's choice).
- Rock-paper-scissors: You reveal at the same moment
- Sealed-bid auctions: Everyone submits without seeing others
Sequential games: Players take turns, and later players see what earlier players did.
- Chess: You see opponent's move before choosing yours
- Bargaining: You hear their offer before responding
3. How We Write Down Games: Matrices and Trees
3.1 Why We Need Notation
To analyze games precisely, we need a way to write them down clearly. There are two main formats:
- Payoff matrices (tables) — best for simultaneous games
- Game trees (diagrams) — best for sequential games
3.2 Payoff Matrices: The Table Format
A payoff matrix shows all possible combinations of actions and their resulting payoffs.
How to read a payoff matrix:
Player B's choices
─────────────────────
│ Left │ Right │
┌───────────┼────────┼─────────┤
Player │ Up │ (3, 1) │ (0, 2) │
A's ├───────────┼────────┼─────────┤
choices │ Down │ (2, 0) │ (1, 3) │
└───────────┴────────┴─────────┘Reading the entries:
- Rows = Player A's possible actions
- Columns = Player B's possible actions
- Each cell = (A's payoff, B's payoff) for that combination
Example: If A chooses "Up" and B chooses "Left", look at row 1, column 1:
- The entry is (3, 1)
- A gets 3 points
- B gets 1 point
Let's trace through another example:
- A chooses "Down", B chooses "Right"
- Look at row 2, column 2: (1, 3)
- A gets 1, B gets 3
3.3 Worked Example: Rock-Paper-Scissors
Players: A and B Actions: Rock (R), Paper (P), Scissors (S) for each Payoffs: Winner gets +1, loser gets -1, tie is 0
Player B
┌────────┬────────┬────────┐
│ Rock │ Paper │Scissors│
┌───────────┼────────┼────────┼────────┤
│ Rock │ (0,0) │(-1,+1) │(+1,-1) │
Player ├───────────┼────────┼────────┼────────┤
A │ Paper │(+1,-1) │ (0,0) │(-1,+1) │
├───────────┼────────┼────────┼────────┤
│ Scissors │(-1,+1) │(+1,-1) │ (0,0) │
└───────────┴────────┴────────┴────────┘Verification:
- Rock vs Scissors: Rock wins → (+1, -1) ✓
- Paper vs Rock: Paper wins → (+1, -1) ✓
- Same choice: Tie → (0, 0) ✓
3.4 Game Trees: The Diagram Format
For games where players move in sequence, a tree is clearer.
The structure:
- Nodes (circles): Decision points
- Branches (lines): Possible actions
- Labels: Which player decides at each node
- Leaves (endpoints): Final outcomes with payoffs
Simple example: A moves first, then B.
A's turn
/ \
Action X Action Y
| |
B's turn B's turn
/ \ / \
L R L R
| | | |
(3,1) (0,2) (2,0) (1,3)How to read this:
- Start at the top (root)
- A chooses X or Y
- Then B sees A's choice and picks L or R
- We reach a leaf with payoffs (A's payoff, B's payoff)
Example path: A picks X, then B picks L → payoff is (3, 1)
3.5 Converting Between Formats
Tree → Matrix:
A strategy in a tree is a complete plan: "What will I do at each of my decision points?"
For the tree above:
- A has 2 strategies: X or Y
- B has 4 strategies:
- "L always" (L if A plays X, L if A plays Y)
- "R always"
- "L if X, R if Y"
- "R if X, L if Y"
But since A moves first and B sees it, we can simplify. The matrix for this game is exactly what we drew: A's choice determines row, B's choice determines column.
Matrix → Tree: We can also go backward, though it's less natural for simultaneous games.
4. Zero-Sum Games: Pure Competition
4.1 What "Zero-Sum" Means
A game is zero-sum if the payoffs always add up to the same constant (usually zero).
In other words: Whatever one player gains, the other loses.
Mathematical definition: For all outcomes,
(Or more generally, = some constant c. We can always subtract c/2 from each player to make it sum to 0.)
4.2 Examples of Zero-Sum Games
Rock-Paper-Scissors: Check our matrix above.
- (0, 0): sum = 0 ✓
- (+1, -1): sum = 0 ✓
- (-1, +1): sum = 0 ✓
Every cell sums to zero. One player's win is the other's loss.
Chess (simplified scoring):
- White wins: (+1, -1)
- Black wins: (-1, +1)
- Draw: (0, 0)
All sum to zero.
Poker (ignoring the house):
- Money won by one player = Money lost by others
- Total money is conserved
4.3 Examples of NON-Zero-Sum Games
Business Partnership:
- Both work hard: Company succeeds, both get bonuses (+100, +100) → sum = +200
- Both slack off: Company fails, both lose jobs (-50, -50) → sum = -100
- Different sums for different outcomes!
Trade:
- I have apples, you have oranges
- We trade: I get fruit variety I like (+3), you get variety you like (+3)
- We don't trade: Both stuck with one type (+1, +1)
- Trade creates value! (+3, +3) > (+1, +1)
Prisoner's Dilemma (we'll study this in detail):
- Outcomes range from sum = -2 to sum = -12
- NOT zero-sum!
4.4 Why Zero-Sum Games Are Simpler
In zero-sum games:
- Interests are perfectly opposed
- Helping your opponent hurts you by definition
- No possibility of "win-win" cooperation
- Pure competition
This simplifies analysis. There's no complicated trade-off between competing and cooperating—you should always compete!
4.5 The Simplification for Zero-Sum Games
Since B's payoff = -(A's payoff) in zero-sum games, we only need to write A's payoffs:
Rock-Paper-Scissors (A's payoffs only):
B
R P S
R 0 -1 +1
A P +1 0 -1
S -1 +1 0B's payoffs are just the negatives of these numbers.
5. Your First Strategy: "What Should I Do?"
5.1 The Central Question
You're playing a game. You need to pick an action. How do you decide?
This seems simple, but it's actually profound. The difficulty:
- Your best action might depend on what your opponent does
- But their best action might depend on what YOU do
- How do we break this circularity?
5.2 What Is a Strategy?
A strategy is a complete plan specifying what you'll do in every possible situation.
Analogy: Imagine you're going on vacation and leaving instructions for a friend to play on your behalf. You need to tell them what to do no matter what happens. That complete instruction manual is your strategy.
In a simple simultaneous game: Your strategy is just your action choice.
- Rock-paper-scissors: Your strategy might be "always play Rock" or "play Paper"
In a sequential game: Your strategy specifies what to do at every decision point, even ones you might not reach.
- Chess: A (hypothetical complete) strategy would say what move to make in EVERY possible board position
Important terminology: In game theory, strategy = policy (from RL).
5.3 Pure Strategies
A pure strategy is a definite, non-random plan.
"I will definitely do X." No randomness, no probability.
Examples of pure strategies:
- "Always play Rock" (rock-paper-scissors)
- "Open with e4" (chess)
- "If opponent cooperates, cooperate. If opponent defects, defect." (repeated game)
5.4 Counting Pure Strategies
If you have 3 choices (like R, P, S), you have 3 pure strategies.
If you have multiple decision points, you multiply:
- Decision point 1: 2 choices
- Decision point 2: 3 choices
- Decision point 3: 2 choices
- Total pure strategies: 2 × 3 × 2 = 12
Why this matters: Even in simple games, the number of strategies grows fast. Chess has roughly 10^120 possible games, making complete analysis impossible.
5.5 The Problem with Pure Strategies in Some Games
Consider rock-paper-scissors.
If I always play Rock (pure strategy):
- Opponent figures this out
- Opponent always plays Paper
- I always lose!
Any pure strategy in RPS can be exploited by a smart opponent.
This suggests we might need something more sophisticated...
6. Minimax: Thinking About the Worst Case
6.1 The Pessimist's Approach
Here's one way to choose: Assume the worst and prepare for it.
This is called maximin (or "minimax" from the opponent's perspective).
The logic:
- For each action I might take, ask: "What's the worst that could happen?"
- Choose the action where that worst case is least bad.
6.2 Maximin Step-by-Step
Let's work through an example with a concrete game.
Game: Investment Choices (A's payoffs only, since this is zero-sum against "Nature/Opponent")
Opponent (B)
Attack Ignore
Strategy Aggressive -50 +100
(A) Defensive -10 +20Reading the game:
- If A is Aggressive and B Attacks: A loses 50
- If A is Aggressive and B Ignores: A gains 100
- If A is Defensive and B Attacks: A loses 10
- If A is Defensive and B Ignores: A gains 20
Step 1: For each of A's strategies, find the minimum payoff.
- Aggressive: min(-50, +100) = -50 (the worst is B attacks)
- Defensive: min(-10, +20) = -10 (the worst is B attacks)
Step 2: Choose the strategy with the maximum of these minimums.
- max(-50, -10) = -10
Maximin strategy: Defensive (guarantees at least -10)
What this means: No matter what B does, if A plays Defensive, A won't lose more than 10. Playing Aggressive risks losing 50.
6.3 The Opponent's Perspective: Minimax
Now think from B's side. B wants to minimize A's payoff (since this is zero-sum—minimizing A's gain = maximizing B's gain).
Step 1: For each of B's strategies, find the maximum A could get.
- Attack: max(-50, -10) = -10 (A does best by being Defensive)
- Ignore: max(+100, +20) = +100 (A does best by being Aggressive)
Step 2: Choose the strategy with the minimum of these maximums.
- min(-10, +100) = -10
Minimax strategy for B: Attack (limits A to at most -10)
6.4 When Maximin = Minimax: The Magic Happens
In our example:
- A's maximin = -10
- B's minimax = -10
They're equal! This is special.
What it means:
- A can guarantee at least -10 (by playing Defensive)
- B can guarantee A gets at most -10 (by playing Attack)
- The game has a well-defined "value" of -10
- Neither player can do better, even if they knew the opponent's strategy!
This point is called a saddle point (from the shape of a saddle—highest in one direction, lowest in the perpendicular direction).
6.5 The Minimax Theorem (Von Neumann, 1928)
Theorem: In any two-player zero-sum finite game of perfect information:
In plain English: The pessimist's value (maximin) equals the optimist's limit (minimax).
What this guarantees:
- Every such game has a well-defined "value"
- Both players have optimal strategies
- These strategies work even if your opponent knows your strategy!
This is remarkable: The game has a "fair" answer that neither player can escape.
6.6 A Complete Worked Example
Game Matrix (A's payoffs):
B: Left B: Middle B: Right
A: Top 5 2 8
A: Bottom 3 4 1Find A's maximin:
For each row, find the minimum (worst case for A):
- Top: min(5, 2, 8) = 2 (Middle is worst)
- Bottom: min(3, 4, 1) = 1 (Right is worst)
Maximin = max(2, 1) = 2 (achieved by playing Top)
Find B's minimax:
For each column, find the maximum (best A can get):
- Left: max(5, 3) = 5 (Top is best for A)
- Middle: max(2, 4) = 4 (Bottom is best for A)
- Right: max(8, 1) = 8 (Top is best for A)
Minimax = min(5, 4, 8) = 4 (achieved by playing Middle)
Compare:
- A's maximin = 2
- B's minimax = 4
They're NOT equal! No saddle point in pure strategies.
What this means: This game doesn't have a "stable" pure strategy solution. If A plays Top (guaranteeing 2), B should play Middle (giving A just 2). But if B plays Middle, A should switch to Bottom (getting 4 instead of 2)! But if A plays Bottom, B should play Right (giving A just 1)...
We need mixed strategies to find the true game value (which will be between 2 and 4).
7. When Randomness Helps: Mixed Strategies
7.1 The Surprising Power of Randomization
So far, we've only considered pure strategies: "Definitely do X."
A mixed strategy introduces randomness: "Do X with probability p, do Y with probability (1-p)."
Why would you ever randomize? At first, this seems like a bad idea. Why not just pick the best action?
7.2 The Rock-Paper-Scissors Insight
Let's think about rock-paper-scissors.
If you always play Rock (pure strategy):
- Your opponent notices and always plays Paper
- You always lose
If you always play Paper: Opponent plays Scissors, you lose.
If you always play Scissors: Opponent plays Rock, you lose.
Any pure strategy is exploitable! An observant opponent will figure out your pattern and beat you every time.
The solution: Be unpredictable. Play each option with probability 1/3.
Now your opponent can't exploit you—there's no pattern to detect!
7.3 Mixed Strategies: The Formal Definition
A mixed strategy is a probability distribution over your pure strategies.
For rock-paper-scissors: where:
- Each p ≥ 0
The uniform mixture: (1/3, 1/3, 1/3)
A biased mixture: (0.5, 0.3, 0.2) — play Rock half the time, Paper 30%, Scissors 20%
7.4 Computing Expected Payoffs
When players use mixed strategies, we care about expected payoffs.
Example: A plays Rock with prob 0.6, Paper with prob 0.4. B plays Paper with prob 0.5, Scissors with prob 0.5.
Expected payoff for A = sum over all outcomes of (probability × payoff)
| A plays | B plays | Probability | A's payoff | Contribution |
|---|---|---|---|---|
| R (0.6) | P (0.5) | 0.6 × 0.5 = 0.3 | -1 | -0.3 |
| R (0.6) | S (0.5) | 0.6 × 0.5 = 0.3 | +1 | +0.3 |
| P (0.4) | P (0.5) | 0.4 × 0.5 = 0.2 | 0 | 0 |
| P (0.4) | S (0.5) | 0.4 × 0.5 = 0.2 | -1 | -0.2 |
Total expected payoff for A = -0.3 + 0.3 + 0 + (-0.2) = -0.2
So with these mixed strategies, A expects to lose 0.2 on average.
7.5 Finding the Optimal Mixed Strategy
The key insight: Choose your mixture so that your opponent cannot exploit you.
How? Make your opponent indifferent—no matter what they do, they get the same expected payoff against you.
For rock-paper-scissors: If A plays (1/3, 1/3, 1/3):
B's expected payoff from playing Rock: = (1/3)(0) + (1/3)(+1) + (1/3)(-1) = 0
B's expected payoff from playing Paper: = (1/3)(+1) + (1/3)(0) + (1/3)(-1) = 0
B's expected payoff from playing Scissors: = (1/3)(-1) + (1/3)(+1) + (1/3)(0) = 0
B is indifferent—Rock, Paper, and Scissors all give B an expected payoff of 0!
When your opponent is indifferent, they can't exploit you. Any choice they make gives them the same result.
7.6 The Minimax Theorem Extended
Von Neumann's theorem extends to mixed strategies:
Full Minimax Theorem: Every finite two-player zero-sum game has a value V, and both players have optimal mixed strategies that guarantee this value.
Even games without pure strategy equilibria (like our 2×3 example earlier) have mixed strategy equilibria.
8. Hidden Information: The Poker Problem
8.1 Why Hidden Information Changes Everything
So far, we've assumed perfect information—both players know everything.
But many real games have hidden information:
- Poker: You don't see opponents' cards
- Negotiations: You don't know their bottom line
- War: You don't know enemy positions
Hidden information makes games much more complex—and makes bluffing and deception rational!
8.2 A Simple Poker Game: Building Intuition
Let's study "mini-poker" from the lectures. This is poker stripped to its essence.
Setup:
- One card is dealt to Player A: either Red or Black (50% each)
- Only A sees the card
- Red is BAD for A (A wants to hide a red card)
- Black is GOOD for A (A wants to show a black card)
The game sequence:
[Card Dealt]
50% Red, 50% Black
|
A sees card
|
A decides: RESIGN or HOLD?
/ \
RESIGN HOLD
| |
Game ends B decides:
A loses 20¢ RESIGN or SEE?
/ \
RESIGN SEE
| |
A wins 10¢ Card revealed:
Red → A loses 40¢
Black → A wins 30¢8.3 Analyzing Mini-Poker: What Should A Do?
Case 1: A has Black (good card)
Should A resign or hold?
- Resign: Lose 20¢
- Hold and B resigns: Win 10¢
- Hold and B sees: Win 30¢ (Black revealed!)
Holding is always better with Black. Even if B sees, A wins!
Case 2: A has Red (bad card)
Should A resign or hold?
- Resign: Lose 20¢
- Hold and B resigns: Win 10¢ (B gave up, never saw the red!)
- Hold and B sees: Lose 40¢ (Red revealed, big loss)
This is the interesting case. If A always resigns with Red, A loses 20¢ for sure. But if A holds (bluffs!), there's a chance B will resign and A wins!
8.4 What Should B Do?
B's problem: A held, but B doesn't know if A has Red or Black.
If B could tell:
- A has Red → B should See (A loses 40¢)
- A has Black → B should Resign (A only wins 10¢ instead of 30¢)
But B can't tell! B must guess.
B's reasoning:
- If A always holds with Black and always resigns with Red: When A holds, A must have Black → B should Resign
- But if B always resigns, A should bluff with Red! Then B is being fooled.
- But if B always Sees to catch bluffs, A should never bluff. Then B is wasting effort Seeing Black cards.
This is why poker is interesting! There's a circular reasoning problem.
8.5 Solving Mini-Poker: Finding the Equilibrium
Let's find the mixed strategy equilibrium.
A's strategies:
- "Honest": Hold with Black, Resign with Red
- "Bluff": Hold with Black, Hold with Red too
B's strategies:
- "Trusting": Always Resign when A holds
- "Suspicious": Always See when A holds
Expected Payoffs (calculated by considering 50% Red, 50% Black):
B
Trusting Suspicious
A Honest -5¢ +5¢
Bluff +10¢ -5¢Calculation for (Honest, Trusting) = -5¢:
- 50% Black: A holds, B resigns → A wins 10¢
- 50% Red: A resigns → A loses 20¢
- Expected: 0.5(+10) + 0.5(-20) = 5 - 10 = -5¢
Calculation for (Honest, Suspicious) = +5¢:
- 50% Black: A holds, B sees Black → A wins 30¢
- 50% Red: A resigns → A loses 20¢
- Expected: 0.5(+30) + 0.5(-20) = 15 - 10 = +5¢
Calculation for (Bluff, Trusting) = +10¢:
- 50% Black: A holds, B resigns → A wins 10¢
- 50% Red: A holds, B resigns → A wins 10¢
- Expected: 0.5(+10) + 0.5(+10) = +10¢
Calculation for (Bluff, Suspicious) = -5¢:
- 50% Black: A holds, B sees Black → A wins 30¢
- 50% Red: A holds, B sees Red → A loses 40¢
- Expected: 0.5(+30) + 0.5(-40) = 15 - 20 = -5¢
8.6 Finding the Mixed Equilibrium
Check for pure strategy equilibrium:
- If A plays Honest: B prefers Trusting (-5¢ for A) over Suspicious (+5¢ for A). B picks Trusting.
- If B plays Trusting: A prefers Bluff (+10¢) over Honest (-5¢). A picks Bluff.
- If A plays Bluff: B prefers Suspicious (-5¢ for A) over Trusting (+10¢ for A). B picks Suspicious.
- If B plays Suspicious: A prefers Honest (+5¢) over Bluff (-5¢). A picks Honest.
We're going in circles! No pure strategy is stable.
Mixed strategy solution:
Let p = probability A bluffs (plays "Bluff").
A's expected payoff vs Trusting: A's expected payoff vs Suspicious:
For B to be indifferent:
A should bluff 40% of the time (hold with Red 40% of the time).
Game value: for A.
8.7 The Deep Insight: Optimal Bluffing
Key takeaway: In poker, the optimal strategy involves bluffing at a precise frequency.
- Bluff too little: Opponents always fold to your big bets (they know you only bet big with good cards)
- Bluff too much: Opponents always call (they know you're probably bluffing)
- Bluff just right: Opponents can't exploit you either way
This is why professional poker players talk about "balanced ranges"—mixing bluffs with value bets at the right frequency.
9. Beyond Zero-Sum: Games Where Everyone Can Win (or Lose)
9.1 The Real World Isn't Always Competitive
Zero-sum games model pure competition. But most real situations have mixed incentives:
- Some overlap in interests (we both want the project to succeed)
- Some conflict (we both want credit)
General-sum games (or non-zero-sum games) allow payoffs to sum to different amounts for different outcomes.
9.2 Coordination Games: We Both Win or Both Lose
Example: Driving
Which side of the road should we drive on?
- Both left: Safe! (+1, +1)
- Both right: Safe! (+1, +1)
- Different sides: Crash! (-10, -10)
B: Left B: Right
A: Left (+1,+1) (-10,-10)
A: Right (-10,-10) (+1,+1)Note: This is NOT zero-sum! Payoffs sum to +2 or -20.
The challenge: We have common interests (avoid crash) but need to coordinate.
9.3 Battle of the Sexes: Partial Alignment
Classic example: A couple wants to go out. He prefers football, she prefers opera. But both prefer being together over being apart.
B: Football B: Opera
A: Football (3, 2) (0, 0)
A: Opera (0, 0) (2, 3)Reading this:
- Football together: He's happy (3), she's okay (2)
- Opera together: She's happy (3), he's okay (2)
- Different places: Both unhappy (0, 0)
The conflict: They agree they should be together, but disagree on where.
9.4 Chicken: Dangerous Competition
The story: Two cars drive toward each other. Each can swerve (chicken out) or keep going (dare).
B: Swerve B: Dare
A: Swerve (0, 0) (-1, +1)
A: Dare (+1, -1) (-10,-10)- Both swerve: Tie, no one is humiliated (0, 0)
- One swerves: The one who swerves is "chicken" (-1), the other is "brave" (+1)
- Neither swerves: Crash, both badly hurt (-10, -10)
The dangerous logic: You want to convince your opponent you'll NEVER swerve, so they have to. But if both think this way... crash!
10. The Prisoner's Dilemma: The Most Important Game
10.1 The Story
This is the most famous and important game in all of game theory. It captures a fundamental problem in human (and AI) interaction.
The scenario:
Two criminals, Alice and Bob, are arrested for a crime. Police separate them into different rooms and offer each the same deal:
The offer to each prisoner:
"If you testify against your partner and they stay silent, you go FREE and they get 9 YEARS."
"If you both stay silent, we can only prove a lesser charge—you each get 1 YEAR."
"If you both testify against each other, you're both guilty of the full crime, but we'll reduce it to 6 YEARS each for cooperating with us."
10.2 Setting Up the Matrix
Actions:
- Cooperate (C): Stay silent (cooperate with your partner)
- Defect (D): Testify against your partner (defect from your partnership)
Payoffs (in years of prison—more negative is worse):
Bob
Cooperate Defect
Alice Cooperate (-1,-1) (-9, 0)
Defect ( 0,-9) (-6,-6)Reading the outcomes:
- (C, C): Both silent → 1 year each → (-1, -1)
- (C, D): Alice silent, Bob testifies → Alice gets 9 years, Bob goes free → (-9, 0)
- (D, C): Alice testifies, Bob silent → Alice goes free, Bob gets 9 years → (0, -9)
- (D, D): Both testify → 6 years each → (-6, -6)
10.3 What Should Alice Do? A Careful Analysis
Let's think through Alice's decision very carefully.
Alice's reasoning, part 1: "What if Bob stays silent (Cooperates)?"
- If I Cooperate too: I get 1 year (-1)
- If I Defect: I go FREE (0)
- 0 > -1, so Defect is better if Bob cooperates.
Alice's reasoning, part 2: "What if Bob testifies (Defects)?"
- If I Cooperate: I get 9 years (-9)
- If I Defect: I get 6 years (-6)
- -6 > -9, so Defect is better if Bob defects.
Alice's conclusion: "No matter what Bob does, I'm better off Defecting!"
10.4 Dominant Strategies
What Alice just discovered is that Defect is a dominant strategy—it's better than Cooperate no matter what the opponent does.
Definition: A strategy is strictly dominant if it gives a strictly higher payoff than any other strategy, regardless of what opponents do.
When you have a dominant strategy, play it! There's no need to guess what others will do.
Since the game is symmetric, Bob's reasoning is identical. Bob also has Defect as a dominant strategy.
10.5 The Tragic Outcome
Result: Both players play their dominant strategies (Defect, Defect).
Outcome: (-6, -6)—both get 6 years in prison.
BUT WAIT: Look at (Cooperate, Cooperate) = (-1, -1).
If both had stayed silent, they'd each get only 1 year!
This is the tragedy: Individual rationality leads to a collectively bad outcome.
- Each player does what's best for THEMSELVES
- The result is WORSE FOR BOTH than an alternative!
10.6 Why This Isn't Zero-Sum
Let's check the payoff sums:
- (C, C): -1 + (-1) = -2
- (C, D): -9 + 0 = -9
- (D, C): 0 + (-9) = -9
- (D, D): -6 + (-6) = -12
Different outcomes have different sums! This is NOT zero-sum.
The insight: (C, C) has the highest sum (-2). Mutual cooperation creates value! But the incentives push toward (D, D), which has the lowest sum (-12).
10.7 Pareto Optimality: What "Better" Means
Definition: An outcome is Pareto optimal (or Pareto efficient) if there's no other outcome that makes someone better off without making anyone worse off.
Check (D, D): Is it Pareto optimal?
- Compare to (C, C): Alice gets -1 instead of -6 (better!), Bob gets -1 instead of -6 (better!)
- (C, C) makes BOTH players better off than (D, D)!
- Therefore, (D, D) is NOT Pareto optimal.
Check (C, C): Is it Pareto optimal?
- No other outcome gives both players more than -1.
- (C, D) gives Alice -9 (worse). (D, C) gives Bob -9 (worse).
- (D, D) gives both -6 (worse).
- (C, C) IS Pareto optimal.
10.8 The Core Tension
The Prisoner's Dilemma captures a fundamental tension:
| Concept | Outcome |
|---|---|
| Nash Equilibrium (what rational players do) | (D, D) = (-6, -6) |
| Pareto Optimal (what's collectively best) | (C, C) = (-1, -1) |
They're different! Rational individual behavior doesn't lead to the best collective outcome.
10.9 Where Prisoner's Dilemma Appears in Real Life
This pattern is EVERYWHERE:
Arms races: Countries would be safer if neither built weapons, but each fears unilateral disarmament.
- Cooperate = Don't build weapons
- Defect = Build weapons
- Outcome: Both build (waste resources, both unsafe)
Climate change: Everyone benefits from reducing emissions, but reducing is costly for each individual/country.
- Cooperate = Reduce emissions
- Defect = Pollute
- Outcome: Everyone pollutes (planet suffers)
Team projects: Everyone benefits from effort, but effort is personally costly.
- Cooperate = Work hard
- Defect = Slack off
- Outcome: Everyone slacks (project fails)
Advertising: Companies spend billions canceling each other out.
- Cooperate = Don't advertise
- Defect = Advertise heavily
- Outcome: Everyone advertises (waste money, no net advantage)
11. Nash Equilibrium: When Nobody Wants to Change
11.1 What Is an Equilibrium?
In physics, an equilibrium is a stable state where forces balance and nothing changes.
Ball in a bowl: At the bottom, it stays there. Push it, it rolls back. That's a stable equilibrium.
Ball on a hilltop: Technically balanced, but any tiny push sends it rolling away. That's an unstable equilibrium.
In game theory, an equilibrium is a state where no player wants to change their strategy.
11.2 Nash Equilibrium: The Formal Definition
Nash Equilibrium: A set of strategies (one for each player) where NO player can improve their payoff by UNILATERALLY changing their strategy.
"Unilaterally" is the key word. It means: "If I change my strategy, but everyone else keeps theirs fixed, can I do better?"
At Nash equilibrium: Everyone is playing a best response to everyone else. No one has an incentive to deviate.
11.3 Why "Nash"?
Named after John Nash, the mathematician portrayed in "A Beautiful Mind." He proved that:
Nash's Theorem (1950): Every finite game has at least one Nash equilibrium (possibly in mixed strategies).
This was a huge deal! It means every game has at least one "stable" outcome, even if it requires randomization.
11.4 How to Find Nash Equilibria: Step-by-Step Method
For a 2-player game with a matrix:
For each cell in the matrix:
- Fix the column (B's strategy) and check if A wants to switch rows
- Fix the row (A's strategy) and check if B wants to switch columns
- If NEITHER wants to switch → Nash Equilibrium!
11.5 Worked Example: Finding Nash Equilibria
Let's find all pure-strategy Nash equilibria in this game:
B: Left B: Right
A: Up (3, 3) (0, 5)
A: Down (5, 0) (1, 1)Check (Up, Left) = (3, 3):
Would A switch? (Fix B at Left)
- A at Up: gets 3
- A at Down: gets 5
- 5 > 3, so YES, A wants to switch!
- ❌ NOT a Nash equilibrium.
Check (Up, Right) = (0, 5):
Would A switch? (Fix B at Right)
- A at Up: gets 0
- A at Down: gets 1
- 1 > 0, so YES, A wants to switch!
- ❌ NOT a Nash equilibrium.
Check (Down, Left) = (5, 0):
Would A switch? (Fix B at Left)
- A at Down: gets 5
- A at Up: gets 3
- 5 > 3, so A does NOT want to switch. ✓
Would B switch? (Fix A at Down)
- B at Left: gets 0
- B at Right: gets 1
- 1 > 0, so YES, B wants to switch!
- ❌ NOT a Nash equilibrium.
Check (Down, Right) = (1, 1):
Would A switch? (Fix B at Right)
- A at Down: gets 1
- A at Up: gets 0
- 1 > 0, so A does NOT want to switch. ✓
Would B switch? (Fix A at Down)
- B at Right: gets 1
- B at Left: gets 0
- 1 > 0, so B does NOT want to switch. ✓
✓ (Down, Right) IS a Nash equilibrium!
11.6 Verifying Prisoner's Dilemma
Let's confirm that (Defect, Defect) is a Nash equilibrium:
Bob
Cooperate Defect
Alice Cooperate (-1,-1) (-9, 0)
Defect ( 0,-9) (-6,-6) ← checking thisWould Alice switch from Defect? (Fix Bob at Defect)
- Alice at Defect: gets -6
- Alice at Cooperate: gets -9
- -6 > -9, so Alice does NOT want to switch. ✓
Would Bob switch from Defect? (Fix Alice at Defect)
- Bob at Defect: gets -6
- Bob at Cooperate: gets -9
- -6 > -9, so Bob does NOT want to switch. ✓
✓ (Defect, Defect) IS the Nash equilibrium.
11.7 Important Properties of Nash Equilibrium
1. Existence (Guaranteed!)
Every finite game has at least one Nash equilibrium. Might require mixed strategies, but it exists.
2. Not Necessarily Unique
Games can have:
- Exactly one Nash equilibrium
- Multiple Nash equilibria (like coordination games)
- Infinitely many (with mixed strategies)
3. Not Necessarily "Good"
Nash equilibrium tells us what WILL happen with rational players, not what SHOULD happen for society.
Prisoner's Dilemma: Nash = (D, D), but (C, C) is better for everyone!
4. Self-Enforcing
At Nash equilibrium, no external enforcement is needed. Players follow their strategies because it's in their own interest.
12. Playing the Same Game Over and Over: Repeated Games
12.1 The Hope of Repetition
In the one-shot Prisoner's Dilemma, defection is inevitable. The game ends, there are no consequences for betraying someone.
But what if you'll see this person again?
Now there are consequences:
- If I defect today, they might defect tomorrow
- If I cooperate, maybe they'll cooperate back
- Reputation matters!
12.2 Repeated Games: The Basic Idea
A repeated game is when the same "stage game" (like Prisoner's Dilemma) is played multiple times between the same players.
New possibilities:
- Punish past bad behavior
- Reward past good behavior
- Build trust over time
12.3 Finite vs. Infinite Horizon: A Crucial Distinction
Finite Horizon (Known Endpoint)
Suppose we play Prisoner's Dilemma exactly 10 times, and everyone knows it.
What happens?
Round 10 (last round):
- "This is our last interaction. No future consequences for defecting."
- Both defect (standard one-shot logic)
Round 9:
- "Round 10 is already determined (both will defect). So round 9 is effectively the 'last' meaningful round."
- No future to protect → Both defect
Round 8:
- Round 9 is determined, so round 8 is the new "last" round
- Both defect
... this reasoning continues all the way to Round 1!
Result: Both defect in EVERY round. Cooperation completely unravels.
The lesson: If players know exactly when the game ends, there's no incentive to build reputation—the end is coming, and backward induction destroys cooperation.
Infinite or Uncertain Horizon
What if you don't know when the game will end?
Model: After each round, the game continues with probability γ (gamma) and ends with probability (1-γ).
The discount factor γ:
- γ = 0.9 means 90% chance of another round
- γ = 0.5 means 50% chance
- Higher γ = longer expected relationship
Expected number of rounds:
| γ | Expected Rounds |
|---|---|
| 0.5 | 2 |
| 0.9 | 10 |
| 0.99 | 100 |
| 0.999 | 1000 |
The key insight: With uncertain horizon, there's ALWAYS a "tomorrow" to consider (probabilistically). No round is ever definitely the "last" round. This changes everything!
12.4 Strategies for Repeated Games
In repeated games, strategies can depend on the history of play. This opens up many possibilities:
Tit-for-Tat (TFT)
Definition:
- First round: Cooperate
- Every subsequent round: Do whatever your opponent did last round
Properties:
- Nice: Starts by cooperating (gives benefit of the doubt)
- Retaliatory: Punishes defection immediately (defect back next round)
- Forgiving: Returns to cooperation when opponent does
- Clear: Simple rule that opponents can easily understand
Example play against various opponents:
Round: 1 2 3 4 5 6 ...
TFT: C ? ? ? ? ?
Opponent: C C D C C D
TFT: C C C D C C DTFT copies the opponent's previous move.
Grim Trigger (Grim)
Definition:
- Cooperate as long as opponent has ALWAYS cooperated
- If opponent EVER defects, defect FOREVER after that
Properties:
- Nice: Starts cooperating
- Extremely punishing: One mistake = eternal punishment
- No forgiveness: Never recovers from defection
The threat: "Cooperate with me, or I'll make your life miserable forever."
Always Defect
Definition: Defect in every round, regardless of history.
This is the "selfish" strategy that ignores any possibility of cooperation.
Pavlov (Win-Stay, Lose-Shift)
Definition:
- If my last outcome was "good" (I got a high payoff): Repeat my action
- If my last outcome was "bad" (I got a low payoff): Switch my action
What counts as "good" vs "bad"?
- (C,C) → I got -1 → Good! Stay with C.
- (D,C) → I got 0 → Good! Stay with D.
- (C,D) → I got -9 → Bad! Switch to D.
- (D,D) → I got -6 → Bad! Switch to C.
Properties:
- Self-correcting: Naturally recovers from mistakes
- Exploitative: Takes advantage of unconditional cooperators
12.5 Why Cooperation Can Emerge: The Math
Setup: Two players using Tit-for-Tat (TFT) in repeated Prisoner's Dilemma with discount factor γ.
If both cooperate forever:
- Each round: Both get -1
- Total for each:
Should I deviate and defect once?
Let's trace what happens:
- Round t: I defect, opponent cooperates → I get 0 (instead of -1)
- Round t+1: I cooperate (TFT), opponent defects (TFT copies me) → I get -9
- Round t+2: I defect (TFT), opponent cooperates (TFT) → I get 0
- Round t+3: I cooperate, opponent defects → I get -9
- ...
We end up alternating between (C,D) and (D,C), averaging about -4.5 per round (compared to -1 from cooperation).
The deviation is only profitable if the short-term gain (avoiding -1, getting 0) outweighs the long-term pain (averaging -4.5 instead of -1).
For high enough γ, cooperation is sustainable!
12.6 The Shadow of the Future
The key factor is how much the future matters.
-
High γ (close to 1): Future rounds are almost as important as today. Long-term relationships. Cooperation is sustainable.
-
Low γ (close to 0): Only today matters. No future to worry about. Defection is optimal.
"The shadow of the future": When future consequences loom large, cooperative behavior becomes rational.
13. How Cooperation Emerges: The Folk Theorem
13.1 The Minmax Value: Your Fallback Option
Before stating the Folk Theorem, we need to understand the minmax value (also called the security level).
Definition: Your minmax value is the payoff you can GUARANTEE yourself, even if your opponent is actively trying to hurt you.
For Prisoner's Dilemma:
- If opponent defects every round, best I can do is also defect → I get -6 per round
- I can't be forced to get worse than -6 (by defecting, I ensure at least -6)
- Minmax value = -6
Intuition: This is your "walk away" payoff—what you can ensure without any cooperation.
13.2 The Feasible Region
The feasible region is all possible average payoff combinations achievable by some joint strategy.
For Prisoner's Dilemma:
- (C,C) every round: (-1, -1)
- (D,D) every round: (-6, -6)
- (C,D) every round: (-9, 0)
- (D,C) every round: (0, -9)
- Alternating: Average = (-4.5, -4.5)
- Any probabilistic mixture of these
The feasible region is the convex hull of these points.
13.3 The Folk Theorem
The Folk Theorem: In an infinitely repeated game with sufficiently high discount factor γ, ANY feasible payoff that gives each player STRICTLY MORE than their minmax value can be sustained as a Nash equilibrium.
What this means for Prisoner's Dilemma:
- Minmax values: (-6, -6)
- Any feasible payoff where A > -6 and B > -6 can be an equilibrium!
- This includes (-1, -1) from mutual cooperation!
- This includes (-3, -3) from alternating!
- This includes many others!
The contrast:
- One-shot: Only (D,D) is equilibrium
- Repeated: Many outcomes, including (C,C), can be equilibria!
13.4 How It Works: Credible Threats
The mechanism: Punish defectors so that defection isn't profitable.
Example strategy (Grim Trigger):
"I'll cooperate as long as you cooperate. If you ever defect, I'll defect forever."
Why this sustains cooperation:
- If you cooperate forever: Get -1 per round → Total:
- If you defect once: Get 0 now, but then -6 forever → Total:
Cooperation is better if:
Simplifying:
For any γ > 1/6, mutual cooperation is sustainable!
13.5 Subgame Perfection: Are Threats Credible?
Problem: Some threats are "empty"—the punisher wouldn't actually follow through if it came to it.
Definition: A strategy is subgame perfect if it remains a Nash equilibrium starting from ANY point in the game, not just the beginning.
Is Grim Trigger Subgame Perfect?
After opponent defects, Grim prescribes: "Defect forever."
Scenario: We're both in "punishment mode" (both defecting forever). Should I keep defecting?
- If I keep defecting: I get -6 forever.
- If I switch to cooperating: Opponent (playing Grim) still defects → I get -9 forever.
- Defecting is still better!
So Grim's punishment IS a best response to Grim—it's subgame perfect! ✓
Is Tit-for-Tat Subgame Perfect?
After one defection, TFT players alternate (D,C), (C,D), (D,C), ...
Scenario: I just played D, opponent played C (retaliation cycle).
- My TFT says: Play C next (copy opponent's C)
- But what if I instead played C AND opponent "forgave" and played C?
- We'd return to (C,C) = -1 each, better than alternating (-4.5 average)!
The issue: TFT's retaliation hurts ME too. I'd rather NOT punish if I could avoid it. The punishment is not "credible" in some sense.
TFT is NOT subgame perfect!
Pavlov: A Subgame Perfect Strategy
Pavlov is subgame perfect because:
- After (C,C): Both stay C → Continues cooperation ✓
- After (D,D): Both switch to C → Returns to cooperation ✓
- After (C,D): Loser switches to D, winner stays D → Goes to (D,D)
- After (D,D): Both switch to C → Returns to cooperation ✓
Pavlov naturally "fixes" mistakes without relying on non-credible threats!
14. Stochastic Games: When the Game Itself Changes
14.1 Motivation: Beyond Repeated Games
In a repeated game, you play the same stage game over and over.
But what if the "game" changes based on what happens?
Examples:
- Business competition: Market conditions change based on both firms' investments
- Military conflict: Territory changes hands based on battles
- Sports: The score changes, affecting strategy (leading team plays defensively)
These are stochastic games (also called Markov games).
14.2 Formal Definition
A stochastic game has:
- S: Set of states (each state defines a different "stage game")
- : Actions available to player i
- : Transition probability — how joint actions determine the next state
- : Immediate reward to player i
- γ: Discount factor
The key difference from repeated games: The state (and thus the available actions and payoffs) can change!
14.3 How Stochastic Games Generalize Everything
| Special Case | Condition | Result |
|---|---|---|
| MDP | 1 player | Standard reinforcement learning |
| Repeated game | 1 state (len(S) = 1) | Same stage game every time |
| Bandit | 1 player, 1 state | Simple action → reward |
Stochastic games are the grand unification of MDPs and game theory!
14.4 Example: Racing to the Treasure
Two players in a grid world, racing to reach a treasure:
+-------+-------+-------+
| A | | |
+-------+-------+-------+
| | WALL | |
+-------+-------+-------+
| | B | $ |
+-------+-------+-------+- A starts at top-left, B starts at bottom-middle
- $ is the treasure (worth +100 to whoever reaches it first)
- Each turn: Both players simultaneously move (N/S/E/W/stay)
- If both reach $ simultaneously, they split it (+50 each)
This is a stochastic game because:
- The state = (position of A, position of B)
- Actions affect transitions between states
- The "game" at each state is different (different distances to treasure)
14.5 Nash Equilibrium in Stochastic Games
A Nash equilibrium in a stochastic game is a pair of policies (complete strategies for every state) where neither player can improve by changing their entire policy.
Complexity: Now strategies are much more complex—you need to specify what to do in every possible state, not just one!
15. Teaching Computers to Play: Multi-Agent RL
15.1 The Challenge of Learning in Games
Single-agent RL: The environment is stationary. You learn Q-values, they converge to optimal.
Multi-agent RL: Other agents are learning too! As you adapt to them, they adapt to you. The "environment" (from your perspective) keeps changing.
The problem: I'm learning to respond to your strategy. But you're also learning. By the time I've adapted to "you", you've changed!
15.2 Minimax-Q: Learning in Zero-Sum Stochastic Games
For zero-sum stochastic games, we can extend Q-learning.
Recall the Bellman equation for MDPs:
The problem for games: The max assumes you control everything. In a game, your opponent is trying to MINIMIZE your payoff!
Naive (WRONG) extension:
This is "delusionally optimistic"—it assumes your opponent will help you!
Correct Minimax-Q:
At each state, we solve a matrix game to find the minimax value, not just take a max.
15.3 Why Minimax-Q Works for Zero-Sum Games
Good properties:
- ✅ Converges to optimal Q-values
- ✅ Unique solution (because zero-sum games have unique minimax values)
- ✅ Players can compute policies independently (each solves their own minimax)
- ✅ Result is a Nash equilibrium
The key: Zero-sum games have a unique "value"—both players agree on what the game is worth. This uniqueness enables learning.
15.4 Nash-Q: Attempting General-Sum Games
For general-sum games (like Prisoner's Dilemma), we might try:
Instead of minimax, find Nash equilibrium payoffs at each state.
THE PROBLEM: Nash-Q does NOT converge!
Why it fails:
- Multiple equilibria: Which Nash equilibrium do we use at each state? Different choices lead to different Q-values.
- Oscillation: As player 1 adapts, player 2's best response changes. As player 2 adapts, player 1's best response changes. They may never stabilize.
- No unique value: Unlike zero-sum games, general-sum games don't have a single "answer."
This is a major open problem in multi-agent RL!
15.5 What Actually Works?
Since Nash-Q fails, researchers have tried other approaches:
- Assume opponents are fixed (not realistic, but simple)
- Fictitious play: Assume opponents play their historical average
- Correlated equilibrium: Easier to compute than Nash
- Mean-field approaches: For many-agent systems
- Self-play with various heuristics (often works in practice!)
This remains an active research area.
16. Better Than Nash: Correlated Equilibrium
16.1 The Problem with Nash Equilibrium
In some games, Nash equilibrium isn't great:
- Multiple equilibria → coordination problem (which one?)
- Mixed equilibria → wasteful randomization
- Can't achieve the best collective outcomes
16.2 The Idea: Shared Randomization
Insight: What if players could coordinate their randomization using a shared signal?
Example setup:
- A "mediator" or "traffic light" gives each player a private recommendation
- Players don't know others' recommendations
- Players choose whether to follow their recommendation
16.3 Detailed Example: Game of Chicken
The game:
B: Swerve B: Dare
A: Swerve (6, 6) (2, 7)
A: Dare (7, 2) (0, 0)Nash equilibria:
- (Dare, Swerve): A gets 7, B gets 2 — unfair to B!
- (Swerve, Dare): A gets 2, B gets 7 — unfair to A!
- Mixed: Each Dares with probability 1/3 → Expected ≈ 4.67 each
The mixed equilibrium problem: There's a 1/9 chance of (Dare, Dare) = (0, 0). Wasteful crash!
The Correlated Solution
A traffic light (correlating device) randomly shows one of these signals:
| Probability | A sees | B sees |
|---|---|---|
| 1/3 | "Swerve" | "Dare" |
| 1/3 | "Dare" | "Swerve" |
| 1/3 | "Swerve" | "Swerve" |
Notice: (Dare, Dare) is NEVER recommended!
Expected payoff for each player:
Each player gets 5, better than the mixed Nash equilibrium (4.67)!
Why Players Follow the Signal
If A sees "Swerve": A knows B got "Dare" (prob 1/2) or "Swerve" (prob 1/2).
Should A follow (play Swerve)?
- If A swerves: Expected = 0.5 × 2 + 0.5 × 6 = 4
- If A deviates (dares): Expected = 0.5 × 7 + 0.5 × 0 = 3.5
Following is better! ✓
If A sees "Dare": A knows B got "Swerve" for sure.
Should A follow (play Dare)?
- If A dares: 7
- If A deviates (swerves): 6
Following is better! ✓
The signal is "incentive compatible" — players WANT to follow.
16.4 Formal Definition
Correlated Equilibrium: A probability distribution over joint strategies such that, given their own recommendation, no player benefits from deviating.
Properties
- Every Nash equilibrium is a correlated equilibrium (with independent randomization)
- Correlated equilibria can achieve HIGHER payoffs than any Nash equilibrium
- Computationally tractable: Finding one is a linear program (polynomial time!)
- Can eliminate bad outcomes (like (Dare, Dare) in Chicken)
16.5 Real-World Example: Traffic Lights
Traffic lights at an intersection implement a correlated equilibrium!
Without lights: Both cars want to go → potential crash (like Chicken)
With lights:
- Light shows green to one direction, red to another
- Each driver follows their signal (go on green, stop on red)
- Crashes are eliminated!
Why drivers follow:
- If you see green: You know cross traffic sees red → safe to go
- If you see red: You know cross traffic sees green → dangerous to go
The traffic light coordinates behavior to avoid the bad (crash) outcome.
17. Designing the Rules: Mechanism Design
17.1 What Is Mechanism Design?
Game Theory: Given a game, predict what players will do.
Mechanism Design: Given desired outcomes, design a game that achieves them.
Mechanism design is "reverse game theory" or "incentive engineering."
17.2 The Key Challenge: People Are Strategic
When you design rules, you must account for the fact that people will try to game those rules!
Bad design: "Report your income honestly for tax purposes."
- People have incentive to underreport
- Need enforcement, audits, penalties
Good design: Create situations where honest behavior is genuinely optimal.
17.3 Incentive Compatibility
Incentive Compatible: A mechanism where being truthful is optimal for all players.
If people have no incentive to lie, you get accurate information without expensive verification.
17.4 Example: Second-Price Auctions
Problem: You're selling an item. You want bidders to bid their true values.
First-Price Auction (Highest Bid Wins, Winner Pays Their Bid)
Should I bid my true value of $100?
- If I bid 100 for something worth $100 to me → zero profit!
- I should shade my bid lower (say $80) to make profit if I win.
- But how much to shade depends on what others bid...
Result: Strategic complexity, inefficiency, people don't bid truthfully.
Second-Price Auction (Highest Bid Wins, Winner Pays Second-Highest Bid)
Should I bid my true value of $100?
If I bid more than 110):
- If highest other bid is 105 for something worth $100 → LOSS!
- Overbidding can hurt me.
If I bid less than 90):
- If highest other bid is $95: I lose even though I value it more than the winner!
- Underbidding can cause me to lose items I want.
If I bid exactly $100:
- I only win when the price (second-highest bid) is below my value
- I never pay more than it's worth to me
- I never lose to someone who values it less
Bidding truthfully is optimal! This is incentive compatible.
17.5 Example: Peer Teaching
Problem: Student B knows the material, student A doesn't. How do we make B teach A well?
Bad mechanism: "Please teach A because it's nice."
- B has no personal stake
- B might give minimal effort
Good mechanism: "B's grade will be based on A's exam performance."
- Now B's success depends on A learning
- B has incentive to teach effectively
The principle: Align personal incentives with desired outcomes.
17.6 Example: King Solomon's Dilemma
The problem: Two women both claim to be the mother of a baby. How do you figure out who's telling the truth?
Biblical solution: Threaten to cut the baby in half.
- Real mother: "Give it to her!" (values baby's life)
- Fake mother: "Fair enough" (doesn't care as much)
Problem with biblical solution: A clever fake mother would also say "Give it to her!"
A Better Mechanism Design Solution
Setup: Let = real mother's value for the baby, = fake mother's value. Assume (real mother values baby more).
The mechanism:
- Woman A declares: "I am the mother."
- Woman B can challenge by agreeing to pay fine X (where ).
- If B challenges, A can either:
- Match: Pay X herself and keep the baby
- Concede: B gets the baby and pays X
Why this works:
If real mother (R) claims first, fake mother (F) can challenge:
- F would have to pay X if she wins
- But , so even winning costs her more than the baby is worth!
- F won't challenge.
- R gets baby for free.
If fake mother (F) claims first:
- R can challenge by committing to pay X
- F can match (pay X) or concede (R gets baby for X)
- F's options: Pay to keep, or lose baby
- F will concede (since paying X isn't worth it)
- R pays X and gets baby.
Either way, the real mother wins!
The mechanism exploits the difference in how much they value the baby to separate truth from lies.
18. Teams That Can't Talk: Dec-POMDPs
18.1 The Coordination Challenge
Scenario: Multiple robots need to work together to achieve a shared goal. BUT:
- Each robot has its own sensors (can't see everything)
- They can't communicate in real-time
- Actions affect each other
Examples:
- Search and rescue robots
- Autonomous vehicle platoons
- Distributed sensor networks
18.2 What is a Dec-POMDP?
Dec-POMDP = Decentralized Partially Observable Markov Decision Process
Components:
- I: Set of agents (robots, players)
- S: States of the world
- : Actions for each agent i
- : How joint actions affect state
- : Shared reward (everyone has same goal!)
- : Observations for agent i
- : What each agent observes
Key features:
- Decentralized: Each agent acts on its own observations
- Cooperative: Same reward function = same goal
- No communication: Can't share observations during execution
18.3 Why It's So Hard
Dec-POMDPs are NEXP-complete — much harder than:
- MDPs (polynomial)
- POMDPs (PSPACE)
The difficulty: Each agent must reason about:
- What do I observe?
- What does that tell me about the state?
- What do others observe?
- What do others think about the state?
- What will others do based on their observations?
- What should I do given all of the above?
The combinatorial explosion makes exact solutions impractical except for tiny problems.
18.4 How to Cope
Approaches:
- Centralized training, decentralized execution: Plan together beforehand, act independently later
- Communication actions: Let agents share information (but at a cost)
- Conventions: Pre-agreed rules for common situations
19. Learning What People Want: Inverse RL
19.1 The Standard RL Problem
Given: Environment (states, actions, transitions) and reward function Find: Optimal policy
19.2 The Inverse Problem
Given: Expert demonstrations (observed behavior) Find: Reward function that explains the behavior
Why "inverse"?: We go backward—from behavior to objectives instead of objectives to behavior.
19.3 Why Inverse RL Matters
Problem 1: Reward Engineering Is Surprisingly Hard
Example: You want a robot to clean a room.
Attempt 1: "Reward = +1 for each piece of dirt picked up"
- Robot might dump dirt to pick it up again!
Attempt 2: "Reward = +1 when room is clean, 0 otherwise"
- Robot might shove all dirt under the rug!
Attempt 3: "Reward = +1 for clean room, -0.01 for moving objects"
- Robot might find other loopholes...
Specifying exactly what you want is HARD. This is called the "reward hacking" problem.
Problem 2: Demonstrating Is Easy
Instead of specifying reward, show the robot what you want:
- Clean the room yourself while the robot watches
- Robot infers your objectives from your behavior
Demonstrations implicitly capture many constraints that are hard to specify explicitly.
Problem 3: Generalization
Behavioral cloning (just copying actions): Only works in situations you demonstrated.
Inverse RL (learning the reward function): The reward function generalizes to new situations!
If I learn your reward function, I can figure out what you'd want even in situations you never demonstrated.
19.4 How IRL Works (Intuition)
The assumption: The expert is (approximately) optimal for some reward function.
The approach:
- Observe what the expert does
- Find a reward function that makes the expert's behavior look optimal
- That reward function captures what the expert is trying to achieve
The challenge: Many different reward functions could explain the same behavior. We need prior beliefs or constraints to pick one.
19.5 Applications
- Autonomous driving: Learn driving style from human drivers
- Robot manipulation: Learn tasks from demonstrations
- Game AI: Create NPCs that behave like humans
- Understanding behavior: What are animals/people optimizing?
20. RL in the Real World
20.1 Why RL Is Different from Supervised Learning
| Aspect | Supervised Learning | Reinforcement Learning |
|---|---|---|
| Data | Fixed dataset | Generated through interaction |
| Feedback | Immediate labels | Delayed rewards |
| Distribution | IID samples | Sequential, correlated |
| Goal | Predict labels | Maximize cumulative reward |
The key difference: In RL, the data you collect depends on your policy. Different policies → different data!
20.2 Why Simulators Are Essential for RL
For supervised learning: You can download a dataset (ImageNet, etc.) and train on it.
For RL: You need an environment to interact with. You take actions, observe consequences, learn from them.
Options:
- Real-world interaction: Expensive, slow, potentially dangerous
- Simulators: Fast, cheap, safe
This is why RL libraries (like BURLAP from lectures) provide simulators, not static datasets!
20.3 Major RL Success Stories
TD-Gammon (1992)
Achievement: World-champion level backgammon
Method:
- TD(λ) learning with neural network
- Self-play training
- No human expert games needed!
Significance:
- First major RL success
- Discovered novel strategies humans adopted
- Showed self-play works
Helicopter Acrobatics (2000s)
Achievement: Model helicopters doing professional stunts (flips, rolls, inverted flight)
Method: Inverse RL from expert pilot demonstrations
Significance: RL can handle complex physical control in the real world
Atari Games - DQN (2013-2015)
Achievement: Superhuman performance on 40+ Atari games
Method:
- Deep Q-Network (neural network Q-function)
- Input: Raw pixels (210 × 160 × 3)
- Output: Q-values for each action
- Same architecture for ALL games!
Key innovations:
- Experience replay
- Target networks
Significance: Deep RL can master complex tasks from raw sensory input
AlphaGo/AlphaZero (2016-2017)
Achievement: Defeated world champion at Go (thought impossible for decades)
Method:
- Monte Carlo Tree Search + Deep RL
- Self-play training
- AlphaZero: No human games at all!
Significance: RL can tackle even harder games than researchers expected
20.4 RL and the Brain
Remarkable discovery: The brain appears to implement TD learning!
Evidence: Dopamine neurons fire in patterns matching TD error:
- Unexpected reward: Dopamine spike (positive TD error)
- Missing expected reward: Dopamine dip (negative TD error)
- Expected reward received: No change (zero TD error)
Implication: Evolution "discovered" TD learning before computer scientists!
21. Everything You Need to Know: Summary
21.1 The Big Picture
This module extended single-agent RL to multi-agent settings:
- Game theory provides mathematical tools for strategic interaction
- Nash equilibrium predicts stable outcomes (but not always good ones!)
- Repeated games enable cooperation through reputation
- Stochastic games combine MDPs with strategic interaction
- Multi-agent RL extends learning to these settings (but is hard!)
- Mechanism design engineers rules to achieve desired outcomes
- Inverse RL learns objectives from demonstrations
21.2 Key Definitions to Know
| Term | Definition |
|---|---|
| Zero-sum game | Payoffs always sum to zero; pure competition |
| Pure strategy | Deterministic action choice |
| Mixed strategy | Probabilistic distribution over actions |
| Dominant strategy | Best regardless of opponents' actions |
| Nash equilibrium | No player can improve by unilaterally changing |
| Pareto optimal | No outcome is better for everyone |
| Minmax value | Guaranteed payoff against worst-case opponent |
| Subgame perfect | Nash equilibrium in every subgame |
| Correlated equilibrium | Equilibrium with shared randomization |
| Incentive compatible | Truthful behavior is optimal |
21.3 Key Formulas
Expected rounds with discount factor γ:
Minimax theorem (zero-sum games):
Nash equilibrium condition:
Minimax-Q Bellman equation:
21.4 Key Insights to Remember
-
Prisoner's Dilemma: Individual rationality can lead to collective disaster
-
Folk Theorem: Repetition enables cooperation (for high enough γ)
-
Minimax works for zero-sum, but Nash-Q fails for general-sum
-
Correlated equilibrium can beat Nash equilibrium payoffs
-
Good mechanism design makes honesty the best policy
-
Inverse RL learns what to optimize from demonstrations
21.5 Common Exam Mistakes to Avoid
❌ "Nash equilibrium is always good" ✓ Nash tells you what WILL happen, not what SHOULD happen. Prisoner's Dilemma's Nash is (D,D), but (C,C) is better!
❌ "More rounds always help cooperation" ✓ Only with UNCERTAIN horizon! Known finite horizon causes backward induction.
❌ "Minimax-Q works for all multi-agent games" ✓ Only for zero-sum! Nash-Q doesn't converge for general-sum.
❌ "Mixed strategies are just about being random" ✓ The point is being UNPREDICTABLE to avoid exploitation.
❌ "Correlated equilibrium requires communication" ✓ It just requires a shared signal. Players don't talk during the game.