Eclair_de_XII said:
Okay, here's what I have:
##P(E|H_1)+ (p^{r-1}-1)P(E|T_1)=p^{r-1}##
##-(1-p)^{s-1}P(E|H_1) + P(E|T_1)=1-(1-p)^{s-1}##
##A = \begin{pmatrix}
1 & (p^{r-1}-1) \\
-(1-p)^{s-1} & 1 \\
\end{pmatrix}##
##det(A)=1+(1-p)^{s-1}(p^{r-1}-1)##
##A^{-1} = \frac{1}{det(A)}\begin{pmatrix}
1 & (1-p^{r-1}) \\
(1-p)^{s-1} & 1 \\
\end{pmatrix}##
##\begin{pmatrix}
P(E|H_1) \\
P(E|T_1) \\
\end{pmatrix} = A^{-1}
\begin{pmatrix}
p^{r-1} \\
1-(1-p)^{s-1} \\
\end{pmatrix}
=\frac{1}{1+(1-p)^{s-1}(p^{r-1}-1)} \begin{pmatrix}
p^{r-1}+(1-p^{r-1})(1-(1-p)^{s-1}) \\
1-(1-p)^{s-1}+p^{r-1}(1-p)^{s-1} \\
\end{pmatrix}##
##P(E)=\frac{1}{1+(1-p)^{s-1}(p^{r-1}-1)}[p^{r}+p(1-p^{r-1})(1-(1-p)^{s-1})+(1-p)(1-(1-p)^{s-1})+p^{r-1}(1-p)^{s}]##
I am not sure if your answer is correct. I get a slightly different-looking answer, obtained in a different way.
We can model the process as a discrete-time stationary Markov chain with states H1, H2, ..., Hr and T1, T2, ..., Ts. The process at the completion of some toss is in state Hj if the toss has just resulted in the jth 'head' in a run of 'heads' (so in state H1 we have just gotten our first 'head' in a potential run of 'heads'). The states Tk have the same type of meaning, but for 'tails'. The two states Hr and Ts are "absorbing", meaning that the game ends when one of them is first reached.
The transitions are simple: when in state H1, we go to state H2 if the toss is a 'head' and to state T1 if a 'tale'. For ##1 \leq i \leq r-1## we go from state Hi to H(i+1) if 'heads' and to state T1 if 'tails'. Similarly, we go from state Tk to T(k+1) if 'tails' and to H1 if 'heads'.
So, now all we need to do is compute the first-passage probabilities for H1->Hr and T1->Hr. The process starts in state H1 with probability p and in state T1 with probability q = 1-p.
If we let ##x_i## be the probability of eventually reaching Hr, starting from state Hi, and ##y_j## be the probability of reaching Hr, starting from state Tj, then, we have:
$$\begin{array}{l}x_i = p x_{i+1} + q y_1, \; i=1,2, \ldots, r-1\\
x_r = 1\\
y_j = q y_{j+1} + p x_1, \; j=1,2, \ldots, s-1 \\
y_s=0
\end{array}$$
These equations lend themselves to a nice solution for ##x_{r-1}##, then ##x_{r-2}## , ##\ldots, ## then ##x_1## in terms of ##p, q## and ##y_1##. So, we have a fairly simple equation for ##x_1## in terms of ##y_1##. Similarly, we obtain a reasonably simple solution for ##y_1## in terms of ##x_1##. Now we have two equations that can be solved to find ##x_1## and ##y_1##. The answer is ##\text{Answer} = p x_1 + q y_1.##