Let $Y$ count the number of widgets succesfully produced before $r$th failure. We are told that machine shuts down when $30$th failure has occured, that is $r=30$. Then probability of producing $y$ widgets before machine shuts down is given by Negative Binomial pmf \begin{equation} \mathbb{P}(Y=y)= \begin{pmatrix} y+r-1\\ y \end{pmatrix} (1-p)^rp^y=\begin{pmatrix} y+29\\ y \end{pmatrix} (1-p)^{30}p^y . \end{equation} WHAT IS THE PROBABILITY THAT MACHINE SHUTS DOWN BEFORE PRODUCING 3 WIDGETS?
Firstly, I have tried to use the pmf of $Y$ in the following way.
$\mathbb{P}\Bigg( machine\ shuts\ down\ before\ 3\ widgets \Bigg)=\mathbb{P}(Y=0)+\mathbb{P}(Y=1)+\mathbb{P}(Y=2)$
that is the sum of probabilities that 0,1,2 widgets produced before machine shuts down.
Then I constructed random variable $X$ that counts failures before $r$th successes, that $X$ pmf is the same as $Y$, with difference of counting probabilities \begin{equation} \mathbb{P}(X=x)= \begin{pmatrix} x+r-1\\ y \end{pmatrix} (1-p)^xp^r \end{equation}
thus setting $r=3$ the required probability can be presented as \begin{equation} \mathbb{P}(X=30)= \begin{pmatrix} 30+3-1\\ 30 \end{pmatrix} (1-p)^{30}p^3=\begin{pmatrix} 32\\ 30 \end{pmatrix} (1-p)^{30}p^3 \end{equation}
PROBLEM!!! The required probability calculated as the sum is NOT the same as one calculated using $X$.
ANY EXPLANATION WHERE DID I MISS THE POINT?
Note: Although the formulation of the two approaches looks quite similar they describe two different situations.
Let's state the problem:
These formulae correspond to the negative binomial distribution
\begin{align*} \mathbb{P}(Y=y)&=\binom{y+r-1}{y }p^y(1-p)^r\\ &=\binom{y+29}{y}p^y(1-p)^{30} \qquad \qquad y\in\{0,1,2\} \end{align*}
\begin{align*} \mathbb{P}(X=30)=\binom{32}{2}p^3(1-p)^{30}=\left(\binom{32}{2}p^2(1-p)^{30}\right)\cdot p\tag{1}\\ \end{align*}
Attention: This approach contradicts the crucial aspects from above which we have to follow:
Conclusion: The second approach does not properly describe the above stated problem.