Skip to content
Tutorials Center
My learning

Topics

Lesson 1 of 37 ยท Getting Started

What Is Game Theory?

Meet game theory, the math of strategic decisions. Learn what a game is, who the players are, why interdependence matters, and run your first game in Python.

Most decisions you make alone: you pick a route to work, you choose a phone plan, you decide what to cook. The weather does not care what you choose. But many decisions are different. When two shops set prices, each shop's profit depends on the other's price. When two drivers meet at a narrow bridge, each one's best move depends on what the other will do. When you bid in an auction, your chance of winning depends on every other bid.

Game theory is the mathematical study of these situations, where the outcome for each decision maker depends on the choices of all the others. The word "game" does not mean the situation is trivial or fun. It is just a precise name for any setting with participants, choices and consequences. This course teaches the ideas step by step and, because you learn best by doing, every idea is implemented in Python and run right in your browser.

This first lesson gives you the vocabulary and the big picture. In the next lessons you will build the tools in order: utility and rational choice, then payoff matrices in NumPy, then equilibrium concepts and beyond.

Single-agent choice versus strategic choice

Compare two problems.

  1. Decision problem. You can invest in a savings account that pays 3 percent or a fund that pays 5 percent in a good year and 1 percent in a bad year. Nature picks the year. You compute the expected value and choose.
  2. Strategic problem. You and a rival each decide whether to open a coffee stand at the same corner. If only one of you opens, that one earns 100 a day. If you both open, each earns 30. If neither opens, nobody earns anything. Your best choice depends on your guess about the rival's choice, and the rival is thinking the same thing about you.

The second problem is a game. The key feature is interdependence: my payoff depends on your action, and yours on mine. That is why you cannot solve it with a plain optimization. You must reason about the other player's reasoning.

The ingredients of a game

Every game, from a children's card game to a trade war, is described by the same four things.

Ingredient Question it answers Coffee stand example
Players Who makes decisions? You and the rival
Actions (strategies) What can each player do? Open or stay home
Information What does each player know, and when? Both choose at the same time, without seeing the other
Payoffs How good is each outcome for each player? 100, 30 or 0

Change any ingredient and you change the game. If the rival must choose first and you can see it, the information differs and so does the best play. Later chapters explore sequential games where order matters; for now we focus on players who choose simultaneously.

Four ingredients of every game

Players Who decides
Actions What they can do
Information Who knows what
Payoffs What outcomes are worth

Change one ingredient and you have a different game.

1 / 3

A first game in code

Let us put the coffee stand game into Python. A payoff is a pair: what you get and what the rival gets. We store all four combinations in a dictionary and look them up.

Python The coffee stand game

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Notice what the last loop does. It does not tell you what to do, because you do not know what the rival will pick. It tells you what you would do for each possible rival choice. This "if they do X, I do Y" table is called a best-response table, and it is the seed of the most famous idea in the subject, the Nash equilibrium. You will build that idea properly in Chapter 3.

Types of games

Game theorists sort games along a few axes. You will meet all of these in the course.

  • Cooperative or non-cooperative. In a non-cooperative game each player picks an action on their own and cannot sign binding agreements. This course mostly studies non-cooperative games, because they model self-interested behavior without assuming anyone enforces promises.
  • Simultaneous or sequential. Do players move at the same moment, or one after another?
  • Zero-sum or non-zero-sum. In a zero-sum game, one player's gain is exactly the other's loss (poker chips in one hand). In a non-zero-sum game, everyone can win or lose together (two firms that both benefit from a standard).
  • Perfect or imperfect information. Does everyone see the entire history of play, as in chess, or are some things hidden, as in poker?
  • One-shot or repeated. Is the game played once or many times? Repetition changes incentives a lot, as the chapter on repeated games shows.
  • Finite or continuous actions. Choosing "left or right" is finite. Choosing a price or a quantity is continuous.
flowchart TD
    G["Game"] --> C["Cooperative"]
    G --> N["Non-cooperative"]
    N --> S["Simultaneous"]
    N --> Q["Sequential"]
    S --> Z["Zero-sum"]
    S --> NZ["Non-zero-sum"]
    Q --> PI["Perfect information"]
    Q --> II["Imperfect information"]

One way to organize the games in this course. Real situations often mix features.

Where game theory is used

The ideas are older than computers, and they now appear everywhere:

  • Economics. Pricing, competition between firms, auctions, bargaining and the design of markets.
  • Biology. Animals do not reason, but evolution rewards strategies that do well against the population. Evolutionary game theory explains fighting, signaling and cooperation.
  • Computer science. Network routing, online ad auctions, multi-agent AI, and security (attacker against defender).
  • Politics and law. Voting, negotiations, arms control, and how rules shape behavior.
  • Everyday life. Queuing, splitting a bill, deciding when to arrive at a party, driving in traffic.

Game theory does not promise to predict human behavior perfectly. People make mistakes, care about fairness and have limited attention. Its real value is that it gives you a precise way to ask "what happens if everyone is smart and self-interested?" and then to compare that answer with reality.

Note: Game theory models what people do when they respond to incentives, not what they should do morally. A result like "both players defect" describes an incentive structure. It is a diagnosis you can use to redesign the rules, not a recommendation to behave badly.

A tiny simulation

Before the formal tools arrive, here is a taste of why strategy matters. We pit a player who flips a coin against a player who always opens a stand, in the coffee game, over many days.

Python Random versus steady

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The coin flipper does much worse than the steady player when they meet. The steady player does best against the coin flipper, but the two steady players earn only 30 each. Whether "always open" is truly the best plan is exactly what equilibrium theory will settle.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What makes a situation a game in the game-theory sense?

    The defining feature is interdependence: my payoff depends on what you do and yours on what I do. The number of players or the stakes do not matter.
  2. 2. Which of these is NOT one of the four basic ingredients of a game?

    A game is described by players, actions, information and payoffs. The weather is not an ingredient unless a particular game models it as a random event.
  3. 3. In a zero-sum game...

    Zero-sum means the payoffs add up to zero in every outcome, so any gain for one player is a loss of the same size for the others.
  4. 4. Why can't a player in the coffee stand game just maximize their own payoff?

    Your payoff changes with the rival's action (for example, opening earns 100 if the rival stays home but only 30 if the rival opens), so you have to reason about what the rival will do.

Summary

  • A game is a situation where each participant's outcome depends on everyone's choices.
  • Games have four ingredients: players, actions, information and payoffs.
  • Games can be simultaneous or sequential, zero-sum or not, one-shot or repeated.
  • A best-response table, "if they do X, I do Y", is the first step toward equilibrium.
  • Game theory describes what incentives produce, in economics, biology, computer science and daily life.

Next: Rational Choice and Utility