Applying the Negative Binomial Distribution to problems. A family decides to have children until it has three children of the same gender. Assuming $P(B) = P(G) = 0.5$, what is the pmf of $X=$ the number of children in the family?
This problem is in the Negative Binomial Distribution section of my textbook and I am having a hard time applying it. My textbook states $nb(x;r,p)$ where $r$ is the number of successes and $p$ is the probability of each trial.
I have tried using $nb(x;3,0.5)$ and evaluated for $X= 3$ but I do not get the same answer as an answer that was posted online. How exactly would I apply this to get a pmf?
 A: The first reply will give you the correct answer, but if you need to use the negative binomial function to generate the pmf...
The equation for the negative binomial is: 
$$nb(x;r,p)= {x+r-1\choose r-1} p^r (1-p)^x$$ where r = number of successes, p = P(S), and  x = the number of failures prior to the rth success. That last part is important to understand in order to solve the rest of the problem. For this problem, p = .5, and r = 3 as the 3rd child of the same gender is where the parents will stop. This gives us: $$nb(x;3,\frac{1}{2})= {x+2\choose 2} \frac{1}{8} (\frac{1}{2})^x$$ (Trust me, using fractions will make this easier to calculate by hand.) If unfamiliar, the large parenthetical indicates a combination process and should be read as "$x+r-1$ choose $r-1$" or in plain English, "out of $x+r-1$ items, how many ways can I select $r-1$ items." You would calculate it for this problem, using this equation: $$\frac{(x+2)!}{2!((x+2)-2)!}$$
First thing to note is that you can achieve success by having either 3 girls or 3 boys. "Either" and "or" indicates a union of two sets, which would also mean the addition of probabilities. Since P(G) = P(B), then whatever probabilities you get for a given x value, you can simply double it in order to show the probability for both cases, 3 boys/3 girls, as the negative binomial equation will not change.
Second thing to note is that $0 \le X < 3$ because there are only two options. 3 failures before the 3rd success then implies that 3 children of the opposite gender were born. Since this would mean success, it is logically impossible for them to have 3 failures before the 3rd success. Thus, X can't be equal to or greater than 3.
From here, it's quite easy. Use the possible x values in X's domain and double your result to get the correct p(x) needed to create a pmf.
I know this seems like overkill, but given how the question was asked, this would be the way to solve it while using the negative binomial.
A: If they keep going until they have three boys or keep going until they have three girls, that's a different problem from what you have if they keep going until they have three boys or three girls.
If they have five children, then either they have at least three girls or at least three boys.  If they have fewer than three, then they don't have at least three of either.  Therefore $X\in\{3,4,5\}$.
\begin{align}
\Pr(X=3) & = \Pr(\text{first three are boys})+\Pr(\text{first three are girls}) = \frac 1 8 + \frac 1 8. \\
\Pr(X=5) & = \Pr(\text{first four are two boys and two girls}) = \frac6{16}. \\
\Pr(X=4) & = 1-\Pr(X=3)-\Pr(X=5).
\end{align}
A: We make the assumption that there are only $2$ genders, called F and M, and that births are equally likely to be gender F and gender M, and that genders of distinct birth events are independent.
Let $X$ be the number of kids. The distribution of $X$ is nowhere near negative binomial, since the birth game must end in at most $5$ trials.
Now let us calculate. The probability that $X=3$ is the probability of $3$  F in a row plus the probability of $3$ M in a row, which is $\frac{1}{4}$.
Now we find $\Pr(X=4)$. We must have $2$ F in the first $3$, and then an F, or $2$ M in the first $3$, and then an M.
The probability of the first is $\binom{3}{2}\left(\frac{1}{2}\right)^3\left(\frac{1}{2}\right)$, as is the probability of the second, for a total of $\frac{3}{8}$.
For $\Pr(X=5)$, do a similar calculation, or (easier) note it is $1-\frac{1}{4}-\frac{3}{8}$.
Remrk: Similar reasoning is used in fining the pmf of the negative binomial. 
