Combinations & Permutations Calculator
Compute combinations (nCr), permutations (nPr) and factorials (n!) — the three core counting tools — with each formula and computation shown.
Calculator
- nCr, nPr, factorial
- Integer validation
- Overflow handling
- Identity check
Result & calculation receipt
- Method
- Combinations — order does not matter
- Formula
C(n, r) = n! / ( r! (n − r)! )- Substitution
- C(5, 2) = 5! / (2! · 3!) = 10
- Steps
- Order is ignored, so divide the permutations by r! to remove duplicates.
- C(5, 2) = 10.
- Verification
- C(n,r) = C(n,n−r): C(5,2) = 10 and C(5,3) = 10. ✓
- Exact result
- 10
- Decimal result
- 10
- Engine
- math-solvers v1.4.0
How this calculator works
A combination counts how many ways to choose r items from n when order does not matter, C(n, r) = n! ÷ (r!(n−r)!). A permutation counts arrangements when order matters, P(n, r) = n! ÷ (n−r)!. The calculator evaluates these multiplicatively to avoid huge intermediate factorials, validates that n and r are non-negative integers with r ≤ n, and returns an overflow error rather than an inexact number when the count is too large.
Worked example
Choosing 2 people from 5 for a committee is C(5, 2) = 10, because order does not matter. Arranging 2 of 5 books on a shelf is P(5, 2) = 20, because order does. A five-card poker hand is C(52, 5) = 2,598,960. The check uses identities such as C(n, r) = C(n, n−r) and P(n, r) = C(n, r) × r!.
Key insight
The single question that picks the right tool is "does order matter?". If it does, use permutations; if not, use combinations. Both are built from the factorial, which counts the arrangements of a whole set.
Frequently asked questions
What is the difference between a combination and a permutation?
A combination counts selections where order does not matter (choosing a committee); a permutation counts arrangements where order matters (ranking finishers). For the same n and r, permutations are always at least as many as combinations.
What is nCr?
nCr, "n choose r", is the number of ways to choose r items from n without regard to order: C(n, r) = n! ÷ (r!(n−r)!). For example C(5, 2) = 10.
What is a factorial?
n! is the product of all positive integers up to n: 5! = 5 × 4 × 3 × 2 × 1 = 120. By definition 0! = 1. Factorials count the arrangements of a full set.
Why do very large inputs return an error?
Factorials and counts grow explosively. Beyond the safe integer range (and 170! overflows double precision) the calculator returns an overflow error instead of an inaccurate value.
Why must r be at most n?
You cannot choose or arrange more items than you have, so r must satisfy 0 ≤ r ≤ n. Values outside that range return an error.
Methodology & verification
Combinations use C(n, r) = n!/(r!(n−r)!), permutations use P(n, r) = n!/(n−r)!, and factorials the product 1·2·…·n (0! = 1), all evaluated multiplicatively to avoid oversized intermediates. Inputs are validated as non-negative integers with 0 ≤ r ≤ n; violations return structured errors, and results beyond the safe integer range (or 170!) return an overflow error. Results are verified with identities such as C(n, r) = C(n, n−r) and P(n, r) = C(n, r)·r!.
Engine: math-solvers v1.4.0 · Last reviewed: · Every result is computed client-side and never sent to a server. See the verification methodology and the scientific calculator validation.