Calcady
Home / Scientific / Permutations & Combinations Engine

Permutations & Combinations Engine

Calculate nPr (permutations) and nCr (combinations) with exact BigInt results. Understand when order matters vs. when it doesn't in counting problems.

nPr & nCr

10! = 3,628,800

3! = 6

P= Order mattersHow many ways to arrange r items?
C= Order doesn't matterHow many ways to choose r items?

Permutations (nPr)

720

order matters

Combinations (nCr)

120

order doesn't matter

nPr / nCr ratio6 (= r!)
Email LinkText/SMSWhatsApp

Permutations & Combinations

Permutations and combinations count the number of ways to select items from a set. The key difference: order matters for permutations, not for combinations.

Formulas

  • Permutation: nPr = n! / (n−r)! — order matters
  • Combination: nCr = n! / (r!(n−r)!) — order doesn't matter
  • nPr = nCr × r! (permutations = combinations × arrangements)

Examples

  • Permutation: Arranging 3 books on a shelf from 10 books
  • Combination: Choosing 3 people for a committee from 10
  • Lottery: Choosing 6 numbers from 49 (combination = 13,983,816)
  • PIN codes: 4-digit PIN from 10 digits (permutation with repetition)

Quick Test 💡

Ask yourself: "Does the order of selection change the outcome?" If picking a president, VP, and treasurer — order matters (permutation). If picking a 3-person team — it doesn't (combination).

Quick Answer: How does the Permutations & Combinations Calculator work?

Enter n (total items) and r (items to choose). The calculator computes both nPr (ordered arrangements) and nCr (unordered selections) using exact BigInt arithmetic — no floating-point rounding errors even for extremely large values.

Mathematical Formulas

nPr = n! / (n-r)! | nCr = n! / (r!(n-r)!)

Where n! is n-factorial (n × (n-1) × … × 1), nPr counts ordered arrangements, and nCr counts unordered selections.

Permutation vs Combination (Quick Reference)

The single question that determines which formula to use.

Scenario Order? Formula Example (n=5, r=3)
Race podium (1st, 2nd, 3rd)YesnPr60
Committee selectionNonCr10
Password charactersYesnPr60
Lottery numbers drawnNonCr10

Real-World Use Cases

Lottery Probability

A lottery draws 6 balls from 49. Since the order of the drawn numbers doesn't matter, the total possible outcomes are C(49, 6) = 13,983,816. Your chance of winning the jackpot with one ticket is 1 in 13,983,816 — roughly 0.0000072%.

Cybersecurity: Password Strength

Password entropy is a permutation problem. An 8-character password using 95 printable ASCII characters has P(95, 8) with replacement = 95⁸ = 6.63 × 10¹⁵ possible combinations. At 1 billion guesses/second, brute-force takes ~77 days. Adding just 4 more characters makes it 10⁸ times harder.

Combinatorics Best Practices (Pro Tips)

Do This

  • Ask: "Does rearranging change the outcome?" If swapping two items creates a meaningfully different result (like a different password or a different race finish), use permutations. If swapping creates the same group (like a committee), use combinations.

Avoid This

  • Don't confuse "with replacement" and "without replacement." Standard nPr/nCr assume each item is used at most once (without replacement). If repetition is allowed (like repeated digits in a PIN), use n^r for permutations or the multiset coefficient for combinations.

Frequently Asked Questions

When should I use permutations vs combinations?

Use permutations when the arrangement order creates a different outcome (passwords, race results, seating charts). Use combinations when the group is the same regardless of order (lottery draws, committee selection, choosing toppings for a pizza).

Why does the calculator use BigInt?

Standard JavaScript numbers lose precision beyond 2⁵³ (about 9 quadrillion). Factorials grow so fast that 21! already exceeds this limit. BigInt provides exact integer arithmetic with unlimited precision, ensuring your combinatorics results are perfectly accurate even for large inputs.

What is the relationship between C(n,r) and Pascal's Triangle?

Each entry in Pascal's Triangle IS the value of C(n, r) — where n is the row number and r is the position in that row. The triangle's structure emerges from Pascal's identity: C(n, r) = C(n-1, r-1) + C(n-1, r). It also gives the coefficients in binomial expansions like (a+b)ⁿ.

Why is 0! equal to 1?

By convention and mathematical necessity. There is exactly one way to arrange zero items: do nothing. This also makes the combination formula consistent: C(n, 0) = n! / (0! × n!) = 1 — there is exactly one way to choose nothing from any set (the empty selection).

Related Math Calculators