Show that the permutation \([n, n-1, \ldots, 2,1]\) has \(n(n-1) / 2\) inversions.

Short Answer

Expert verified
The permutation \([n, n-1, \ldots, 2,1]\) has \(\frac{n(n-1)}{2}\) inversions.

Step by step solution

01

Analyzing the permutation

The given permutation is \([n, n-1, \ldots, 2,1]\). This permutation is in decreasing order. This means that for each number in the permutation, all the numbers after it are smaller. So, each number forms an inversion with every number that comes after it in the sequence.
02

Counting inversions for each number

Considering each number in the permutation, the number n has \(n-1\) numbers after it, hence \(n-1\) inversions. The number \(n-1\) has \(n-2\) numbers after it, hence \(n-2\) inversions. This pattern continues until the number 2, which has 1 number after it, hence 1 inversion. The number 1 has no numbers after it, hence it forms 0 inversions.
03

Total inversions

The total inversions in the permutation is therefore the sum of all the inversions caused by each number. This sum is given by \((n-1) + (n-2) + \ldots + 1\), which is a sum of an arithmetic series. The formula to find the sum of an arithmetic series is \(\frac{(firstTerm + lastTerm) \cdot numberOfTerms}{2}\). The first term in our case is \(n-1\), the last term is 1, and the number of terms is \(n-1\). Plugging these values into the formula, we get \(\frac{(n-1 + 1) \cdot (n-1)}{2}\), which simplifies to \(\frac{n(n-1)}{2}\).
04

Conclusion

So, the number of inversions in a permutation \([n, n-1, \ldots, 2,1]\) is indeed \(\frac{n(n-1)}{2}\). This completes our proof.

Unlock Step-by-Step Solutions & Ace Your Exams!

  • Full Textbook Solutions

    Get detailed explanations and key concepts

  • Unlimited Al creation

    Al flashcards, explanations, exams and more...

  • Ads-free access

    To over 500 millions flashcards

  • Money-back guarantee

    We refund you if you fail your exam.

Over 30 million students worldwide already upgrade their learning with Vaia!

One App. One Place for Learning.

All the tools & learning materials you need for study success - in one app.

Get started for free

Most popular questions from this chapter

See all solutions

Recommended explanations on Computer Science Textbooks

View all explanations

What do you think about this solution?

We value your feedback to improve our textbook solutions.

Study anywhere. Anytime. Across all devices.

Sign-up for free