# Voting power (7): Quarreling voters

In all the previous discussions of voting power, we have assumed that all
winning coalitions are equally likely. But in practice that is not necessarily
the case. Two or more voters may be opposed on so many issues that they would
never vote the same way on any issues: such a pair of voters may be said to be
*quarrelling*.

To see how this may make a difference, consider the voting game \[ [51; 49,48,3] \] The winning coalitions for which a party is critical are \[ [49,48],\; [49,3],\; [48,3] \] and since each party is critical to the same number of winning coalitions, the Banzhaf indices are equal.

But suppose that the two largest parties are quarrelling, and so the only winning
coalitions are then
\[
[49,3],\; [48,3].
\]
This means that the smaller party has *twice* the power of each of the larger
ones!

We can set this up in Sage, using polynomial rings, with an ideal that represents the quarrel. In this case:

```
sage: q = 51
sage: w = [49,48,3]
sage: R.<x,y,z> = PolynomialRing(QQ)
sage: qu = R.ideal(x*y)
sage: p = ((1+x^49)*(1+y^48)*(1+z^3)).reduce(qu)
sage: p
```

\[ x^{49}z^3+y^{48}z^3+x^{49}+y^{48}+z^3+1 \] From this polynomial, we choose the monomials whose degree sums are not less than the quota:

```
sage: wcs = [m.degrees() for m in p.monomials() if sum(m.degrees()) >= q]
sage: wcs
```

\[ [(49,0,3),(0,48,3)] \] To determine the initial (not normalized) Banzhaf values, we traverse this list of tuples, checking in each tuple if the value is critical to its coalition:

```
sage: beta = [0,0,0]
sage: for c in wcs:
sc = sum(c)
for i in range(3):
if sc-c[i] < q:
beta[i] += 1
beta
```

\[ [1,1,2] \] or \[ [0.24, 0.25, 0.5] \] for normalized values.

## Generalizing

Of course the above can be generalized to any number of voters, and any number of quarrelling pairs. For example, consider the Australian Senate, of which the current party representation is:

Although the current government consists of two separate parties, they act in effect as one party with a weight of 36. (This is known formally as the "Liberal-National Coalition".) With no quarrels then, we have \[ [39;36,26,9,2,1,1,1] \] of which the Banzhaf values have been found to be 52, 12, 12, 10, 4, 4, 4 and the Banzhaf power indices \[ 0.5306, 0.1224, 0.1224, 0.102, 0.0408, 0.0408, 0.0408. \] Suppose that the Government and Opposition are quarrelling, as are also the Greens and One Nation. (This is a reasonable assumption, given current politics and the platforms of the respective parties.)

```
sage: q = 39
sage: w = [36,26,9,2,1,1,1]
sage: n = len(w)
sage: R = PolynomialRing(QQ,'x',n)
sage: xs = R.gens()
sage: qu = R.ideal([xs[0]*xs[1],xs[2]*xs[3]])
sage: pr = prod(1+xs[j]^w[j] for j in range(n)).reduce(qu)
```

As before, we extract the degrees of those monomials whose sum is at least \(q\), and determine which party in each is critical:

```
sage: wcs = [m.degrees() for m in pr.monomials() if sum(m.degrees()) >= q]
sage: beta = [0]*n
sage: for c in wcs:
sc = sum(c)
for i in range(n):
if sc-c[i] < q:
beta[i] += 1
sage: beta
```

\([16,0,7,6,2,2,2]\)

which can be normalized to

\([0.4571, 0.0, 0.2, 0.1714, 0.0571, 0.0571, 0.0571]\).

The remarkable result is that Labor - the Opposition party, with the second
largest number of seats in the Senate - loses all its power! This means that
Labor *cannot* afford to be in perpetual quarrel with the government parties.

## A simple program

And of course, all of the above can be written into a simple Sage program:

```
def qbanzhaf(q,w,r):
n = len(w)
R = PolynomialRing(QQ,'x',n)
xs = R.gens()
qu = R.ideal([xs[y[0]]*xs[y[1]] for y in r])
pr = prod(1+xs[j]^w[j] for j in range(n)).reduce(qu)
wcs = [m.degrees() for m in pr.monomials() if sum(m.degrees()) >= q]
beta = [0]*n
for c in wcs:
sc = sum(c)
for i in range(n):
if sc-c[i] < q:
beta[i] += 1
return(beta)
```

All the quarrelling pairs are given as a list, so that the Australian Senate computation could be entered as

```
sage: qbanzahf(q,w,[[0,1],[2,3]])
```