Lesson 2 of 2 · Game Theory

Zero-sum games, the Minimax theorem and adversarial networks

In a zero-sum game what one player wins the other loses; the Minimax theorem guarantees that \(\max\min = \min\max\) with mixed strategies, generative adversarial networks are a zero-sum game between a generator and a discriminator, and simultaneous gradient descent-ascent can cycle or diverge around the equilibrium instead of converging.

Advanced mathematics for AI Difficulty: Expert Study time: 55 min
Lesson contents
  1. Introduction
  2. Why study this topic?
  3. Theoretical explanation
  4. Mathematical definitions
  5. The equations
  6. Worked example
  7. Application in AI
  8. Interactive lab
  9. Practice exercises
  10. Summary
  11. Short quiz
  12. Related lessons

1 Introduction

The generator in a GAN tries to fool the discriminator, and the discriminator tries to detect fakes. What one gains the other loses. This is the structure of a zero-sum game, and it explains why training GANs is fundamentally different from minimizing a single loss function.

Learning objectives

  • Compute maximin, minimax and the saddle point
  • Solve a 2×2 zero-sum game with mixed strategies
  • Write the GAN objective and derive the optimal discriminator
  • Analyze gradient descent-ascent on \(f(x, y) = xy\)

2 Why study this topic?

The original GAN objective (Goodfellow et al., 2014) is a min-max problem. Adversarial training to make models robust against attacks is also a min-max problem. Understanding gradient dynamics in games explains the instability of GAN training and phenomena such as cycling around the equilibrium.

3 Theoretical explanation

Zero-sum game

The second player's payoff is the negative of the first's: \(B = -A\). The first maximizes A and the second minimizes it. The best the first can guarantee with a pure strategy is \(\max_i\min_j A_{ij}\) (maximin), the best the second can guarantee is \(\min_j\max_i A_{ij}\) (minimax), and always \(\text{maximin} \le \text{minimax}\).

Saddle point

If they are equal, there is a saddle point: an entry that is the smallest in its row and the largest in its column. In \(\begin{bmatrix}4&2\\3&1\end{bmatrix}\) the entry 2 is a saddle point and the value of the game is 2.

Minimax theorem

Von Neumann (1928): with mixed strategies the two sides are always equal:

\[\max_{p}\min_{q} p^\top A q = \min_{q}\max_{p} p^\top A q = v\]

For \(A = \begin{bmatrix}3&-1\\-2&1\end{bmatrix}\): the pure maximin is \(-1\) and the pure minimax is 1, while with mixing the value is \(v = 1/7\) and \(p^* = 3/7\).

GAN as a zero-sum game

\[\min_G \max_D\; \mathbb E_{x\sim p_{\text{data}}}[\log D(x)] + \mathbb E_{z}[\log(1 - D(G(z)))]\]

For a fixed generator the optimal discriminator is \(D^*(x) = \frac{p_{\text{data}}(x)}{p_{\text{data}}(x) + p_g(x)}\), and by substitution the generator's objective becomes \(-\log 4 + 2\,\mathrm{JSD}(p_{\text{data}}\|p_g)\), so its minimum is \(-\log 4\) when \(p_g = p_{\text{data}}\), and then \(D^* = 1/2\) everywhere.

Gradient dynamics in games

On the simplest game \(f(x, y) = xy\) (x minimizes and y maximizes) the equilibrium is \((0, 0)\). The simultaneous update:

\[x_{t+1} = x_t - \eta y_t,\qquad y_{t+1} = y_t + \eta x_t\]

is a rotation with scaling: the distance from the origin is multiplied by \(\sqrt{1 + \eta^2}\) every step, so the path spirals outward. The alternating update (y uses the new x), however, keeps the path on a roughly closed orbit. That is why GANs use techniques such as alternating updates, different learning rates and regularization.

The first player chooses the p that maximizes the minimum of the two lines, which meet at p = 3/7 with value 1/7

4 Mathematical definitions

Zero-sum game
A game in which the players' payoffs sum to zero in every outcome.
\[B=-A\]
Saddle point
An entry that is the smallest in its row and the largest in its column, where maximin and minimax are equal.
Value of the game
The guaranteed payoff of the first player when both sides play their optimal strategies.
\[v=\max_p\min_q p^\top Aq\]
Generative adversarial network
A generator and a discriminator trained together in a min-max game.
Zero-sum game
A game in which one player's gain equals the other's loss.
\[B=-A\]
Minimax theorem
With mixed strategies, maximin and minimax are equal in finite zero-sum games.
\[\max_p\min_q p^\top Aq=\min_q\max_p p^\top Aq\]
The GAN objective
A min-max game between a generator and a discriminator whose solution is \(p_g = p_{\text{data}}\).
\[\min_G\max_D\mathbb E[\log D]+\mathbb E[\log(1-D(G(z)))]\]

5 The equations

\[\max_p\min_q p^\top Aq = \min_q\max_p p^\top Aq\]
Minimax theorem
\[\min_G\max_D\; \mathbb E[\log D(x)] + \mathbb E[\log(1 - D(G(z)))]\]
GAN objective
\[D^*(x) = \frac{p_{\text{data}}(x)}{p_{\text{data}}(x)+p_g(x)}\]
Optimal discriminator
\[\|(x_{t+1}, y_{t+1})\| = \sqrt{1+\eta^2}\,\|(x_t, y_t)\|\]
Divergence of the simultaneous update

6 Step-by-step worked example

A mixed game

Problem: Solve the zero-sum game \(A = \begin{bmatrix}3&-1\\-2&1\end{bmatrix}\).

  1. No saddle point: maximin = −1 and minimax = 1.
  2. \(d = 3 + 1 + 2 + 1 = 7\), \(p^* = (1 + 2)/7 = 3/7\).
  3. \(v = (3 \cdot 1 - (-1)(-2))/7 = 1/7\).

Result: \(v = 1/7\), \(p^* = 3/7\)

Optimal discriminator

Problem: At a point x, \(p_{\text{data}}(x) = 0.6\) and \(p_g(x) = 0.2\). What is \(D^*(x)\)?

  1. \(D^* = 0.6/(0.6 + 0.2)\).

Result: \(D^* = 0.75\)

Gradient divergence

Problem: With \(\eta = 0.1\), by how much is the distance from equilibrium multiplied in each simultaneous step on \(xy\)?

  1. \(\sqrt{1 + 0.01}\).

Result: \(\approx 1.00499\), so after 100 steps it grows by a factor of about 1.64

7 Practical application in AI

  • Generative adversarial networks: The generator and the discriminator play a min-max game, and training them is a search for its equilibrium.
  • Adversarial training: To make a classifier robust we solve \(\min_\theta \max_{\|\delta\| \le \epsilon} L(x + \delta)\).
  • Multi-agent games: Chess and poker algorithms search for Minimax strategies or approximations of Nash equilibrium.

8 Interactive lab linked to the lesson

Two-player games with two payoff matrices, pure and mixed Nash equilibria and the two best-response functions; zero-sum games and the minimax theorem; and learning dynamics: simultaneous and alternating gradient descent-ascent, and fictitious play.

Open the Game Theory Lab

9 Practice exercises

Review questions for reflection

  • Why is \(D^* = 1/2\) at equilibrium in a GAN?
  • Why does the simultaneous update diverge on \(xy\)?

Common mistakes

  • Treating GAN training as minimizing a single loss and expecting it to decrease monotonically.
  • Assuming that every zero-sum game has a pure saddle point.
  • Thinking that simultaneous descent-ascent always converges to the equilibrium.
  • Forgetting that mixed strategies are necessary for maximin and minimax to be equal.

Practice 9 questions from the question bank for this lesson

10 Lesson summary

  • In a zero-sum game maximin ≤ minimax.
  • With mixing they are equal (the Minimax theorem).
  • The GAN objective is min-max and its solution is \(p_g = p_{\text{data}}\).
  • Simultaneous gradients cycle and diverge around the equilibrium in the simplest games.

11 Short quiz

5 questions · 10 minutes · pass mark 60% — passing it completes the lesson.