PMF of x where x is number of flips to get 2 heads and 1 tail. We have a biased coin, P(heads) = p, X is the number of times we throw is before we see at least two heads and one tail in any order (and anywhere).
I know how to find the PMF for just one head or one tail. It would be P(X = n) = $p^n$ where n  is 1, 2, 3, 4, ... and 0 otherwise.
I think I know how to find one head and one tail but I'm not sure. I think it would be P(X = n) = $p^n * (1-p)^n$ where n is 2, 3, 4... and 0 otherwise?
I get stuck with the order issue of the order when I need two heads and one tail. I could see something like $<h,t^x,h>$ or $<h^x,t>$ or $<t^x,h,t^x,h>$ where x is any number > 0.
For example if I got h,h,h,h,h,h,h,h,t I would stop after 9 tosses but if I saw t,h,h,h,h,h,h,h,h I would have stopped after 3 tosses and never seen the rest of the flips.
What I don't know is how to include this idea of order into the PMF.
Thank you!

We condition on the result of the first two tosses. 
If we get HT or TH (probability $2p(1-p)$) we are waiting for the third head. The probability that the additional waiting time is $k$ is $(1-p)^{k-1}p$. So in that case we have $\Pr(X=n)=(1-p)^{n-3}p$. That gives a contribution of 
$$2p(1-p)(1-p)^{n-3}p$$
to the pmf.  
If we get HH, (probability $p^2$) the contribution to the pmf is, by a similar argument,
$$p^2p^{n-3}(1-p).$$
Finally, we deal with the case TT. We are then waiting for two heads. The probability that this takes exactly $k$ additional trials is the probability of one head in the first $k-1$ additional trials, and head on the $k$-th. The probability of this is $\binom{k-1}{1}p^1(1-p)^{k-2}p$, for a total contribution to the pmf of 
$$(1-p)^2 \binom{n-3}{1}p(1-p)^{n-4}p.$$
Add up and, if desired, simplify.
