How to use the permutation and combination calculator
- Choose a mode. “Choose r from n” covers line-ups, committees, hands of cards and similar selections. “Arrange letters” counts the different orderings of a word.
- Enter n and r. n is the number of items available and r is how many you pick. Both must be whole numbers with r no larger than n (up to 1,000).
- Read both answers. The large figure is the combination count C(n, r). The cards show the permutation count P(n, r), the count with repetition allowed, the ratio between P and C, and the number of subsets of any size.
The calculator opens on 12 choose 9. There are 220 groups of 9 from 12, and 79,833,600 ordered line-ups, the value worked in OpenStax’s Precalculus 2e, section 11.5.
Does order matter?
That one question decides which count you need.
- Permutation: order matters. Awarding gold, silver and bronze to 3 of 10 runners, assigning a batting order, or setting a 4-digit lock code. Ann–Bo–Cy and Cy–Bo–Ann are different results.
- Combination: order doesn’t matter. Picking 3 of 10 people for a committee, choosing pizza toppings, or the cards in a hand. Ann, Bo and Cy are the same committee in any order.
A quick test: if swapping two of the chosen items gives a different outcome, use permutations. If it gives the same outcome, use combinations.
The formulas
Both formulas use the factorial, n! = n × (n − 1) × … × 2 × 1, with 0! = 1.
The permutation formula comes from the multiplication principle: there are n choices for the first position, n − 1 for the second, and so on for r positions. For 3 of 10 runners: 10 × 9 × 8 = 720 podium finishes.
Each group of r items can be ordered in r! ways, so dividing by r! removes the duplicates: C(10, 3) = 720 ÷ 3! = 720 ÷ 6 = 120 committees. That is why the “P ÷ C” card shows r!.
Combinations are symmetric. Choosing which 2 of 5 to take is the same as choosing which 3 to leave, so C(5, 2) = C(5, 3) = 10, as the precalculus text points out.
Worked examples
| Question | Count | Answer |
|---|---|---|
| Line up 9 of 12 people | P(12, 9) | 79,833,600 |
| Pick 9 of 12 for a team | C(12, 9) | 220 |
| Two-card starting hands from a 52-card deck | C(52, 2) | 1,326 |
| Five-card hands | C(52, 5) | 2,598,960 |
| 4-digit codes, digits may repeat | 10⁴ | 10,000 |
| Baked potato with any of 4 toppings | 2⁴ | 16 |
Repeats allowed and subsets
With repetition. When an item can be used again, such as digits in a PIN or letters in a license plate, each of the r positions has all n choices. The multiplication rule, as set out in OpenStax’s Contemporary Mathematics section 7.1, gives n × n × … × n = nʳ. A 4-digit code has 10⁴ = 10,000 possibilities, compared with P(10, 4) = 5,040 when no digit may repeat.
All subsets. If you may choose any number of the n items, including none or all, each item is either in or out, giving 2ⁿ choices. The precalculus text’s example is a baked potato with butter, cheese, chives and sour cream available: 2⁴ = 16 ways to order it, counting a plain potato. That total is also the sum of C(4, 0) through C(4, 4): 1 + 4 + 6 + 4 + 1.
Arranging letters with repeats
A word with n letters, all different, can be arranged in n! ways. Repeated letters create duplicates, because swapping two identical letters doesn’t change the word. Divide by the factorial of each repeated letter’s count:
The precalculus text works two examples. DISTINCT has 8 letters with I and T each appearing twice: 8! ÷ (2! × 2!) = 40,320 ÷ 4 = 10,080. CARRIER has 7 letters with R three times: 7! ÷ 3! = 5,040 ÷ 6 = 840. Try MISSISSIPPI too: 11 letters with four I’s, four S’s and two P’s give 34,650 arrangements.
The same formula counts arrangements of any objects with identical copies, such as flags on a pole or colored beads in a row.
Very large counts
Factorials grow fast: 20! is already more than 2 quintillion. The calculator works with exact whole numbers rather than floating-point approximations, so results like C(100, 50) show every digit. Long results are shown with digit grouping and a scientific-notation summary. Inputs are limited to 1,000 so the page stays responsive.
Using counts for probability
When every selection is equally likely, a probability is a ratio of counts: favorable selections divided by all selections. Suppose a committee of 3 is drawn at random from 10 people. What is the chance that Ann is on it? Committees that include Ann need 2 more members from the other 9, so there are C(9, 2) = 36 of them, out of C(10, 3) = 120 in all. The probability is 36 ÷ 120 = 0.3.
The probability calculator handles the next step, such as combining events or finding the chance of at least one success.
Common counting mistakes
- Using permutations for a group. If the chosen items have no roles or positions, the order is irrelevant and the permutation count is too large by a factor of r!.
- Forgetting repeats. PINs, passwords and license plates allow repeated characters, so they use nʳ, not P(n, r).
- Adding instead of multiplying. Choosing a shirt from 5 and pants from 4 gives 5 × 4 = 20 outfits, not 9.
- Double-counting identical items. Arranging letters or objects with copies needs the division by each repeat’s factorial.
Combinations and Pascal’s triangle
The combination counts for a fixed n form a row of Pascal’s triangle. For n = 4 the row is 1, 4, 6, 4, 1: one way to choose none, four ways to choose one, six to choose two, and so on. Each entry is the sum of the two above it, which matches the identity C(n, r) = C(n − 1, r − 1) + C(n − 1, r). The row adds up to 2ⁿ, the subset count on the cards, and it is symmetric for the same reason C(5, 2) equals C(5, 3).
Sources & assumptions
How this calculator gets its numbers. Full method: our methodology.
- P(n, r) = n! ÷ (n − r)!, C(n, r) = n! ÷ (r!(n − r)!), ordered selections with repetition = nʳ, subsets = 2ⁿ.
- Arrangements of a word divide n! by the factorial of each repeated letter’s count; letters are case-insensitive and spaces are ignored.
- All counts are exact integers; n and r up to 1,000.
Sources
- OpenStax, Rice University, Precalculus 2e, 11.5 Counting Principles. Factorials and the permutation and combination formulas, with 6!/3! = 120 and P(12, 9) in Example 4.
- OpenStax (Rice University), Contemporary Mathematics, 7.3 Combinations. The combination formula with card-game examples (Example 7.10: two-card Texas Hold’em hands).
- OpenStax (Rice University), Contemporary Mathematics, 7.1 The Multiplication Rule for Counting. Multiplying the number of choices at each stage, which gives nʳ ordered selections when repeats are allowed.
Last reviewed . Results with more than 15 digits are shown in scientific notation, with the exact value below.
Frequently asked questions
What is the difference between a permutation and a combination?
Order matters in a permutation and doesn’t in a combination. Choosing a president and vice president is a permutation; choosing two committee members is a combination.
How do I calculate combinations?
C(n, r) = n! ÷ (r!(n − r)!). For 3 of 10: 10! ÷ (3! × 7!) = 120.
How do I calculate permutations?
P(n, r) = n! ÷ (n − r)!, or multiply n × (n − 1) × … for r terms. For 3 of 10: 10 × 9 × 8 = 720.
How many 5-card hands are there?
C(52, 5) = 2,598,960, since the order in which the cards are dealt doesn’t change the hand.
What is 0 factorial?
0! = 1 by definition. It makes the formulas work at the edges, for example C(n, 0) = C(n, n) = 1.
How many ways can I arrange the letters of a word?
Divide the factorial of the letter count by the factorial of each repeated letter’s count. DISTINCT gives 8! ÷ (2! × 2!) = 10,080.