It has been a long time since I last dealt with sums of probabilities, so, when puzzling through the solution to the fourth problem in Frederick Mosteller’s *Fifty Challenging Problems in Probability*, I got temporarily stumped by this equation:

p + pq + pq^{2 }+ … = p(1** **+ q + pq^{2 }+ …)

= p / (1 – q) = p / p = 1.

I understood all the steps except for the middle one: how is it that

p(1+ q + pq^{2 }+ …) = p / (1 – q)?

Then this morning it came to me: (1 – q)(1+ q + pq^{2 }+ …) = 1, since it is equal to (1+ q + pq^{2 }+ …) – (q + pq^{2 }+ …). So (1+ q + pq^{2 }+ …) = 1 / (1-q).

If all these intermediary steps had been laid out, this book would have been much thicker and less fun. Part of the intrigue (and insight) lies in figuring out how you get from one step to the next.

This week, in Civilization class, a student mentioned the American penchant for “showing your work” in mathematics. He related it to the overall overtness of American culture and said it worked against those who were good at doing in their heads. I found it rather tedious to “show my work” in high school, but since then the demands have only increased–no intermediary step is to be omitted. I can see the reason to do this once in a while, as an exercise, or as a way of uncovering an error, but as a general practice, it beats the elegance and succinctness out of mathematics. It also leaves you nothing to puzzle over.

Anyway, the fourth problem in the book is this: On the average, how many times must a die be thrown until one gets a 6? The answer is 6, but along the way I found out something interesting: A little over half of the time (about 51.7% of the time), one will get a 6 in 4 tries or less. One could confuse 4 with the average, but it is not the same thing. Since there is no limit to the potential number of trials, there might be a time when you toss the die 25 times before getting a 6.

I took this into Perl:

use strict;

use warnings;

use 5.010;

my $number = 0;

my @sequence;

my @tries;

my @half;

my $toss = 0;

my $total = 1000000;

my $average;

my $sum = 0;

my $totalunderfive;

for (my $i = 0; $i < $total; $i++) {

until ($toss == “6”) {

$toss = 1 + int rand(6);

push @sequence, “$toss”;

$number++;

}

if ($number < 5) {

push @half, $number;

}

push @tries, $number;

$number = 0;

$toss = 0;

}

foreach (@tries){

$sum += $_;

}

$average=$sum/$total;

print “$average is the average number of tosses that it took to get a 6.\n”;

$totalunderfive=scalar(@half);

my $percentunderfive=($totalunderfive/$total)*100;

print “$percentunderfive percent of the time, a 6 was obtained in 4 tries or less.\n”;

“Tossing the die” a million times in the Perl Online Editor, I got this result just now:

6.006929 is the average number of tosses that it took to get a 6.

51.7173 percent of the time, a 6 was obtained in 4 tries or less.

Algebraically, the chance of getting a 6 in 4 tries or less is (where p is the probability of getting a 6 on a given toss, and q is (1 – p), or the probability of not getting a 6 on a given toss):

p + pq + pq^{2 }+ pq^{3 }= approximately .517744.

Generally, the greater the number of trials, the closer the result will come to this figure, but there will be some visible variation.

Anyway, I wouldn’t have bothered with any of this if the book had showed its work. The solutions themselves require a little bit of puzzling through, especially for someone out of practice with these things, but that’s part of why I remember this book from childhood and recently tracked down a copy. The book is 88 pages long, and there’s enough in there to keep me occupied (in the spare minutes around the edges of the day, and in its momentary breaks) for years and years.