Can I solve the problems of Combination with indistinguishable objects plus repetition allowed using a formula?
For instance,
How many $3$-letter combinations could be formed from the word $BBA$ if repetition of letters is allowed?
We know the answer is $4$, as $S=\{{AAA, BBB, ABB, AAB}\}$.
Can these kinds of problems be solved using a formula, or, do I need to manually solve it every time?
Note. The problem in this question is different from the problem posted in this problem which I posted earlier. Here we have $2$ letters and need to produce $3$-element combinations (i.e. $n<r$). On the other hand, in the previous problem, we had $3$ letters to choose from $26$ letters (i.e. $n>r$).
This is a so called combination with repetition. The $BBA$ is a bit misleading.
Basically you want to create $3$-multisets - multisets with $3$ items - from the set $\{A,B\}$. ("multiset" means that repetitions are allowed).
In general the number of $k$-multisets from a set of $n$ elements is $$\binom{n+k-1}{k}$$
In your case you have $n=2$ and $k=3$: $$\binom{4}{3}=\frac{4!}{3!\cdot 1!} = 4$$