🎲

Combination & Permutation Calculator

Calculate combinations C(n,r), permutations P(n,r), and factorials n! with step-by-step solutions.

MATHEMATICS

The Combination and Permutation Calculator computes C(n,r), P(n,r), and factorial with solution steps.

Uses BigInt for accurate calculations up to 170!. Includes an interactive Pascal's triangle, real-world examples (ATM PIN, team picks, pizza toppings), and an explanation of when to use combinations vs. permutations.

Loading calculator…

Calculator information

How to use this calculator

  1. Enter the total number of elements n (size of the set) and the number of elements to choose r.
  2. Choose the type: combination C(n,r) if order doesn't matter, or permutation P(n,r) if order matters.
  3. For pure factorial, use 'n!' mode and enter n (0-170 supported with BigInt).
  4. Click Calculate for the result plus a step-by-step solution with factorial expansion and simplification.
  5. Explore the interactive Pascal's triangle to see C(n,r) values laid out visually.
  6. Read real-world examples (ATM PIN, team lineup, pizza toppings) to learn when to use combinations vs. permutations.
  7. Mnemonic tip: 'P needs order, C just selects'; C(n,r) ≤ P(n,r) because order is ignored.

Combinations, Permutations, Factorials

C(n,r) = n! / (r!(n-r)!) ; P(n,r) = n! / (n-r)!
  • n! = n × (n-1) × (n-2) × ... × 2 × 1, with 0! = 1
  • Constraints: 0 ≤ r ≤ n, n and r non-negative integers
  • Property: C(n,r) = C(n,n-r) (symmetry)
  • P(n,r) = r! × C(n,r)
  • Circular permutations: (n-1)! ; permutations with repetition: n^r

For large n, use Stirling's approximation: n! ≈ √(2πn) × (n/e)^n.

Worked example: Pick 3 people from 10 for a team (combination) vs. 1st-2nd-3rd place (permutation)

Given:
  • n = 10, r = 3
Steps:
  1. Permutation (order matters, 1st-2nd-3rd are distinct): P(10,3) = 10!/(10-3)! = 10!/7! = 10 × 9 × 8 = 720.
  2. Combination (order doesn't matter, 3-person team): C(10,3) = 10!/(3!·7!) = 720/6 = 120.
  3. Verification: C(10,3) = P(10,3)/3! = 720/6 = 120 ✓.
  4. Interpretation: 720 distinct podium orderings, but only 120 unique team compositions.

Result: P(10,3) = 720 orderings; C(10,3) = 120 teams. Difference factor: 3! = 6 (orderings per team).

Frequently asked questions

When should I use combinations vs. permutations?
Use PERMUTATIONS when order changes the outcome: ATM PIN (1234 ≠ 4321), race rankings (gold/silver/bronze), seating arrangements, passwords. Use COMBINATIONS when order doesn't matter: choosing a team (Alice-Bob-Carol = Carol-Bob-Alice), pizza topping selections, picking 5 books to read this month from a shelf of 20. Quick test: 'do AB and BA count as the same?' If yes -> combination.
How big are the numbers in C(n,r) for typical real-world cases?
The math scales dramatically. C(20,5) = 15,504 (choosing 5 books from a shelf of 20). C(60,6) = 50,063,860 (picking 6 items from 60). C(100,10) = 17,310,309,456,440. Combinations grow much faster than factorials in r alone, and tools like Pascal's triangle help you spot the patterns and shortcuts before reaching a calculator.
How many 8-character passwords are possible?
With 95 printable ASCII characters (upper/lowercase letters + digits + symbols), there are 95^8 = 6.6 × 10^15 combinations. A modern computer at 1 billion guesses per second needs 76 days to brute-force. With 12 characters that jumps to 5.4 × 10^23 = 17,000 years. NIST SP 800-63B recommends passwords of at least 8 characters from a broad set, or passphrases of 4 random words (~44 bits of entropy).
What is Pascal's triangle and what is it used for?
Pascal's triangle is a triangular arrangement where each number equals the sum of the two numbers above it. Row n contains C(n,0), C(n,1), ..., C(n,n). Applications: binomial coefficients in (a+b)^n, Sierpinski fractals (color odd numbers), probabilities in the binomial distribution, and discrete combinatorics. Notable patterns: row n sums to 2^n; the second diagonal lists the triangular numbers.
How do I compute 100! without overflow?
100! ≈ 9.33 × 10^157 - far beyond a 64-bit integer (max 9.22 × 10^18) or a double-precision float (accurate to ~17 significant digits). Solution: use BigInt (arbitrary precision) in JavaScript/Python, or BigInteger in Java. For a fast estimate, Stirling: 100! ≈ √(200π) × (100/e)^100 with under 1% error. 170! is the upper bound for IEEE 754 double (Number.MAX_VALUE).

Last updated: May 11, 2026