Combination & Permutation Calculator

Calculate nCr (combinations) and nPr (permutations) with step-by-step formula.

Combinations & Permutations

Combinations (nCr)
--
Permutations (nPr)
--
Step-by-Step
--

What are Combinations and Permutations?

Permutations (nPr) count the number of ways to arrange r items from a set of n items where order matters. For example, the order of runners finishing a race or the sequence of digits in a code creates different permutations even if the same elements are used.

Combinations (nCr) count the number of ways to select r items from a set of n items where order does not matter. For example, choosing a committee or selecting cards from a deck focuses on which items are selected, not the sequence.

The key distinction is simple: arrangements (order matters) use permutations; selections (order doesn't matter) use combinations. Combinations are always less than or equal to permutations for the same n and r (when r > 1), because each combination corresponds to r! different permutations.

Both nPr and nCr are built from factorials. The formulas are: nPr = n! / (n − r)! and nCr = n! / (r! × (n − r)!). These formulas assume that items are distinct and that each item can be used only once (without replacement).

Key Properties

  • Order matters — nPr counts ordered arrangements; nCr counts unordered subsets.
  • Factorial-based — Both formulas derive from the multiplication principle and factorials.
  • Constraint — r ≤ n is required when selecting without replacement.
  • Symmetry — nCr(n,r) = nCr(n, n-r) in many cases.
  • Boundary values — nC0 = nCn = 1, nP0 = 1, nPn = n!.
  • Growth — Values grow quickly; large n require big number arithmetic.

How to Use

  1. Enter n — Total number of distinct items in the set (n ≥ r, non-negative integers).
  2. Enter r — Number of items to choose or arrange (0 ≤ r ≤ n).
  3. Check constraints — Ensure r is not greater than n; if r > n, results are 0.
  4. Calculate — View nCr (combinations) and nPr (permutations) with step-by-step formula.
  5. Interpret results — Use nCr for selections, nPr for arrangements. Review the formula steps.

Formulas and Quick Reference

Concept Formula Example Explanation
Permutation (nPr)n! / (n−r)!10P3 = 720Arrangements; order matters
Combination (nCr)n! / (r! × (n−r)!)10C3 = 120Selections; order doesn't matter
nP0, nC015C0 = 1Choosing nothing
nPnn!3P3 = 6Arrange all items
nCn15C5 = 1Choose all items
SymmetrynCr = nC(n−r)10C3 = 10C7Choose 3 or exclude 7
RelationnPr = nCr × r!720 = 120 × 6Order the selected items

Worked Examples

  • Arranging books (permutation) — Arrange 3 books from 10 on a shelf: 10P3 = 10×9×8 = 720.
  • Selecting a team (combination) — Choose 3 members from 10: 10C3 = 120 (order of selection doesn't matter).
  • Passwords/code sequences — 4 distinct digits in order from 0-9: 10P4 = 5040.
  • Poker hands — 5 cards from 52: 52C5 = 2,598,960.
  • Committee with roles — President, VP, Secretary from 20 people: 20P3 = 6,840 (roles make order matter).
  • Lottery — Pick 6 numbers from 49: 49C6 = 13,983,816.

Tips and Common Mistakes

  • Ask: does order matter? — If yes, use permutation (nPr). If no, use combination (nCr). This is the most important distinction.
  • r ≤ n required — You cannot choose or arrange more distinct items than exist. If r > n, result is 0.
  • Without replacement — These formulas assume each item is used only once (sampling without replacement).
  • Items must be distinct — If items are identical, different formulas apply.
  • nPr is always ≥ nCr — For r > 1, nPr = nCr × r! ≥ nCr.
  • Watch for repetition — These are permutations/combinations without repetition. With repetition, formulas differ.

Common Use Cases

Combinatorics is essential for counting possibilities in probability, statistics, and everyday scenarios:

  1. Probability & statistics — Calculate sample spaces, combinations for hypergeometric distributions, and event probabilities.
  2. Games & gambling — Compute odds for lotteries, poker hands, card games, and sports brackets.
  3. Cryptography — Estimate keyspaces and number of possible codes or passwords.
  4. Scheduling — Count possible arrangements of meetings, teams, or tournament seeding.
  5. Operations research — Count combinations for resource allocation and experimental design.
  6. Quality control — Determine sample combinations for inspection plans.

Frequently Asked Questions

What is the difference between nCr and nPr?

nCr (combinations) counts selections where order does not matter. nPr (permutations) counts arrangements where order matters. nPr is always larger than nCr for the same n and r (when r > 1), since each combination can be arranged in r! ways.

What happens when r > n?

When r is larger than n, both nCr and nPr are 0 because you cannot choose or arrange more distinct items than are available.

What is the maximum value for n?

This calculator supports values up to n=170. Beyond that, factorial results exceed JavaScript's maximum safe integer (Number.MAX_SAFE_INTEGER), so exact values cannot be represented as numbers.

What do nC0 and nCn mean?

nC0 = 1 (choose nothing) and nCn = 1 (choose all). Similarly, nP0 = 1 and nPn = n! (arrange all).

What is the symmetry property of combinations?

nCr = nC(n-r). Choosing r items from n is the same as choosing which (n-r) to exclude. For example, 10C3 = 10C7.

Are permutations and combinations with or without repetition?

These formulas (nPr = n!/(n-r)!, nCr = n!/(r!(n-r)!)) are for permutations and combinations without repetition (each item used only once). With repetition, the formulas are different.

When should I use permutations vs combinations?

Use permutations when order matters (e.g., race positions, lock codes, sequences). Use combinations when order doesn't matter (e.g., committees, lottery numbers, hand of cards).

Can n or r be negative?

No. n and r must be non-negative integers. If r > n, the result is 0.