๐ŸงฎCombinatorics

Permutation Formulas

Study smarter with Fiveable

Get study guides, practice questions, and cheatsheets for all your subjects. Join 500,000+ students with a 96% pass rate.

Get Started

Why This Matters

Permutation formulas are the backbone of counting problems where order matters. Recognizing when order matters is half the battle on any combinatorics exam. You're being tested on your ability to identify which formula applies to a given scenario: Is repetition allowed? Are some objects identical? Are there forbidden positions?

Each formula exists because a specific constraint changes how we count. Don't just memorize P(n,r)=n!(nโˆ’r)!P(n,r) = \frac{n!}{(n-r)!} and call it a day. You need to understand why we divide, why we subtract, and why circular arrangements behave differently from linear ones. The concepts here (overcounting corrections, symmetry elimination, inclusion-exclusion) appear throughout discrete mathematics and give you a toolkit for tackling any arrangement problem.


Linear Arrangements: The Foundation

These formulas handle the most common scenario: arranging objects in a line or sequence where position matters. The key principle is that each successive choice has fewer options available.

Basic Permutation Formula

P(n,r)=n!(nโˆ’r)!P(n,r) = \frac{n!}{(n-r)!}

This counts arrangements of rr objects selected from nn distinct objects where order matters. The factorial structure reflects successive multiplication: you have nn choices for the first position, (nโˆ’1)(n-1) for the second, and so on down to (nโˆ’r+1)(n-r+1) for the last.

Use this when each object can only be used once and every object is distinguishable from the others.

For example, choosing a president, vice president, and treasurer from a club of 10 people gives P(10,3)=10!7!=10ร—9ร—8=720P(10,3) = \frac{10!}{7!} = 10 \times 9 \times 8 = 720.

Permutations with Repetition

nrn^r

This applies when you can reuse objects, giving nn independent choices for each of rr positions. Your choice for one slot doesn't affect options for another. Classic examples include PIN codes (10 digits, 4 positions = 104=10,00010^4 = 10{,}000), license plates, and any scenario where "replacement" is allowed.

Compare: Basic permutations vs. permutations with repetition: both count ordered arrangements, but repetition allows reuse (nrn^r) while basic permutations don't (n!(nโˆ’r)!\frac{n!}{(n-r)!}). If a problem mentions "with replacement" or "can repeat," you want nrn^r.


Correcting for Overcounting

When objects are identical or positions are equivalent, the basic formula overcounts. These formulas divide out the redundant arrangements.

Permutations with Indistinguishable Objects

n!n1!โ‹…n2!โ‹…โ€ฆโ‹…nk!\frac{n!}{n_1! \cdot n_2! \cdot \ldots \cdot n_k!}

This is the multinomial coefficient for arranging nn objects when groups of size n1,n2,โ€ฆ,nkn_1, n_2, \ldots, n_k are identical. Dividing by the factorials eliminates arrangements that look the same, because swapping identical objects doesn't create a new permutation.

The classic example is counting arrangements of "MISSISSIPPI" (11 letters total). You divide 11!11! by 4!4! for the four S's, 4!4! for the four I's, 2!2! for the two P's, and 1!1! for the single M:

11!4!โ‹…4!โ‹…2!โ‹…1!=34,650\frac{11!}{4! \cdot 4! \cdot 2! \cdot 1!} = 34{,}650

Note that n1+n2+โ‹ฏ+nkn_1 + n_2 + \cdots + n_k must equal nn. Every object needs to belong to exactly one group.

Circular Permutations

(nโˆ’1)!(n-1)!

This counts arrangements of nn objects in a circle where rotations are considered identical. The reasoning: fix one object in place to break the rotational symmetry, then arrange the remaining (nโˆ’1)(n-1) objects linearly. For 6 people around a round table, that's 5!=1205! = 120 (not 6!=7206! = 720).

Watch for reflections: if the circle can be flipped (like a bracelet that you can turn over, as opposed to people seated at a fixed table), divide by 2 to get (nโˆ’1)!2\frac{(n-1)!}{2}.

Compare: Indistinguishable objects vs. circular permutations: both divide to correct overcounting, but for different reasons. Identical objects create internal redundancy (swapping S's in MISSISSIPPI changes nothing). Circular arrangements create positional equivalence through rotation (everyone shifts one seat, but the seating is the same). Know which symmetry you're eliminating.


Derangements: When Nothing Stays Put

Derangements count permutations where no element remains in its original position. These problems use inclusion-exclusion to subtract out forbidden arrangements.

Derangements (Subfactorial)

!n=n!โˆ‘i=0n(โˆ’1)ii!!n = n! \sum_{i=0}^{n} \frac{(-1)^i}{i!}

This counts permutations where every object moves from its starting position. The inclusion-exclusion logic works like this:

  1. Start with all n!n! permutations.
  2. Subtract permutations where at least one element is fixed: (n1)(nโˆ’1)!\binom{n}{1}(n-1)!
  3. Add back permutations where at least two elements are fixed (you subtracted these twice): (n2)(nโˆ’2)!\binom{n}{2}(n-2)!
  4. Continue alternating signs until you've accounted for all overlaps.

A quick approximation: !nโ‰ˆn!e!n \approx \frac{n!}{e}, rounded to the nearest integer. This becomes increasingly accurate as nn grows. For small values: !1=0!1 = 0, !2=1!2 = 1, !3=2!3 = 2, !4=9!4 = 9, !5=44!5 = 44.

Partial Derangements

D(n,k)=(nk)โ‹…!(nโˆ’k)D(n,k) = \binom{n}{k} \cdot !(n-k)

This counts arrangements where exactly kk objects stay fixed and the rest are deranged. The logic is a two-step process:

  1. Choose which kk objects remain fixed: (nk)\binom{n}{k} ways.
  2. Derange the remaining (nโˆ’k)(n-k) objects: !(nโˆ’k)!(n-k) ways.

This is the formula you need when a problem asks something like "how many arrangements of {1,2,3,4,5}\{1,2,3,4,5\} have exactly 2 items in their original positions?"

Compare: Full derangements vs. partial derangements: !n!n requires every object to move, while D(n,k)D(n,k) allows exactly kk fixed points. If a problem says "no object in its original position," use !n!n. If it says "exactly kk objects fixed," use D(n,k)D(n,k).


Restricted and Structured Permutations

These concepts handle constraints, ordering systems, and more complex counting scenarios.

Permutations with Forbidden Positions

There's no single clean formula here. Instead, you choose a strategy based on the problem:

  • Complementary counting often works best for simple restrictions: calculate total arrangements minus arrangements that violate the restriction. For example, "arrangements of {1,2,3,4}\{1,2,3,4\} where 1 is not first" = 4!โˆ’3!=184! - 3! = 18.
  • Inclusion-exclusion handles multiple restrictions by accounting for overlaps between forbidden cases. If elements aa, bb, and cc each have one forbidden position, you subtract cases where each violates its restriction, add back cases where pairs violate simultaneously, and subtract the triple overlap.
  • Rook polynomials provide a systematic approach for complex forbidden-position problems on a grid, where you're placing non-attacking rooks on allowed squares.

Lexicographic Order

Lexicographic order arranges permutations by comparing elements left-to-right, just like alphabetizing words. For {1,2,3}\{1,2,3\}, the order is: 123, 132, 213, 231, 312, 321.

Finding the kkth permutation uses factorial decomposition:

  1. Determine the first element by computing โŒŠk/(nโˆ’1)!โŒ‹\lfloor k / (n-1)! \rfloor (adjusting for 0-indexing).
  2. Use the remainder to determine the second element by dividing by (nโˆ’2)!(n-2)!.
  3. Continue until all positions are filled.

Counting predecessors tells you a permutation's rank, which is useful for encoding permutations as single integers.

Compare: Forbidden positions vs. lexicographic order: both add structure to permutation counting, but forbidden positions restrict which arrangements are valid, while lexicographic order organizes all valid arrangements systematically. One reduces your count; the other indexes it.


Permutation Structure and Properties

Understanding the internal structure of permutations reveals deeper patterns and connects to abstract algebra.

Inversions in Permutations

An inversion is a pair (i,j)(i, j) where i<ji < j but the element at position ii is greater than the element at position jj. The inversion count measures how "out of order" a permutation is.

  • The identity permutation (1,2,3,โ€ฆ,n)(1, 2, 3, \ldots, n) has 0 inversions.
  • The reverse permutation (n,nโˆ’1,โ€ฆ,1)(n, n-1, \ldots, 1) has (n2)\binom{n}{2} inversions, the maximum possible.
  • Sorting algorithms like bubble sort perform exactly as many adjacent swaps as there are inversions.

For example, the permutation (3,1,2)(3, 1, 2) has two inversions: (3,1)(3,1) and (3,2)(3,2).

Permutation Groups and Cycle Notation

Cycle notation writes a permutation as disjoint cycles. For instance, (1ย 3ย 2)(4ย 5)(1\ 3\ 2)(4\ 5) means 1โ†’31 \to 3, 3โ†’23 \to 2, 2โ†’12 \to 1, and 4โ†’54 \to 5, 5โ†’45 \to 4. Elements not appearing in any cycle are fixed points.

Permutation composition combines two permutations by applying them in sequence. The set of all permutations of nn elements forms the symmetric group SnS_n, which is a central object in abstract algebra.

The cycle type of a permutation determines key properties. Most importantly, the order of a permutation (the number of times you must apply it to return to the identity) equals the LCM of its cycle lengths. For (1ย 3ย 2)(4ย 5)(1\ 3\ 2)(4\ 5), the cycle lengths are 3 and 2, so the order is lcm(3,2)=6\text{lcm}(3,2) = 6.

Compare: Inversions vs. cycle notation: both analyze permutation structure, but inversions count disorder (useful for sorting analysis), while cycles describe movement patterns (useful for algebra and repeated application). Know which tool fits your problem.


Quick Reference Table

ConceptFormula
Basic ordered selectionP(n,r)=n!(nโˆ’r)!P(n,r) = \frac{n!}{(n-r)!}
Selection with replacementnrn^r
Identical objectsn!n1!โ‹…n2!โ‹ฏnk!\frac{n!}{n_1! \cdot n_2! \cdots n_k!} (multinomial)
Circular arrangements(nโˆ’1)!(n-1)! or (nโˆ’1)!2\frac{(n-1)!}{2} with reflections
No fixed points!n=n!โˆ‘i=0n(โˆ’1)ii!!n = n! \sum_{i=0}^{n} \frac{(-1)^i}{i!}
Exactly kk fixed pointsD(n,k)=(nk)โ‹…!(nโˆ’k)D(n,k) = \binom{n}{k} \cdot !(n-k)
Measuring disorderInversion count
Algebraic structureCycle notation, permutation groups

Self-Check Questions

  1. You're arranging 5 people in a line versus around a circular table. Which formula applies to each, and why does the circular case give fewer arrangements?

  2. The word "BANANA" has 6 letters. Why can't you just use 6!6! to count its arrangements, and what's the correct formula?

  3. Compare P(10,3)P(10, 3) and 10310^3: what real-world scenario would use each formula?

  4. If you're asked to count permutations of {1,2,3,4,5}\{1, 2, 3, 4, 5\} where exactly 2 elements remain in their original positions, which formula do you need and what's your setup?

  5. A problem asks: "How many arrangements of {1,2,3,4}\{1, 2, 3, 4\} have the property that 1 is not in position 1 and 2 is not in position 2?" Explain why you'd use inclusion-exclusion rather than a single formula.