:

## A digression about the US electoral college tie

Maple 2015

A fascinating race is presently running (even if the latest results seem  to have put an end to it).
I'm talking of course about the US presidential elections.

My purpose is not to do politics but to discuss of a point of detail that really left me puzzled: the possibility of an electoral college tie.
I guess that this possibility seems as an aberration for a lot of people living in democratic countries. Just because almost everywhere at World electoral colleges contain an odd number of members to avoid such a situation!

So strange a situation that I did a few things to pass the time (of course with the earphones on the head so I don't miss a thing).
This is done with Maple 2015 and I believe that the amazing Iterator package (that I can't use thanks to the teleworking :-( ) could be used to do much more interesting things.

 > restart:
 > with(Statistics):
 > ElectoralCollege := Matrix(51, 2, [
 > Alabama,        9,        Kentucky,        8,        North_Dakota,        3,
 > Alaska,        3,        Louisiana,        8,        Ohio,        18,
 > Arizona,        11,        Maine,        4,        Oklahoma,        7,
 > Arkansas,        6,        Maryland,        10,        Oregon,        7,
 > California,        55,        Massachusetts,        11,        Pennsylvania,        20,
 > Colorado,        9,        Michigan,        16,        Rhode_Island,        4,
 > Connecticut,        7,        Minnesota,        10,        South_Carolina,        9,
 > Delaware,        3,        Mississippi,        6,        South_Dakota,        3,
 > District_of_Columbia,        3,        Missouri,        10,        Tennessee,        11,
 > Florida,        29,        Montana,        3,        Texas,        38,
 > Georgia,        16,        Nebraska,        5,        Utah,        6,
 > Hawaii,        4,        Nevada,        6,        Vermont,        3,
 > Idaho,        4,        New_Hampshire,        4,        Virginia,        13,
 > Illinois,        20,        New_Jersey,        14,        Washington,        12,
 > Indiana,        11,        New_Mexico,        5,        West_Virginia,        5,
 > Iowa,        6,        New_York,        29,        Wisconsin,        10,
 > Kansas,        6,        North_Carolina,        15,        Wyoming,        3 ]):
 (1)
 (2)
 > ec := convert(ElectoralCollege, listlist):
 > # Sets of states that form an electoral college tie R      := 10^5: nbties := 0: states := NULL: for r from 1 to R do   poll  := combinat:-randperm(ec):   cpoll := CumulativeSum(op~(2, poll)):   if tie in cpoll then     nbties := nbties+1;     place  := ListTools:-Search(tie, cpoll);     states := states, op~(1, poll)[1..place]:   # see below   end if: end do:
 > # electoral college tie is not so rare an event # (prob of occurrence about 9.4 %). # # Why the hell the US constitution did not decide to have an odd # number or electors to avoid ths kind of situation instead of # introducing a complex mechanism when tie appears???? nbties; evalf(nbties/R); states := [states]:
 (3)
 > # What states participate to the tie? names := sort(ElectoralCollege[..,1]): all_states_in_ties := [op(op~(states))]: howoften := Vector(                     51,                     i -> ListTools:-Occurrences(names[i], all_states_in_ties)             ): ScatterPlot(Vector(51, i->i), howoften);
 > # All the states seem to appear equally likely in an electoral college tie. # Why? Does someone have a guess? # # The reason is obvious, as each state must appear in the basket of a candidate, # then in case of a tie each state is either in op~(1, poll)[1..place] (candidate 1) # or either in op~(1, poll)[place+1..51] (candidate 2); # So, as we obtained 9397 ties, each states appears exactly 9397 times (with # different occurences in the baskets of candidate 1 and 2).
 > # Lengths of the configurations that lead to a tie. # # Pleas refer to the answer above to understand why Histogram(lengths) should be # symmetric. lengths := map(i -> numelems(states[i]), [\$1..nbties]): sort(Tally(lengths))
 (4)
 > Histogram(lengths, range=min(lengths)..max(lengths), discrete=true)
 > ShortestConfigurations := map(i -> if lengths[i]=min(lengths) then states[i] end if, [\$1..nbties]): print~(ShortestConfigurations):
 (5)
 > LargestConfigurations := map(i -> if lengths[i]=max(lengths) then states[i] end if, [\$1..nbties]): print~(LargestConfigurations):
 (6)
 > # What could be the largest composition of a basket in case of a tie? # (shortest composition is the complementary of the largest one) ecs   := sort(ec, key=(x-> x[2])); csecs := CumulativeSum(op~(2, ecs)): # Where would the break locate? tieloc := ListTools:-BinaryPlace(csecs, tie); csecs[tieloc..tieloc+1]
 (7)
 > # This 40  states coniguration is not a tie. # # But list all the states in basket of candidate 1 and look to the 41th state (which is # in the basket of candidate 2) ecs[1..tieloc]; print(): ecs[tieloc+1]
 (8)
 > # It appears that exchanging Virginia and New_Jersey increases by 1 unit the college of candidate 1 # and produces a tie. LargestBasketEver := [ ecs[1..tieloc-1][], ecs[tieloc+1] ]; add(op~(2, LargestBasketEver))
 (9)
 > # The largest electoral college tie contains 40 states (the shortest 11)