How can I choose r elements from n elements with replacement? Which one is the appropriate formula $(n) ^r$ or $C^{n+r-1}_{r}$ and why? For example: Given $r$ integers, 0<r<10 are chosen from (0,1,2,.....9) at random and with replacement. Now according to me the total possible ways should be $C^{n+r-1}_{r}$  but the answer in the assignment shows $10^r$. Where am I wrong?
 A: Notice that the question says with replacement rather than with repetition.  The words with replacement mean that we make a selection, return it to the set, then select again.  Therefore, the order of selection matters.  If we are making $k$ selections from a set with $n$ elements, we have $n$ choices for each of those $k$ selections, so by the Multiplication Principle, there are $n^k$ possible sequences of outcomes.  In this case, $n = 10$ and $k = r$, giving $10^r$ possible sequences of outcomes.
The formula $n^k$ represents the number of ways of selecting $k$ objects from $n$ objects when the order of selection matters and repetition is permitted.
The formula
$$\binom{n + k - 1}{n - 1} = \binom{n + k - 1}{k}$$
represents the number of ways of selecting $k$ objects from $n$ types of objects when repetition is permitted and the order of selection does not matter or the number of ways of placing $k$ indistinguishable objects in $n$ distinct boxes when each box has the capacity to hold all $k$ objects and some boxes may be left empty.
