# Find the expected value of a dice sum

If fair dodecahedron is rolled until at least $k$($k$ is fixed between 2 and 12) is gotten, and $X$ is the sum of all numbers appeared until the last time, what is $E(X)$?

-
What is the probability that it will take m rolls? What is the distribution of X over those m rolls? – Yang Apr 13 '12 at 21:27
Once $k$ or greater than that appears, quit the rolling. The sum includes $k$!!! – hkju Apr 13 '12 at 21:35
Doesn't it related with the negative binomial distribution? – hkju Apr 13 '12 at 22:18
When you say "until at least $k$ is gotten", does that mean until a sum of previous rolls is at least $k$ or that an individual roll is at least $k$? – Henry Apr 13 '12 at 23:35
An individual roll is at least $k$. – hkju Apr 15 '12 at 18:54

The probability that any roll is greater than or equal to $k$ is $$\frac{13-k}{12}$$ so the expected number of rolls until a roll of $k$ or greater is $$\frac{12}{13-k}.$$ All but the last one of these rolls is less than $k$, so the sum of those rolls has an expected value of $$\left( \frac{12}{13-k} -1 \right) \frac{1+ (k-1)}{2}.$$ Add to this the expected value of the final roll $$\frac{k+12}{2}$$ and so the expectation of the sum is $$\left( \frac{12}{13-k} -1 \right) \frac{1+ (k-1)}{2} + \frac{k+12}{2} = \frac{78}{13-k}.$$

-
I am wondering that the value we want is simply the sum of both expectations? – hkju Apr 13 '12 at 22:21
Yes, we can use the additivity of expectation here. – Matthew Conroy Apr 13 '12 at 22:22
Isn't it a little strange that you both get the same answer even though you claim to be answering different questions? – Michael Lugo Apr 13 '12 at 22:29
Didier edited later. – hkju Apr 13 '12 at 22:39
And now I've edited my answer since Didier is now answering the right question. – Matthew Conroy Apr 13 '12 at 23:03

Let $n=12$ denote the number of faces. If the first roll is $i\geqslant k$, $X=i$. If the first roll is $i\lt k$, $X=i+X'$ where $X'$ is distributed like $X$. Hence, $$\mathrm E(X)=\frac1n\sum_{i\geqslant k}i+\frac1n\sum_{i\lt k}\left(i+\mathrm E(X)\right)=\frac1n\sum_{i=1}^ni+\frac1n\mathrm E(X)\sum_{i=1}^{k-1}1,$$ that is, $$n\mathrm E(X)=\frac{n(n+1)}2+(k-1)\mathrm E(X),$$ hence $$\mathrm E(X)=\frac{n(n+1)}{2(n-k+1)}=\frac{78}{13-k}.$$

-
the sum includes last rolling. – hkju Apr 13 '12 at 21:42
Doesn't it depend on $k$? – hkju Apr 13 '12 at 22:04