# Shapley–Shubik power index

The Shapley–Shubik power index was formulated by Lloyd Shapley and Martin Shubik in 1954 to measure the powers of players in a voting game.
The constituents of a voting system, such as legislative bodies, executives, shareholders, individual legislators, and so forth, can be viewed as players in an n-player game. Players with the same preferences form coalitions. Any coalition that has enough votes to pass a bill or elect a candidate is called winning. The power of a coalition (or a player) is measured by the fraction of the possible voting sequences in which that coalition casts the deciding vote, that is, the vote that first guarantees passage or failure.
The power index is normalized between 0 and 1. A power of 0 means that a coalition has no effect at all on the outcome of the game; and a power of 1 means a coalition determines the outcome by its vote. Also the sum of the powers of all the players is always equal to 1.
There are some algorithms for calculating the power index, e.g., dynamic programming techniques, enumeration methods and Monte Carlo methods.
Since Shapley and Shubik have published their paper, several axiomatic approaches have been used to mathematically study the Shapley–Shubik power index, with the anonymity axiom, the null player axiom, the efficiency axiom and the transfer axiom being the most widely used.

## Examples

Suppose decisions are made by majority rule in a body consisting of A, B, C, D, who have 3, 2, 1 and 1 votes, respectively. The majority vote threshold is 4. There are 4! = 24 possible orders for these members to vote:
| ABCD | ABDC | ACBD | ACDB | ADBC | ADCB |
| BACD | BADC | BCAD | BCDA | BDAC | BDCA |
| CABD | CADB | CBAD | CBDA | CDAB | CDBA |
| DABC | DACB | DBAC | DBCA | DCAB | DCBA |
For each voting sequence the pivot voter – that voter who first raises the cumulative sum to 4 or more – is bolded. Here, A is pivotal in 12 of the 24 sequences. Therefore, A has an index of power 1/2. The others have an index of power 1/6. Curiously, B has no more power than C and D. When you consider that A's vote determines the outcome unless the others unite against A, it becomes clear that B, C, D play identical roles. This reflects in the power indices.
Suppose that in another majority-rule voting body with $n+1$ members, in which a single strong member has $k$ votes and the remaining $n$ members have one vote each. In this case the strong member has a power index of ${\dfrac {k}{n+1}}$ (unless $k>n+1$, in which case the power index is simply $1$). Note that this is more than the fraction of votes which the strong member commands. Indeed, this strong member has only a fraction ${\dfrac {k}{n+k}}$ of the votes. Consider, for instance, a company which has 1000 outstanding shares of voting stock. One large shareholder holds 400 shares, while 600 other shareholders hold 1 share each. This corresponds to $n=600$ and $k=400$. In this case the power index of the large shareholder is approximately 0.666 (or 66.6%), even though this shareholder holds only 40% of the stock. The remaining 600 shareholder have a power index of less than 0.0006 (or 0.06%). Thus, the large shareholder holds over 1000 times more voting power as each other shareholder, while holding only 400 times as much stock.
The above can be mathematically derived as follows. Note that a majority is reached if at least $t(n,k)=\left\lfloor {\dfrac {n+k}{2}}\right\rfloor +1$ votes are cast in favor. If $k\geq n+1$, the strong member clearly holds all the power, since in this case $k\geq t(n,k)$ (i.e., the votes of the strong member alone meet the majority threshold). Suppose now that $k\leq n+1$ and that in a randomly chosen voting sequence, the strong member votes as the $r$th member. This means that after the first $r-1$ member have voted, $r-1$ votes have been cast in favor, while after the first $r$ members have voted, $r-1+k$ votes have been cast in favor. The vote of strong member is pivotal if the former does not meet the majority threshold, while the latter does. That is, $r-1<t(n,k)$, and $r-1+k\geq t(n,k)$. We can rewrite this condition as $t(n,k)+1-k\leq r<t(n,k)+1$. Note that our condition of $k\leq n+1$ ensures that $1\leq t(n,k)+1-k$ and $t(n,k)+1\leq n+2$ (i.e., all of the permitted values of $r$ are feasible). Thus, the strong member is the pivotal voter if $r$ takes on one of the $k$ values of $t(n,k)+1-k$ up to but not including $t(n,k)+1$. Since each of the $n+1$ possible values of $r$ is associated with the same number of voting sequences, this means that the strong member is the pivotal voter in a fraction ${\dfrac {k}{n+1}}$ of the voting sequences. That is, the power index of the strong member is ${\dfrac {k}{n+1}}$.

## Applications

The index has been applied to the analysis of voting in the Council of the European Union.
The index has been applied to the analysis of voting in the United Nations Security Council. The UN Security Council is made up of fifteen member states, of which five (the United States of America, Russia, China, France and the United Kingdom) are permanent members of the council. For a motion to pass in the Council, it needs the support of every permanent member and the support of four non permanent members. This is equivalent to a voting body where the five permanent members have eight votes each, the ten other members have one vote each and there is a quota of forty four votes, as then there would be fifty total votes, so you need all five permanent members and then four other votes for a motion to pass. Note that a non-permanent member is pivotal in a permutation if and only if they are in the ninth position to vote and all five permanent members have already voted. Suppose that we have a permutation in which a non-permanent member is pivotal. Then there are three non-permanent members and five permanent that have to come before this pivotal member in this permutation. Therefore, there are $\textstyle {\binom {9}{3}}$ ways of choosing these members and so 8! × $\textstyle {\binom {9}{3}}$ different orders of the members before the pivotal voter. There would then be 6! ways of choosing the remaining voters after the pivotal voter. As there are a total of 15! permutations of 15 voters, the Shapley-Shubik power index of a non-permanent member is: ${\frac {{\binom {9}{3}}(8!)(6!)}{15!}}={\frac {4}{2145}}$. Hence the power index of a permanent member is ${\frac {421}{2145}}$.

## Python implementation

This is a simple implementation of the above example in Python.