Permutation and Combination Calculator

The Permutation and Combination Calculator solves two fundamental problems in combinatorics: how many ways can you arrange or select items from a set? Permutations count ordered arrangements (the order matters), while combinations count unordered selections (order doesn't matter). This calculator handles both cases, with and without repetition, showing every step of the factorial calculation so you can understand the math behind the answer.

star 4.9
auto_awesome AI
New

nPr & nCr Calculator calculator

calculate Inputs

Total items in the set (max 170)

Quick Examples

analytics Results

Without Repetition

Permutations nPr Order matters
Combinations nCr Order doesn't matter

Step-by-Step

lightbulb Tips

  • Order matters → Permutation (nPr)
  • Order doesn't matter → Combination (nCr)
  • C(n,r) = C(n, n−r) — symmetric property
  • nCr ≤ nPr always (for same n, r)

functions Formulas

Without Repetition
nPr n! / (n−r)!
nCr n! / (r!×(n−r)!)
With Repetition
nPr (rep)
nCr (rep) C(n+r−1, r)
Common Examples
Lottery C(49,6) 13,983,816
Cards C(52,5) 2,598,960
4-digit PIN (rep) 10,000

The Formula

Permutations (nPr) count ordered arrangements. Combinations (nCr) count unordered selections. With repetition: nPr = nʳ, nCr = (n+r−1)! / (r!(n−1)!)

nPr = n! / (n−r)! | nCr = n! / (r! × (n−r)!)

lightbulb Variables Explained

tips_and_updates Pro Tips

1

Use permutation when order matters (e.g., first/second/third place finishes)

2

Use combination when order doesn't matter (e.g., selecting a team)

3

nCr is always ≤ nPr for the same n and r

4

C(n,r) = C(n, n−r) — choosing 3 from 10 = choosing 7 from 10

5

For repetition allowed: arranging r items from n gives nʳ permutations

Permutations and combinations are fundamental counting techniques in probability and statistics that determine the number of ways to select and arrange items from a set. The key distinction is order: permutations count arrangements where order matters (ABC ≠ BCA), while combinations count selections where order does not matter (ABC = BCA). The formulas — P(n,r) = n!/(n-r)! for permutations and C(n,r) = n!/[r!(n-r)!] for combinations — answer questions from lottery odds and password security to team selection and experimental design. From a group of 10 people, there are P(10,3) = 720 ways to assign president, VP, and secretary (order matters), but only C(10,3) = 120 ways to select a 3-person committee (order doesn't matter). Our permutation and combination calculator computes both values for any n and r, handles large factorials precisely, shows step-by-step solutions, and supports repetition variants for scenarios where items can be reused.

When to use permutations vs combinations

Use permutations when the order or arrangement of selected items matters:

  • assigning ranked positions (1st, 2nd, 3rd place)
  • arranging books on a shelf
  • creating passwords or PIN codes
  • seating arrangements
  • phone numbers

Use combinations when you are simply choosing a subset and order is irrelevant:

  • selecting team members
  • choosing lottery numbers
  • picking menu items
  • forming committees

A helpful test: if swapping two selected items creates a different outcome, use permutations; if the swap doesn't matter, use combinations.

Lottery numbers illustrate this perfectly — the Mega Millions drawing selects 5 numbers from 70 plus 1 from 25: C(70,5) × 25 = 302,575,350 possible tickets. If order mattered, there would be P(70,5) × 25 = 36,309,042,000 possibilities — 120 times more.

Formulas and calculation techniques

Basic permutations: P(n,r) = n!/(n-r)!. P(10,3) = 10!/7! = 10×9×8 = 720.

Basic combinations: C(n,r) = n!/[r!(n-r)!]. C(10,3) = 10!/(3!×7!) = 720/6 = 120.

With repetition allowed: permutations = n^r (e.g., a 4-digit PIN from digits 0-9 has 10⁴ = 10,000 possibilities).

Combinations with repetition: C(n+r-1, r) — choosing 3 scoops from 5 ice cream flavors with repeats allowed gives C(7,3) = 35.

For large values, use the multiplicative formula to avoid computing huge factorials: C(52,5) = (52×51×50×49×48)/(5×4×3×2×1) = 2,598,960 — the number of possible 5-card poker hands.

Real-world applications and probability

Password security: an 8-character password using uppercase, lowercase, digits, and 10 symbols (72 characters) has 72⁸ = 722 trillion permutations with repetition — taking a brute-force attack approximately 22,800 years at 1 billion attempts per second. Adding just 2 more characters (10-character password) increases this to 3.7 quadrillion — 5,140 times harder to crack.

  • In genetics, the number of ways to choose 23 chromosome pairs from a parent's 46 chromosomes is C(46,23) ≈ 8.2 billion, explaining genetic diversity.
  • In quality control, selecting 5 items from a batch of 100 for testing involves C(100,5) = 75,287,520 possible samples.
  • In tournament brackets, the number of possible NCAA March Madness brackets is 2⁶³ ≈ 9.2 quintillion — which is why no one has ever correctly predicted a perfect bracket.

What Is the Difference Between a Permutation and a Combination?

A permutation is an ordered arrangement of items, while a combination is an unordered selection — that single distinction, order, is the whole story.

If you pick the letters A, B, and C, the arrangements ABC and CAB are two different permutations but the same combination, because a combination only cares which items were chosen, not their sequence. As Encyclopaedia Britannica explains, combinatorics is the branch of mathematics devoted to counting such arrangements and selections.

A quick test: ask whether swapping two chosen items changes the outcome. Ranking gold, silver, and bronze medalists changes if you swap two runners, so order matters and you use permutations. Choosing three pizza toppings does not change if you swap them, so you use combinations.

How Do You Calculate nPr and nCr Using the Factorial Formula?

The permutation formula is nPr = n! / (n − r)! and the combination formula is nCr = n! / [r! × (n − r)!], where n! (n factorial) is the product of every integer from 1 up to n.

To find P(10,3), compute 10! / 7!, which simplifies to 10 × 9 × 8 = 720. To find C(10,3), divide that result by 3! = 6, giving 120. The factorial itself grows fast: 5! = 120 and 10! = 3,628,800.

Wolfram MathWorld defines the binomial coefficient C(n,r) precisely this way. Because nCr divides out the r! orderings that permutations count separately, nCr is always less than or equal to nPr for the same n and r.

How to Calculate Combinations Step by Step (Worked Example)

To calculate C(52,5) — the number of five-card poker hands — start with the multiplicative form rather than full factorials to keep the numbers manageable. Write the numerator as the top five descending factors, 52 × 51 × 50 × 49 × 48, and the denominator as 5! = 120. The numerator equals 311,875,200; dividing by 120 gives exactly 2,598,960 possible hands.

For a smaller check, C(5,2) = (5 × 4) / (2 × 1) = 10, and C(8,3) = (8 × 7 × 6) / (3 × 2 × 1) = 56.

Khan Academy teaches this cancellation shortcut because it avoids computing enormous factorials directly. The NIST Digital Library of Mathematical Functions (DLMF) gives the same binomial-coefficient definition used here.

How Do Permutations and Combinations Change With Repetition Allowed?

When repetition is allowed, the formulas change because items can be reused.

  • For permutations with repetition, the count is simply n^r: a 4-digit PIN drawn from digits 0–9 has 10^4 = 10,000 possibilities, since each of the four positions independently has ten choices.
  • For combinations with repetition, the count is C(n + r − 1, r). Choosing 3 scoops from 5 ice-cream flavors when repeats are allowed gives C(5 + 3 − 1, 3) = C(7,3) = 35.

Contrast this with selection without repetition, where each pick reduces the pool by one. Repetition dramatically increases the totals, which is why password strength and PIN security rely on it — every added character multiplies the possibilities.

Where Are Permutations and Combinations Used in Real Life?

Permutations and combinations appear anywhere you count arrangements or selections.

  • Lotteries use combinations: choosing 6 numbers from 49 gives C(49,6) = 13,983,816 possible tickets, which sets the jackpot odds.
  • Card games rely on them too — there are 2,598,960 possible five-card poker hands from a 52-card deck.
  • Cybersecurity uses permutations with repetition to measure how many passwords or keys are possible, directly driving brute-force resistance.
  • Statistics and probability use the binomial coefficient C(n,r) inside the binomial distribution and Pascal's triangle.
  • Scheduling, tournament seeding, DNA sequence analysis, and quality-control sampling all depend on these counts.

Encyclopaedia Britannica notes that combinatorial counting underpins probability theory, which is why this calculator pairs naturally with probability and statistics tools.

Common Mistakes When Calculating Permutations and Combinations

  • The most frequent error is choosing the wrong tool: using a permutation when order does not matter inflates the answer by a factor of r!, because nPr counts each unordered group r! separate times. For example, treating a 3-person committee from 10 people as ordered gives P(10,3) = 720 instead of the correct C(10,3) = 120.
  • A second mistake is forgetting whether repetition is allowed — a PIN reuses digits (n^r), but a lottery does not.
  • A third is confusing n and r, since the formulas are not symmetric in them.
  • Finally, avoid computing giant factorials fully and then dividing; use the cancellation method so intermediate values stay small and you sidestep overflow or rounding errors.

How Do Permutations Grow Compared to Combinations for the Same n and r?

For any fixed n and r, permutations always meet or exceed combinations because nPr = nCr × r!, the extra factor accounting for every ordering of the chosen items.

When r = 1 they are equal, since a single item has only one arrangement: P(20,1) = C(20,1) = 20. As r grows, the gap widens quickly. With n = 10 and r = 3, P(10,3) = 720 but C(10,3) = 120 — the permutation count is exactly 3! = 6 times larger. Choosing all items, P(5,5) = 5! = 120 while C(5,5) = 1.

This is why ranked outcomes explode in count faster than unordered selections, and why lotteries (combinations) have far better odds than they would if drawing order counted. Understanding this ratio helps you sanity-check any result the calculator returns.

Frequently Asked Questions

sell

Tags