UPI Study › Courses › Discrete Mathematics › Free lessons › Lesson 5.4 Free with a free account
Permutations and Ordered Arrangements
Discrete Mathematics · Chapter 5: Counting Methods and Basic ProbabilitySection 5.4 · lesson 30 of 879 min · free with a free account
Free preview
Create a free account to keep watching
It takes a minute and costs nothing. Your free account unlocks all of Chapter 1 and 3 more lessons of Discrete Mathematics.
Lesson complete
Earn the 4 college credits for Discrete Mathematics
Enrolling adds a quiz after each lesson, the graded work and the official transcript. Recommended for credit by NCCRS.
Next lesson: Probability of Permutation Events →← The Pigeonhole PrincipleNext lesson: Probability of Permutation Events →
In this lesson
Counting arrangements in which order matters.
- Use factorial notation to count full orderings
- Derive and apply the permutation formula
- Adjust the count when some items are identical
- Choose the right formula for a scenario
Transcript
Everything said in the video, section by section (1,275 words). Read along, or search it.
Counting Methods and Basic Probability
Permutations and Ordered Arrangements
This section counts arrangements in which order matters. They're called permutations. We'll build factorial notation, then a general formula for arranging some of a collection, and then the adjustment needed when some items can't be told apart. Everything here is about the counts themselves. Turning counts into probabilities comes in section five point five.
The Opening Problem
Every Ordering, or Just the Top 3?
A continuous integration pipeline queues up six independent verification checks, with no dependencies between them. The order they run in shows up in the build log. How many distinct run orders are possible, for all six checks? A related but different question comes from a hackathon. It awards distinct first, second, and third place prizes among nine teams. How many ways can just those three placements be handed out, in order, without accounting for every other team's position? The first question asks for every ordering of a whole collection. The second asks for ordered ways to pick out and arrange only part of it. Both are answered by permutations. Counts of arrangements, in which order matters.
Factorial Notation
Counting All Possible Orderings
Start with arranging all n items of a group of distinct items, every check in some order, with none left out. Fill the sequence one position at a time, using the multiplication rule from section five point two. There are n choices for the first position. Once that's made, n minus one items remain for the second. Then n minus two for the third, and so on, down to one choice for the last. The product of all those counts is called n factorial, written n with an exclamation mark. It's the number of orderings of n distinct items. By convention, zero factorial is one. There's exactly one way to arrange zero items. The empty arrangement. So the six pipeline checks have six factorial run orders. Six times five times four times three times two times one, which is seven hundred twenty.
Ordering a Subset
Stop After r Positions
The hackathon question is different in kind. Only three placements are filled, out of nine teams. The six teams outside the top three don't appear in the count at all. Filling just r positions out of n distinct items works the same way. n choices for the first position, n minus one for the second, and so on, stopping after r positions. The r-th position has n minus r plus one choices left. So the product has exactly r consecutive descending terms. Now multiply and divide that product by n minus r factorial, the product of everything from n minus r down to one. That doesn't change the value. But the top now runs all the way down to one, so it's n factorial. The result is n factorial over n minus r factorial.
Theorem
The Permutation Formula
That's the permutation formula. The number of ordered arrangements of r items, chosen from n distinct items, is written n P r. It equals n factorial, over n minus r factorial, for r from zero up to n. When r equals n, it gives n factorial over zero factorial, which is n factorial over one. That's just n factorial, consistent with before. And that's exactly why zero factorial is defined to be one, rather than left undefined. Without that convention, the formula would break down right at the boundary case, r equals n.
Worked Example 2
3 Ordered Prizes Among 9 Teams
Now the hackathon. Here n is nine and r is three. Nine P three is nine factorial over six factorial. Everything from six down cancels, leaving nine times eight times seven, which is five hundred four. So there are five hundred four distinct ways to award the three placements. The same picture works with eight teams. Eight choices for first place, seven remaining for second, and six for third. And the other five teams play no role in the count at all. Setting r equal to n would fill every position, and reduce the formula to plain n factorial.
Checking in Code
Factorial and Permutation, Built In
Python's built-in functions confirm both hand computations. The factorial of six prints seven hundred twenty, the number of run orders for all six checks. The perm function, with nine and three, prints five hundred four, the ordered placements of three of nine teams. And computing nine factorial divided by six factorial directly gives five hundred four as well, matching the perm function.
Repeated Objects
When Items Aren't All Distinguishable
Both the factorial count and the permutation formula assume every item is distinguishable from every other. Swapping any two always gives a visibly different sequence. That assumption fails when a collection has duplicates. Suppose a queue of six tasks has two identical lint tasks, three identical test tasks, and one unique deploy task. Treat all six as temporarily distinguishable, by mentally labeling the duplicates. Lint one, lint two, test one, test two, test three. That gives six factorial, seven hundred twenty labeled orderings. But many of those look identical once the invented labels are dropped. Swapping lint one and lint two changes nothing that's actually visible in the queue. For a fixed visible arrangement, the two lint tasks can be relabeled in two factorial ways. And independently, the three test tasks in three factorial ways. So every visible arrangement was counted two factorial times three factorial, which is twelve times over.
Figure 2
2 Labelings, 1 Visible Queue
This picture shows the collapse for one visible queue. The top two rows are labeled orderings. They differ only in which lint task comes first, highlighted in gold. Drop the labels, and both become the same visible queue at the bottom. Lint, test, lint, deploy, test, test. Count all the relabelings, two factorial for the lint tasks and three factorial for the test tasks, and twelve labeled orderings collapse onto each visible one.
Theorem and Worked Example 3
Permutations of a Multiset
That gives the formula for permutations of a multiset. Take n items made of k groups of identical items, with sizes n one through n k, adding up to n. The number of distinguishable orderings is n factorial, divided by the product of each group's factorial. Dividing by each group's factorial removes exactly the overcounting caused by treating that group's identical items as distinct. For the task queue, n is six, and the group sizes are two, three, and one. That's seven hundred twenty over two times six times one, which is seven hundred twenty over twelve, or sixty. So there are sixty distinguishable orderings. Far fewer than the seven hundred twenty counted by treating every task as distinct.
Summary Table
Choosing the Right Formula
This table sorts out which formula to use. If every item is used, and all are distinct, it's n factorial. If only r of the n distinct items are arranged, it's n P r, n factorial over n minus r factorial. And if every item is used, but there are groups of duplicates, divide n factorial by each group's factorial. These formulas count arrangements only. Turning a count into a probability is section five point five, and arranging items around a circle is section five point six.
Takeaways
Order Matters - and So Do Duplicates
To summarize. n factorial counts the orderings of n distinct items. And zero factorial is one, chosen so that later formulas stay consistent at their boundary cases. n P r counts ordered arrangements of r items out of n distinct items. It's the same position-by-position count, stopping after r positions. Setting r equal to n gives back n factorial. Both assume every item is distinguishable from every other one. When there are groups of identical items, treating them as distinct overcounts. Dividing by each group's factorial removes exactly that overcount. Here's something to think about. A student counts the task queue's orderings as six P six, which is seven hundred twenty. They reason that n P r counts ordered arrangements. Explain precisely why seven hundred twenty overcounts. Which assumption built into n P r does this scenario violate? And what should the correct count be?
About Discrete Mathematics at UPI Study
Discrete Mathematics (Math 230) is a self-paced online course of 87 video lessons in 13 chapters, from logic and proof to counting, probability, graph theory and trees. It carries a NCCRS credit recommendation for 4 semester credits.
Every lesson transcript is free on pages like this one, and the videos are free with a free UPI Study account. Enrolling adds a practice quiz after each lesson, the graded work and final exam that earn the credit, lifetime access, and an official transcript on completion. UPI Study has helped over 130,000 students with college credits. ACE and NCCRS have over 2,100 cooperating colleges that will consider accepting credits; the final decision is with the universities.
Enroll now → Course details Download the syllabus Every course with PRO →
Why take it here
Why students take Discrete Mathematics with UPI Study
Where the credit goes
Universities that work with NCCRS
Discrete Mathematics carries a NCCRS credit recommendation. These universities work with NCCRS; some are UPI Study's signed partners. ACE and NCCRS have over 2,100 cooperating colleges that will consider accepting credits; the final decision is with the universities.
Thomas Edison State UniversitySigned partner
University of the PeopleSigned partner
Charter Oak State CollegeSigned partner
Strayer UniversitySigned partner
Columbia Southern UniversitySigned partner
Indiana TechSigned partner
Penn StateWorks with NCCRS
Southern New Hampshire UniversityWorks with NCCRS
SUNYWorks with NCCRS
+many more cooperating universitiesFind my college →Find my college → Not listed? Ask Athena in the corner of this page, or book a 15-minute call.
FAQ
Questions students ask us
About Permutations and Ordered Arrangements
What is a permutation, and what does n factorial count?
How do you derive and use the permutation formula _nP_r?
How do you count arrangements when some items are identical?
How do I decide whether to use n!, _nP_r, or the formula for identical items?
About the Discrete Mathematics course
How many college credits is Discrete Mathematics?
How much does Discrete Mathematics cost and what is included?
Which universities accept UPI Study credits?
How long does Discrete Mathematics take?
How are the exams done?
How do my credits reach my college?
Ready for the full course? Earn 4 credits in Discrete Mathematics.
87 video lessons, a quiz after each one, and the graded work that earns the credit. Recommended for credit by NCCRS.
4 credits · NCCRSEnroll →