Permutation & Combination Calculator
Calculate nPr (permutations) and nCr (combinations) with step-by-step factorial breakdowns. Everything runs in your browser — nothing is stored or sent to any server.
Understanding Permutations and Combinations
Permutations and combinations are fundamental counting techniques in mathematics used to determine the number of possible arrangements or selections from a set of items. They appear everywhere — from probability and statistics to cryptography, genetics, and game theory.
The key distinction is straightforward: permutations care about order, while combinations do not. Choosing Alice, Bob, and Carol for president, vice-president, and treasurer is a permutation problem (ABC differs from BAC). Choosing 3 people for a committee is a combination problem (the same group regardless of order).
Formulas
Permutation: nPr = n! / (n - r)!
Combination: nCr = n! / [r! × (n - r)!]
Where:
- n = total number of items
- r = number of items chosen
- n! = n factorial = n × (n-1) × (n-2) × ... × 1
Real-World Examples
- Lottery numbers: Picking 6 numbers from 49 is a combination problem — order does not matter. C(49,6) = 13,983,816 possible tickets.
- Team selection: Choosing 5 starters from 12 basketball players is C(12,5) = 792 possible lineups.
- Passwords: Arranging 4 digits from 0-9 without repetition is P(10,4) = 5,040 passwords.
- Race rankings: Gold, silver, bronze from 8 runners is P(8,3) = 336 possible podiums.
Permutation vs Combination: Quick Rule
Ask yourself: "Does the order in which I pick items change the outcome?" If yes, use permutations. If no, use combinations. For instance, a PIN code 1234 is different from 4321 (permutation), but a hand of cards {A, K, Q} is the same regardless of draw order (combination).
Factorials Explained
A factorial (written as n!) is the product of all positive integers from 1 to n. For example, 5! = 5 × 4 × 3 × 2 × 1 = 120. By convention, 0! = 1. Factorials grow extremely fast — 20! is already over 2.4 quintillion. This calculator handles values up to n = 170 before JavaScript number precision limits are reached.
Applications
Combinatorics underpins probability theory, statistical sampling, algorithm design (sorting, hashing), error-correcting codes, DNA sequencing, and tournament scheduling. Understanding permutations and combinations is essential for standardised tests like the GRE, GMAT, SAT, and competitive programming contests.