How to solve this probability problem analytically (instead of using simulation)? Probability of Bill wins the game if he goes first Here is the problem setup:
Two people play a game of throwing balls at a pin. Sally hits the pin 70% of the times she throws, and Bill hits the pin 40% of the times he throws. The game is won by the person who hits the target first. If Bill throws first each time, find the probability he will win.
With simulation, I get Bill's probability of winning to be around 0.52 (rounding to two decimal places). How to solve this problem analytically? 
 A: For the first round, Bill wins with probability 0.6. For he to win on the second round, Sally needs to lose. Let $B_i$ be the event that Bill wins at $i$-th trial; same for Sally (i.e. $S_i$). So, for the second trial, we can write:
$$P(B_2)=P(B_1')P(S_1'|B_1')P(B_2|B_1',S_1')=0.6\times0.3\times0.4$$
This goes on similarly for each $i$, ending up with:
$$P(\text{Bill wins})=0.4(1+0.18+0.18^2+\dots)=\frac{0.4}{1-0.18}$$
A: It seems easiest to do it as a recurrence relation.
Bill and Sally are going to alternate throwing. When Bill goes first, he will win immediately 40% of the time. The other 60% is like saying Sally goes first. In that case, Sally will win 70% of the time and the other 30% (of the 60%), we're back to the probability of Bill winning if he goes first.
p = 0.4 + 0.6 ( 0.3 * p)
Solve for p, get p = 0.4 / 0.82 = 48.8%
Something's up with your simulation, or @CFD and I don't understand your problem statement.
A: I think you may have Bill and Sally backwards in your sim. I find that Bill's probability of winning is $\approx 0.488$.
Bill's probability of winning on his first throw, call it $p_1$ is $0.40$.
Bill's probability of winning on his second throw requires him to miss, Sally to miss, then Bill to hit, or 
$p_2=(1-0.4)(1-0.7)0.4 = (0.18)(0.4)$
Similarly, 
$p_3=(1-0.4)(1-0.7)(1-0.4)(1-0.7)0.4 = (0.18)^{2}(0.4)$
Or generally,
$p_i=(0.18)^{i-1}(0.4)$
Bill's overall probability of winning is $\Sigma p_i$.
Since the ratio of sequential probabilities is constant, this is a geometric series. The sum of an infinite geometric series can be found with the formula
$\Sigma r^{i-1}p_1 = \frac{p_1}{1-r}=\frac{0.4}{1-0.18}=\frac{0.4}{0.82}\approx0.4878$
A: The symmetric situation of Sally and Bill suggests we solve the problem for arbitrary probabilities. 
So, let $s$ be Sally's chance of hitting the target and $b$ be Bill's chance.  When it's Sally's turn, let $p(s,b)$ represent her chance of eventually winning. We seek a formula for $p(s,b).$  Because Sally and Bill play identical roles in this game, merely differing in their skills, any formula for $p$ will tell us that $p(b,s)$ is Bill's chance of eventually winning when it's his turn.  This is the first simplification afforded by the symmetry.
We also know the turns in the game alternate between the players.  Thus, when it's a player's turn, their chance of eventually winning equals their chance of hitting the target plus the chance that their opponent (who gets the next turn) eventually loses.  That, of course, is given by subtracting the opponent's chance of winning from $1.$
This gives two symmetrical equations, one for each player:
$$\left\{\eqalign{p(s,b) = s + (1-s)(1-p(b,s))\; \\ p(b,s) = b + (1-b)(1-p(s,b)).}\right.$$
That's the second simplification due to symmetry--and it's enough to go directly to the answer, because plugging the second equation into the first (to eliminate $p(b,s)$) gives an equation relating $p(s,b)$ to $s$ and $b.$  Use algebra to solve it:
$$p(s,b) = \frac{s}{1 - (1-s)(1-b)}.$$
With $s=7/10$ and $b=4/10,$ this gives
$$p(7/10, 4/10) = \frac{7/10}{1 - (3/10)(6/10)} = \frac{70}{82}\approx 85.37\%$$
for Sally to win if it's her turn and
$$p(4/10, 7/10) = \frac{4/10}{1 - (3/10)(6/10)} = \frac{40}{82} \approx 48.78\%$$
for Bill to win if it's his turn.

Another solution method notes this is a Markov chain on the four states "Sally's turn," "Bill's turn," "Sally wins," and "Bill wins."  You can set up the $4\times 4$ transition matrix
$$\mathbb{P} = \pmatrix{0 & 3/10 & 7/10 & 0 \\ 6/10 & 0 & 0 & 4/10 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1}$$
and turn the Markov chain theory crank.  Because the largest size of the non-unit eigenvalues of $\mathbb{P}$ is $\sqrt{(1-s)(1-b)},$ or approximately $0.4242641,$ whose common logarithm is $-0.37,$ and double-precision arithmetic doesn't quite achieve $16$ decimal places, taking a power of $\mathbb P$ greater than about $16 / 0.37 = 43$ will reveal the answers (in its $(1,3)$ and $(2,4)$ entries).  That is,
$$p(s,b) = \lim_{n\to \infty} (\mathbb{P}^n)_{\text{Sally's turn},\text{Sally wins}}= \lim_{n\to \infty} (\mathbb{P}^n)_{1,3}$$
and 
$$p(b,s) = \lim_{n\to \infty} (\mathbb{P}^n)_{\text{Bill's turn},\text{Bill wins}}= \lim_{n\to \infty} (\mathbb{P}^n)_{2,4}$$
both converge exponentially rapidly.
