Probability of getting the same ball I encounter the following question.

A bag has $n$ balls labeled with $1,\dots, n$. A person draw a ball, and put it back, until he gets a ball which has been draw before, then stops. What is the probability distribution of the number of drawing?

Here is how I did it:

Let $X$ be the number of drawing. Then $P(X>k) = P(k \text{ different balls}) = C(n, k)/n^k$. Then $p(k) = P(X> k-1) - P(X>k) = C(n, k-1) * \frac{nk-n+1-1}{k}/n^k, \forall k = 2, \dots, n+1$.

But the answer given is $p(k) = (k-1)!C(n, k-1)\frac{k-1}{n^k}$
Where did I make a mistake?
 A: The balls are being drawn with replacement and say we draw the same ball in $k^{th}$ draw. Then previous $(k-1)$ draws are all different balls.
Number of ways for $(k-1)$ draws to be all different balls = $ \displaystyle {n \choose k-1} \cdot (k-1)!$
Also $k^{th}$ ball is one of the previous $(k-1)$ balls which is given by $ \displaystyle {k-1 \choose 1}$.
Finally there are $n^k$ unrestricted ways. That leads to probability of,
$ \displaystyle P(X = k) = {n \choose k-1} \cdot (k-1)! \cdot (k-1) / n^k$

The method you are applying will also work but you have mistakes.
Probability that it takes more than $(k-1)$ draws for a ball to be drawn twice,
$ \displaystyle P(X \gt k-1) = {n \choose k-1} (k-1)! / n^{k-1}$
Probability that it takes more than $k$ draws for a ball to be drawn twice,
$ \displaystyle P(X \gt k) = {n \choose k} k! / n^k$
Then, $ ~ P(X = k) = P(X \gt k-1) - P(X \gt k)$
A: The event of $X=k$ is the event of drawing some arrangement of $k-1$ from $n$ distinct balls, then drawing one from those $k-1$ balls again.
$$\mathsf P(X=k) = \dfrac{(k-1)!~{^{n}C_{k-1}}}{n^{k-1}}\cdot\dfrac{(k-1)}{n}$$
Simplify:...
