With minor edits for formatting and style, this article is adapted from my Polya's Game Simulation page on GitHub.
Table of Contents
Ergodicity
I encountered this game quite recently when studying ergodicity in random processes [1]. With ergodicity we try to answer the question whether the behaviour of a single instance of a process or a system is the same as the behaviour of all similar processes or systems.
To be more specific an ergodic process is a process where the time average of a single process is equal to the ensemble average of all processes. Polya's urn or Polya's game is an example of a process that is not ergodic. The game is surprisingly simple, and in every instance of the game the time average quickly converges to a stable value. And this may lead to the false conclusion that the game is ergodic. Yet the ensemble average of all instances of the game is not equal to the time average of a single instance of the game.
Rules of Polya's Game
Now let's take a look at the rules of Polya's game. The game is played with an urn containing blue and red balls.
- Start with an urn containing one red ball and one blue ball.
- At each step, draw a ball from the urn. (random choice)
- If the drawn ball is red, add another red ball to the urn.
- If the drawn ball is blue, add another blue ball to the urn.
- Repeat the process for a specified number of steps.
- Observe the proportion of red and blue balls in the urn.
Simulation
The simulation below allows us to repeatedly run Polya's game for a specified number of steps. While the game is running, the time average of the proportion of red balls, and the ensemble average of the proportion of red balls are displayed. The time average is calculated as the average of the proportions of red balls in the urn at each step, while the ensemble average is calculated as the average of the proportions of red balls across all instances of the game.
Each run of the simulation runs till the urn fills up with balls. Then the next run starts with 2 balls (one red and one blue). This is repeated for the specified number of runs.
Usually with the second run we can already see that the time average of the proportion of red balls is not equal to the ensemble average of the proportion of red balls. Both the time average and the ensemble average stabilize around a certain value, but they are not equal.
The game is quite sensitive to what colour you draw first. If you draw a red ball first, the proportion of red balls in the urn will increase, and if you draw a blue ball first, the proportion of red balls in the urn will decrease.
The game is also sensitive to the number of runs. The more runs you do, the more stable the time average and ensemble average become. But they will rarely be equal.
The simulation is implemented in JavaScript using the p5.js library.
[Open in a new tab: Polya's Game Simulation]
References
Revisions
Date | Version | Description |
---|---|---|
2025-04-09 | 1.0 | Initial version of the simulation. |