Press ▶ Play to build all P(n, r) arrangements, or Step ▶ to advance one ball at a time. Switch balls / letters and adjust n and r.
● BallsA Letters
n =3?
r =2?
Speed
Building partial permutations
P(3, 2) = 3! / (3−2)! = 3 × 2 = 6
Choose and arrange r items out of n — order matters, no repetition. Each step builds the family of arrangements starting with one fixed first item; there are n such families, each containing (n−1)! / (n−r)! arrangements.
Partial permutation — an ordered selection of r items from a set of n distinct items, with no item reused. The count is P(n,r)=n!/(n−r)!.
$P(n, r)$ — standard notation for the number of partial permutations of size r taken from n items. Also written nPr or Prn.
Order matters — two selections with the same items in different positions count as different partial permutations. This is what distinguishes partial permutations from combinations.
Position — a slot in the arrangement, numbered #1 through #r from left to right in the build area.
First-item group — the family of partial permutations that share the same item in position #1. There are n such groups, each containing (n−1)!/(n−r)! partial permutations.
Source row — the set of n available items shown at the top of the scene. Items already placed in the current build are dimmed.
Getting Started
The tool opens with n=3 and r=2, ready to build. The scene splits into three areas:
• A source row at the top showing all n available items.
• A build area in the middle with exactly r slots labeled #1 through #r.
• A completed section below, where every finished partial permutation is filed under the row matching its first item.
To run the visualization:
• Press ▶ Play to auto-build all P(n,r) partial permutations.
• Press Step ▶ to advance one ball at a time.
• Press ◀ to step backward through the animation.
• Adjust the Speed slider to control how fast play advances.
The header in the top right shows P(n,r)=total alongside a live status line such as *Step X (item name): k / (n−1)!/(n−r)!* while building, or *Complete · total / total* when done.
The Build Area
The build area is where one partial permutation at a time is constructed. Unlike a full permutation, only r slots appear — not n. The label above the area reads *BUILD AREA (r = R)* with the current r.
What to watch:
• Empty slot outlines with dashed borders, labeled #1,#2,…,#r. The label tells you the position number being filled.
• When a ball is in flight from the source row to a slot, a dotted guide line in that ball's color traces the trajectory.
• Each ball lands in its assigned slot and stays put until the partial permutation completes.
• In the source row above, every item already placed in the current build (plus the one in flight) is dimmed to indicate it's out of play.
• When all r slots are filled, a flash ring briefly pulses around the build area. The completed arrangement is then copied to the appropriate first-item row in the completed section below.
Adjusting n and r
Two steppers in the control bar control the size:
• n sets the size of the source set — the pool of available items.
• r sets the number of positions to fill. The constraint r≤n is enforced; if you reduce n below the current r, the tool clamps r down automatically.
Common combinations:
• n=3,r=2: P(3,2)=6 partial permutations.
• n=4,r=2: P(4,2)=12 partial permutations.
• n=4,r=3: P(4,3)=24 partial permutations.
• n=5,r=3: P(5,3)=60 partial permutations.
• n=5,r=5: P(5,5)=120 — this is the full permutation case, where r=n and the formula reduces to n!.
Changing either n or r resets the build, refreshes the formula in the header, and reorganizes the completed grid into the new number of first-item rows.
Grouping by First Item
The completed section organizes partial permutations into first-item groups — every arrangement starting with the same item appears in the same row.
There are exactly n groups (one per item in the source set), and each group holds exactly (n−1)!/(n−r)! partial permutations. So the total is:
n×(n−r)!(n−1)!=(n−r)!n!=P(n,r)
This is the visual proof of the partial permutation formula. Pick any item to put in position #1: n choices. For each choice, fill the remaining r−1 positions with r−1 items chosen in order from the remaining n−1 items: (n−1)!/(n−r)! ways. Multiply.
Each group row in the completed area has:
• A tinted background in a faint version of the group's color.
• A colored accent stripe on the left edge.
• A left-side avatar showing the first item — a colored circle with the item's number in balls mode, or the letter in letters mode.
• Mini partial-permutation cards, each one a full arrangement of r items starting with that first item.
Transport Controls
The control bar offers four transport buttons plus a speed slider:
• ◀ (Step back) — walks the animation one step backward. Useful for re-examining a single partial permutation or pausing mid-build.
• Step ▶ (Step forward) — advances one ball into one slot. Stop after each step to read the partial arrangement so far.
• ▶ Play / ⏸ Pause — runs the animation continuously until all P(n,r) partial permutations are built, then auto-pauses.
• ↺ Reset — clears the completed section and starts over from the first arrangement.
The Speed slider controls how fast play advances. At higher speeds the fly and land timings shrink proportionally; at slower speeds you can clearly see each ball travel from source to slot and follow the dotted guide line in detail.
Mode Switch
The Mode switch at the start of the control bar toggles how each item is rendered:
• Balls mode (default) — items appear as colored circles. The first-item avatar in each completed group is a circle with the item's number. Best for tracking position and group membership visually.
• Letters mode — items appear with letter labels (A, B, C, …). The first-item avatar in each completed group is just the letter, colored to match. Best for reading off the sequence in each partial permutation and matching it to algebraic notation like (A,C) or (B,A,D).
The encoding is consistent across the source row, the build slots, the flying ball, every mini card in the completed grid, and the right-panel narration. Switching modes mid-animation is safe — the build state preserves; only the rendering changes.
Right Panel and Progress
The right panel narrates the build as it unfolds, anchored by the header *Building partial permutations* with the full formula P(n,r)=n!/(n−r)!=n×(n−1)×⋯=total.
A StepRow is added for each first-item group as soon as a partial permutation in that group either starts building or completes. Each StepRow shows:
• The first item as a chip plus its name — for instance, *First item: A*.
• A progress counter like k/((n−1)!/(n−r)!) tracking how many partial permutations in this group have completed.
• A short narration of the structure: *Position 1 is locked to A. The next r−1 positions are filled from B, C, D, or E in (n−1)×(n−2)×⋯=M ways.* When r=1 the narration adjusts: with only one position, the outcome is just the first item alone.
When all groups complete, every StepRow shows *done* with a checkmark, and the header counter reaches total/total.
What Is a Partial Permutation
A partial permutation is an ordered selection of r items from a set of n distinct items, with no item used twice. The count of such selections is:
P(n,r)=(n−r)!n!=n×(n−1)×⋯×(n−r+1)
The formula collapses to n! when r=n — the full permutation. When r<n, the multiplication stops after r factors instead of continuing all the way down to 1.
Examples:
• Picking a 1st, 2nd, and 3rd place from 8 runners: P(8,3)=8×7×6=336 podiums.
• Choosing a president and a vice-president from 10 candidates: P(10,2)=90 outcomes.
• Forming a 4-digit code from 10 digits with no repeats: P(10,4)=5040 codes.
The partial permutation is the right model whenever you need both *which* items and *what order* — and reuse is not allowed.
For deeper coverage of the formula and its derivation, see the partial permutation without repetition section on the permutations theory page.
Deriving P(n,r) Step by Step
Apply the multiplication principle of counting one position at a time:
• Position $\#1$: any of the n items. n choices.
• Position $\#2$: any of the remaining n−1 items. n−1 choices.
• Position $\#3$: any of the remaining n−2 items. n−2 choices.
• …
• Position $\#r$: any of the remaining n−r+1 items. n−r+1 choices.
Multiply the r factors:
P(n,r)=n×(n−1)×(n−2)×⋯×(n−r+1)
This product equals n!/(n−r)! because the r factors are exactly the top r terms of n!, with the bottom n−r terms canceled by the (n−r)! in the denominator.
The tool visualizes the equivalent factoring: fix the first item (n ways), then arrange r−1 of the remaining n−1 items in order ((n−1)!/(n−r)! ways). Every row in the completed section is one of those n first-item families.
Related Concepts
Full permutation — the case r=n, where every item from the source set is used. Formula P(n,n)=n!.
Permutation with repetition — relaxes the no-reuse rule, allowing the same item in multiple positions. Formula nr, which is larger than P(n,r).
Permutation with identical items — handles a source set where some items are indistinguishable. Divides n! by the factorial of each repeat group's size.
Circular permutation — arrange items around a circle where rotations are identical. Formula (n−1)!.
Combination — the unordered companion of the partial permutation. Drops the order requirement, so C(n,r)=P(n,r)/r!.
Multiplication principle — the foundational counting rule that produces P(n,r) as the product of choices at each successive position.
Combinatorics calculator — to compute P(n,r) for arbitrary values of n and r, see the partial permutation calculator.