In Chapter 12 of General Theory of Employment Interest and Money Keynes uses the example of a beauty contest to explain price fluctuations in the stock market. Imagine a newspaper contest in which entrants are asked to choose the most beautiful face from a set of six photographs of women. If your choice is the most popular, then you get a prize.
The "first degree" strategy is to choose the face you truly choose is the prettiest. But if you care about winning, you might instead use a "second degree" strategy in which you choose the face you think other people believe is the prettiest. A "third degree" strategy chooses a face based on the average opinion of what the average opinion of beauty is. And so on ...
Relating this to the stock market, Keynes wrote that investment in the stock market is driven by expectations about what other investors think, rather than your own expectations about whether a particular investment will be profitable.
This is one example from the field of game theory, which tries to model strategic situations (or games) in which the outcomes for each participant depend on the choices made by the others. Game theory has wide applicability to fields as diverse as economics, political science, biology, computer science, and philosophy. At its heart, game theory tries to model rational human behavior in competitive situations.
One of the classic problems in game theory is the Prisoner's Dilemma. While there are many variants, the original problem states that two suspects have been arrested for a crime, but the police have insufficient evidence to convict them. Each prisoner is offered the following deal: (a) testify against the other suspect or (b) remain silent. If both testify against each other, they will both receive 5 years in jail. If one testifies and the other is silent, then the silent one will receive 10 years in jail and the other will go free in return for his testimony. If both remain silent, they will go to jail for 6 months on a minor charge. Neither knows the other's decision ahead of time.
At first, it seems like the prisoners should cooperate and get only 6 months in jail. However, consider each suspect individually. If suspect A thinks suspect B will remain silent, then A's choice is to be silent and get 6 months or testify and go free. Clearly the right choice is to testify. On the other hand, if suspect A thinks suspect B will testify, then A's choice is to be silent and get 10 years or testify and get 5 years in jail. Again, the right choice is to testify. So it doesn't matter what A thinks B will do, A should always testify! This ends up satisfying the prosecution, because both suspects will testify and get 5 years in jail.
This problem is a case in which the odds are stacked against the players, and might seem unrealistic. However, it can be applied in numerous ways. It models two superpowers who have a choice to build more nuclear weapons or to disarm. It can be applied to climate change, where any meaningful action requires everyone to cooperate, but it is generally in any single country's interest to continue emitting carbon. It has even been applied to steroid use in sports.
Even more interesting, strategies for the Prisoner's Dilemma problem change when the problem is repeated among the participants. In this case, participants learn and can reward behavior from previous rounds. There is now an incentive to cooperate, because you can convince the other player you will not testify and so you can each get a short sentence. It turns out that there is a very simple cooperative strategy in this case that works very well, called tit for tat:
On the first turn, remain silent. On subsequent turns, use the same choice that the other player made last turn.In this case, you are essentially rewarding or punishing, tit for tat, the other player's choice. If the other player starts remaining silent, so will you. Eventually, the players will end up cooperating.
This same problem has been applied in computer science in the area of peer-to-peer networking. Peer-to-peer systems are self-scaling only as long as every participant is willing to donate bandwidth -- then the upload capacity scales to meet the download demand. However, if a user decides not to provide upload capacity, he can freeload on the system and download the file without giving back to the system. If everyone acts selfishly (which is the assumption in game theory), the system will collapse. In BitTorrent, this problem is solved by using a tit for tat system inspired by the iterated (or repeated) version of the Prisoner's Dilemma. If you can download a piece of a file from someone, then you are willing to upload a piece back to them. Good behavior is rewarded, and eventually everyone cooperates.
A solution to a game theoretic problem is called a Nash equilibrium, after John Forbes Nash. The solution occurs when each player has chosen a strategy and no player will benefit by making a different choice (with the others staying unchanged). Nash is a fascinating character whose life was portrayed in the movie A Beautiful Mind.
There are many other classic problems in the field of game theory. Here is one introductory site that has some good examples. If you're interested, you might look at the section that examines how game theory can model Keynesian macroeconomics.