CipherMatrix

Permutation and Combination Calculator

Compute nPr, nCr, n!, arrangements with repetition and multiset permutations exactly, with the formula substituted step by step and checked in a second way.

Permutations versus combinations

Counting problems come down to two questions: does the order of selection matter, and may items be repeated? A permutation counts ordered arrangements, a combination counts unordered selections. Choosing a president, a secretary and a treasurer from ten people is a permutation problem, P(10, 3) = 720, because roles differ. Choosing a committee of three from ten people is a combination problem, C(10, 3) = 120, because only the group matters. Notice that 720 = 120 × 3!: each committee can be ordered in 3! ways.

The formulas

The calculator supports six counting situations.

  • Factorial n! = n(n − 1)…1, the number of ways to arrange n distinct objects in a row; 0! = 1.
  • Permutation P(n, r) = n! / (n − r)! for ordered selections without repetition.
  • Combination C(n, r) = n! / (r!(n − r)!), also called a binomial coefficient, for unordered selections without repetition.
  • Permutation with repetition nr, for example four-digit PIN codes: 104 = 10 000.
  • Combination with repetition C(n + r − 1, r), from the stars-and-bars argument, for example choosing 3 scoops from 5 flavours with repeats allowed.
  • Multiset permutation n! / (k₁! k₂! …), arrangements of items where some are identical, such as the letters of MISSISSIPPI.

Exact results for huge numbers

Counts grow explosively: 52! has 68 digits and 100! has 158. An ordinary calculator switches to scientific notation and loses digits, but this tool uses arbitrary-precision integers, so every digit is exact. To keep results readable, n is limited to 1000. For binomial coefficients the calculator never computes the full factorials; it cancels common factors, so even C(1000, 500) is instant.

Built-in cross-checks

Every answer is verified a second way: P(n, r) is compared with C(n, r) × r!, combinations are checked against symmetry C(n, r) = C(n, n − r) and Pascal's rule C(n, r) = C(n − 1, r − 1) + C(n − 1, r), and multiset counts against a group-by-group product of binomial coefficients. A mismatch would stop the calculation instead of showing a wrong number.

Worked examples

These examples are computed by the same engine as the calculator above, so you can compare each step with your own working.

C(10, 3)

  • Counting type: Combination C(n, r)
  • n: 10
  • r: 3
  • Group sizes (identical-items type): 1
C(10, 3)
120

Step-by-step solution

Formula used
C(n, r) = n! / (r!(n − r)!)
Order does not matter, no repetition. C(n, r) = C(n, n − r).
  1. CalculateApply the combination formula
    C(n, r) = n! / (r!(n − r)!)
    C(10, 3) = 10! / (3! × 7!)
  2. CalculateCancel the common factorial
    C(10, 3) = (10 × 9 × 8) / 3!
    = 720 / 6 = 120
  3. ResultResult
    C(10, 3) = 120
  4. CheckCross-check
    Symmetry: C(n, n − r) = 120 ✓
    Pascal's rule: C(n − 1, r − 1) + C(n − 1, r) = 36 + 84 = 120 ✓

P(10, 3)

  • Counting type: Permutation P(n, r)
  • n: 10
  • r: 3
  • Group sizes (identical-items type): 1
P(10, 3)
720

Step-by-step solution

Formula used
P(n, r) = n! / (n − r)! = n(n − 1)…(n − r + 1)
Order matters, no repetition.
  1. CalculateApply the permutation formula
    P(n, r) = n! / (n − r)!
    P(10, 3) = 10! / 7!
    = 10 × 9 × 8
  2. ResultResult
    P(10, 3) = 720
  3. CheckCross-check
    n!/(n−r)! gives the same number ✓
    C(n, r) × r! = 120 × 6 = 720 ✓ (choose first, then arrange)

52!

  • Counting type: Factorial n!
  • n: 52
  • r: 0
  • Group sizes (identical-items type): 1
52!
80658175170943878571660636856403766975289505440883277824000000000000
68 digits

Step-by-step solution

Formula used
n! = n × (n − 1) × … × 2 × 1, 0! = 1
  1. CalculateMultiply the integers from 1 to n
    n! = n·(n−1)·…·1
    52! = 52 × 51 × 50 × 49 × … × 2 × 1
  2. ResultResult
    52! = 80658175170943878571660636856403766975289505440883277824000000000000
  3. CheckCross-check
    52! = 52 × 51! = 52 × 1551118753287382280224243016469303211063259720016986112000000000000 (a 67-digit number) ✓

MISSISSIPPI letters

  • Counting type: Arrangements with identical items
  • n: 0
  • r: 0
  • Group sizes (identical-items type): 1, 4, 4, 2
11! / (1! × 4! × 4! × 2!)
34650
Example: the word MISSISSIPPI has groups M=1, I=4, S=4, P=2, so its letters can be arranged in 1, 4, 4, 2 → 34650 ways.

Step-by-step solution

Formula used
Arrangements of n items with repeated groups k₁, …, kₘ: n! / (k₁! k₂! … kₘ!)
  1. CalculateDivide by the arrangements inside each group
    n! / (k₁! k₂! … kₘ!)
    n = 1 + 4 + 4 + 2 = 11
    11! / (1! × 4! × 4! × 2!) = 34650
  2. ResultResult
    11! / (1! × 4! × 4! × 2!) = 34650
  3. CheckCross-check
    Choosing positions group by group: C(11, 1) × C(10, 4) × C(6, 4) × C(2, 2) = 34650 ✓

3 scoops from 5 flavours

  • Counting type: Combination with repetition
  • n: 5
  • r: 3
  • Group sizes (identical-items type): 1
C(5 + 3 − 1, 3)
35

Step-by-step solution

Formula used
Multisets of size r from n types (stars and bars): C(n + r − 1, r)
  1. CalculateStars and bars
    C(n + r − 1, r)
    Place 3 identical items into 5 types using 4 dividers.
    C(5 + 3 − 1, 3) = C(7, 3) = 35
  2. ResultResult
    C(5 + 3 − 1, 3) = 35
  3. CheckCross-check
    Equivalently the number of non-negative integer solutions of x₁ + … + x5 = 3.

Frequently asked questions

What is the difference between nPr and nCr?

nPr counts ordered arrangements and nCr counts unordered selections. They are related by P(n, r) = C(n, r) × r!.

How many ways can 5 people sit in a row?

5! = 120. The first seat has 5 choices, the next 4, and so on.

What is 0!?

By definition 0! = 1: there is exactly one way to arrange no objects. This also makes the formulas for C(n, 0) and C(n, n) equal to 1.

When should I use stars and bars?

When you distribute identical items into distinct groups, or choose with repetition and without regard to order. The count is C(n + r − 1, r).

Related calculators