nCr = n! / (r! × (n−r)!) | nPr = n! / (n−r)!Combinations (nCr) count the number of ways to choose r items from n without regard to order. Permutations (nPr) count the number of ways to arrange r items from n where order matters. The difference is the r! term in the denominator of combinations, which divides out the orderings of the selected items.
Enter n total items and r to choose or arrange. Get combinations nCr and permutations nPr with all factorial values.
Enter the total number of items (n) and the number to choose or arrange (r) to get combinations nCr and permutations nPr. Displays all factorial values used in the calculation. Covers lotteries, passwords, committee selection, and arrangement problems.
Combinations and permutations count the number of ways to select or arrange items from a group. The critical distinction is whether order matters. Choosing a committee of 3 from 10 people: order does not matter, so use combinations. Arranging 3 books in order on a shelf from a set of 10: order matters, so use permutations. Combinations (nCr) are also called binomial coefficients and appear in Pascal's triangle, probability theory, and the binomial theorem. Permutations (nPr) count ordered arrangements and are used in password counting, race outcomes, and scheduling. Both use factorial notation. n! means the product of all integers from 1 to n. The calculator computes these iteratively to handle n up to 170 before JavaScript floating-point overflow.
You came here because
Common situations
- Lottery odds: A lottery requires picking 6 numbers from 49. The number of possible tickets is C(49,6) = 13,983,816. Probability of winning = 1 / 13,983,816.
- Committee selection: How many ways can a 5-person committee be chosen from 20 candidates? C(20,5) = 15,504 possible committees.
- Password counting: A 4-digit PIN from digits 0-9 without repetition has P(10,4) = 5,040 possible combinations (order matters, no repeats).
- Tournament brackets: How many ways can 3 medals be awarded to 8 competitors? P(8,3) = 336 possible gold-silver-bronze outcomes.
Under the hood
How the calculation works
- 1Enter n (the total number of items to choose from) and r (the number being chosen or arranged).
- 2The calculator validates that both are non-negative integers and that r does not exceed n.
- 3It computes n!, r!, and (n−r)! iteratively to avoid recursion overhead.
- 4nCr = n! / (r! × (n−r)!) counts unordered selections.
- 5nPr = n! / (n−r)! counts ordered arrangements.
- 6All factorial values are shown in the secondary results.
Show me
A real example
Example: Choose 3 from 10 (C(10,3) and P(10,3))
- 1n = 10, r = 3
- 2n! = 10! = 3,628,800
- 3r! = 3! = 6
- 4(n−r)! = 7! = 5,040
- 5nCr = 3,628,800 / (6 × 5,040) = 3,628,800 / 30,240 = 120
- 6nPr = 3,628,800 / 5,040 = 720
Watch out for
What can go wrong
- Confusing order matters vs. order does not matter: The most common error. Picking a winning lottery ticket (unordered) uses combinations. Placing 1st through 3rd in a race (ordered) uses permutations. Ask: does swapping the selection change the outcome?
- Entering non-integer values: Factorials are only defined for non-negative integers. Entering n=5.5 or r=2.3 is invalid. The calculator returns an error for non-integer inputs.
- Setting r greater than n: You cannot choose more items than are available. C(5,7) is undefined because r > n. The calculator flags this as an error.
- Overflow for large factorials: 170! is the largest exact factorial JavaScript can represent. For n > 170, the result overflows to Infinity. Use logarithms of factorials for very large combinatorial problems.
Glossary
Related concepts
| Term | Definition |
|---|---|
| Factorial (n!) | The product of all positive integers up to n. 5! = 5 × 4 × 3 × 2 × 1 = 120. By definition, 0! = 1. Factorials grow extremely fast: 20! is about 2.4 × 10^18. |
| Binomial coefficient | Another name for combinations. Written as C(n,r) or "n choose r". They form Pascal's triangle and appear in the binomial theorem: (a+b)^n = sum of C(n,k)×a^k×b^(n−k). |
| Sampling with/without replacement | |
| Multinomial coefficient | Generalizes binomial coefficients to dividing n items into multiple groups. C(n; k1, k2, ...) = n! / (k1! × k2! × ...). Relevant for distributions into more than two categories. |
Make it better
Pro tips
- Use C(n,r) = C(n, n−r) to simplify computation: C(100, 97) = C(100, 3) = 161,700. When r is close to n, compute with the smaller of r and n−r to reduce the number of multiplications.
- Verify with Pascal's triangle for small values: Pascal's triangle gives C(n,r) directly. Row n, position r (starting at 0). Row 5: 1, 5, 10, 10, 5, 1. So C(5,2) = 10. Use this to spot-check the calculator for small inputs.
- nPr = nCr × r!: Permutations equal combinations times r factorial. Every combination can be arranged in r! ways. This relationship is worth memorizing as a quick sanity check.
- For very large n, use Stirling's approximation: When n exceeds 170, switch to logarithmic methods: ln(n!) ≈ n×ln(n) − n + 0.5×ln(2πn). This gives log-probabilities without overflow.
Common questions
Frequently asked questions
For related calculations, try the Probability Calculator, Percentage Calculator, or Average Calculator. Browse all Calculator Online calculators for the full catalog.
Methodology
This calculator uses the standard combinations calculator formula. Results match those from established financial, scientific, and health references.
Reviewed by
Calculator Online Editorial Team. All formulas verified against authoritative sources before publication.
Last updated
2026-05-24
Sources & References
- Weisstein, Eric W., Combination (MathWorld)
Mathematical definition, formulas, and properties of combinations and binomial coefficients.
- Weisstein, Eric W., Permutation (MathWorld)
Mathematical definition and formulas for permutations.
- NIST Digital Library of Mathematical Functions, Combinatorics
Authoritative reference for combinatorial functions including binomial coefficients and factorials.