# Probability that Alice Tossed a Coin Three Times If Alice and Bob Tossed Totally 7 Times ## Problem 752

Alice tossed a fair coin until a head occurred. Then Bob tossed the coin until a head occurred. Suppose that the total number of tosses for Alice and Bob was $7$.

Assuming that each toss is independent of each other, what is the probability that Alice tossed the coin exactly three times? Add to solve later

## Hint.

Let $X$ be the number of Alice’s tosses until she got a head.

Then $X$ is a geometric random variable with parameter $p=1/2$.
Recall that a geometric random variable can be interpreted as the number of trials until getting the first success and each trial is successful with probability $p$ and fails with probability $q=1-p$.

Note that
$P(X=k)= q^{k-1} p = (1-p)^{k-1} p.$

## Solution.

Let $X$ be the number of Alice’s tosses until she got a head. Also, let $Y$ be the number of Bob’s tosses until he got a head. As each toss is an independent event and the coin is fair, the random variables $X$ and $Y$ are geometric with parameter $p=1/2$ (the probability of success(head) is $p=1/2$ and the probability of failure(tail) is $1-p=1/2$).

This question asks to find the conditional probability
$P(X=3 \mid X+Y=7) = \frac{P\left((X=3) \cap (X+Y=7) \right)}{P(X+Y=7)}.$

Let us first compute the numerator as follows.
\begin{align*}
P\left((X=3) \cap (X+Y=7) \right) &= P\left((X=3) \cap (Y=7-X) \right) \\
&= P\left((X=3) \cap (Y=4) \right) \\
&= P(X=3) \cdot P(Y=4)
\end{align*}
since $X$ and $Y$ are independent.

Now, as $X$ and $Y$ follow the geometric distribution with parameter $p$, we have
\begin{align*}
P(X=3) &= \left(\frac{1}{2}\right)^2 \frac{1}{2} = \frac{1}{2^3}\\
P(Y=4) &= \left(\frac{1}{2}\right)^3 \frac{1}{2} = \frac{1}{2^4}.
\end{align*}
The product of these gives the numerator $\frac{1}{2^7}$.

Next, let us calculate the denominator $P(X+Y=7)$.
The law of total probability yields
\begin{align*}
P(X+Y=7) = \sum_{k=1}^6 P(X=k) P(X+Y = 7 \mid X=k).
\end{align*}

As before, since $X$ is a geometric random variable with parameter $p=1/2$, we have
$P(X=k) = \left(\frac{1}{2}\right)^{k-1} \frac{1}{2} = \frac{1}{2^k}.$

The second factor $P(X+Y \mid X= k)$ can be computed as follows.
\begin{align*}
&P(X+Y = 7 \mid X= k)\\
&= P(Y = 7 – X \mid X = k)\\
&= P(Y = 7 – k \mid X = k)\\
&= P(Y=7 – k)\\
&= \left(\frac{1}{2}\right)^{(7-k)-1} \frac{1}{2} = \frac{1}{2^{7-k}}
\end{align*}
Here, the third equality follows because $X$ and $Y$ are independent.

It follows that the denominator becomes
\begin{align*}
P(X+Y=7) &= \sum_{k=1}^6 \frac{1}{2^k} \cdot \frac{1}{2^{7-k}}\\
&= \sum_{k=1}^6 \frac{1}{2^7}\\
&= \frac{6}{2^7}.
\end{align*}

Combining these computations, it follows that the desired conditional probability is
\begin{align*}
P(X=3 \mid X+Y=7) = \frac{1/2^7}{6/2^7}=\frac{1}{6}.
\end{align*}

## Abstraction

If you solved this problem, then try the following problem as well. This is more abstract than the current problem but the idea is the same.

Problem.
Let $X$ and $Y$ be geometric random variables with parameter $p$, with $0 \leq p \leq 1$. Assume that $X$ and $Y$ are independent.

Let $n$ be an integer greater than $1$. Let $k$ be a natural number with $k\leq n$. Then prove the formula
$P(X=k \mid X + Y = n) = \frac{1}{n-1}.$

Its solution can be found in the post: Conditional Probability When the Sum of Two Geometric Random Variables Are Known Add to solve later

### 3 Responses

1. Pavel says:

Hello.
I believe that after words “Now, as X and Y follow the geometric distribution with parameter p, we have” formula should read P(X=3) not P(X=2).

• Yu says:

Dear Pavel,

Thank you for catching the typo. Yes, you are right. I fixed it. Thanks!

1. 02/05/2020

[…] Probability that Alice Tossed a Coin Three Times If Alice and Bob Tossed Totally 7 Times […]

This site uses Akismet to reduce spam. Learn how your comment data is processed.

###### More in Probability ##### Probability of Getting Two Red Balls From the Chosen Box

There are two boxes containing red and blue balls. Let us call the boxes Box A and Box B. Each...

Close