An urn contains $n$ balls numbered 1 through $n$. If you withdraw $m$ balls randomly in sequence, each time replacing the ball selected previously, find $P\{X=k\}$, $k = 1,.....m$, where $X$ is the maximum of the $m$ chosen numbers.
This was my approach
If $k$ is the maximum then all the $m$ numbers have to be chosen from $1,...k$. Now we can have $i$ balls that are less than $k$ which gives $k-1$ options and $m-i$ balls that are numbered exactly $k$ where $i$ goes from $0$ to $m-1$.
So $$P\{X=k\} = \sum\limits_{i=0}^{m-1}{m\choose k}\frac{(k-1)^i}{n^i}\frac{1}{n^{m-i}}$$
However the answer given is
$$P\{X=k\} = \frac{k^m}{n^m} - \frac{(k-1)^m}{n^m}$$
I wanted to know if my approach and answer are correct, if yes how can I come to the second solution from the first one? If no, can please give the correct approach?
Noting that $n^i\times n^{m-i}=n^m$ we can rewrite your sum as $$\frac 1{n^m}\times \binom mk\times \sum_{i=0}^{m-1}(k-1)^i$$ For $k=1$ this is $\frac m{n^m}$ which is not correct.
A quick approach:
It is somewhat easier to compute $P(X≤k)$. There are $k^m$ ways to choose $m$ values $≤k$ and $n^m$ unconstrained selections, so $$P(X≤k)=\frac {k^m}{n^m}$$
But, of course, $$P(X=k)=P(X≤k)-P(X≤k-1)$$