Conditional Probability of Binomial Distribution

What is the probability of tossing $k_2$ heads in $n_2$ trials conditional that in the first $n_1$ attempts there were $k_2$ heads? Assume the probability of heads is $p$.

How does that change when I need to calculate the probability of tossing $k_2$ heads in $n_2$ trials conditional that in first $n_1$ attempts there were NOT $k_2$ heads?

Thanks.

-
 Hello Zamboni! Is your question related to the Mathematica software? – Rojo Jan 26 at 3:19 the conditional stipulation doesn't effect the probability, the events are independent – Rustyn Yazdanpour Jan 26 at 4:00

migrated from mathematica.stackexchange.comJan 26 at 3:55

$1$. We first find the probability of $b$ heads in $n$ trials given that there were $a$ heads in the first $m$ trials. By independence, this is just the probability of exactly $b-a$ heads in $n-m$ trials. That is a standard calculation: the probability of $c$ heads in $t$ trials is $\binom{t}{c}p^c(1-p)^{t-c}$.
$2$. We now find the probability of $b$ heads in $n$ trials given that the number of successes in the first $m$ trials is not $a$. This is more complicated, but doable.
Let $B$ be the event we get $b$ heads in $n$ trials, and let $A$ be the event we get $a$ heads in the first $m$ trials. Then $$B= (B\cap A)\cup (B\cap A^c),$$ where $A^c$ is the complement of $A$. This is a disjoint union. Thus $\Pr(B\cap A^c)=\Pr(B)-\Pr(B\cap A)$.
We can give simple explicit expressions for $\Pr(B)$ and $\Pr(B\cap A)$. So we can compute $\Pr(B\cap A^c)$. But $$\Pr(B|A^c)=\frac{\Pr(B\cap A^c)}{\Pr(A^c)}.$$ Finally, $\Pr(A^c)$ can be computed, it is $1-\Pr(A)$. Now put the pieces together. We get $$\Pr(B|A^c)=\frac{\Pr(B)-\Pr(B\cap A)}{1-\Pr(A)}.$$ All of the quantities on the right-hand side can be written down explicitly, using the standard Binomial distribution probabilities.