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)