A **permutation** is a collection or a combination of objects from a set where the order or the arrangement of the chosen objects does matter. In other words, a **permutation is an arrangement of objects in a definite order**. So before deep dive into permutation let’s have a brief discussion on factorial first.

**Factorial**

- Factorial of a natural number n is denoted by the notation n!
- n! is the product of all natural numbers starting from 1 till n, including 1 and n.

i.e. n × (n-1) × (n-2) × (n-3) . . . × 1

**Example:**

If n = 33! = 3 × 2 × 1 = 6

If n = 55! = 5 × 4 × 3 × 2 × 1 = 120

If n = 11! = 1

Note:The factorial of 0 is defined as 1 by conventioni.e.0! = 1

**Why Use Factorial?**

The main use of factorial is counting the number of permutations (number of ways of arranging some objects). Let us understand this with examples.

**Examples**

**Question 1. A class has just 3 seats vacant. Three people P, A, and R arrive at the same time. In how many ways can P, A, and R be arranged on those 3 vacant seats?**

**Solution:**

For the very first seat, we have3 choicesi.e. P, A and R.Let us randomly select A for the first seat.

For the second seat, we have2 choicesi.e. P and RLet us randomly select R for the second seat.

For the third seat, we have1 choicei.e. P

To summarize, we did the following:Placed a person on seat 1andplaced a person on seat 2andplaced a person on seat 3.

Usage of and comes from the fact that occupation of all 3 seats was mandatory.

In mathematics, and is related with multiplication, hence we can say that total choices = 3 × 2 × 1 = 3!

If we change the seating order to P on the first seat, A on the second seat, and R on the third, does that change the total number of choices?

No, it does not. This is because equal importance is given to all three P, A, and R.

**Question 2. Find the number of ways of arranging 5 people if 2 of them always sit together?**

**Solution:**

Let us consider the 2 people as a unit and the remaining 3person as 3 separate units, So we have total 4 units.

The number of ways of arranging these 4 units is 4!(just the way we proved in previous problem)The number of ways of arranging the 2 person amongst themselves is 2!

In conclusion, the number of ways of arranging the 4 units and 2 person amongst themselves is 4! × 2!

**Question 3. **Find all the three-letter words beginning and ending with a vowel. Given that repetition of alphabets is not allowed.

**Solution:**

Total vowels in english = 7 ( a, e, i, o, u, y, w)Total consonants in english = 26 – 7 = 19

1.The choices for the first letter are 72.The choices for the third letter are 6(since 1 vowel was placed as first letter)3.The choices for the middle letter are 19 + (7 – 2) = 24(19 consonants + the vowels which were not placed)

Hence total permutations are 7 × 6 × 24 = 1008

Do observe that here we first satisfied the vowel conditionfor first and third letter and then placed the middle letter.

**Permutation**

- If n objects are available and we arrange all, then every arrangement possible is called a permutation.
- If out of n available objects, we choose r and arrange them. Then every possible arrangement is called an r – permutation.
- In permutation the order of objects matters.

In permutation, we primarily deal with four kinds of problems

**Permutation with repetition****Permutation without repetition****r – permutation without repetition****r- permutation with repetition**

**Permutation With Repetition**

This is the simplest of the lot. In such problems, the objects can be repeated. Let’s understand these problems with some examples.

**Examples**

**Question 1. How many 3 digit numbers greater than 500 can be formed using 3, 4, 5, and 7?**

**Solution:**

Since a three-digit number, greater than 500 will have either 5 or 7 at its hundredth place, we have2 choicesfor this place.

There is no restriction on repetition of the digits, hence for the remaining 2 digits we have4choiceseach

So the total permutations are: 2 × 4 × 4 = 32

**Question 2. How many even numbers lying between 1000 and 2000 can be formed using the digits 1, 2, 4, 5, and 9?**

**Solution:**

Since the number is supposed to be even, the digits at units place must either be 2 or 4 leaving us with2 choicesfor the digit at units place.

The number is supposed to lie between 1000 and 2000, So the digits at thousand’s place must be 1, we thus have1 choicefor the digit at thousands place.

Rest of the 2 digits can be any one from 1, 2, 4, 5 and 9 i.e.5 choiceseach

So the total permutations are: 2 × 5 × 5 × 1 = 50

**Permutation Without Repetition**

In this class of problems, the repetition of objects is not allowed. Let’s understand these problems with some examples.

**Examples**

**Question 1. How many 3-digit numbers divisible by 3 can be formed using digits 2, 4, 6, and 8 without repetition?**

**Solution:**

For a number to be divisible by 3, the sum of it digits must be divisible by 3

From the given set, various arrangements like 444 can be formed but since repetition isn’t allowed we won’t be considering them.

We are left with just 2 cases i.e. 2, 4, 6 and 4, 6, 8

The number of arrangements are 3! in each case

Hence the total number of permutations are: 3! + 3! = 12

**Question 2.** **How many 4 digit numbers divisible by 5 can be formed using 0, 3, 5, 7, and 9 if repetition of digits is not allowed?**

**Solution:**

For the number to be divisible by 5, the digit at units place must either be 0 or 5, hence we have 2 possibilities.

Case 1.The digit at units place is 0There are 4 choices for 10^{3}place (all numbers except 0)There are 3 choices for the 10^{2}place (1 got used up at 10^{3}place)There are 2 choices for the 10^{1 }place (1 got used up at 10^{3}place and 1 at 10^{2}place)

Hence the possible arrangements with 0 at units place are4 × 3 × 2 = 24

Case 2.The digit at units place is 5There are 3 choices for 10^{3}place (all except 0 and 5)There are 2 choices for 10^{2}place (1 got used up at 10^{3}place)There is 1 choice for 10^{1}place (1 got used up at 10^{3}place and 1 at 10^{2 }place)

Hence the possible arrangements with 5 at units place are 3 × 2 × 1 = 6

Total arrangements = Number of arrangements in case 1 + Number of arrangements in case 2= 24 + 6 = 30

**r – Permutation Without Repetition**

This is when we arrange just r objects out of n objects without repetition. Let us understand this with an example.

**Example. An ice-cream shop has 10 flavors of ice cream. Find the number of ways of preparing an ice cream cone with any 3 different flavors?**

**Solution:**

Let us consider n = 10 (total number of flavors) and r = 3 (number of different flavors needed)

For first flavor we have 10 choicesFor second flavor we have 10 – 1 choicesFor third flavor we have 10 – 2 choices and this is same as (n – r + 1)

The numbers of arrangement would be: 10 × (10 – 1) × (10 – 3 + 1) = 720

From this we can generalize that, the number of ways of arranging r objects out of n different objects is:n × (n – 1) . . . (n – r + 1) =^{n}P_{r}

**Permutation Formula ( **^{n}P_{r })

^{n}P

_{r })

From the previous example, we understood that_{r}^{n}P_{r}= n × (n – 1) . . . (n – r + 1)

Multiplying and Dividing by (n – r)!^{n}P_{r}= n × (n – 1) × (n – 2) × . . . × (n – r + 1) × (n – r)! / (n – r)!

^{n}P_{r}= n × (n – 1) × (n – 2) × . . . × (n – r + 1) × (n – r) × (n – r – 1) × . . . × 1 / (n – r)!

^{n}P_{r}= n! / (n – r)! where 0 ≤ r ≤ n

**Question** **1. Find ^{6}P_{3}?**

**Solution:**

As per the above formula:^{6}P_{3}= 6! / (3!) = 6 × 5 × 4 = 120

**Question 2. 10 Olympians are running a race. Find the different arrangements of 1 ^{st}, 2^{nd,} and 3^{rd} place possible?**

**Solution:**

We have to find different arrangements of 10 taken 3 at time.Here n = 10r = 3

^{10}P_{3}= 10! / (7!) = 10 × 9 × 8 = 720

**Question 3.** **Find n if ^{n}P_{2} = 12?**

**Solution:**

^{n}P_{r}= n! / (n – r)!^{n}P_{2}= n! / (n – 2)!= n × (n – 1) × (n – 2)! / (n – 2)!= n × (n – 1)= n^{2}– n

∴ n^{2}– n = 12

Solving the equation,n^{2}– n – 12 = 0n (n – 4) + 3 (n – 4) = 0(n + 3) (n – 4) = 0∴ n = -3 or n = 4

∵ n ≥ 0, n = 4

**r – Permutation With Repetition**

This can be thought of as the distribution of n objects into r boxes where the repetition of objects is allowed and any box can hold any number of objects.

The 1^{st}box can hold n objectsThe 2^{nd}box can hold n objectsThe 3^{rd}box can hold n objects. .. .. .The r^{th}box can hold n objects

Hence total number of arrangements are:n × n × n . . . (r times)= n^{r}

**Question 1. A police officer visits the crime scene 3 times a week for investigation. Find the number of ways to schedule his visit if there is no restriction on the number of visits per day?**

**Solution:**

The number of ways to schedule first visit is 7 (any of the 7 days)The number of ways to schedule second visit is 7 (any of the 7 days)The number of ways to schedule third visit is 7 (any of the 7 days)

Hence, the number of ways to schedule first and second and third visit is 7 × 7 × 7 = 7^{3}= 343

**Question 2. In how many ways can 6 prisoners be placed in 4 cells if any number of prisoners can fit in a cell?**

**Solution:**

The 1^{st}prisoner can be sent to any of the 4 cellsThe 2^{nd}prisoner can be sent to any of the 4 cells. .. .. .The 6^{th}prisoner can be sent to any of the 4 cells

The total arrangements are:4 × 4 × 4 . . . (6 times) = 4^{6}

**Permutation-Combination Relationship**

Permutation | Combination |
---|---|

A permutation is a way of arranging some objects. | A Combination is a way of selecting objects. |

In permutation the order matters | In Combination, the order does not matter |

The permutation of n objects taken r at a time is denoted by | The combination of n objects taken r at a time is denoted by |

**Relation Between **^{n}P_{r} & ^{n}C_{r}

^{n}P

_{r}&

^{n}C

_{r}

We can understand^{ n}C_{r}through the following analogy

Consider that we have n distinct boxes and r identicalballs. (n > r)

The task is to place all the r balls into boxes such that nobox contains more than 1 ball.

Had the balls been distinct, this was a problem ofr – permutation without repetition and then theanswer was^{n}P_{r }as discussed earlier.

But since all r objects are same, the r! ways of arranging themcan be considered as a single way.

To group all r! ways of arranging, we divide^{n}P_{r}by r!

^{n}C_{r}=

**Hence the relation between **^{n}P_{r} & ^{n}C_{r} is:

^{n}P

_{r}&

^{n}C

_{r}is:

^{n}C_{r} =

^{n}C

_{r}=

### Examples

**Question 1. How many 4-letter words, with or without meaning can be formed out of the letters of the word, ‘SATURDAY’ if repetition of letters is not allowed?**

**Solution:**

The word SATURDAY has 8 letters i.e. S, A, T, U, R, D, A, and Y

To form 4-letter words, we first have to select 4 letters from these 8 letters

The ways of selecting 4 letters from 8 letters disregarding the order is^{8}C_{4}.

After selection, there are 4! arrangements.

Hence, total number of words formed are:^{8}C_{4}× 4!

Note:Selecting r objects out of n objects and then arranging them is same as r-permutation of n objects.So the above result can be directly obtained using^{n}P_{r}formula where n = 8 and r = 4

**Question 2.** **Find the number of ways of selecting 6 balls from 4 red, 6 blue, and 5 white given that the selection must have 2 balls of each color?**

**Solution:**

We need to select 2 balls each of color red, blue and white as per the given condition.

The number of ways of selecting 2 red balls is^{4}C_{2}The number of ways of selecting 2 blue balls is^{6}C_{2}The number of ways of selecting 2 white balls is^{5}C_{2}

Hence, the total ways of selection are^{4}C_{2}×^{6}C_{2}×^{5}C_{2 }= 900

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the **DSA Self Paced Course** at a student-friendly price and become industry ready.