I assume you know how to count the nunmber of possible subsets of set with cardinality n.
\[
\lvert B \rvert = \binom{n}{k}
\]
B is the set containig subsets of A all with cardinality k. One question arises, how to count the possible combinations which allow repetitions in their arrangment? For example we have elements H and T and we want to count the number arrangement we can put these in three slots. we can blindly say that the count would be $2^3$, but this would be worng since the problem is not concerned with order. This table shows the list of combinations of elements HT with repetition
To solve this problem, we use a weird looking seperator | and the elements on its left represent the Tails and astricks on its right represnt Heads. We can say all the spots where seperator can seat is in the set A = {s1, s2, s3, s4} and saying this we have four spots to put only one seprator which means $\binom{4}{1}$ possible ways. The general fomula is:
\[
\binom{r+n-1}{n-1} = \binom{r+n-1}{r}
\]
r is number of slots, n number of distinct objects and n-1 number of sepreators. |