Tom K. answered 09/09/21
Knowledgeable and Friendly Math and Statistics Tutor
It is easy to see that P(z) = z/g (If you wish, you can easily show that this solves P(0) = 0, P(g) = 1, P(z) = 1/2 P(z-1) + 1/2 P(z-1), z = 1, 2, ..., g-1)
Then, P(first toss is heads | you win) = P(you win and first toss is heads)/(P(you win and first toss is heads)+P(you win and first toss is tails)) =
P(first toss is heads)P(win|first toss is heads)/(P(first toss is heads)P(win|first toss is heads)+P(first toss is tails)P(win|first toss is tails)) = 1/2P(z+1)/(1/2P(z+1)+1/2P(z-1)) =
P(z+1)/(P(z+1)+P(z-1)) =
(z+1)/g/((z+1)/g+(z-1)/g) =
(z+1)/(2z) or 1/2 + 1/(2z)