MatheramaMatherama
← Combinatorics
Combinatorics·Section 3·14 min read

Linear Permutations, Factorials, and Restricted Arrangements

In Sections 01 and 02, we counted ordered arrangements directly using the Multiplication Principle. We now formalize the concept of a linear permutation, introduce factorial, falling factorial, and rising factorial notations, develop three core strategies for constrained arrangements, and learn how to find the dictionary (lexicographical) rank of a word with distinct letters.


Permutations of Distinct Objects and Factorial Notation§

Look back at three counting results we already obtained in Sections 01 and 02 using the Multiplication Principle:

  • Choosing a captain and a monitor from 6060 students: 60×5960 \times 59.
  • Forming a 44-digit number from {1,2,…,9}\{1, 2, \dots, 9\} without repetition: 9×8×7×69 \times 8 \times 7 \times 6.
  • Forming a 77-letter password with no repeated letters from 2626 letters: 26×25×24×23×22×21×2026 \times 25 \times 24 \times 23 \times 22 \times 21 \times 20.

Every one of these problems shares the exact same underlying structure: we have nn distinct objects and rr distinct positions in a row (0≤r≤n0 \le r \le n), and we arrange rr of those objects into the rr positions without repetition.

Such an ordered arrangement is called an rr-permutation of nn distinct objects, and the total number of such arrangements is denoted by nPr{}^n P_r (or P(n,r)P(n, r)).

To derive a single general formula for nPr{}^n P_r, fill the rr distinct positions one by one from left to right. Because repetition is not allowed, each filled position reduces the pool of remaining objects by 11, while keeping the count of remaining choices independent of which particular objects were placed earlier:

  • The 11-st position can be filled in n=n−0n = n - 0 ways.
  • The 22-nd position can be filled in n−1n - 1 ways.
  • The 33-rd position can be filled in n−2n - 2 ways.
  • Following this pattern, the kk-th position can be filled in n−(k−1)=n−k+1n - (k - 1) = n - k + 1 ways, so the rr-th (last) position can be filled in n−r+1n - r + 1 ways.

By the Multiplication Principle:

nPr=n(n−1)(n−2)⋯(n−r+1){}^n P_r = n(n - 1)(n - 2) \cdots (n - r + 1)

Slot-by-Slot Derivation of the r-Permutation Formula

Factorial Notation§

For any natural number n∈Nn \in \mathbb{N}, the product of all natural numbers from 11 to nn is called the factorial of nn, denoted n!n!:

n!=1×2×3×⋯×nn! = 1 \times 2 \times 3 \times \dots \times n

Multiplying and dividing our expression for nPr{}^n P_r by (n−r)(n−r−1)⋯3⋅2⋅1=(n−r)!(n - r)(n - r - 1) \cdots 3 \cdot 2 \cdot 1 = (n - r)! compresses it into a compact fraction:

nPr=n(n−1)(n−2)⋯(n−r+1)⋅(n−r)(n−r−1)⋯3⋅2⋅1(n−r)(n−r−1)⋯3⋅2⋅1=n!(n−r)!{}^n P_r = \frac{n(n - 1)(n - 2) \cdots (n - r + 1) \cdot (n - r)(n - r - 1) \cdots 3 \cdot 2 \cdot 1}{(n - r)(n - r - 1) \cdots 3 \cdot 2 \cdot 1} = \frac{n!}{(n - r)!}

Let us test this formula on boundary values of rr:

  • For r=1r = 1: nP1=n!(n−1)!=n{}^n P_1 = \frac{n!}{(n - 1)!} = n. This makes immediate sense—there are nn ways to place one of nn objects into a single spot.
  • For r=2r = 2: nP2=n!(n−2)!=n(n−1){}^n P_2 = \frac{n!}{(n - 2)!} = n(n - 1).
  • For r=0r = 0: nP0=n!(n−0)!=1{}^n P_0 = \frac{n!}{(n - 0)!} = 1. Though unusual at first glance, this says there is exactly one way to arrange nn objects in zero places—namely, do nothing (the empty arrangement).

Why Zero Factorial Equals One§

Now test r=nr = n in our formula:

nPn=n!(n−n)!=n!0!{}^n P_n = \frac{n!}{(n - n)!} = \frac{n!}{0!}

Here we hit a snag: our original definition of n!n! applies only to natural numbers n∈Nn \in \mathbb{N}, and 00 is not a natural number! Does that mean nPn{}^n P_n is meaningless? Not at all. Physically, nPn{}^n P_n simply means arranging nn distinct objects in nn distinct places: nn choices for the first place, n−1n - 1 for the second, ..., down to 11 choice for the last place. Directly from the Multiplication Principle:

nPn=n(n−1)(n−2)⋯3⋅2⋅1=n!{}^n P_n = n(n - 1)(n - 2) \cdots 3 \cdot 2 \cdot 1 = n!

For the general formula nPr=n!(n−r)!{}^n P_r = \frac{n!}{(n - r)!} to hold seamlessly at r=nr = n, we require n!0!=n!\frac{n!}{0!} = n!. Therefore, by mathematical definition:

0!=10! = 1

When all nn distinct objects are arranged in nn distinct places, we simply call it a permutation of nn distinct objects, and its count is n!n!.

Example 1 (Students and Chairs — Including r>nr > n): Find the number of ways 1010 students can be seated on: (a) 66 chairs, (b) 99 chairs, (c) 1010 chairs, (d) 1515 chairs.

Solution:

(a) 66 chairs: Both students and chairs are distinct, and r=6≤10=nr = 6 \le 10 = n:

10P6=10!(10−6)!=10!4!=10×9×8×7×6×5=151,200{}^{10} P_6 = \frac{10!}{(10 - 6)!} = \frac{10!}{4!} = 10 \times 9 \times 8 \times 7 \times 6 \times 5 = 151{,}200

(In every arrangement, 44 students remain standing.)

(b) 99 chairs: 10P9=10!1!=10!{}^{10} P_9 = \frac{10!}{1!} = 10!.

(c) 1010 chairs: 10P10=10!0!=10!{}^{10} P_{10} = \frac{10!}{0!} = 10!.

Pause and ask: Why are the answers to parts (b) and (c) identical? When 1010 students sit on 99 chairs, exactly 11 student is always left standing—you can imagine that standing student as occupying an "invisible" 1010-th chair! In general:

nPn−1=nPn=n!{}^n P_{n - 1} = {}^n P_n = n!

(d) 1515 chairs: Now there are more chairs than students. Can we write 10P15=10!(−5)!{}^{10} P_{15} = \frac{10!}{(-5)!}? No—the factorial of a negative integer is undefined! Yet seating 1010 students on 1515 chairs is obviously possible; 55 chairs simply stay empty.

Think from the students' perspective instead of the chairs' perspective: the first student can sit on any of the 1515 chairs (1515 ways); independently, the second student has 1414 remaining chairs; the third has 1313; ..., and the tenth student has 66 choices:

15×14×13×⋯×6=15!5!=15P1015 \times 14 \times 13 \times \dots \times 6 = \frac{15!}{5!} = {}^{15} P_{10}

Symmetric Insight:
Seating 1010 students on 77 chairs gives 10P7{}^{10} P_7 ways (with 33 students standing). Seating 77 students on 1010 chairs also gives 10P7{}^{10} P_7 ways (with 33 chairs empty). Always put the larger pool of distinct items in the superscript of nPr{}^n P_r!


Falling Factorials and Rising Factorials§

In the product nPr=n(n−1)(n−2)⋯(n−r+1){}^n P_r = n(n - 1)(n - 2) \cdots (n - r + 1), each factor drops by 11 from the previous factor. For this reason, nPr{}^n P_r is also called the falling factorial, denoted nr‾n^{\underline{r}}.

There is a natural dual concept where each successive factor increases by 11: the rising factorial, denoted nr‾n^{\overline{r}}. Let us discover it through two concrete problems.

Example 2 (Rings on Fingers): Find the number of ways 77 distinct rings can be worn on 1010 distinct fingers (assuming a finger can hold any number of rings, and the vertical order of rings on a finger matters).

Solution: Place the rings one by one:

  • Ring 11: Can go on any of the 1010 fingers (1010 ways).
  • Ring 22: Surprisingly, Ring 22 has 1111 ways—not 1010! Why? It can go on any of the 99 empty fingers, or above Ring 11 on its finger, or below Ring 11 on its finger (9+2=119 + 2 = 11 positions).

Why Ring 2 Has 11 Choices After Ring 1 Is Placed on One of 10 Fingers

  • Ring 33: Notice that placing Ring 22 eliminated 11 empty slot and created 22 new slots (above and below Ring 22), increasing the total number of available slots by 11—so Ring 33 has 1212 ways!
  • Continuing inductively, Ring 77 has 10+6=1610 + 6 = 16 ways.

By the Multiplication Principle, the total number of ways is:

10×11×12×13×14×15×16=16!9!=16P710 \times 11 \times 12 \times 13 \times 14 \times 15 \times 16 = \frac{16!}{9!} = {}^{16} P_7

Example 3 (Queues at Bank Cash Counters): A bank has nn distinct cash counters, each able to form a queue. In how many ways can rr distinct people arrange themselves in queues at these nn counters?

Solution: Person 11 has nn counters to choose from (nn ways). Person 22 can pick any of the n−1n - 1 empty counters, or stand in front of or behind Person 11 (n+1n + 1 ways). Person 33 has n+2n + 2 positions, and so on until the rr-th person has n+r−1n + r - 1 positions:

n(n+1)(n+2)⋯(n+r−1)=(n+r−1)!(n−1)!=n+r−1Prn(n + 1)(n + 2) \cdots (n + r - 1) = \frac{(n + r - 1)!}{(n - 1)!} = {}^{n + r - 1} P_r

Summary of Falling and Rising Factorial Notation§

nr‾=n(n−1)(n−2)⋯(n−r+1)=nPrn^{\underline{r}} = n(n - 1)(n - 2) \cdots (n - r + 1) = {}^n P_r nr‾=n(n+1)(n+2)⋯(n+r−1)=n+r−1Prn^{\overline{r}} = n(n + 1)(n + 2) \cdots (n + r - 1) = {}^{n + r - 1} P_r

Three Core Strategies for Restricted Permutations§

When linear permutations come with extra conditions—objects that must stay together, objects that must stay apart, or objects with positional preferences—three foundational strategies handle them cleanly. (Once we introduce combinations in Section 04, we will add a fourth strategy, Select-and-Arrange, for drawing objects from multiple pools before arranging them.)

1. Tie-and-Arrange (Bundle Method)§

When to use: kk particular objects out of nn distinct objects must always appear together as a contiguous block.

Tie the kk objects together into a single indivisible bundle. Together with the remaining n−kn - k free objects, we now have (n−k)+1=n−k+1(n - k) + 1 = n - k + 1 units to arrange, which can be done in (n−k+1)!(n - k + 1)! ways. For each arrangement of the units, the kk distinct objects inside the bundle can be permuted among themselves in k!k! ways.

Visualizing the Tie-and-Arrange Bundle Method

By the Multiplication Principle:

Total arrangements=(n−k+1)!⋅k!\text{Total arrangements} = (n - k + 1)! \cdot k!

Example 4: In how many ways can 66 distinct mathematics books and 44 distinct physics books be arranged on a shelf so that (a) all 44 physics books stay together, (b) not all 44 physics books stay together?

Solution:

(a) All 44 physics books together: Bundle the 44 physics books into 11 unit. We arrange 6+1=76 + 1 = 7 units in 7!7! ways, and permute the 44 physics books inside the bundle in 4!4! ways:

7!×4!=5040×24=120,9607! \times 4! = 5040 \times 24 = 120{,}960

(b) Not all 44 physics books together: By the Subtraction Principle, subtract part (a) from all 10!10! unrestricted arrangements:

10!−7!×4!=3,628,800−120,960=3,507,84010! - 7! \times 4! = 3{,}628{,}800 - 120{,}960 = 3{,}507{,}840

2. The Gap Method (No Two Adjacent)§

When to use: No two objects from a restricted group of size kk may stand next to each other.

First arrange the mm unrestricted objects in a row in m!m! ways. Observe that these mm objects create exactly m+1m + 1 gaps—m−1m - 1 interior gaps between consecutive objects, plus 22 outer positions at the very front and very end of the row:

Gap Method Diagram Showing m Objects Creating m+1 Gaps

Now place the kk restricted objects (k≤m+1k \le m + 1) into kk of these m+1m + 1 distinct gaps in m+1Pk{}^{m + 1} P_k ways. Because at least one unrestricted object sits between any two distinct gaps, no two restricted objects can ever be adjacent. By the Multiplication Principle:

Total arrangements=m!⋅m+1Pk\text{Total arrangements} = m! \cdot {}^{m + 1} P_k

Example 5: In how many ways can 1010 boys and 55 girls stand in a queue so that no two girls are next to each other?

Solution: Arrange the 1010 boys in 10!10! ways, creating 99 interior gaps plus 22 end positions =11= 11 gaps. Place the 55 distinct girls into these 1111 gaps in 11P5{}^{11} P_5 ways:

Total ways=10!⋅11P5\text{Total ways} = 10! \cdot {}^{11} P_5

Critical Warning — "Not All Together" vs. "No Two Together":
For k≥3k \ge 3 restricted objects, "not all kk together" (Example 4b, solved by subtracting the bundle from the total) is completely different from "no two together" (Example 5, solved by the Gap Method). Subtracting "all 55 girls together" still leaves arrangements where 22, 33, or 44 girls stand side by side!

3. Positional Preferences (Fulfill Preferences First)§

When to use: Specific objects restrict themselves to specific subsets of positions. Just as in Section 01, fulfill the preferences first so the remaining counts stay independent!

Example 6: A classroom has a front row and a back row, each containing 1010 distinct chairs. Eight students enter: 33 particular students insist on sitting in the front row, 22 particular students are shy and prefer the back row, and the remaining 33 students have no preference. In how many ways can they sit?

Solution: Fulfill the strict preferences before seating the unrestricted students:

  1. Seat the 33 front-row students on the 1010 front-row chairs: 10P3{}^{10} P_3 ways.
  2. Seat the 22 back-row students on the 1010 back-row chairs: 10P2{}^{10} P_2 ways (completely independent of Step 1).
  3. Seat the remaining 33 unrestricted students on the 20−5=1520 - 5 = 15 remaining chairs: 15P3{}^{15} P_3 ways.

By the Multiplication Principle:

Total ways=10P3⋅10P2⋅15P3\text{Total ways} = {}^{10} P_3 \cdot {}^{10} P_2 \cdot {}^{15} P_3

(Notice: if you had tried to seat the 33 unrestricted students first, the number of chairs left in the front and back rows would depend on where they sat, destroying independence!)


Lexicographical (Dictionary) Rank of a Word§

If all distinct permutations of the letters of a word are listed in alphabetical order (exactly as in a dictionary), the position of a given word in that list is called its dictionary rank.

Computing Dictionary Rank for Distinct Letters§

To find the rank of an nn-letter word with all letters distinct, count how many words come strictly before it by locking letters one by one from left to right:

  1. Write the nn letters in alphabetical order.
  2. At position ii (i=1,2,…,ni = 1, 2, \dots, n), count how many unused letters appear strictly before the ii-th letter of the target word in the alphabet. Placing any one of those smaller letters at position ii allows the remaining n−in - i letters to permute freely in (n−i)!(n - i)! ways—every such word precedes our target word!
  3. Sum these counts over all positions i=1,…,ni = 1, \dots, n, and add 11 for the target word itself.

Example 7: Find the dictionary rank of the word MOTHER.

Solution: Sort the 66 distinct letters alphabetically: E, H, M, O, R, T.

  • Position 1 (M): Unused letters before M are E, H (22 letters)   ⟹  2×5!=240\implies 2 \times 5! = 240 preceding words. Lock M.
  • Position 2 (O): Unused letters are E, H, O, R, T. Letters before O are E, H (22 letters)   ⟹  2×4!=48\implies 2 \times 4! = 48. Lock O.
  • Position 3 (T): Unused letters are E, H, R, T. Letters before T are E, H, R (33 letters)   ⟹  3×3!=18\implies 3 \times 3! = 18. Lock T.
  • Position 4 (H): Unused letters are E, H, R. Letter before H is E (11 letter)   ⟹  1×2!=2\implies 1 \times 2! = 2. Lock H.
  • Position 5 (E): Unused letters are E, R. Letters before E: 0  ⟹  0×1!=00 \implies 0 \times 1! = 0. Lock E.
  • Position 6 (R): 0×0!=00 \times 0! = 0.

Adding 11 for MOTHER itself:

Rank(MOTHER)=240+48+18+2+0+0+1=309\text{Rank}(\text{MOTHER}) = 240 + 48 + 18 + 2 + 0 + 0 + 1 = 309

Example 8: Find the dictionary rank of the word RANDOM.

Solution: Sort the 66 distinct letters alphabetically: A, D, M, N, O, R.

  • Position 1 (R): Letters before R are A, D, M, N, O (55)   ⟹  5×5!=600\implies 5 \times 5! = 600. Lock R.
  • Position 2 (A): Remaining A, D, M, N, O. Letters before A: 0  ⟹  0×4!=00 \implies 0 \times 4! = 0. Lock A.
  • Position 3 (N): Remaining D, M, N, O. Letters before N are D, M (22)   ⟹  2×3!=12\implies 2 \times 3! = 12. Lock N.
  • Position 4 (D): Remaining D, M, O. Letters before D: 0  ⟹  0×2!=00 \implies 0 \times 2! = 0. Lock D.
  • Position 5 (O): Remaining M, O. Letter before O is M (11)   ⟹  1×1!=1\implies 1 \times 1! = 1. Lock O.
  • Position 6 (M): 0×0!=00 \times 0! = 0.

Adding 11 for RANDOM itself:

Rank(RANDOM)=600+0+12+0+1+0+1=614\text{Rank}(\text{RANDOM}) = 600 + 0 + 12 + 0 + 1 + 0 + 1 = 614

(In Section 06, once we derive permutations of multisets, we will extend this exact algorithm to words containing repeated letters.)


Summary Table§

Concept / Strategy Formula When to Apply
rr-Permutation (Falling Factorial) nPr=nr‾=n!(n−r)!{}^n P_r = n^{\underline{r}} = \frac{n!}{(n - r)!} Arranging rr of nn distinct objects in rr distinct slots without repetition (r≤nr \le n)
Rising Factorial nr‾=n(n+1)⋯(n+r−1)=n+r−1Prn^{\overline{r}} = n(n + 1) \cdots (n + r - 1) = {}^{n + r - 1} P_r Ordered placements where each placed object creates 11 new slot
Tie-and-Arrange (kk together) (n−k+1)!⋅k!(n - k + 1)! \cdot k! kk specific objects must form one contiguous block
Gap Method (No two together) m!⋅m+1Pkm! \cdot {}^{m + 1} P_k kk restricted objects separated by mm unrestricted objects (k≤m+1k \le m + 1)
Positional Preferences Satisfy strictest preferences first Keeps subsequent counts independent
Dictionary Rank (distinct letters) 1+∑i=1n(smaller unused at i)⋅(n−i)!1 + \sum_{i=1}^n (\text{smaller unused at } i) \cdot (n - i)! Prefix-by-prefix counting in alphabetical order
Section 3 of 11 · Combinatorics

Mark this section complete when you have worked through its proofs.