Conditional Probability Coin Flipping Question

1. Dec 7, 2013

Yagoda

1. The problem statement, all variables and given/known data
The following experiment involves a single coin with probability p of heads on any one ﬂip, where
0 < p < 1.

Step 1: Flip the coin. Let X = 1 if heads, 0 otherwise.
Step 2: Flip the coin (X + 1) times. Let Y = the number of heads obtained in this step.
Step 3: Flip the coin (X + Y + 1) times. Let Z = the number of heads obtained in this step.
Let T denote the total number of heads across all three steps.

What is P(X = 1|Z = 0)?

2. Relevant equations
$P(A|B) = \frac{P(A \cap B)}{P(B)}$

3. The attempt at a solution
I think I have been thinking about this too long and am just confusing myself. My first gut reaction was to say that no matter what the outcome of Z, since the coin isn't changing, the probability of it coming up heads on any given flip (ie P(X = 1)) will be p.
But since you are flipping a variable number of times to get Z, it seems your chance of getting Z = 0 would be greater with a smaller number of flips, which would be more likely if you begin with X=0 than X=1. Does this even matter?
I tried using the above conditional probability formula as well, but it got ugly quickly in trying to calculate the numerator. Is there a less thorny method that I'm missing?

2. Dec 7, 2013

PeroK

Have you throught about doing a tree of the possibilities?

3. Dec 7, 2013

Yagoda

I did try one, but I was having trouble keeping track of all the relevant numbers: possible flips, number of heads, corresponding probabilities that I was hoping there might be a clearer way. I might have to give it another crack...

4. Dec 7, 2013

Ray Vickson

You MUST keep track of the possible numbers of heads, etc., whether it is troublesome or not. And yes, it might be lengthy and require quite a bit of work, but that is the most straightforward way to solve the problem.