Suppose a computer needs 20 memory chips to work, and there is a 0.1 probability that a given chip is defective.
Part 1: If $X$ denotes the number of chips to be ordered to ensure that 20 chips work, what is the probability density function of the random variable $X$?
Part 2: What is the expected value of that density function?
My attempt: In my opinion, the problem wasn't worded as clearly as it could have been. I interpreted Part 1 to ask for the density function $f(x)$, where $f(x)$ is the probability that exactly 20 of the $x$ chips work. Under this interpretation, I previously thought the density function should be $f(x)={x \choose 20}0.9^{20}0.1^{x-20}$. However, this density function does not appear to sum to one. I've tried numerous other potential density functions, and I can't seem to find one that sums to one. I would greatly appreciate any advice on this.
Your answer to the first part is not correct, because if we conceptualize the ordering process as comprising successive orders of one chip at a time until the $20^{\rm th}$ non-defective chip is obtained, then we stop precisely when that $20^{\rm th}$ good chip is obtained, hence the last ordered chip is always good. Consequently, there are only $\binom{x-1}{19}$ ways of arranging the previous $19$ good chips among the $x-1$ previous chips ordered before the last good one is obtained, hence $$\Pr[X = x] = \binom{x-1}{19} (0.9)^{20} (0.1)^{x-20}, \quad x = 20, 21, 22, \ldots.$$ This is a negative binomial distribution with parameters $r = 20$ and $p = 0.9$.
To find $\operatorname{E}[X]$, it suffices to observe by construction that $$\sum_{x=r}^\infty \Pr[X = x] = \sum_{x=r}^\infty \binom{x-1}{r-1} p^r (1-p)^{x-r} = 1.$$ Next, consider $$x \binom{x-1}{r-1} = \frac{x!}{(r-1)! \, (x-r)!} = r \cdot \frac{x!}{r! \, (x-r)!} = r \binom{x}{r}.$$ Thus $$\begin{align*} \operatorname{E}[X] &= \sum_{x=20}^\infty x \Pr[X = x] \\ &= \sum_{x=20}^\infty x \binom{x-1}{19} (0.9)^{20} (0.1)^{x-20} \\ &= \frac{20}{0.9} \sum_{x=20}^\infty \binom{(x+1)-1}{21 - 1} (0.9)^{21} (0.1)^{(x+1)-21} \\ &= \frac{200}{9} \sum_{x=21}^\infty \binom{x-1}{21-1} (0.9)^{21} (0.1)^{x-21} \\ &= \frac{200}{9}, \end{align*}$$ where in the last step we recognize the sum as being that of a negative binomial random variable with parameters $r = 21$, $p = 0.9$ over its support, so it has value $1$. In general, we see that for parameters $r$ and $p$, $$\operatorname{E}[X] = \frac{r}{p}$$ for this particular parametrization of the negative binomial distribution.