# Thread: simple coin flip problem

1. ## simple coin flip problem

hi, I recently discovered this forum and I think this could help me with my stats courses...

I havent received the text book yet, so my first assignment is more difficult without anything to consult... heres the question:

you flip a coin with probability p unknown, you keep flipping until you get a pattern of TTH landing in a row, then u stop. let X be the # of flips, calculate E(X).

I know flipping a coin is binomial. I just need something to help me get started, I calculated that P(TTH) = (1-p)(1-p)p = p(1-p)^2 but am unsure if this helps any and am not sure where to start.

i know that E(X) = SUM x*p(x) in this case we sum from x = 3 to x = infinite

but how do i go about calculating p(x)

2. If the random experiment is ' tosing the coin till the first head turns up and noting the number of tosses ', then the distribution is not binomial but geometric. f(x)=q^x.p; x=0,1,2,...
where p is the probability of getting head.
Expected value of the no. of tosses is q/p.

3. its not quite geometric if you are required to have two tails in a row followed by a head. a success for this problem is when three tosses yields TTH in exactly that sequence. a success for a geometric would be "the first instance of a head" example:

thththtth would be x = 9 in this problem but would be x = 2 for a geometric distribution.

I don't have an answer for your question, but its not geometric. I would have to take a brute force approach to this problem and see what came out of it.

i hope that helps,
jerry

4. apparently not all coin flipping questions are simple...

the assignment was extended until wednesday, someone said theres an example similar in the book, however i have not received the book in the mail yet

5. I'm still working on it....

6. rumour is it has to do with conditioning so E(X) = E[E(X|Y)]

but i didnt know what to condition on, and we never did conditioning last year in stats, so i have no idea what it does or how it works

7. LOL,

logman that is funny, because here i am trying to solve your problem as stated. and i don't think it is that simple.

what i did was to write out several of the possible successful sequences, eg: tth, htth, ttth, thtth, tttth... you get the idea. then i used your formula "P(TTH) = (1-p)(1-p)p = p(1-p)^2" and did a series of computations of the probabilities.

so for the list above:

P(TTH) = (1-p)(1-p)p = p(1-p)^2
P(htth) =p^2(1-p)^2
P(ttth)= p(1-p)^3
etc.

If you plug those probabilities into a comutation fo expected value it appears that the result is an infinite series with coefficients that follow the binomial theorem (ie pascal's triangle). I suspect that the series will be a collapsing series though i had not continued to work on it since then. I was simply waiting to see if you were still working on this or not. its an interesting problem, but i don't see a solution using a conditional unless the original problem was mis-stated.

cheers
jerry

8. the solution hasnt been posted on the website yet, but i stated the question properly, and it involves conditioning, it would be impossible to calculate it using a brute force method similar to what u were trying

9. What makes you so sure that "it would be impossible to calculate" using my approach? Have you tried and shown it to fail, or is there a flaw in what i posted?

I'm certainly not infallible, but if you are going to claim that my approach cannot yield a solution you should offer your reasoning.

I'll take an honest shot at solving it using a conditional, why don't you take a shot at proving my original attemp invalid....

jerry

10. well I'm not sure exactly what you are doing, but there is obviously an infinite number of possibilities to get this sequence ending TTH, you couldnt possibly calculate the probability of each..

11. 3-27. Condition on the outcome of the first flip to obtain
E[X] = E[X|H]p + E[X|T](1 − p)
= (1 + E[X])p + E[X|T](1 − p).
Condition on the outcome of the next flip gives
E[X|T] = E[X|TH]p + E[X|TT](1 − p)
= (2 + E[X])p + (2 + 1/p)(1 − p),
where the final equality follows since given that the first two flips are tails the number of additional
flips is just the number of flips needed to obtain a head. Putting the preceding together yields
E[X] = (1 + E[X])p + (2 + E[X])p(1 − p) + (2 + 1/p)(1 − p)2
or
E[X] = 1 / [p(1 − p)^2]

12. Logman,

that solution does not match the question you posted. that solution is for working with a geometric distribution. you posed the question as being when you could first expect to see the exact sequence TTH, which is what i was working on. i did try to solve it using a conditional but i was unsuccessful. while trying i did find a counting solution that leads tot he same colapsing series that i found on my first try.

cheers
jerry

13. Originally Posted by Logman
well I'm not sure exactly what you are doing, but there is obviously an infinite number of possibilities to get this sequence ending TTH, you couldnt possibly calculate the probability of each..
no, i could not compute an infinite number of probability values. but i can, and did, discover a pattern that can be generalized to uncover an infinite series that sums to give the probability. that series turns out to be a collapsing series as well, so the value can be found.

It is a moot point at this point since the question that i was working on is not the one you were given the solution to.

cheers
jerry

14. 3-27. A coin that comes up heads with probability p is continually flipped until the pattern T, T, H appears. (That is, you stop flipping when the most recent flip lands heads, and the two immediately preceding it lands tails.) Let X denote the number of flips made, and find E[X].

thats the question copied straight from the assignment, i dont know what you mean how/if I stated it differently

15. well that is what you originally posted, i guess then that i disagree that the solution that you were provided is the correct solution tot hat problem.

given that the first two flips are tails the number of additional
flips is just the number of flips needed to obtain a head
this part of the solution is saying "from here on out its geometric" because the claim is made that the number of additional flips is the number to obtain a head, that is clearly a geometric distribution. however the way the problem is written the following sequence is one possible outcome whose probability is not consdered in the solution that you posted: thththtth the posted solution only allows flipping until the first head is obtained after the third flip. seems like the solver is allowing for all possible combinations in the first two flips but then disallowing anything but a geometric situation for all following flips.

my opinion is the solution does not match the problem,

cheers
jerry