0

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:

  1. AB
  2. AL
  3. BA
  4. BL
  5. LA
  6. LB
  7. 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.

SLax
  • 115
  • For your specific example, there are $3\times 3 - 1 - 1 = 7$ such arrangement; $3\times 3$ counting the number of ways of having two letters in sequence where we ignore the restrictions of the number each kind of letter available, and the $-1-1$ for accounting for the fact that we didn't want to include AA and BB in our count which would have been included in the earlier calculation. The full process for arbitrary scenarios is often quite involved and very tedious. – JMoravitz Jun 19 '18 at 17:24
  • See this related question for some discussion on the topic or this other related question for another take on it. Brute force using computer assistance is often the easiest however. I seem to remember taking the time to write out the full generalized formula here once, but it is difficult to find quickly. – JMoravitz Jun 19 '18 at 17:25

1 Answers1

2

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.

awkward
  • 14,736