Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

If given ABBC, find the permutations if 2 letters are picked. If I calculate manually, they are: AB, AC, BA, BB, BC, CA, CB, 7 permutations. Is there any formula to solve this type of question? (Meaning, picking r number of letters from n number of letters with duplicated letters)

share|cite|improve this question
Depends a bit on what you mean by "this type of question". Are you always given 4 letters, or can that vary? Do they always include 3 distinct letters, or can that vary? Do you always pick 2 letters, or can that vary? – Gerry Myerson Aug 15 '11 at 12:38
For this type of question, I am meaning, picking r number letters from n number letters with k duplicated. – Allen Aug 15 '11 at 12:53
up vote 1 down vote accepted

Suppose you had $n$ unique letters ${X_k}$, and letter $X_k$ were present in $r_k$ copies.

Then the number of unique pairs of letters, can be computed as $n (n-1) + \sum_{k} \mathrm{sgn} (r_k-1)$.

The term $n(n-1)$ count the number of pairs where letters are distinct, and remaining sum counts same letter pairs.

share|cite|improve this answer
If $r_k\gt2$ then you want to count just one pair where both letters are $X_k$, not $r_k-1$ pairs. From AAA you just get AA, for example. – Gerry Myerson Aug 15 '11 at 12:34
@Gerry I realized this as well, I will edit as soon as I can. Thanks – Sasha Aug 15 '11 at 12:41
If picking 3 letters out of ABBC, is there any formula? – Allen Aug 15 '11 at 13:13
@Allen Suppose all $n$ letters are distinct. Then there are $n(n-1)(n-2)$ ways to pick triplets. Now if you have some distinct letters, you should subtract from that number the number of identical triples. – Sasha Aug 15 '11 at 13:17
@Sasha Thank you for your explanation. – Allen Aug 15 '11 at 14:25

Permutation of n things taken r at a time out of which k are repeated is


In your question , n=4 r=2, k=2

so total permutations is $\frac{4!}{2!2!}$=6

share|cite|improve this answer
Allen has shown you 7 permutations, so if your formula gives 6, then something is wrong with your formula, or something is wrong with mathematics. – Gerry Myerson Aug 15 '11 at 12:36

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.