In a cooperative game, a group of players can form any coalition they like. Each possible coalition has some value it can guarantee on its own — money it can earn, costs it can avoid, votes it can pass. The question this lab is about: once everyone has joined the grand coalition, how should they divide the spoils?
This isn't a voting question — the players have already agreed to cooperate. The question is how to divide the joint surplus their cooperation creates, fairly enough that no sub-group walks away.
To split the spoils fairly we need to answer a sharper question first: how much did each player actually contribute to the group? "Contribution" is slippery in teamwork. A player's solo value v({i}) ignores synergy; her share of v(N)/n ignores skill. The right notion is the marginal contribution — how much value i adds when she joins a coalition S: v(S ∪ {i}) − v(S). But that number depends on which coalition S she joins, so a single answer needs us to average it across all the coalitions she could have walked into. That average — the Shapley value — is what this lab builds up.
Before the formulas, three stories where the same question keeps showing up: a group together produces value — how much of it does each member really deserve? The members can be politicians, fighters, or pixels in an image.
v(N). The Shapley value is one canonical answer.v(N) ≥ Σ v({i}) the grand coalition is profitable. Usually we assume it forms.For 3 players there are 23 = 8 coalitions. For 10 players, 1024. For the UN Security Council (15 members), 32 768. A full game specifies v(S) for every one of them.
A quick glossary of the most useful properties a cooperative game can have, plus the standard "kinds of player" that show up everywhere in the lab — null, dummy, veto, symmetric. Each card gives the formal condition and a one-line meaning. Use it as a reference while you work through the later tabs.
v(S∪T) < v(S)+v(T)).x is efficient if the players' shares sum exactly to the grand-coalition value — no surplus held back, nothing invented out of thin air. Shapley is efficient by construction (Σ φᵢ = v(N)); this is the first of the four Shapley axioms covered in tab 03.v and the afternoon revenue w — running the solution rule on each separately and adding the shares gives the same answer as running it once on the combined game v + w. The Shapley value satisfies this; it's the fourth Shapley axiom from tab 03.N is at least as good as any partition — so usually the players want to form it.v(N)/n.Hierarchy of niceness: convex ⇒ superadditive ⇒ essential. Monotonicity is independent. Most "real" games people study (voting, runway cost-sharing, ML feature attribution) are at least superadditive — which is why Shapley is so widely applicable.
φᵢ = 0 — fair, because she literally adds nothing.v({i}). A null player is the special case where v({i}) = 0.φᵢ = φⱼ — equal contribution, equal pay.Player i's Shapley value φi is the average marginal contribution of i over all possible coalitions she could join.
"All possible coalitions" can be counted two ways — over subsets or over orderings — and the formulas look different but give the same number.
It looks ugly. |S|! · (n−|S|−1)! / n! ?? Where does that come from?
It's just counting orderings. For player i to "arrive after exactly the players in S":
So Form 1 and Form 2 say the same thing. Form 2 (orderings) is the intuitive one. Form 1 (subsets) is what you implement in code.
Click through every subset on the left — for every choice of S, the matching-ordering count is exactly |S|! · (n − |S| − 1)!. Add those counts across all 2n−1 subsets and you recover all n! orderings. That's why dividing each subset's contribution by n! gives a clean probability — the Form 1 weight.
A tiny 3-player game. Every coalition's value v(S) is laid out below — only the pair {1,2} and the grand coalition produce anything.
Players 1 and 2 are productive together (80); player 3 only bumps the grand coalition by 10. Walk through all 3! = 6 orderings of the players. For each ordering π, write down each player's marginal contribution — the bump in v when she walks in. Then average across the 6 rows:
Reading a row. Take 2 → 1 → 3: player 2 walks in first, so MC₂ = v({2}) − v(∅) = 0. Player 1 walks in next, so MC₁ = v({1,2}) − v({2}) = 80 − 0 = 80. Player 3 walks in last, so MC₃ = v({1,2,3}) − v({1,2}) = 90 − 80 = 10. Each row sums to v(N) = 90 (every player gets credited exactly once when they arrive).
The columns. Player 1 collects 80 in two orderings (when she arrives second after 2 alone) and 90 in two orderings (when she arrives last after either {2,3} or {3,2}) → total 260, average 260 / 6 = 43.33. Player 2 is symmetric → also 43.33. Player 3 only ever brings 10 (and only in two of the six orderings where she arrives last after {1,2} or {2,1}) → total 20, average 3.33.
Sum of averages: 43.33 + 43.33 + 3.33 = 90 = v(N). The Shapley shares add to the grand coalition's value — that's efficiency, our first axiom.
What does it mean for a sharing rule to be "fair"? Shapley (1953) wrote down four properties that any reasonable rule should satisfy, then proved that exactly one rule satisfies all four — his.
v(S ∪ {i}) = v(S) for every S, then i contributes nothing — and gets nothing.This is a beautiful axiomatic result: pick the axioms, get the formula for free. Variants of this proof technique recur all over economics — Arrow's impossibility theorem (Voting lab), Nash bargaining, etc.
v({3}) − v(∅) = 0 · v({1,3}) − v({1}) = 0 · v({2,3}) − v({2}) = 0 ·
v({1,2,3}) − v({1,2}) = 90 − 80 = 10 ≠ 0
vA(S) = 80 · 𝟙[S ⊇ {1,2}] (the productive-pair piece)vB(S) = 10 · 𝟙[S = N] (the grand-coalition bonus)v = vA + vB. Compute Shapley on each:Pick a small game. We'll walk through every permutation of the players, accumulate each player's marginal contributions, and watch the Shapley values converge.
Shapley answers "what's fair?". The Core answers a different question: "what's stable?". A payoff vector x is in the core if no coalition can do strictly better by defecting.
The clearest way to feel why Core ≠ Shapley is to find a game where the Shapley split is something some coalition strictly prefers to escape from. Here it is, in 3 players.
Compute Shapley. A and B are symmetric, C contributes a little (the grand coalition lifts the {A,B} value of 80 by 5, up to 85). Running the Form-1 sum (which you can do in the Shapley Playground with the Custom preset) gives:
The Core for this game is the set of (xA, xB, xC) with Σ = 85, every x ≥ 0, xA+xB ≥ 80, xA+xC ≥ 20, xB+xC ≥ 20. Solving: xA+xB ≥ 80 together with xA+xB = 85 − xC forces xC ≤ 5. So C's share in any stable allocation is at most 5 — strictly less than her Shapley value of 8.33. That single inequality is what kicks Shapley out of the Core: she's being paid more than the {A,B} coalition is willing to leave on the table.
The Core is to cooperative game theory what Nash equilibrium is to non-cooperative game theory. In both:
The Core is strictly stronger than Nash: it closes deviations under arbitrary group sizes, not just individuals. Restricted to singletons, "xi ≥ v({i})" is exactly the individual rationality condition — the cooperative version of "no unilateral profitable deviation". Add the requirement that no 2-player, 3-player, …, (n−1)-player group can defect either, and you arrive at the Core.
In the worked example above, the Shapley vector passes every singleton check (Nash-style individual rationality) but fails the {A,B} pair check — a deviation only a coalition can spot. That gap is exactly why the Core was introduced as a separate stability concept.
The Core is a set of allocations, and that set can take two very different special shapes:
x1+x2 ≥ 1, x1+x3 ≥ 1, x2+x3 ≥ 1. Adding the three: 2(x1+x2+x3) ≥ 3, so Σ xi ≥ 1.5. But efficiency says Σ xi = v(N) = 1 < 1.5 — a flat contradiction. No allocation exists in the Core. Whichever pair forms, the third player can offer the other two more than they're getting and break the deal.2 Σ xi ≥ 150, so Σ xi ≥ 75. Efficiency says Σ = 75 exactly — so all three pair constraints must be tight equalities. Solving xA+xB = xA+xC = xB+xC = 50 forces xA = xB = xC = 25. The Core is the single point (25, 25, 25) — and Shapley, by symmetry, lands right on it. Fair and stable, and uniquely so.Convex (big core) example in the visualiser below illustrates this.
Drag the sliders to set every v(S) yourself. The triangle shades in the Core (all stable splits), drops a gold dot for the Shapley value, and lists every coalition constraint — green if no one defects, red if someone walks away.
The triangle is the 2-simplex of efficient allocations (x₁+x₂+x₃ = v(N)). Each vertex is "one player gets everything"; the centre is equal split.
Things to try: (1) start from Balanced, raise v({A,B}) past 40 — watch the Core shrink and Shapley fall outside. (2) start from Empty Core, raise v(N) until the shaded region reappears. (3) use Convex and verify that Shapley sits cleanly inside the Core no matter how you wiggle the singletons.
Pick a game. Edit the inputs. Watch Shapley update in real time. The first four are bargaining / cost-sharing problems that show up in real politics and economics; the fifth is a live explainable-AI demo — every word of a movie review is a player, and Shapley tells you which words drove the model's prediction.
The setup. Build a battle squad from a roster of 7 units. Each unit deals damage over a limited survival time; the squad's value is total damage dealt before everyone falls. The catch: a wizard alone dies almost instantly (1 second), but with 3 soldiers guarding him he survives 7 seconds — and his 10 dps suddenly matters. Healers are zero-dps alone but extend everyone else's survival.
The characteristic function is v(S) = Σᵢ∈S dpsᵢ × survᵢ(S), where survival depends on how many soldiers and healers are in S. Shapley distributes the credit fairly across every unit — including the guards who never landed a hit but kept the wizard alive.
What to look for. The wizard's solo value is just 10 — but his Shapley value (the fair credit averaged across every team) is much higher, because in the roughly half of orderings where ≥1 soldier already arrived, he contributes 30–70. Each soldier looks individually modest (15 dmg solo) but gets a big Shapley bump for enabling the squishy ranks. The healer, who deals zero damage, still earns positive Shapley — she lengthens everyone else's survival. This is the complementarity premium of cooperative game theory in action.