Combinations Calculator
Calculate combinations and permutations
How It Works
Overview
Combinations and permutations are the two basic counting tools of combinatorics. They answer the question "how many ways can I select or arrange r things from a set of n?" — and they give different answers depending on whether the order of selection matters. Both rest on the factorial function n!, which counts the number of ways to arrange n distinct items in a line.
Use permutations when order matters: race finishes, passwords, seating arrangements. Use combinations when order doesn't matter: lottery picks, poker hands, committee selections. The two are tightly linked — every combination can be arranged in r! different orders, so P(n,r) = C(n,r) × r!. Picking the right one is usually the hardest part of any counting problem.
The Formula
Where:
- n = total number of distinct items available
- r = number of items to select or arrange (0 ≤ r ≤ n)
- n! = factorial = n × (n−1) × (n−2) × ... × 1; by convention 0! = 1
- C(n,r), often written as nCr or (n choose r), counts unordered selections
- P(n,r), often written as nPr, counts ordered arrangements
These formulas assume each item is distinct and you don't repeat selections. If items can repeat, the formulas change: permutations with repetition become n^r, combinations with repetition become C(n + r − 1, r).
Worked Example
Combination — poker hand. How many distinct 5-card hands are possible from a 52-card deck?
- n = 52, r = 5, order doesn't matter
- C(52, 5) = 52! / (5! × 47!) = (52 × 51 × 50 × 49 × 48) / (5 × 4 × 3 × 2 × 1)
- = 311,875,200 / 120 = 2,598,960 hands
Permutation — race finish. How many ways can 8 sprinters finish 1st/2nd/3rd?
- n = 8, r = 3, order matters
- P(8, 3) = 8! / 5! = 8 × 7 × 6 = 336 different podium orders
Factorial — book arrangement. How many ways to arrange 7 distinct books on a shelf?
- 7! = 7 × 6 × 5 × 4 × 3 × 2 × 1 = 5,040 arrangements
Notice the size jumps. For just 10 items chosen 5 at a time, P(10,5) = 30,240 while C(10,5) = 252 — exactly 5! = 120 times smaller, reflecting the orderings folded out.
When to Use This
- Lottery and gambling odds — total tickets, hand counts, and bingo combinations all use C(n, r).
- Password and key-space analysis — permutations with repetition (n^r) estimate brute-force time.
- Tournament brackets and seeding — number of possible bracket fills uses combinations.
- Selecting committees, juries, or teams — anywhere "pick k out of n people" appears, it's a combination.
- Probability problems — many P(event) calculations boil down to a ratio of two combinations.
Common Mistakes to Avoid
- Using permutations when combinations apply (or vice versa). Always ask: does the order matter? If swapping two picks gives the "same" outcome, use combinations.
- Forgetting the constraint r ≤ n. You can't choose 8 items from a set of 5; both formulas are undefined and the calculator returns nothing.
- Treating items as distinct when some are identical. Arranging the letters of MISSISSIPPI is 11! / (4! × 4! × 2!), not 11!.
- Ignoring repetition rules. Drawing with replacement vs without changes the formula completely.
- Overflowing intermediate values. 70! is larger than a JavaScript number can hold; use BigInt or compute the ratio without expanding the full factorials.
Frequently Asked Questions
Ad Space