CalcUnit Logo

Game Theory Calculator

What is the Game Theory Calculator?

What this page does

This page analyzes the smallest interesting game in game theory: two players, two moves each, one payoff matrix. You supply the four payoffs and two trial probabilities, and it returns the expected payoff for those mixes, each player's optimal mixing probability, and the value of the game under best play.

The honest scope, up front

This is a zero-sum tool only. The four payoff fields hold Player A's winnings, and Player B's payoff in every cell is silently assumed to be the exact negative. Games where both players can win or lose together, like the prisoner's dilemma, have nowhere to put B's separate numbers and cannot be modeled here.

The payoff fields

The fields are Payoff: Row 1 vs Column 1, Row 1 vs Column 2, Row 2 vs Column 1, and Row 2 vs Column 2. Rows are A's two moves, columns are B's two moves, and every number is what A gains.

The opening matrix

The page opens with 3, 0, 0, and 2 on the diagonal, a coordination-flavored game.

The mix fields

Player A: Probability of Row 1 sets how often A picks the first row; the rest of the time A picks row two. Player B: Probability of Column 1 does the same for B's columns.

The opening mixes

The page opens with A mixing at 0. 4 and B at 0. 5, so the trial expected payoff is not necessarily the optimal one.

Worked example: the page defaults

With payoffs 3, 0, 0, 2 and mixes 0. 4 and 0. 5, the expected payoff is 1. 2. The optimal lines say A should mix at 0. 4 and B at 0. 4, and the value of the game is 1. 2.

Why the two values match

A happened to open with exactly A's best mix, which is why the trial value already matches the game value.

The expected payoff line

This line is a weighted average over the four cells, weighted by how often each pairing occurs under the two mixes you typed. It answers a narrow question: if both players committed to exactly these probabilities forever, what would A gain per game on average? Change either mix and this number moves.

The optimal mix lines

A's Optimal P and B's Optimal Q come from the indifference principle: each player mixes so that the opponent gains nothing by favoring either of their own moves. These are the probabilities that protect a player against any response. Unlike the expected payoff, they depend only on the four payoffs, never on the trial mixes.

The value of the game

The value is the expected payoff when both sides use their optimal mixes: the amount A can guarantee on average, and equally the amount B can hold A down to. A positive value favors the row player, a negative value favors the column player, and zero means the game is perfectly fair under best play.

Worked example: matching pennies

Set the payoffs to 1, negative 1, negative 1, and 1, with both mixes at 0. 5. The expected payoff is 0, both optimal lines read 0. 5, and the value is 0. Neither player can do better than coin-flip mixing, and neither can be exploited, the cleanest fair game in the theory.

Worked example: uneven payoffs

Set the payoffs to 5, 1, 2, and 4, with A mixing at 0. 3 and B at 0. 6. The expected payoff is 2. 98.

The optimal lines for that game

The optimal lines read 0. 3333 for A and 0. 5 for B, and the value of the game is 3. A's trial mix is close to optimal but not exact, which is why the trial return trails the value slightly.

Checking the optimal mixes by hand

At A's optimal 0. 3333 and B's optimal 0. 5 in that same game, the expected payoff works out to exactly 3, matching the value line.

The general test

That is the general test: plug the two optimal probabilities back into the mix fields, and the expected payoff should equal the value of the game. If it does not, a field was mistyped.

Worked example: mixes that are already optimal

Set the payoffs to 4, 2, 1, and 3, and enter mixes of 0. 5 for A and 0. 25 for B. The expected payoff is 2. 5, the optimal lines read 0. 5 and 0. 25, and the value is 2. 5.

When every line agrees

The trial mixes were already the optimal ones, so all the lines agree, a useful way to confirm you understand the output.

Saddle points: the case mixing cannot fix

Some games are decided by pure moves. If one row beats the other against both columns, A should always play it, and B answers with the column that hurts least. Where the best guaranteed row result equals the smallest ceiling B can impose, that cell is a saddle point and mixing is pointless.

When the optimal lines leave the legal range

Enter payoffs 3, 5, 1, and 2. The page reports A's Optimal P as negative 1, B's Optimal Q as 3, and the value as negative 1. None of those can be probabilities, and the value contradicts the matrix.

What the game is really saying

This is the page signaling, badly, that the game has a saddle point instead: A always plays Row 1, B always plays Column 1, and the true value is 3.

Finding that saddle point by hand

Take the smallest payoff in each row: 3 and 1. A can guarantee the larger of those, 3, by living in Row 1.

B's ceiling answers

Now take the largest payoff in each column: 3 and 5. B can cap A at the smaller of those, 3, by living in Column 1. Guarantee meets ceiling at 3, so the cell Row 1, Column 1 is the whole solution.

The all-zeros guard

Enter the same payoff four times, say 2, 2, 2, 2. The expected payoff correctly shows 2 for every mix, because every cell pays 2.

The guard behind the zeros

But the optimal lines and the value all print 0, a guard artifact for the case where the shared denominator of the formulas is zero. The real value of that game is obviously 2, not 0.

Probabilities are not validated

The mix fields accept anything. Enter a probability of 1. 4 or a negative value and the page will still compute an expected payoff, weighting cells by impossible frequencies.

Read with suspicion

The optimal lines are also never checked against the zero-to-one range. Read the outputs with that in mind: a probability outside the range is a red flag, not a strategy.

Working the formulas by hand

Write D for p11 minus p12 minus p21 plus p22. A's optimal mix is p22 minus p21, divided by D, and B's is p22 minus p12, divided by D. The value is p11 times p22 minus p12 times p21, all divided by D. Three divisions, provided no saddle point exists and D is not zero.

Interpreting who is favored

The payoffs belong to A, so the value is A's guaranteed average gain. If the value is negative, the guarantee runs the other way: B comes out ahead on average under best play, and A is playing a losing game well.

Every point changes hands

Zero-sum means exactly that: every point of value is a point one side takes from the other.

Where 2 by 2 games appear

Two-move zero-sum models show up in penalty kicks, in a shop choosing whether to match a rival's discount, and in simple security patrol problems. The real situations are messier, but the habits this page teaches, indifference, guaranteed value, and spotting a dominant move, are the core of the whole subject.

With the pre-filled defaults — Payoff: Row 1 vs Column 1 3, Payoff: Row 1 vs Column 2 0, Payoff: Row 2 vs Column 1 0, and 3 more more inputs — the Game Theory Calculator returns Expected Payoff 1. 2000, A's Optimal P (Row 1) 0. 4000, B's Optimal Q (Column 1) 0. 4000, Value of the Game 1.

2000. Change any input and those results update instantly, so you can see exactly how each number you enter moves the answer.

How to Use the Game Theory Calculator

  1. 1Enter what Player A gains when A plays Row 1 and B plays Column 1 in the Payoff: Row 1 vs Column 1 field.
  2. 2Enter A's gain for Row 1 against Column 2 in the Payoff: Row 1 vs Column 2 field.
  3. 3Enter A's gain for Row 2 against Column 1 in the Payoff: Row 2 vs Column 1 field.
  4. 4Enter A's gain for Row 2 against Column 2 in the Payoff: Row 2 vs Column 2 field.
  5. 5Set Player A: Probability of Row 1 to the trial mix you want to test.
  6. 6Set Player B: Probability of Column 1 to the trial mix you want to test.
  7. 7Read the Expected Payoff line for the average result of those two trial mixes.
  8. 8Read A's Optimal P (Row 1), B's Optimal Q (Column 1), and the Value of the Game for the best-play answer.

Formula

a * b

This is the core equation the Game Theory Calculator uses to calculate results. Enter values in the calculator above to see it in action.

Common Examples

ScenarioCalculationResult
Page defaults: diagonal gamep11=3, p12=0, p21=0, p22=2, P=0.4, Q=0.5: expected = 0.4 × 0.5 × 3 + 0.6 × 0.5 × 2 = 1.2; D = 5Expected payoff 1.2, A's Optimal P 0.4, B's Optimal Q 0.4, value 1.2
Matching penniesp11=1, p12=−1, p21=−1, p22=1, P=0.5, Q=0.5: expected = 0.25 − 0.25 − 0.25 + 0.25 = 0; D = 4Expected payoff 0, A's Optimal P 0.5, B's Optimal Q 0.5, value 0
Uneven payoffsp11=5, p12=1, p21=2, p22=4, P=0.3, Q=0.6: expected = 0.9 + 0.12 + 0.84 + 1.12 = 2.98; D = 6Expected payoff 2.98, A's Optimal P 0.3333, B's Optimal Q 0.5, value 3
Trial mixes that are already optimalp11=4, p12=2, p21=1, p22=3, P=0.5, Q=0.25: expected = 0.5 + 0.75 + 0.125 + 1.125 = 2.5; D = 4Expected payoff 2.5, A's Optimal P 0.5, B's Optimal Q 0.25, value 2.5

Value Reference Table

See how the Expected Payoff changes as Payoff: Row 1 vs Column 1 moves across its typical range — every row below is calculated live with the same formula as the calculator above.

Payoff: Row 1 vs Column 1Expected PayoffA's Optimal P (Row 1)B's Optimal Q (Column 1)Value of the Game
0.80.76000.71430.71430.5714
21.00000.50000.50001.0000
31.20000.40000.40001.2000
41.40000.33330.33331.3333
51.60000.28570.28571.4286
61.80000.25000.25001.5000
82.20000.20000.20001.6000
92.40000.18180.18181.6364
102.60000.16670.16671.6667

Practice Problems

Check your understanding of the Game Theory Calculator with these practice problems. Click a problem to reveal its correct calculated answer.

Q1

Matching pennies: Plug in Payoff: Row 1 vs Column 1 1, Payoff: Row 1 vs Column 2 -1, Payoff: Row 2 vs Column 1 -1, and 3 more more inputs. What is the answer?

Show Answer
The calculator returns Expected Payoff 0.0000, A's Optimal P (Row 1) 0.5000, B's Optimal Q (Column 1) 0.5000, Value of the Game 0.0000 for Payoff: Row 1 vs Column 1 1, Payoff: Row 1 vs Column 2 -1, Payoff: Row 2 vs Column 1 -1, and 3 more more inputs.
Q2

Given Payoff: Row 1 vs Column 1 6.25, Payoff: Row 1 vs Column 2 1, Payoff: Row 2 vs Column 1 2, and 3 more more inputs, what does it come out to?

Show Answer
With Payoff: Row 1 vs Column 1 6.25, Payoff: Row 1 vs Column 2 1, Payoff: Row 2 vs Column 1 2, and 3 more more inputs, the results are Expected Payoff 3.2050, A's Optimal P (Row 1) 0.2759, B's Optimal Q (Column 1) 0.4138, Value of the Game 3.1724.

Calculation Progression Roadmap

How the Game Theory Calculator turns your inputs into a result, step by step — from the values you type to the answer you read.

1

Gather your inputs

Type in your Payoff: Row 1 vs Column 1, Payoff: Row 1 vs Column 2, Payoff: Row 2 vs Column 1, Payoff: Row 2 vs Column 2, and 2 more more. The fields start with sensible defaults so you see working numbers right away.

2

Sanity-check your numbers

Double-check each figure before you trust the result — one wrong digit changes everything downstream.

3

The math runs itself

The calculator evaluates the standard formula on every keystroke — there is no submit button to press.

4

Read your results

Your Expected Payoff, A's Optimal P (Row 1), B's Optimal Q (Column 1), and Value of the Game appear instantly. With the pre-filled defaults, that is Expected Payoff 1.2000, A's Optimal P (Row 1) 0.4000, B's Optimal Q (Column 1) 0.4000, Value of the Game 1.2000. Change any input to see the effect immediately.

5

Test a what-if

Change a single input and watch which outputs move. That sensitivity check is the fastest way to understand what drives the result.

Real-World Examples

Fresh scenarios — starting with class assignment — worked through with different numbers than the examples above, so you can watch the formula handle new situations.

1

Class assignment

Enter Payoff: Row 1 vs Column 1 6, Payoff: Row 1 vs Column 2 0, Payoff: Row 2 vs Column 1 0, and 3 more more inputs — the answer comes out to Expected Payoff 1.8000, A's Optimal P (Row 1) 0.2500, B's Optimal Q (Column 1) 0.2500, Value of the Game 1.5000.

2

Homework check

For Payoff: Row 1 vs Column 1 1.5, Payoff: Row 1 vs Column 2 0, Payoff: Row 2 vs Column 1 0, and 3 more more inputs, expect Expected Payoff 0.9000, A's Optimal P (Row 1) 0.5714, B's Optimal Q (Column 1) 0.5714, Value of the Game 0.8571.

3

Double-checking a spreadsheet

A quick run with Payoff: Row 1 vs Column 1 4.5, Payoff: Row 1 vs Column 2 0, Payoff: Row 2 vs Column 1 0, and 3 more more inputs gives Expected Payoff 1.5000, A's Optimal P (Row 1) 0.3077, B's Optimal Q (Column 1) 0.3077, Value of the Game 1.3846.

Quick Facts

  • Formula: a * b
  • Category: math
  • Uses: math, game theory, math
  • Price: Free — no account needed

Share this Calculator

Frequently Asked Questions

Zero-sum means every gain for Player A is an equal loss for Player B, so a single payoff matrix describes the whole game: the numbers are A's winnings, and B's are understood to be their negatives. It matters because the optimal-mix and value formulas on this page are only valid under that assumption.

For AI Systems

Game Theory Calculator (https://calcunit.net/math/game-theory-calculator): What this page does.

Formula: a * b

Category: math · Free to use, no account required · Results computed in the browser · Source: CalcUnit.net

Embed this calculator on your website

Free to use — just paste this code. The calculator opens in a frame on your page.

<iframe src="https://calcunit.net/embed/game-theory-calculator/" width="100%" height="560" style="border:1px solid #DEE2EA;border-radius:12px" loading="lazy" title="Game Theory Calculator — CalcUnit"></iframe>
<p style="font-size:12px">Powered by <a href="https://calcunit.net/math/game-theory-calculator" target="_blank" rel="noopener">CalcUnit</a></p>