I came across an interesting question on the “/r/learnmath” subreddit. The poster describes two players, A and B, playing a game of dice. Each one has a die that has a specific side weighted. Each player rolls his die. If it lands on the weighted side, he gets the value of the side added to his score and rolls again. If it lands on any of the nonweighted sides, his turn is over. Whoever has the highest score wins. I found this question intriguing, and thought it would be a good opportunity for me to work on understanding infinite series, a weak area for me. Note that the original question states that if the first roll is a nonweighted side, the player gets that many points (instead of zero like on subsequent rolls). I’m going to ignore that rule and focus on the general pattern.

**Problem:**Each player has a die that is weighted on one side. He gets that many points and gets to roll again if it lands on the weighted side; if it lands on the unweighted side, his turn is over. More specifically, A’s weighted side is 3 and he has a 20% chance of rolling it; B’s weighted side is 2 and she has a 30% chance of rolling it. What is the chance that A will win (not tie)?

Let’s define some variables to make the solution as general as possible: *a* = 3 (A’s weighted side), *b* = 2 (B’s weighted side), *p* = 0.2 (A’s weighted probability), and *q* = 0.3 (B’s weighted probability). And let’s say *P*(A=*x*) is the probability that A has *x* successful rolls.

I’m hoping this can be solved with infinite series, but I’m not sure how it will handle the infinite number of cases within each sum.

The probability that A has 0 successful rolls, *P*(*A*=0), is simply 1 – *p* (an unsuccessful roll). The score would be 0×3=0 of course. *P*(*A*=1), with a score of 1×3 requires the first roll to be successful (*p*), and the next roll to be unsuccessful (1–*p*). The general pattern will be for having *n* successful rolls is *P*(A=*n*) = *p*^{n}(1–*p*), with a score of *na*.

So we can sum for all values of *n* to get the probability A will win, by multiplying for each *n *the probability of A getting *n* rolls by the probability of B getting fewer than *k* rolls (where *k* is the yet-to-be-determined number that B needs to tie or beat A).

The probability that A beats B will be the sum of all cases where B didn’t get a high enough score to tie or beat A.

I have no idea how to evaluate that second (finite) series. It occurs to me that it might be easier to consider the complementary case, where B wins or ties (that is, A does not win). That will switch the series to the remainder infinite series, which maybe will be easier to solve. **We will have to remember that we are now solving for A losing or tying, not A winning.**

This is an infinite sum, where each term in the sum itself contains an infinite series. I will have to evaluate that series if I am to have any hope of evaluating the primary series. I don’t know how to evaluate that.

But, as I think about it, there’s another way. The chance that B gets at least *k* rolls will be *q*^{k }(times 1, rather than times 1–*q*, since it doesn’t matter what the rest of the rolls are.

Now we’re getting somewhere! I almost feel like I could tackle this series, except for the tiny problem that I have no idea what *k* is, or how it depends on *n*. Well, I take that back. I can describe it, but the problem is that this isn’t a smooth, continuous relationship. If A gets 0 successful rolls, he has a score of 0×3 = 0, and so B needs at least 0/2 = 0 rolls. If A gets 1 successful roll, he has a score of 1×3 = 3, and so B needs at least 3/2 = 1.5 → 2 successful rolls. This rounding is where the problem is. I could write this as

where those partial brackets represent the *ceiling* function, rounding the value up to the nearest integer. I can substitute this in, but I won’t be able to further simplify it.

I’m almost stuck. This is the part I was afraid of when first tackling this problem.

However, *a* and *b* are such small numbers, that we might be able to just delineate the specific cases (and unfortunately, lose part of the generality of our solution).

Let’s look for a pattern. For *n *= 0, *k* = 0. For *n* = 1, *k * = 2. (These are the cases I went through above. For *n* = 2*, **k* = 3 (2×3 = 6; 3×2 = 6). For *n* = 3, *k* = 5 (3×3 = 9; 5×2 = 10). For *n* = 4, *k* = 6 (4×3 = 12; 6×2 = 12). For *n* = 5, *k *= 8 (5×3 = 15; 8×2 = 16).

There’s an alternating pattern here. We have (0, 0), (2, 3), (4, 6), and so on, where 3*n* is even, yielding an integer when divided by 2. Then we have (1, 2), (3, 5), (5, 8), and so on (the “half” cases, where 3*n* is odd and we have to round). In each group, every time *n* goes up by 2, *k* goes up by 3, which is just what we’d expect from the values of *a* = 3 and *b* = 2.

Let’s split our series into the sum of these two component series. I’m going to use a new index, *i*, for the summation. For the first sum, for A, we have 0, 2, 4, … which we can represent as 2*i*. For B, we have 0, 3, 6, … which we can represent as 3*i*. For the second sum, for A, we have 1, 3, 5, … which we can represent as 2*i* + 1. And for B, we have 2, 5, 8, … which we can represent as 3*i* + 2. Putting this all together yields:

I don’t know how to evaluate this. However, I do know the formula for the infinite geometric series:

So I’m going to try to reformulate my series into that form. Let’s work on one series at a time. First, I’ll factor out the constant (1 – *p*):

This is now in the proper form for the geometric series, where *r* = *p*^{2}*q*^{3 }.

It worked! Now let’s tackle the second sum. We’ll factor out the “extra” *p*’s and *q*’s.

Next, we can factor out everything which does not depend on *i*:

This infinite series is exactly the same as the one I just simplified, so I’ll jump ahead.

Factoring out the common terms yields

And solving for *W*, we get

That should be the general formula (for the predefined values *a*=3 and *b*=2, but for any values of *p* and *q*). If we substitute in *p*=0.2 and *q*=0.3, we get

I believe this answer to be correct, but it is far lower than I had expected. I had actually expected it to be greater than 0.5, but I suppose there are many ties (especially 0 = 0 ties), and a tie means A didn’t win. I’d like to explore this more in a future post.