Conditioning of geometric probability mass function Problem:
A group of integrated circuits is being tested. All tests are independent. The tests continue until a failure is detected. N is the number of tests. The probability of a failure, p = 0.1. Consider the condition B = {N >= 20}. Please find:
a) P(N = n);
b) PN given B, the conditional PMF of N given that there have been 20 consecutive tests without a failure;
c) E[N given B], the expected number of tests given that there have been 20 consecutive tests without a failure.
Solution:
Ok, so I understand that this problem can be represented by a geometric PMF, i.e. P(N = n) = p(1-p)^(n-1) = 0.1(0.9)^(n-1), given that n= 1, 2, 3, 4, ...
So on the second part of the problem, would I just plug in 20 for n to obtain P[B] = 0.1(0.9)^19 and then use this value to find the conditional PMF, i.e. P[N given B] = (0.1(0.9)^n-1)/(0.1(0.9)^19) = (0.9)^20 ?
And then how would I approach the third part, since n can increase without bound?
 A: We use your choice of $N\ge 20$. If you want to use no bads in $20$ tests, an obvious modification will do the job.
Given that $N\ge 20$, the random variable $N$ can take on the values $20$, $21$, $22$, and so on.  We find a formula for $\Pr(N=19+k|B)$. One can do it informally or formally.  Given there have been no bads in $19$ trials, the probability the first bad occurs on trial $19+k$ is $(0.1)(0.9)^{k-1}$.
Alternately, use the conditional probability formula. Let $A$ be the event the first bad occurs on trial $19+k$. We want $\Pr(A|B)$.
By the usual formula, this is $\frac{\Pr(A\cap B)}{\Pr(B)}$.
Calculate. We have $\Pr(A\cap B)=\Pr(A)=(0.1)(0.9)^{18+k}$. The probability of $B$ is the probability of $19$ good in a row, which is $(0.9)^{19}$. Divide. We get $(0.1)(0.9)^{k-1}$, just like in the informal calculation.
This is a very important fact called the memorylessness of the geometric distribution.
We leave, at least temporarily, the conditional expectation to you. One can make a formal calculation. But exploiting memorylessness will make the answer obvious.
A: a) $P(N = n) = p(1-p)^{n-1}$
b) $P(N = n \mid N \geq 20) = \begin{cases} 0 & n \in [0, 19]\\ p(1-p)^{n-20} & n\in [20, \infty) \end{cases}$
Remark: You don't need Bayes for this.  It's the probability of getting $1$ success after $n-1$ failures, when it is given that the first $19$ tests were certainly failures.
c)
 $\begin{align}E[N \mid N\geq 20] & = \sum\limits_{n=20}^{\infty} n p(1-p)^{n-20} \\ & = \sum\limits_{m=0}^{\infty} (m+20)p(1-p)^m \\ &= p \sum\limits_{m=0}^\infty m (1-p)^m + 20 p\sum\limits_{m=0}^\infty (1-p)^m\end{align}$
Remark Use Geometric series to complete.
