# Martha has a fair die with the usual $6$ sides…What is the probability that she stops at a cumulative sum of $13$?

Martha has a fair die with the usual six sides.

1. She throws the die and records the number.
2. She throws the die again and adds the second number to the first.
3. She repeats this until the cumulative sum of all the tosses first exceeds $10$.

What is the probability that she stops at a cumulative sum of $13$ ?.

Is there an easier way of finding the probability than making a tree diagram ?.

Denote by $p_n$ the probability that in successive rollings of the die we land on the sum $n$ during the process. Then $$p_n=0\quad(n<0),\qquad p_0=1,\qquad p_n={1\over6}\sum_{k=1}^6 p_{n-k}\quad(n\geq1)\ .$$ Mathematica computes $$\bigl(6^n\,p_n\bigr)_{0\leq n\leq 10}= \bigl(1, 1, 7, 49, 343, 2401, 16807, 70993, 450295, 2825473, 17492167)\ .$$ Under the rules of the game the last stop before reaching the sum $13$ has to be one of $7$, $\ldots$, $10$ with a direct jump from there to $13$. It follows that the probability $p$ we are after is given by $$p={1\over6}\sum_{n=7}^{10}p_n={65990113\over362797056}=18.1893\>\%\ .$$

You may try to work backwards. If she stops at $13$, the previous total is $10,9,8$ or $7$. So the wanted probability is the probability of reaching $10$ and thowing a $3$, or reaching $9$ and throwing a $4$, or reaching $8$ and throwing a $5$, or reaching $7$ and throwing a $6$. I.e. $\frac{1}{6}$ of the probability of reaching $7,8,9$ or $10$. The probability of avoiding such states is the probability of reaching $6$ and throwing a $5$ or a $6$ or reaching $5$ and throwing a $6$. There are no other ways to avoid them. The probability of reaching $5$ (sooner or later) is $$\frac{1}{6}+\frac{4}{6^2}+\frac{6}{6^3}+\frac{4}{6^4}+\frac{1}{6^5}= \frac{2401}{7776}$$ and similarly the probability of reaching $6$ (sooner or later) is $$\frac{1}{6}+\frac{5}{6^2}+\frac{10}{6^3}+\frac{10}{6^4}+\frac{5}{6^5}+\frac{1}{6^6}= \frac{16807}{46656}$$ hence the probability of avoiding $7,8,9,10$ is $$\frac{2401}{7776}\cdot\frac{1}{6}+\frac{16807}{46656}\cdot\frac{2}{6}$$ and the probability of reaching (sooner or later) $7,8,9,10$ is $\frac{57979}{69984}$.
The wanted probability of stopping at $13$ is so $$\frac{1}{6}\cdot \frac{57979}{69984}=\frac{57979}{419904}\approx{13.8\%}.$$

Please take the above lines with caution, since a numerical simulation suggests the probabilities of stopping at $11-12-13-14-15-16$ are close to $29-24-18-14-9-5\%$. Indeed, I spotted the flaw: once we reach $7,8,9,10$, we may stay there for a few throws, then reach $13$. The above probability has to be corrected by considering this situation. The correct probability is the one mentioned in Christian Blatter's answer.

• How could one stay at 7, 8, 9, or 10 for a few throws? You mean not stying on a given number, but staying inside $\{7, 8, 9, 10\}$? – Eric Duminil Nov 20 '17 at 7:41
• @EricDuminil: badly worded, I simply meant that the total amount can belong to $\{7,8,9,10\}$ for a few consecutive throws. For instance $7\to 8\to 10$ if we reached seven, then threw a $1$, then a $2$. – Jack D'Aurizio Nov 20 '17 at 8:28
• Thanks for the explanation. – Eric Duminil Nov 20 '17 at 8:30

This MATLAB function builds the transition matrix of a Markov chain for this puzzle and then finds the probability mass function for the sum of the values after the die is rolled rolls times.

function [p, A] = stop13(rolls)
if nargin < 1
rolls = 11;
elseif rolls > 11
rolls = 11;
end

A = toeplitz(zeros(17,1),[0 ones(1,6)/6 zeros(1,10)]);
A(1:6,1:6) = eye(6);

p = A^rolls * [zeros(16,1); 1];
end


For the default input value of $11$ rolls, it returns \begin{align} p_{16} &= 0.0482 \\ p_{15} &= 0.0949 \\ p_{14} &= 0.1396 \\ p_{13} &= 0.1819 \\ p_{12} &= 0.2419 \\ p_{11} &= 0.2934 \\ p_{10} &= 0 \\ &\ldots \\ p_{0} &= 0\enspace, \end{align} in excellent agreement with Jack's simulation.

The following script is a JavaScript one. Run it with $\texttt{node.js}$ as

$\texttt{node tosses0.js}$

// tosses0.js 30-nov-2017. F. P. Marin.
"use strict";
var ITERATIONS = 100000000; // One Hundred Million.
var i = 0;
var sumEqual13 = 0;

var tosses = (function ()
{
var sum = null;

return function ()
{
sum = 0;
do sum += 1 + (Math.floor(Math.random()*6.0)%6); while (sum <= 10);
return sum;
};
})();

do { if (tosses() === 13) ++sumEqual13; } while (++i < ITERATIONS);
console.log("Probability = " + sumEqual13/ITERATIONS);


Run Result:

$\displaystyle\texttt{Probability = 0.18183714}$

which is 'close' to the Christian Blatter result $\displaystyle\texttt{18.1893 %}$.