# How to calculate combinations with duplicates?

This site http://webviewworks.com/math/index.html explains that the word BABY has 7 combinations(AB, AY, BA, BB, BY, YA, YB). Can you explain me how is it beeing calculated?

It's not:

• Why are AA and YY not included? Commented Feb 21, 2015 at 15:28
• Becuase you only have 1 A and 1 Y in the word BABY. Commented Feb 21, 2015 at 17:17

Let's consider the B's to be distinct for the moment. There are four cases for how the permutations could come out:

(1) Neither letter is a B. There are $2\times1 = 2$ permutations here.

(2) The first letter is a B. There are $2\times2 = 4$ permutations (considering each B to be a different letter).

(3) The second letter is a B. There are also 4 permutations here.

(4) Both letters are B. There are 2 permutations here.

Now since the B's are actually indistinct, you would have to divide the permutations in cases (2), (3), and (4) by 2 to account for the fact that the B's could be switched. This gives 2 + 2 + 2 + 1 = 7 permutations. Of course, this process will be much more complicated with more repeated letters or with longer permutations. For instance, in the word RIVIERA you would have to make a case for one R and one I, two R's, two I's, one R, one I, or neither.

one way to look at this a little more analytically is to count the non-zero terms in: $$(A+B+C)^2$$ where the variables are not assumed to commute, but are subject to the relations $A^2=0$, $C^2=0$

What you are doing is, making permutation. $^nC_r$ is used when making combination. The permutation you are making has B repeated twice so you cannot use $^nP_r$ either. How to find the total number of possible permutations is already explained in other answers.

$$\begin{array}{c|cccc} - & b & a & b & y \\ \hline b & bb & ba & bb & by \\ a & ab & aa & ab & ay \\ b & bb & ba & bb & by \\ y & yb & ya & yb & yy \\ \end{array}$$

We can create a table of outcomes as above. From here you can see that the number of distinct entries is $9$. Dropping the $aa$ and $yy$ leaves the $7$ you listed. I can't see any particular rule for this - it seems to be 'not the main diagonal and no repeats'.

• It's pick one letter without replacement and then another, and then remove duplicates.
– JMP
Commented Feb 21, 2015 at 0:37