Proof

Since successive trials are independent, then the probability of the rth success occurring on the x-th trial presumes that in the previous x-1 trials were r-1 successes and x-r failures. You can arrange these indistinguishable successes (and failures) in \(\binom{x-1}{r-1}\) unique ways. Therefore the desired probability is given by
\begin{equation*} P(X=x) = \binom{x - 1}{r-1}(1-p)^{x-r}p^r \end{equation*}
in-context