**Prerequisite – **Permutation and Combination, Permutations | Set 1

**Formula’s Used :**

P(n, r) = n! / (n-r)!

**Example-1 :**

How many words can be formed from the letters of the word WONDER, such that these begin with W and end with R?

**Explanation :**

If we fix W in the beginning and R at the end,

then the remaining 4 letters can be arranged in ^{4}P_{4 }ways.

Thus, the total number of words which begin with W and end with R

=^{4}P_{4 }= 4! = 24

**Example-2 :**

How many numbers are there between 1000 and 10000 in which all the digits are distinct?

**Explanation :**

We need to form all possible 4-digit numbers with distinct digits as a number between 1000 and 10000 has 4 digits.

At the thousand’s place, we cannot have 0. So, thousand’s place can be filled with 9 ways.

Now, hundred’s place can be filled with any of the remaining 9 digits in 9 ways.

Similarly, tens and units place can be filled in 8 ways and 7 ways respectively as repetition is not allowed.

Thus, total number of required numbers

= 9 * 9 * 8 * 7 = 4536

**Example-3 :**

How many numbers divisible by 4 and lying between 400 and 500 can be formed from the digits 1, 2, 3, 4, 5, 6, and 7?

**Explanation :**

A number between 400 and 500 must have 4 at the hundred’s place.

Also, the number is divisible by 4 so it must have 4 at the unit’s place.

Now the tens place can be filled in 7 ways.

Thus, the total number of required numbers

= 1 * 7 * 1 = 7

**Example-4 :**

How many numbers are there between 1000 and 10000 such that every number is either of 1, 2, or 3?

**Explanation :**

Every number between 1000 and 10000 is a 4-digit number.

We need to determine the total number of 4 digit numbers such that every digit is either 1, 2, or 3.

For this, each one of thousand’s, hundred’s, ten’s and unit’s place can be filled in 3 ways.

Thus, the total number of required numbers

= 3 * 3 * 3 * 3 = 81

**Example-5 :**

Tomorrow is Rahul’s birthday and he wants to invite 5 of his friends. He has 4 servants to carry the invitation cards. In how many ways can he send invitation cards to his friends?

**Explanation :**

A card can be sent by any one of four servants.

Total number of ways of sending a card to 1st friend = 4

Similarly, cards can be sent to each of the 5 friends in 4 ways.

Thus, the total ways of sending cards

= 4 * 4 * 4 * 4 * 4 = 4^{6}

Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the **CS Theory Course** at a student-friendly price and become industry ready.