CalcTrace

Permutation and Combination Calculator

Count the number of ways to choose r items from n. Say whether the order matters and whether an item can be picked more than once, and the calculator gives the exact answer, however large, with the factorial working written out.

Last updated .

Your selection

Does the order matter?
Can the same item be chosen more than once?

Result

Combinations

–

Ways to chooseNo repetitionWith repetition
Order matters (permutations)––
Order does not matter (combinations)––

Show the working

    Does order matter? The one question to settle first

    Permutations and combinations both count the ways of choosing r items from n. The difference is whether two selections containing the same items in a different order count as different.

    A quick test: describe one outcome, shuffle it, and ask whether you would call the result something new. If yes, you want a permutation. The second question is whether an item can be used again once it has been chosen. Digits in a PIN can repeat; runners in a race cannot finish twice.

    The four formulas

    In each formula n is the number of different items available, r is how many are chosen, and n! (“n factorial”) is the product of every whole number from n down to 1, so 5! = 5 × 4 × 3 × 2 × 1 = 120. By convention 0! = 1.

    Permutations, no repetition: nPr = n! ÷ (n − r)!

    Combinations, no repetition: nCr = n! ÷ (r! × (n − r)!)

    Permutations with repetition: nr

    Combinations with repetition: (n + r − 1)! ÷ (r! × (n − 1)!)

    The first formula is less daunting than it looks. Dividing n! by (n − r)! cancels everything except the first r factors, so nPr is just n × (n − 1) × … counted down r times. The second formula divides that by r!, the number of orders in which the same r items could have been picked, because a combination treats all those orders as one. Without repetition r cannot exceed n; with repetition it can.

    Worked example: choosing 3 from 10

    1. Permutations. There are 10 choices for the first place, 9 for the second and 8 for the third: 10 × 9 × 8 = 720. In factorial form that is 10! ÷ 7!.
    2. Combinations. Any group of three can be arranged in 3! = 3 × 2 × 1 = 6 orders, and the 720 permutations count each group six times. So 10C3 = 720 ÷ 6 = 120.
    3. Permutations with repetition. Each of the three places can be any of the 10 items: 10 × 10 × 10 = 1,000.
    4. Combinations with repetition. (10 + 3 − 1)! ÷ (3! × 9!) is the same as 12C3 = (12 × 11 × 10) ÷ 6 = 220.

    The four cases in everyday terms

    Things worth knowing

    A “combination lock” is really a permutation lock

    The code 1-2-3 will not open a lock set to 3-2-1, so order matters and repeats are allowed. A three-dial lock with digits 0 to 9 has 103 = 1,000 codes. Everyday language uses “combination” loosely; the mathematics does not.

    Choosing r is the same as leaving out n − r

    Picking 3 people from 10 to be on a team is the same decision as picking the 7 who are not, so 10C3 = 10C7 = 120. This symmetry is a useful check, and it means nCr is largest when r is as close as possible to half of n.

    The numbers grow faster than intuition suggests

    20! is 2,432,902,008,176,640,000, already too large for an ordinary calculator to show exactly. The number of ways to order a full pack of cards, 52!, has 68 digits and is about 8.07 × 1067. Splitting 100 people into two equal teams by choosing 50 gives 100C50 = 100,891,344,545,564,193,334,812,497,256 selections. This calculator uses whole-number arithmetic of unlimited length, so every digit shown is exact; where the answer is too long for the headline it is shown in scientific notation with the full number underneath.

    Special cases

    Choosing nothing can be done in exactly one way, so nP0 = nC0 = 1. Choosing everything gives nCn = 1 but nPn = n!. Asking for more items than exist without repetition is impossible, and the answer is 0.

    These counts assume the n items are all different

    Arranging the letters of a word with repeated letters, such as LEVEL, needs a further division by the factorial of each repeat count: 5! ÷ (2! × 2!) = 30 arrangements, not 120.