Permutation & Combination Calculator
Enter n (total items) and r (items chosen) to calculate nPr and nCr side by side, with the factorial formulas worked through using your numbers — and a plain-English explanation of when order matters.
nPr and nCr
Permutations — order matters (10P3)
720
10P3 = 10! ÷ (10 − 3)! = 10! ÷ 7!
10! ÷ 7! cancels down to the product of the top 3 factors:
10 × 9 × 8 = 720
Combinations — order ignored (10C3)
120
10C3 = 10! ÷ (3! × (10 − 3)!) = 10! ÷ (3! × 7!)
10C3 = 10P3 ÷ 3! — divide out the 6 orderings of each selection:
720 ÷ 6 = 120
When does order matter?
Order matters → permutation (nPr). A lock code is the classic example: on a 3-digit lock using the digits 1, 2, and 3, the codes 1-2-3 and 3-2-1 are different — the same three digits in a different order will not open the lock. Race podiums (1st, 2nd, 3rd), passwords, and seating arrangements all work the same way.
Order does not matter → combination (nCr). Pizza toppings are the classic example: a pizza with mushrooms, olives, and peppers is exactly the same pizza as one with peppers, olives, and mushrooms. Committees, lottery number picks, and hands of cards are combinations too.
That is why nCr is never larger than nPr: every unordered selection of r items corresponds to r! different ordered arrangements, so nCr = nPr ÷ r!.
Frequently Asked Questions
- What is the difference between a permutation and a combination?
- A permutation counts ordered arrangements — picking 1st, 2nd, and 3rd place is a permutation. A combination counts unordered selections — choosing 3 people for a committee is a combination. For the same n and r, nPr is always at least as large as nCr.
- What is the formula for nPr?
- nPr = n! ÷ (n − r)!. In practice that is the product n × (n − 1) × … × (n − r + 1), which is exactly how this calculator computes it — no full factorials needed.
- What is the formula for nCr?
- nCr = n! ÷ (r! × (n − r)!). It equals nPr divided by r!, because every unordered selection of r items can be arranged in r! different orders.
- Why is the input limited to n ≤ 170?
- 170! is the largest factorial that fits in a JavaScript floating-point number; 171! overflows to infinity. Within the limit, very large results are shown in scientific notation.
- Is a lock "combination" really a combination?
- No — mathematically it is a permutation, because 1-2-3 and 3-2-1 open different locks. Order matters, so "permutation lock" would be the accurate name.