Problem statement:
- You have a biased coin.
- If you flip the coin, then with probability $p$ the coin will come up
heads, and otherwise it'll come up tails.
- You're allowed to continue flipping the coin until it comes up tails, or you've flipped it $N$ times (whichever comes first).
There are two approaches to this problem. The algebraic approach, and the pure probability approach. I'll cover the algebraic approach first, as it may have more familiar notation for a beginner, however the pure probability approach is simpler and cleaner.
Let's look at an example case. If $N=3$, the possible results are: T
(tails on first flip), HT
(1 head, then 1 tail), HHT
(2 heads, then 1 tail), and HHH
(3 heads).
The probability of getting all heads is pretty straightforward: it's just $p^N$. Otherwise, the probability of getting $n$ heads (with $n<N$) is either $0$ (in the case of negative heads or more than $N$ heads), or it's $p^n(1-p)$. In formal probability notation, we can write this as follows.
Let $X$ represent the number of heads you get from carrying out this process. For a given number of heads $n$,
$$\Pr(X=n)=\begin{cases}
p^n(1-p)& \text{if}\; 0\leq n<N,\\
p^n& \text{if}\; n=N,\\
0& \text{otherwise}
\end{cases}$$
This means that the expected number of heads $\text E(X)$ is given by:
$$\text E(X)=N p^N+\sum_{n=0}^{N-1}n p^n(1-p)=N p^N+(1-p)\sum_{n=0}^{N-1}n p^n$$.
Simplifying this formula, we obtain:
$$\text E(X) = \frac {p(1-p^N)} {(1-p)}$$
This formula gives the answer you calculated:
$$0.3 (1 - 0.3^2)\,/\,0.7=0.39$$
Pure probability approach: Let's generalize. What is the expected number of heads, assuming there's no limit to the number of tosses? (Your problem is easy to solve once we know this).
When there's no limit on the number of flips, then the formula becomes $\text E(X)=\frac p {1-p}$. This fits our intuition: if $p$ is closer to $1$, then on average you'll have a lot more successes.
Your problem asked
What is the expected number of heads, given that we know we got $N$ heads or fewer?
And we can write this as $\text E(X\,|\,X\leq N)$. This means the expectation of $X$, given that the number of heads $X$ is less than or equal to our limit.
Basically, we're removing all the cases where there were more than $N$ heads. To solve you're problem, just subtract out all cases where there were more than $N$ heads:
$$\text E(X\,|\,X\leq N)=\text E(X)-\text E(X\,|\,X>N)$$
This particular distribution is geometric. That means that $\text E(X\,|\,X>N+1)=p\, \text E(X\,|\,X>N)$. Through induction, we obtain $$\text E(X\,|\,X>N)=p^N\,\text E(X)$$
It follows
$$\text E(X\,|\,X\leq N)=\text E(X)\;-\;p^N\,\text E(X)$$
Which simplifies to
$$\text E(X\,|\,X\leq N)=(1-p^N)\,\text E(X)$$
We have that $\text E(X)=\frac p {1-p}$, so
$$\text E(X\,|\,X\leq N)=\frac {p\,(1-p^N)} {1-p}$$
Best Answer
Let me rename the events, because I keep thinking event A refers to Andre.
Let A be the event that Andre's car starts the first time and let C be the event that Claude's car starts the first time. We are asked for $$\Pr(A|A\cup C)=\frac{\Pr(A\cap(A\cup C))}{\Pr(A\cup C)}=\frac{\Pr(A)}{\Pr(A\cup C)}$$
Now, $\Pr(A\cup C)=\Pr(A)+\Pr(C)-\Pr(A\cap C) = .7+.8-.7\cdot.8=.94$, so the required probability is $$\frac{.7}{.94}=\frac{35}{47}$$