Aptitude

ShareBefore we start our main topic it is important that we cover the concept of factorial. If you know what a factorial is and how to find the factorial of a number then you can skip few paragraphs and go straight to Permutations. If you don’t know what factorial is then go through the next few paragraphs. And if you know about factorial and what to revise the topic then keep reading.

Factorial is an important topic in math and computer and in many other disciplines and not too hard to understand so let’s start.

If n is a positive number then the product of the numbers from 1 to n is called the factorial of n and it is denoted as n!

We can write it as n! = 1 x 2 x 3 x … x n

So if we are asked to find the factorial of 3 then we will write 3! = 1 x 2 x 3 = 6.

Similarly, if we are asked to find the factorial of 6 then we will write 6! = 1 x 2 x 3 x 4 x 5 x 6 = 720.

See I told you it’s not tough at all.

Now to solve problems of permutations and combinations we will be using a lot of factorials so it’s important for you to memorize the following table of factorial

n | n! |

1 | 1 |

2 | 2 |

3 | 6 |

4 | 24 |

5 | 120 |

6 | 720 |

7 | 5040 |

8 | 40320 |

9 | 362880 |

10 | 3628800 |

Each of the different ARRANGEMENTS which can be made by taking some or all of the given number of things is called a permutation.

Permutation is generally denoted by P.

Let’s take an example. Say we have three digits 1, 2 and 3 and we have to form all possible 3 digits number using these digits without repeating any digit in a number. If you look at the problem you will notice that the problem is asking you to find all the possible arrangements using the three digits. So let’s visualize the problem. We have three places and three digits. Let’s mark these places as A, B and C.

[ A | B | C ]

Without repeating any digit in a number we will get the following 3-digit numbers

123

132

213

231

312

321

How we got the numbers? Well… We can fill the first place i.e., A with any one of the 3 digits. Once A is filled with any one of the digits we are left with 2 digits. So B can be filled with 2 digits. And once B is filled, we are left with C which is filled with the remaining 1 digit.

In short

We can fill the first place A with any one of the 3 digits.

We can fill the second place B with any one of the 2 digits.

And we can fill the third place C with the remaining 1 digit.

Hence total possible arrangements we can have = 3x2x1 = 6

Mathematically, if we want to find the number of permutations of n different things taken r at a time where r <= n.

We can write this as, nPr = n! / (n-r)!

Let’s look at another example.

How many different numbers of four digits can be formed with the digits 1, 2, 3, 4, 5, 6 if none of the digits is repeated in any one of the numbers?

This question is asking us to find all possible arrangements i.e., permutation. We have 6 digits so n = 6. And we have to form 4 digits numbers. So r in this case is 4. Hence we need to find the number of permutations of 6 different things (digits) taking 4 at a time.

So we can write this as 6P4 = 6! / (6-4)! = 360.

Therefore, we can have 360 different numbers.

**Q. How many different three digits numbers can be formed with the digit 0, 1, 2, 3 if none of the digits is repeated in any one of the numbers?**

A. This question is asking us to find the permutation of 4 digits taken 3 at a time.

Using the formula of permutation we get,

4P3 = 4! / (4-3)! = 24

But unfortunately this is a wrong answer!

I mean there is nothing wrong with the calculation but the approach is incorrect.

Let’s find out.

We have 4 digits 0, 1, 2 and 3

We need to form 3 digits number, so we have 3 places to fill. Let’s proceed like we did in the above example.

[ A | B | C ]

Now tell me with how many digits can you fill the first place A?

If your answer is 4 then you are wrong. Let me tell you why. If we fill A with 0 then we will get a two digit number not three. So we cannot fill the first place with 0 but we can fill it by the remaining 3 digits.

So,

We can fill the first place A with anyone of the 3 digits.

We can fill the second place B with anyone of the 3 digits.

(Why 3? Well… we already used a digit in the first place so we are left with 3 digits out of 4)

We can fill the third place C with anyone of the 2 digits.

So total number of permutations = 3 x 3 x 2 = 18.

And the numbers are

102, 103, 120, 123, 130, 132

201, 203, 210, 213, 230, 231

301, 302, 310, 312, 320, 321

**Q. How many different 4 digits numbers can be formed using the digits 1, 2, 3, 4, 5, 6 if none of the digits is repeated in any of the numbers and each number starts with 1?**

A. In this case we are asked to find the permutation of 6 digits taken 4 at a time. So we have 6 digits and 4 places to fill and it is also mentioned that each number starts with 1 i.e., the first place is already occupied. So we now have 3 places to fill and 5 digits to fill with. This means we actually have to find the permutation of 5 digits taken 3 at a time.

So the format of our 4 digit number looks something like this

[ 1 | A | B | C ]

And we can fill the second place that is A with anyone of the 5 digits

We can fill the third place i.e., B with anyone of the 4 digits

And we can fill the fourth place i.e., C with anyone of the 3 digits

So total number of permutations = 5 x 4 x 3 = 60

If you use the permutation formula you would get the same result.

5P3 = 5! / (5-3)! = 60

Let’s take one more question

**Q. How many different 4 digits numbers can be formed using the digits 1, 2, 3, 4, 5, 6 if none of the digits is repeated in any of the numbers and each number starts with 1 and ends with 6?**

A. In this case we are asked to find the permutation of 6 digits taken 4 at a time. So we have 6 digits and 4 places to fill and it is also mentioned that each number starts with 1 i.e., the first place is fixed and it is also mentioned that the numbers ends with 6 i.e., the last place is also fixed. So we now have 2 places to fill and 4 digits to fill with. This means we actually have to find the permutation of 4 digits taken 2 at a time.

So the format of our 4 digit number looks something like this

[ 1 | A | B | 6 ]

And we can fill the second place that is A with anyone of the 4 digits

And we can fill the third place i.e., B with anyone of the 3 digits

So total number of permutations = 4 x 3 = 12

Using the permutation formula we would get the same result.

4P2 = 4! / (4-2)! = 12

**Q. In how many ways can the letters of the word “FRIDAY” be arranged so that vowels always remain together? The vowels are never together? Given that the letters are not repeated in each arrangement.**

A. In this problem we have to find the permutation of 6 letters take 6 at a time.

So we have 6 places and 6 letters to fill those places.

The vowels in the word FRIDAY are A and I.

The consonants in the word FRIDAY are D, F, R and Y.

Now according to first part of the question, we have to form all possible words by arranging the 6 letters in such a way that the vowels are always together.

Let’s consider the 2 vowels as one single letter say X. So, now we have 5 letters i.e., 4 consonants and 1 vowel. This means we have 5 places and 5 letters to fill those places.

Number of permutations of 5 letters taken 5 at a time is 5P5 = 5! = 120

Now in each of these 120 words the 2 vowels that we considered as X can be arranged among themselves in 2P2 ways = 2

Therefore, total number of arrangements in which the vowels will always remain together is 120 x 2 = 240.

Now according to the second part of the question we need to find the total number of arrangements in which the vowels are never together. For this we have to first find the total number of different words that can be formed using the 6 letters.

Number of permutations (arrangements) of 6 letters taken 6 at a time is 6P6 = 6! = 720.

Now from the first part of the question we have seen that we can have total 240 words in which the vowels are always together. So if we subtract this number with the total number of words we will get what we are looking for.

Therefore, total number of words in which the vowels are never together = 720 – 240 = 480.

Let’s take another question.

**Q. If 4 boys and 3 girls are to be seated for dinner such that no two girls sit together and no two boys sit together. Find the number of ways in which they can be seated?**

A. According to the question we have, 4 boys and 3 girls. This means we have 7 chairs and 7 persons.

If we number the chairs as 1, 2, 3, 4, 5, 6 and 7 and ask the girls to seat only on the even numbered chairs and ask the boys to seat only on the odd numbered chair then in that case none of the two girls will be seated together and none of the two boys will be seated together and we will have the following arrangement in general

BGBGBGB

Where B represents a boys and G represents a girl.

So, 3 girls can occupy 3 places in 3P3 ways = 6

And 4 boys can occupy 4 places in 4P4 ways = 24

Therefore, the required number of arrangements = 6 x 24 = 144

- Node.js - URL module Node.js
- Node.js - Create web server using http module Node.js
- Node.js - Event Emitter Node.js
- Node.js - How to write file in Node.js using fs module Node.js
- Node.js - How to read file in Node.js using fs module Node.js
- ES6 - Arrow Function ES6 JavaScript
- PostgreSQL - ALTER Table PostgreSQL
- PostgreSQL - DROP Table PostgreSQL
- PostgreSQL - Database PostgreSQL
- PostgreSQL - CREATE Table PostgreSQL