MODULE 06

Permutations & Combinations Calculator

Factorial

Permutation P(n, r)

Combination C(n, r)

Addition Rule (mutually exclusive tasks)

Enter comma-separated task sizes, e.g. 3,5,2

Product Rule (sequential tasks)

Enter comma-separated task sizes, e.g. 3,5,2

Pigeonhole Principle Solver

What is Permutations & Combinations?

Combinatorics answers "how many ways can this happen?" using permutations (order matters), combinations (order doesn't), and rules like the pigeonhole principle, without listing every possibility by hand.

How Does This Calculator Work?

Choose factorial, permutation, or combination, enter n (and r where relevant), and get the result with the formula substitution shown step by step — not just the final number.

Common Formulas & Rules

  • Factorial (n!): the number of ways to arrange n distinct items in order, n × (n-1) × ... × 1.
  • Permutation P(n,r): the number of ordered arrangements of r items chosen from n, = n! / (n-r)!.
  • Combination C(n,r): the number of unordered selections of r items from n, = n! / (r!(n-r)!).
  • Addition rule: if tasks are mutually exclusive, add the number of ways to do each.
  • Product rule: if tasks are independent and sequential, multiply the number of ways to do each.
  • Pigeonhole principle: if more than n items are placed into n boxes, at least one box holds more than one item.

Worked Example

How many ways can you choose a 3-person committee from 5 people, where order doesn't matter? That's C(5,3) = 5!/(3!×2!) = (5×4)/(2×1) = 10. If instead you needed to assign 3 distinct roles (president, secretary, treasurer) to 3 of the 5 people, order matters, so it becomes P(5,3) = 5×4×3 = 60.

Study guide: Counting

Written for students learning this topic for the first time. Last updated October 2026.

Overview

Counting, or combinatorics, answers “how many?” without listing every case. Two rules, the sum rule and the product rule, cover a surprising amount, and permutations and combinations handle the rest.

The real skill is deciding two things: does order matter, and is repetition allowed? Once those are settled the formula follows.

Key ideas explained

Sum and product rules

If you can do task A in m ways or task B in n ways, and they cannot both happen, there are m + n ways in total. If you do one task and then another, there are m · n ways. When cases overlap, use inclusion–exclusion to avoid counting twice.

Permutations

Ordered arrangements of r items from n: P(n, r) = n! / (n − r)!. Arranging all n gives n!. With repeated items divide by the repeats: the letters of MISSISSIPPI can be arranged in 11! / (4!·4!·2!) = 34,650 ways.

Combinations

Unordered selections: C(n, r) = n! / (r!(n − r)!) = P(n, r) / r!. Useful facts: C(n, r) = C(n, n − r), Pascal's rule C(n, r) = C(n−1, r−1) + C(n−1, r), and each row of Pascal's triangle sums to 2ⁿ. Choosing r items with repetition from n types gives C(n + r − 1, r) (stars and bars).

The pigeonhole principle

If more than k items are placed in k boxes, some box holds at least ⌈items / k⌉ of them. It proves that something must exist without saying which item or box it is.

Worked examples

Order matters or it does not

Problem. From 8 people, choose a 3-person committee. Then count the ways to pick a president, vice-president and treasurer from the 8.

  1. A committee is unordered: C(8, 3) = 56.
  2. Officers are ordered, so swapping two people gives a different outcome: P(8, 3) = 8·7·6 = 336.
  3. Consistency check: 56 committees × 3! orderings = 336.

Answer. 56 committees and 336 ways to assign the three offices.

Repeated letters and the pigeonhole principle

Problem. (a) Arrangements of the letters in LEVEL. (b) The least number of people among 25 who must share a birth month.

  1. (a) LEVEL has 5 letters with L twice and E twice: 5! / (2!·2!) = 120 / 4 = 30.
  2. (b) 25 people in 12 month-boxes: ⌈25 / 12⌉ = 3.

Answer. (a) 30 arrangements. (b) At least 3 people share a month.

Enter these same values in the calculator above and compare each step with the working shown here.

Common mistakes to avoid

  • Using permutations when order does not matter, or the reverse. Ask whether swapping two chosen items gives a different outcome.
  • Adding when you should multiply. “Then” usually means multiply; “or” means add.
  • Counting overlapping cases twice without subtracting the overlap.
  • Forgetting that 0! = 1 and C(n, 0) = C(n, n) = 1.

Where this shows up in computer science

  • Password strength: 8 characters from 62 symbols allow 62⁸ ≈ 2.18 × 10¹⁴ possibilities.
  • Classical probability is favorable outcomes over total outcomes, and both are counted combinatorially.
  • Counting subsets (2ⁿ) or orderings (n!) shows why brute-force search explodes as inputs grow.

Test yourself

Try each question before opening the answer.

How many 5-card hands can be dealt from a 52-card deck?

C(52, 5) = 2,598,960.

In how many ways can 6 people sit in a row? Around a circular table?

6! = 720 in a row; (6 − 1)! = 120 around a circle, since rotations are the same seating.

How many binary strings of length 10 contain exactly three 1s?

C(10, 3) = 120.

Frequently asked questions

When should I use a permutation instead of a combination?

Use a permutation, P(n,r), when the order of selection matters (like ranking 1st/2nd/3rd place). Use a combination, C(n,r), when only the selection itself matters, not the order (like picking a committee).

What is the pigeonhole principle in simple terms?

If you place more than n items into n boxes, at least one box must contain more than one item. It sounds obvious but proves surprisingly powerful results, like guaranteeing two people in a room of 367 share a birthday.

How is C(n,r) related to P(n,r)?

C(n,r) = P(n,r) / r!. A combination is a permutation with the ordering "divided out", since every group of r items can be arranged in r! different orders that a combination treats as identical.