Probability mass function, biased coin

Here's the question, basically I'm not sure how to bridge the two parts together. Thanks for any and all help!

Two biased coins have the same probability p of coming up Heads. The first coin is tossed until Heads appears for the first time, let N be the number of tosses. The second coin is then tossed N times. Let X be the number of times the second coin comes up Heads. Find the pmf (probability mass function) of X (express the pmf by writing P (X = k) as an infinite series).

So I know that the pmf of the first part of the problem, the first coin being tossed until H appears, is:

P(X=N) = [(1 - p)^(N-1)]p

I'm having trouble bridging the first pmf with the second pmf. My thinking is that P(N) above is now the probability that the second coin's toss would come up heads , but I'm lost beyond that. I also don't understand how this can be written as an infinite series if we're limiting the amount of throws of the second coin to be N. Any and all help will be greatly appreciated!

Re: Probability mass function, biased coin

find P(X=k|N=n). hint : binomial distribution.

then use

$\displaystyle p(X=k) = \sum_{n=1}^{n=\infty} P(X=k|N=n)P(N=n)$

Re: Probability mass function, biased coin

Thank you so much! I'm confident the answer I got to is correct, but I'm not going to type it out to double check with you because I'm terrible with Latek. (Wink)