TITLE: Recursion for Finding Expectation (Somewhat Lengthy)
QUESTION [6 upvotes]: Preface:
Ever since I read the brilliant answer by Mike Spivey I have been on a mission for re-solving all my probability questions with it when possible. I tried solving the Coupon Collector problem using Recursion which the community assisted on another question of mine. Now, I think I have come close to completely understanding the way of using recursion. But.....
Question:
This is from Stochastic Processes by Sheldon Ross (Page  49, Question 1.14). The question is:
A fair die is continually rolled until an even number has appeared on 10 distinct rolls. Let $X_i$ denote the number of rolls that land on side $i$. Determine :

$E[X_1]$
$E[X_2]$
PMF of $X_1$
PMF of $X_2$

My Attempt:
Building on my previous question, I begin:
Let $N$ denote the total number of throws (Random Variable) and let
$Z_{i}$ denote the result of the $i^{th}$ throw. Then:
\begin{eqnarray*}
E(X_{1}) & = & E\left(\sum_{i=1}^{N}1_{Z_{i}=1}\right)\\
 & = & E\left[E\left(\sum_{i=1}^{N}1_{Z_{i}=1}|N\right)\right]\\
E(X_{1}|N) & = & E(1_{Z_{1}=1}+1_{Z_{2}=1}+\cdots+1_{z_{N}=1})\\
 & = & \frac{N-10}{3}\\
E(X_{1}) & = & \frac{E(N)-10}{3}
\end{eqnarray*}
To Find : $E(N)$
Let $W_{i}$ be the waiting time for the $i^{th}$ distinct roll of
an even number. Then:
$$E(N)=\sum_{i=1}^{10}E(W_{i})$$
Now,
\begin{eqnarray*}
E(W_{i}) & = & \frac{1}{2}(1)+\frac{1}{2}(1+E(W_{i}))\\
E(W_{i}) & = & 1+\frac{E(W_{i})}{2}\\
\implies E(W_{i}) & = & 2\\
\therefore E(N) & = & \sum_{i=1}^{10}2\\
 & = & 20\\
\therefore E(X_{1}) & = & \frac{10}{3}\\
 &  & \blacksquare
\end{eqnarray*}
The exact same procedure can be followed for $E(X_2)$ with the same answer. The answer matches the one given in the book. I am confused how to go from here to get the PMFs. 
Note : If possible, please provide me an extension to this answer for finding the PMFs rather than a completely different method. The book has the answer at the back using a different method. I am not interested in an answer as much as I am interested in knowing how to continue this attempt to get the PMFs.

REPLY [2 votes]: The main idea is to use probability generating functions. (If you don't know what that means, this will be explained later on in the solution)
We solve the problem in general, so replace $10$ by any non-negative integer $a$.
Let $p_{k, a}(i)$ be the probability of getting $k$ rolls with face $i$ when a fair dice is continually rolled until an even number has appeared on $a$ distinct rolls. In relation to your problem, when $a=10$, we have $p_{k, 10}(i)=P(X_i=k)$.
To start off, note that $p_{-1, a}(i)=0$ (You can't have $-1$ rolls), 
$$p_{k, 0}(i)=\begin{cases} 1 & \text{if} \, k=0 \\ 0 & \text{if} \, k \geq 1 \end{cases}$$
(If you continually roll a fair dice until an even number has appeared on $0$ distinct rolls, then you must have $0$ rolls for all faces since you don't roll at all.)
Now we have 2 recurrence relations:
$p_{k, a}(1)=\frac{1}{6}p_{k-1, a}(1)+\frac{1}{3}p_{k, a}(1)+\frac{1}{2}p_{k, a-1}(1)$ and $p_{k, a}(2)=\frac{1}{6}p_{k-1, a-1}(2)+\frac{1}{3}p_{k, a-1}(2)+\frac{1}{2}p_{k, a}(2)$.
Simplifying, we get $p_{k, a}(1)=\frac{1}{4}p_{k-1, a}(1)+\frac{3}{4}p_{k, a-1}(1)$ and $p_{k, a}(2)=\frac{1}{3}p_{k-1, a-1}(2)+\frac{2}{3}p_{k, a-1}(2)$.
Time to bring in the probability generating functions.
Define $f_a(x)=\sum\limits_{k=0}^{\infty}{p_{k, a}(1)x^k}$, $g_a(x)=\sum\limits_{k=0}^{\infty}{p_{k, a}(2)x^k}$.
Basically, the coefficient of $x^k$ in $f_a(x)$ is the probability that you have $k$ rolls of $1$. You can think of it (using your notation) as $f_{10}(x)=E(x^{X_1})$ (and similarly for $g_a(x)$)
We easily see that $f_0(x)=g_0(x)=1$.
Multiplying the first recurrence relation by $x^k$ and summing from $k=0$ to $\infty$ gives 
$$\sum\limits_{k=0}^{\infty}{p_{k, a}(1)x^k}=\frac{1}{4}\sum\limits_{k=0}^{\infty}{p_{k-1, a}(1)x^k}+\frac{3}{4}\sum\limits_{k=0}^{\infty}{p_{k, a-1}(1)x^k}$$
$$f_a(x)=\frac{1}{4}xf_a(x)+\frac{3}{4}f_{a-1}(x)$$
$$f_a(x)=\frac{3}{4-x}f_{a-1}(x)$$
$$f_a(x)=\left(\frac{3}{4-x}\right)^af_0(x)=\left(\frac{3}{4-x}\right)^a$$
The coefficient of $x^k$ in the expansion of $f_a(x)$ is just $\left(\frac{3}{4}\right)^a\frac{1}{4^k}\binom{k+a-1}{k}$.
In particular, when $a=10$, the PMF $F_1(x)$ of $X_1$ is 
$$F_1(k)=P(X_1=k)=\frac{3^{10}}{4^{k+10}}\binom{k+9}{k}$$
Doing the same to the 2nd second recurrence gives
$$g_a(x)=\left(\frac{1}{3}x+\frac{2}{3}\right)g_{a-1}(x)$$
$$g_a(x)=\left(\frac{1}{3}x+\frac{2}{3}\right)^ag_0(x)=\left(\frac{1}{3}x+\frac{2}{3}\right)^a$$
The coefficient of $x^k$ in the expansion of $g_a(x)$ is just $\frac{1}{3^a}2^{a-k}\binom{a}{k}$.
In particular, when $a=10$, the PMF $F_2(x)$ is 
$$F_2(k)=P(X_2=k)=\frac{2^{10-k}}{3^{10}}\binom{10}{k}$$
P.S. It is now a trivial matter to calculate expectation, by differentiating the probability generating function and then evaluating at $x=1$:
$$E(X_1)=f_{10}'(1)=\frac{10}{3}, E(X_2)=g_{10}'(1)=\frac{10}{3}$$