Katie has \( N \) keys in her purse of which one opens the door to her house. When she arrives home at the end of a long day, she puts her hand into her purse, randomly grabs a key, and tries to unlock the door. If she fails, she puts the key back into her purse and then randomly draws another key. Suppose over the course of 5 days, she manages to unlock her front door on the 8th, 12th, 7th, 6th, and 12th attempts. (Assume the keys are similar, so each has the same chance to be picked.)
Which distribution models this scenario?
\[ \begin{align} &L(p | 8, 12, 7, 6, 12)\\ &=(1-p)^7 \cdot p \cdot (1-p)^{11} \cdot p \cdot (1-p)^6 \cdot p\\ &\cdot (1-p)^5 \cdot p \cdot (1-p)^{11} \cdot p \end{align} \]
\[ \begin{align} \ln(L(p))&=\sum_{i=1}^n \ln(1-p)^{x_i-1} + \sum_{i=1}^n \ln(p)\\ &=\sum_{i=1}^n (x_i-1) \cdot \ln(1-p) + \sum_{i=1}^n \ln(p)\\ &= \ln(1-p) \sum_{i=1}^n (x_i-1) + \ln(p) \cdot \sum_{i=1}^n 1\\ &= \ln(1-p) \sum_{i=1}^n (x_i-1) + \ln(p)\cdot n \end{align} \]
\[ \frac{d}{dp} \ln(L(p))=-40\cdot \frac{1}{1-p}+\frac{5}{p} \] Set equal to zero: \[ \begin{align} 0&=-40\cdot \frac{1}{1-p}+\frac{5}{p}\\ \frac{40}{1-p}&=\frac{5}{p}\\ \frac{1-p}{40}&=\frac{p}{5}\\ 1-p&=8p\\ 1&=9p\\ p&=\frac{1}{9} \dots \text{ so } N=9\\ \end{align} \]