A SIMPLE CARD GUESSING GAME REVISITED

Arnold Knopfmacher

The John Knopfmacher Centre for Applicable Analysis and Number Theory Department of Applied Mathematics University of the Witwatersrand, P. O. Wits 2050 Johannesburg, South Africa

                  email: arnoldk@gauss.cam.wits.ac.za
   homepage: http://www.wits.ac.za/science/number theory/arnold.htm

Helmut Prodinger

The John Knopfmacher Centre for Applicable Analysis and Number Theory Department of Mathematics University of the Witwatersrand, P. O. Wits 2050 Johannesburg, South Africa

                  email: helmut@gauss.cam.wits.ac.za
           homepage: http://www.wits.ac.za/helmut/index.htm

Submitted: January 4, 2000; Accepted: March 3, 2000.

Abstract. A deck of cards consisting of m red and n black cards is given. A guess is made as to the colour of the top card, after which it is revealed and discarded. To maximise the number of correct guesses one chooses the colour corresponding to the majority of cards remaining in the deck. We determine the expected number of correct guesses with this strategy, as well as the probability of beating an opponent who uses the naive stategy of random guessing.

AMS Subject Classification. 05A15 (primary) 60C05 (secondary)

1. Introduction

A number of authors have considered the following simple combinatorial game; [5, 3, 7, 6]. One starts with a deck of cards consisting of m red and n black cards. A guess is made as to the colour of the top card, after which it is revealed and discarded. To maximise the number of correct guesses one chooses the colour corresponding to the majority of cards remaining in the deck. We determine the expected number of correct guesses with this strategy, as well as the probability of beating an opponent^{1} who uses the naive stategy of random guessing. The first of these problems was analysed by Levasseur [3] but only for the case m = n. The second question was investigated by Zagier [7], again for the case m = n. He obtained an asymptotic answer only, whereas we can derive exact formulas for this probability for general m and n. We also re–derive the probability distribution for the number of correct guesses for a pack of m + n cards, found originally by Sulanke [6].

Whereas the previous authors made use of lattice paths, our approach will be based on recurrence relations and probability generating functions. We also consider a variation of the game in which you and your opponent alternate in guessing the colour of the card. We find that there is a slight advantage to playing second in this variation.

In what follows, m always refers to number of cards of the colour that is predominant, n to the other colour.

2. The number of correctly guessed cards

We begin by re–proving some results of [6].

Let p(m, n; k) denote the probability that, assuming that one has m cards of one colour and n cards of a second colour, with m ≥ n ≥ 0, that one guesses k cards correctly. Sulanke [6], using lattice path arguments, found the following explicit expression:

p(m, n; k) = \frac{1}{\binom{m+n}{m}}[\binom{m + n}{k} − \binom{m + n}{k + 1}] for m ≤ k ≤ m + n.  (1)

One can prove this also using the following recursions. Introducing probability generating functions

φ_{m,n}(u) = ∑_{m≤k≤m+n} p(m, n; k)u^{k},

one sees the recursions

φ_{m,n}(u) = u\frac{m}{m + n}φ_{m−1,n}(u) + \frac{n}{m + n}φ_{m,n−1}(u) for m > n ≥ 0,
φ_{m,m}(u) = (1 + u)\frac{1}{2}φ_{m,m−1}(u) for m ≥ 1, φ_{0,0}(u) = 1

almost immediately. If one defines Φ_{m,n}(u) = \binom{m+n}{m}φ_{m,n}(u) instead, the recursions are nicer, viz.

Φ_{m,n}(u) = uΦ_{m−1,n}(u) + Φ_{m,n−1}(u) for m > n ≥ 0,
Φ_{m,m}(u) = (1 + u)Φ_{m,m−1}(u) for m ≥ 1, Φ_{0,0}(u) = 1.

1Previous authors [3, 7] used phrases like “How often should you beat your kids?” etc. In accordance with the editor’s wishes it was decided to avoid such phrases.

From these, Sulanke’s result (1) is readily proved by induction.

Instead of either guessing or using lattice path arguments, we can use a generating function method that deserves perhaps to be known more widely to deal with such recursions with boundary conditions. It is due to Knuth [2, page 537]; a tutorial version of it appears in [4].

If we set

F (z, x) = ∑_{m≥n≥0} Φ_{m,n}(u)z^{m}x^{m−n},
F_{0}(z) = ∑_{m≥0} Φ_{m,m}(u)z^{m},
F_{1}(z) = ∑_{m≥1} Φ_{m,m−1}(u)z^{m},

then the first and second recursion for Φ_{m,n}(u) give

F (z, x) − F_{0}(z) = uzx F (z, x) + \frac{1}{x}[F (z, x) − F_{0}(z) − F_{1}(z)x]

and F_{0}(z) = 1 + (1 + u)F_{1}(z), respectively. Hence

(1 − x + uzx^{2})F (z, x) = 1 − x + (1 + u − ux)F_{1}(z).

Now the fact that the power series F (z, x) remains finite at x = λ := 2/(1+\sqrt{1 − 4uz}) gives (this is Knuth’s trick) F_{1}(z) = (λ − 1)/(1 + u − λu) and finally

F (z, x) = (\frac{1 + \sqrt{1 − 4uz}}{2} − \frac{1 − \sqrt{1 − 4uz}}{2} u)^{−1}(1 − \frac{1 − \sqrt{1 − 4uz}}{2} x)^{−1}.

From this, using the expansion of the geometric series and the identity [1, (5.61)]

∑_{n≥0} \binom{2n + k}{n}X^{n} = \frac{2^{k}}{\sqrt{1 − 4X}(1 + \sqrt{1 − 4X})^{k}}

the quantities in (1) can be obtained.

Considering the expected values T (m, n) = \frac{d}{du}φ_{m,n}(u)|_{u=1}, simple telescoping leads to

\binom{m + n}{m}T (m, n) = ∑_{k≥m} k[\binom{m + n}{k} − \binom{m + n}{k + 1}] = m\binom{m + n}{m} + ∑_{k>m} \binom{m + n}{k}.

Theorem 1. The expected number of correct guesses is given by

T (m, n) = m + \frac{1}{\binom{m+n}{m}} ∑_{k=0}^{n−1} \binom{m + n}{k}.  (2)

Remark. Although this seems to be the nicest expression for the mean, we are able to derive other equivalent ones:

T (m, n) = m − 1 + \frac{2^{n}}{\binom{m+n}{m}} ∑_{k=0}^{n} \binom{m + k − 1}{k}\frac{1}{2^{k}} ,  (3)

T (m, n) = m + \frac{2^{n−1}}{\binom{m+n}{m}} ∑_{k=0}^{n−1} \binom{m + k}{k}\frac{1}{2^{k}} ,  (4)

T (m, n) = m + n ∑_{k=0}^{n−1} \binom{n − 1}{k}\frac{2^{n−1−k}(−1)^{k}}{m + 1 + k} .  (5)

Since the equivalence of these binomial expressions is not obvious, we prove these equalities. To prove that (2) is equivalent to (3), we must show that

∑_{k=0}^{n} \binom{m + n}{k} = 2^{n} ∑_{k=0}^{n} \binom{m + k − 1}{k}2^{−k}.

In terms of generating functions, we must prove that

[x^{n}]\frac{1}{1 − x}(1 + x)^{m+n} = [x^{n}]\frac{1}{1 − 2x} \frac{1}{(1 − x)^{m}} .

This can be seen by Cauchy’s integral formula (the substitution x = t/(1−t) is used):

[x^{n}]\frac{1}{1 − x}(1 + x)^{m+n} = \frac{1}{2πi} ∮ \frac{dx}{x^{n+1}} \frac{1}{1 − x}(1 + x)^{m+n}

= \frac{1}{2πi} ∮ \frac{dt}{t^{n+1}} \frac{1}{1 − 2t} \frac{1}{(1 − t)^{m}}

= [t^{n}]\frac{1}{1 − 2t} \frac{1}{(1 − t)^{m}} .

The equivalence of (3) and (4) is straightforward by writing

\binom{m + k}{k} = \binom{m + k − 1}{k} + \binom{m + k − 1}{k − 1}

and performing some elementary operations.

For the equivalence of (5) and (4) we use hypergeometric functions:

n ∑_{k=0}^{n−1} \binom{n − 1}{k}\frac{2^{n−1−k}(−1)^{k}}{m + 1 + k} = \frac{n2^{n−1}}{(m + 1)} _{2}F_{1}[−n + 1, m + 1; m + 2|\frac{1}{2}]

= \frac{n2^{n−1}(n − 1)!(m + 1)!}{(m + 1)(m + n)!} _{2}F_{1}[−n + 1, m + 1; −n + 1|\frac{1}{2}]

= \frac{2^{n−1}}{\binom{m+n}{m}} ∑_{k=0}^{n−1} \binom{m + k}{k}\frac{1}{2^{k}} .

Here, we have used the transformation (5.105) [1].

Remark. As one referee has pointed out, there are shorter proofs of these equivalences. The ones presented above have the advantage of offering some insight as opposed to providing merely mechanical verifications.

It is interesting to note that the formula

∑_{k=0}^{m} \binom{m + k}{k}\frac{1}{2^{k}} = 2^{m}

follows from the discussion of Banach’s match box problem, see [1].

It is also not too hard to compute the variance; we start with the second moment:

\frac{1}{\binom{m+n}{m}} ∑_{k≥m} k^{2}[\binom{m + n}{k} − \binom{m + n}{k + 1}]

= m^{2} + \frac{1}{\binom{m+n}{m}} ∑_{k>m}(2k − 1)\binom{m + n}{k}

= m^{2} + \frac{2(m + n)}{\binom{m+n}{m}} ∑_{k>m} \binom{m + n − 1}{k − 1} − \frac{1}{\binom{m+n}{m}} ∑_{k>m} \binom{m + n}{k}

= m^{2} + \frac{m + n}{\binom{m+n}{m}} ∑_{k>m} \binom{m + n − 1}{k − 1} + \frac{m + n}{\binom{m+n}{m}} ∑_{k≥m} \binom{m + n − 1}{k} − \frac{1}{\binom{m+n}{m}} ∑_{k>m} \binom{m + n}{k}

= m^{2} + n + \frac{m + n}{\binom{m+n}{m}} ∑_{k>m} \binom{m + n}{k} − \frac{1}{\binom{m+n}{m}} ∑_{k>m} \binom{m + n}{k}

= m^{2} + n + \frac{m + n − 1}{\binom{m+n}{m}} ∑_{k=0}^{n−1} \binom{m + n}{k}.

Subtracting the square of the expectation, we get:

Theorem 2. The variance of the number of correct guesses is given by

n − \frac{m + 1 − n}{\binom{m+n}{m}} ∑_{k=0}^{n−1} \binom{m + n}{k} − \frac{1}{\binom{m+n}{m}2} ( ∑_{k=0}^{n−1} \binom{m + n}{k})^{2}.

In the symmetric case m = n, this can be simplified to

m + \frac{1}{4} − \frac{4^{2m−1}}{\binom{2m}{m}2} ,

in agreement with the earlier result of Sulanke [6].

3. How often will you beat a naive player?

Zagier [7] considered the probability that you beat the naive player (with your superior strategy) and gave the asymptotic answer

\frac{1}{2} + \frac{1}{\sqrt{8}} + O(m^{−1/2})

for the symmetric case m = n.

Now we can give an exact result: Recall that the probability that you score k by guessing the more likely outcome is given by

A(m, k) = \frac{1}{\binom{2m}{m}}[\binom{2m}{k} − \binom{2m}{k + 1}], m ≤ k ≤ 2m.

The distribution for the naive player is given by

C(m, k) = \frac{1}{4^{m}} \binom{2m}{k}, 0 ≤ k ≤ 2m.

Therefore the probability that you win is

∑_{0≤k<m} C(m, k) + ∑_{m≤k<j≤2m} C(m, k)A(m, j).

The first, easy sum is

∑_{0≤k<m} C(m, k) = \frac{1}{2}(1 − \frac{\binom{2m}{m}}{4^{m}}).

The other sum is

\frac{1}{\binom{2m}{m}4^{m}} ∑_{m≤k<j≤2m} \binom{2m}{k}[\binom{2m}{j} − \binom{2m}{j + 1}]

= \frac{1}{\binom{2m}{m}4^{m}} ∑_{m≤k<2m} \binom{2m}{k}\binom{2m}{k + 1}

= \frac{1}{2\binom{2m}{m}4^{m}} ∑_{0≤k<2m} \binom{2m}{k}\binom{2m}{k + 1}

= \frac{1}{2\binom{2m}{m}4^{m}} ∑_{0≤k<2m} \binom{2m}{k}\binom{2m}{2m − k − 1}

= \frac{1}{2\binom{2m}{m}4^{m}} \binom{4m}{2m − 1}.

Theorem 3. The probability that the player guessing the more likely colour beats the one guessing naively is (exactly) given by

\frac{1}{2} + \frac{1}{2} \frac{\binom{4m}{2m+1}}{\binom{2m}{m}4^{m}} − \frac{1}{2} \frac{\binom{2m}{m}}{4^{m}}.

Stirling’s formula readily gives the result

\frac{1}{2} + \frac{1}{\sqrt{8}} − \frac{1}{2\sqrt{πm}} − \frac{7\sqrt{2}}{64m} + \frac{1}{16\sqrt{π}m^{3/2}} + O(m^{−2}).

Very similarly, we can consider the probability that the game against the naive player is a draw, which turns out to be

∑_{m≤k≤2m}C(m, k)A(m, k) = \frac{1}{\binom{2m}{m}4^{m}} ∑_{m≤k≤2m} \binom{2m}{k}[\binom{2m}{k} − \binom{2m}{k + 1}]

= \frac{1}{2\binom{2m}{m}4^{m}} [ ∑_{0≤k≤2m} \binom{2m}{k}^{2} + \binom{2m}{m}^{2}] − \frac{1}{2\binom{2m}{m}4^{m}} \binom{4m}{2m + 1}

= \frac{1}{2\binom{2m}{m}4^{m}} \binom{4m}{2m} + \frac{1}{2 4^{m}} \binom{2m}{m} − \frac{1}{2\binom{2m}{m}4^{m}} \binom{4m}{2m + 1}

= \frac{1}{2(2m + 1)\binom{2m}{m}4^{m}} \binom{4m}{2m} + \frac{1}{2 4^{m}} \binom{2m}{m}

= \frac{1}{2\sqrt{πm}} + \frac{\sqrt{2}}{8m} + O(m^{−3/2}).

4. A variation

Instead of guessing at the same time as the naive player, suppose that the game is now played alternately. The naive player guesses, then the clever player, then the naive player again, and so on. We will see that is makes a (small) difference whether the clever or the naive player starts. We will discuss again the average score of the clever player and start by considering the case where the clever player plays first.

T (m, n) = [[m + n even]]\frac{m}{m + n} + \frac{m}{m + n}T (m − 1, n) + \frac{n}{m + n}T (m, n − 1), 0 ≤ n < m,
T (m, m) = \frac{1}{2} + 2T (m, m − 1),  m ≥ 1, T (0, 0) = 0.

([[P]] is 1 if condition P is true, 0 otherwise.) It is quite easy to guess the solution and prove it by induction:

T (2m, 2n) = m + \frac{1}{\binom{2m+2n}{2n}} ∑_{k=0}^{n−1} \binom{2m + 2n}{2k},

T (2m, 2n + 1) = m + \frac{1}{\binom{2m+2n+1}{2n+1}} ∑_{k=0}^{n−1} \binom{2m + 2n + 1}{2k + 1} − \frac{m}{2m + 2n + 1},

T (2m + 1, 2n) = m + \frac{1}{\binom{2m+2n+1}{2n}} ∑_{k=0}^{n−1} \binom{2m + 2n + 1}{2k + 1} − \frac{n}{2m + 2n + 1},

T (2m + 1, 2n + 1) = m + \frac{1}{\binom{2m+2n+2}{2n+1}} ∑_{k=0}^{n−1} \binom{2m + 2n + 2}{2k + 1} + \frac{1}{2}.

Therefore

T (m, m) = \frac{m − 1}{2} + \frac{4^{m−1}}{\binom{2m}{m}} .

Now the case when the naive player starts is briefly sketched.

T (m, n) = [[m + n odd]]\frac{m}{m + n} + \frac{m}{m + n}T (m − 1, n) + \frac{n}{m + n}T (m, n − 1), 0 ≤ n < m,
T (m, m) = 2T (m, m − 1),  m ≥ 1, T (0, 0) = 0.

And the solution is

T (2m, 2n) = m + \frac{1}{\binom{2m+2n}{2n}} ∑_{k=0}^{n−1} \binom{2m + 2n}{2k + 1},

T (2m, 2n + 1) = m + \frac{1}{2\binom{2m+2n+1}{2n+1}} ∑_{k=0}^{n} \binom{2m + 2n + 2}{2k + 1},

T (2m + 1, 2n) = m + \frac{1}{\binom{2m+2n+1}{2n}} ∑_{k=0}^{n} \binom{2m + 2n + 1}{2k} + \frac{n}{2m + 2n + 1},

T (2m + 1, 2n + 1) = m + \frac{1}{\binom{2m+2n+2}{2n+1}} ∑_{k=0}^{n−1} \binom{2m + 2n + 2}{2k + 1} + \frac{m + 3n + 2}{2(m + n + 1)}.

Therefore

T (m, m) = \frac{m}{2} + \frac{4^{m−1}}{\binom{2m}{m}} .

So one does slightly better (by \frac{1}{2}) when one is allowed to play after the naive player. And the sum of the scores in both instances is

T (m, m) = m − \frac{1}{2} + \frac{4^{m}}{2\binom{2m}{m}},

as it should be, since the score is only divided into the score obtained at even (resp. odd) steps.

Acknowledgment. The insightful comments of two anonymous referees are gratefully acknowledged.

References

[1] R. L. Graham, D. E. Knuth, and O. Patashnik. Concrete Mathematics (Second Edition). Addison Wesley, 1994.

[2] D. E. Knuth. The Art of Computer Programming, volume 1: Fundamental Algorithms. Addison-Wesley, 1968. Third edition, 1997.

[3] K. Levasseur. How to beat your kids at their own game. Mathematical Magazine, 61:301–305, 1988.

[4] A. Panholzer and H. Prodinger. Towards a more precise analysis of an algorithm to generate binary trees : A tutorial. The Computer Journal, 41:201–204, 1998.

[5] R. C. Read. Card–guessing with information. A problem in probability. American Mathematical Monthly, 69:506–511, 1962.

[6] R. A. Sulanke. Guessing, ballot numbers, and refining Pascal’s triangle (9 pages). http://diamond.idbsu.edu/∼sulanke/recentpapindex.html, 1995.

[7] D. Zagier. How often should you beat your kids? Mathematical Magazine, 63:89–92, 1990.