Mathematics | PnC and Binomial Coefficients

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.

Permutation –

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 r elements of a set is called an r-permutation. It is represented as P(n,r).
For 1\leq r\leq n,

     \begin{flalign*} P(n,r) &= n * (n-1) * ... * (n-r+1)\\ &= \frac{n * (n-1) * ... * (n-r+1) * (n-r) *...* 2 * 1}{(n-r) * (n-r-1) * .... * 2 * 1}\\ &= \frac{n!}{(n-r)!} \end{flalign*}

The above formula for P(n,r) 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 P(n,n) = n! where n = 12. But since the letter ‘I’ repeats 4 times, the number of permutations are less. This is because the permuation 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 P(r,r) where r is the number of times a letter or object is repeated.
    Total number of arrangements = \frac{P(12,12)}{P(4,4)} = \frac{12!}{4!} =  19958400

Combination –

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 r elements from a set is called an r-combination. It is represented as C(n,r) and \binom{n}{r}.
Since a combination is just a permutation without order, the number of r-combination can be expressed in terms of r-permutation.
The r-permutation can be obtained by first obtaining the r-combination and then ordering the elements in each r-combination, which can be done in P(r, r) ways.
 \therefore P(n,r) = C(n,r) * P(r,r)\\
which gives us-

     \begin{flalign*} C(n,r) &= \frac{P(n,r)}{P(r,r)}\\ &= \frac{n!}{(n-r)!} * \frac{1}{r!}\\ &= \frac{n!}{r!(n-r)!}& \end{flalign*}

  • Example 1 – Determine the number of ways in which 5 cards can be chosen from a deck of 52 cards, such that there is exactly one ace.
  • Solution – Out of the 4 aces, one can be chosen in \binom{4}{1} = 4 ways.
    The remaining 4 cards have to be chosen from the remaining 48 cards. Number of ways of choosing these 4 cards is \binom{48}{4} = 194580.
    Total number of ways of choosing 5 cards by product rule = \binom{4}{1} * \binom{48}{4} = 4 * 194580 = 778320.

  • Example 2 – A polygon has 44 diagnols. Find the number of its sides.
  • Solution – A diagnol is a line which connects two non-adjacent vertices. If n is the number of vertices, then the number of pairs of non-adjacent vertices = \binom{n}{2} - n. n is subtracted since there are n sides.
    Therefore number of diagnols = number of non-adjacent vertices
    \frac{n(n-1)}{2} - n = 44
    On solving we get n = 11.

Binomial Coefficients –

The r-combinations from a set of n elements if denoted by \binom{n}{r}. 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 x and y be variables and n be a non-negative integer. Then

     \begin{flalign*} (x+y)^n &= \sum_{j=0}^{n} \binom{n}{j} x^{n-j}y^j\\ &= \binom{n}{0}x^{n} + \binom{n}{1}x^{n-1}y +...+ \binom{n}{n-1}xy^{n-1} + \binom{n}{n}y^{n} \end{flalign*}

  • Example 1 – What is the coefficient of x^{12}y^{13} in the expansion of (2x-3y)^{25}?
  • Solution – (2x-3y)^{25} = (2x+(-3y))^{25}.
    By the binomial theorem-
    (2x+(-3y))^{25} = \sum_{j=0}^{25}\binom{25}{j}(2x)^{25-j}(-3y)^j
    Since the power of y is 13, j = 13.
    Therefore the coefficient of x^{12}y^{13} is-

    \binom{25}{13}2^{12}(-3)^{13} = - \frac{25!}{13!12!}2^{12}3^{13}

  • Example 2 – Prove that \sum_{k=0}^{n} \binom{n}{k} = 2^n.
  • Solution – If we put x = 1 and y = 1 in the binomial theorem expression, we get-

    \\ (1 + 1)^n = \sum_{k=0}^{n}\binom{n}{k} 1^{n-k} 1^{k} = \sum_{k=0}^{n}\binom{n}{k}\\
    2^n = (1 + 1)^n = \sum_{k=0}^{n}\binom{n}{k}

  • Example 3 – Prove that \sum_{k=0}^{n} (-1)^{k}\binom{n}{k} = 0.
  • Solution – If we put x = -1 and y = 1 in the binomial theorem expression, we get-

    \\ ((-1) + 1)^n = \sum_{k=0}^{n}\binom{n}{k} (-1)^{n-k} 1^{k} = \sum_{k=0}^{n} (-1)^{k} \binom{n}{k}\\
    0 = 0^n = ((-1) + 1)^n = \sum_{k=0}^{n} (-1)^{k} \binom{n}{k}

  • Example 4 – Prove that \sum_{k=0}^{n} (2)^{k}\binom{n}{k} = 3^n.
  • Solution – If we put x = 1 and y = 2 in the binomial theorem expression, we get-

    \\ (1 + 2)^n = \sum_{k=0}^{n}\binom{n}{k} (1)^{n-k} 2^{k} = \sum_{k=0}^{n} 2^{k} \binom{n}{k}\\
    3^n = (1 + 2)^n = \sum_{k=0}^{n} 2^{k} \binom{n}{k}

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 or mail your article to 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.

GATE CS Corner    Company Wise Coding Practice

Recommended Posts:

0 Average Difficulty : 0/5.0
No votes yet.

Writing code in comment? Please use, generate link and share the link here.