[Math] Expected sum of all the n-sided dice rolls until we get n

diceexpectationprobability

So the problem is the following.
We have an $n$-sided die. We throw it until we get $n$. What's n, if the expected sum of all the throws including the $n$ one is $21$.

Now, I did manage to solve it by assuming we throw the dice m times, then getting the expected value of a single throw and multiplying it with m to get the expected sum of all the throws. Then I just needed to get the expected m for an n sided die. However, the solution provided with the problem seems to be much shorter and I don't really understand how it works. It goes like this:

Let X be a random variable representing the sum. Let Y be a random variable representing the value of the first throw. Then we can write the expected value of X using the law of total expectation like this:

$EX=E(X|Y=1)P(Y=1) + …+E(X|Y=n)P(Y=n)$

So far so good I thought. But then they substitute $EX$ with $21$ and do this:

$21 = (21+1)\frac{1}{n}+…+(21+n-1)\frac{1}{n}+1$

Solving it for $n$ does produce the correct result ($6$), but I don't understand the reasoning behind $E(X|Y=a)=(21+a)$

Surely the expected value of $X$ already takes into account that the first throw will add something into the sum, right? So how is the expected value of $X$ GREATER than $21$ if the first throw gave the lowest possible amount?

Using the same logic I tried to solve it by calculating the expected value for each throw ($\frac{n+1}{2}$) and then replacing $E(X|Y=a)$ with $(21+a-\frac{n+1}{2})$ my logic being that if we get $a$ and we expect $\frac{n+1}{2}$, the sum goes up or down by the same amount that $a$ differs from the expected value.

Solving it like that, however, produces a wrong result ($-41$).

So, where did I make a mistake?

Best Answer

Okay here is an idea. All throws are independent. This means if you know that you did not succeeded in the first try, this is equivalent to starting all over. However you already got 'a' points so you have to add them, this means: E(X | Y = a) = a + E(X) for a!=n. It may look confusing but this is due to the fact that overall the expected value does not increase because in the last case a==n you can only add 'a'. It is like a balancing act.

For your second argument: Because there is a probability to throw 'n' in the first try, you can not simply subtract (n+1)/2. I'm not able to give you a good reason, or an alternative, but I hope my answer helps nevertheless.