Given the letters "BALL", how many arrangements of two letters exists? Using brute force, i.e. without using any counting technique, I get the following arrangements:
- AB
- AL
- BA
- BL
- LA
- LB
- LL
Please let me know how I can get the correct answer using a counting formula. For example, if I wanted to know the number of arrangements that include all the letters, it would be $\frac{4!}{2!}$; where the 2! accounts for the duplicate L's in BALL.
The general approach to problems like this is via exponential generating functions. That is, we solve the more general problem of how many strings of length $n$ can be formed from BALL: say this number is $a_n$. Then we define the exponential generating function of $a_n$ as $$f(x) = \sum_{n=0}^{\infty} \frac{a_n}{n!} x^n$$
Since we have one A, one B, and two Ls, the generating function in this case is $$f(x) = (1+x) (1+x) \left(1 + x + \frac{1}{2!} x^2 \right)$$
When we expand $f(x)$ as a polynomial, we find $$f(x) = 1 + 3x + \frac{7}{2!} x^2 + \frac{12}{3!} x^3 + \frac{12}{4!}x^4$$ so there are $3$ strings of length one, $7$ strings of length two, $12$ strings of length three, and $12$ strings of length four that can be formed from BALL.
If you are not familiar with generating functions, you can read about them in many books on combinatorics. One free on-line resource is Enumerative Combinatorics Through Guided Discovery (pdf) by Kenneth P. Bogart. Another is a book devoted entirely to generating functions, generatingfunctionology (pdf) by Herbert Wilf.