Prerequisite – Combinatorics Basics
Several Counting problems require finding the number of ways to arrange a certain number of distinct elements, where the relative order of these elements matter, other problems focus on finding the number of ways of selecting a particular number of elements from a set, where the order of the elements does not matter. Both types of problems are similar except for one crucial difference, that difference is order.
A permutation of a set of distinct objects is an ordered arrangement of these objects. A permutation is often also referred to as an arrangement. The relative order of the elements matters in an arrangement.
An ordered arrangement of elements of a set is called an r-permutation. It is represented as .
The above formula for is a simple application of the product-rule.
- Example 1 – How many permutations of the string “ABCDEFGH” have the string “ABC” as a substring?
- Solution – For “ABC” to be a substring, the letters A,B, and C must occur as a block. If we consider that block and the remaining 5 letters as objects, we have a total of 6 objects to arrange.
Therefore the number of strings having “ABC” as their substring = 6! = 720.
- Example 2 – Find the number of permutations of the word “CIVILIZATION”.
- Solution – The word civilization has the following character frequency-
‘C’ – 1
‘I’ – 4
‘V’ – 1
‘L’ – 1
‘Z’ – 1
‘A’ – 1
‘T’ – 1
‘O’ – 1
‘N’ – 1
If all the characters were distinct, the number of permutations would be where = 12. But since the letter ‘I’ repeats 4 times, the number of permutations are less. This is because the permutation as a whole does not change if the ‘I’s’ are arranged amongst themselves. So to correct the number of permutations, we divide the total permutations by where is the number of times a letter or object is repeated.
Total number of arrangements =
A combination of a set of distinct objects is just a count of the number of ways a specific number of elements can be selected from a set of a certain size. The order of elements does not matter in a combination.
An unordered selection of elements from a set is called an r-combination. It is represented as and .
Since a combination is just a permutation without order, the number of -combination can be expressed in terms of -permutation.
The -permutation can be obtained by first obtaining the -combination and then ordering the elements in each -combination, which can be done in ways.
which gives us-
Binomial Coefficients –
The -combinations from a set of elements if denoted by . This number is also called a binomial coefficient since it occurs as a coefficient in the expansion of powers of binomial expressions.
The binomial theorem gives a power of a binomial expression as a sum of terms involving binomial coefficients.
Let and be variables and be a non-negative integer. Then
GATE CS Corner Questions
Practicing the following questions will help you test your knowledge. All questions have been asked in GATE in previous years or in GATE Mock Tests. It is highly recommended that you practice them.
Questions 1 and 2 are related.
1. GATE CS 2007, Question 84
2. GATE CS 2007, Question 85
3. GATE CS 2003, Question 4
4. GATE CS 2003, Question 5
Discrete Mathematics and its Applications, by Kenneth H Rosen
This article is contributed by Chirag Manwani. If you like GeeksforGeeks and would like to contribute, you can also write an article using write.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.