Skip to content

An Example of Intransitivity in Probability

Vector 9:3, page 141

mathematics and statistics competitions and puzzles

Transcribed from the printed issue; not yet reviewed. Read it in the PDF of the issue, page 141

This is something I wrote over a year ago. It is a wonderful illustration of how well APL can be used as a tool of thought: commenting, defining, calculating and displaying the way through a problem like this seems a very effective monologue. Being a dialogue with a computer might be a reason why it is better than a normal monologue!

The APL session contains almost the same amount of English commentary as the display of the results, with the APL definitions being a minor part. I approve of these proportions: output as manageable as the input, and about six parts of commentary to one part of code. It is an example which suggests an alternative to the commentary convention: that the interpreter should assume everything is commentary unless it meets an execute symbol, when it is to assume that everything to the right of it should be interpreted as APL.

      ⍝ This is a demonstration in APL of "dice odds intransitivity".
      ⍝ I have 4 dice, A,B,C, and D. On their 6 faces they are numbered
      A←4 4 4 4 0 0
      B←3 3 3 3 3 3
      C←2 2 2 2 6 6
      D←1 1 1 5 5 5

      ⍝ If I play A against C, there are these 36 possible outcomes
      ⍝ which I can show by comparing 6 sets of the 6 outcomes of A
      ⍝ with the 6 sets of the 6 outcomes of C

      A∘.>C
1 1 1 1 0 0
1 1 1 1 0 0
1 1 1 1 0 0
1 1 1 1 0 0
0 0 0 0 0 0
0 0 0 0 0 0
      ⍝ Which gives us a 1 for a win for A, and 0 for a loss, showing
      ⍝ that the probability of A winning over C is 16/36, or 4/9.
      +/,A∘.>C
16

      ⍝ Now let us find the odds of A against B, B against C etc.
      +/,⎕←A∘.>B
1 1 1 1 1 1
1 1 1 1 1 1
1 1 1 1 1 1
1 1 1 1 1 1
0 0 0 0 0 0
0 0 0 0 0 0
24
      ⍝ A wins over B by 24/36, or 2/3

      +/,⎕←B∘.>C
1 1 1 1 0 0
1 1 1 1 0 0
1 1 1 1 0 0
1 1 1 1 0 0
1 1 1 1 0 0
1 1 1 1 0 0
24
      ⍝ B wins over C, again with a probability of 2/3

      +/,⎕←C∘.>D
1 1 1 0 0 0
1 1 1 0 0 0
1 1 1 0 0 0
1 1 1 0 0 0
1 1 1 1 1 1
1 1 1 1 1 1
24
      ⍝ C wins over D with another 2/3

      ⍝ Now, surely D will LOSE to A. But no!
      +/,⎕←D∘.>A
0 0 0 0 1 1
0 0 0 0 1 1
0 0 0 0 1 1
1 1 1 1 1 1
1 1 1 1 1 1
1 1 1 1 1 1
24

      ⍝ D wins over A with a 2/3 probability yet again!

This problem was introduced to me by John Allen Paulos in his book ‘Innumeracy’, subtitled ‘Mathematical Illiteracy and its Consequences’, Penguin, 1988. The problem, described on p. 100, is credited to Bradley Efron.