Permutations & Combinations - Nikhil Goyal


  • QA & DI Mentor | Ex TIME faculty | Co founder - Learn Quest


    Fundamental principle of counting

    Multiplication principle : Suppose an event E can occur in m different ways and associated with each way of occurring of E, another event F can occur in n different ways, then the total number of occurrence of the two events in the given order is m × n .

    Addition principle : If an event E can occur in m ways and another event F can occur in n ways, and suppose that both can not occur together, then E or F can occur in m + n ways.

    Example :

    There are 2 Distinct fruits and 3 vegetables available in the market. In how many ways you can pick either one fruit or one vegetable ?

    Suppose there are two fruits named (F1,F2) and you have to pick one
    You can either pick F1 or F2 i.e there are 2 ways to pick one fruit
    Similarly for vegetables (named V1, V2 and V3) ,there are three ways to pick one vegetables ,either V1 ,V2 or V3
    So total number of ways would be 2 + 3 = 5

    There are 2 Distinct fruits and 3 vegetables available in the market. In how many ways you can pick one fruit and one vegetable ?

    If you pick one fruit
    Suppose F1 then you would have three options to pick one vegetables
    Like
    F1 V1
    F1 V2
    F1 V3
    I.e 3 ways for fruit F1
    Similarly three ways for fruit F2
    F2 V1 , F2 V2 and F2 V3
    So for every fruit (2) we have three ways to select one vegetables
    I.e total number of ways = 2 * 3 = 6 ways

    There are 5 doors and 6 Windows in a house
    Q(1) In How many ways thief can enter in house ?
    Q(2) In How many ways thief can enter through door and exist through windows ?
    Q(3) How many ways thief can enter and exit ?

    Solutions:

    (I) Thief can enter in house ,either through doors or windows
    So 5 + 6 = 11 ways
    (ii) 5 * 6 = 30 ways
    (iii) Here possibilities are
    Thief can enter through door or window and similarly thief can exit through door or window
    I.e (5 + 6) * (5 + 6) = 11 * 11 = 121 ways

    Let's continue the same logic in arrangements

    How many 5 digit numbers can be formed from digits 1,2,3,4and 5 such that repetition is not allowed ?

    We have a 5 digit No.
    i.e. 5 spaces is to be filled.
    – – – – –
    The 1st place can be filled with any of the 5 digits
    I.e. in 5 ways (1,2,3,4,5)
    As repetition is not allowed
    The 2nd place in 4 ways
    The 3rd place in 3 ways
    The 4th place in 2 ways
    The 5th place in 1 way
    So, for these independent set of events, total no. of ways is 5 × 4 × 3 × 2 × 1 = 120
    Similarly if the repetition is allowed
    Then every space can be filled in 5 ways there is no constraint
    So total number of ways = 5 * 5 * 5 * 5 * 5 = 5^5

    How many numbers are there between 99 and 1000 having 7 in the units place?

    First note that all these numbers have three digits.
    7 is in the unit’s place.
    The middle digit can be any one of the 10 digits from 0 to 9. The digit in hundred’s place can be any one of the 9 digits from 1 to 9.
    Therefore, by the fundamental principle of counting, there are 10 × 9 = 90 numbers between 99 and 1000 having7 in the unit’s place.

    How many numbers are there between 99 and 1000 having at-least one of their digits 7?

    Total number of 3 digit numbers having at-least one of their digits as 7 =
    (Total numbers of three digit numbers) – (Total number of 3 digit numbers in which 7 does not appear at all).

    Total three digit numbers = 9 * 10 * 10
    As first place can be filled in 9 ways and rest two can be filled in 10 * 10 ways

    Total three digit number in which 7 does not appear at all = 8 * 9 * 9
    As only 9 digits are available and first can be filled in 8 ways and so on ,so forth
    = (9 × 10 × 10) – (8 × 9 × 9)
    = 900 – 648 = 252.

    Will solve some questions.

    Case (i) There are 5 digits (1, 2, 3, 4, 5)
    Case (ii) There are 5 digits (0, 1, 2, 3, 4)
    In both the cases repetition is not allowed
    How many 5 digit even numbers are possible

    Solutions:

    Case (i) digits are 1, 2, 3, 4, 5
    For even numbers , it must ends with 2 and 4
    Five spaces : _ _ _ _ _
    I.e unit place can be filled in only two ways (2,4)
    Now one digit is fixed ,we are left with 4 digits
    Tenth place can be filled in 4 ways
    Similarly rest place can be filled in 3 ,2 and 1
    So total number of ways = 1 * 2 * 3 * 4 * 2 = 48 ways

    Case (ii) digits are 0, 1, 2, 3, 4
    For even numbers , it must ends with 0,2 and 4

    Case (a) if it ends with zero
    _ _ _ _ 0
    I.e unit place can be filled in only one way (0)
    Now one digit is fixed ,we are left with 4 digits
    Tenth place can be filled in 4 ways
    Similarly rest place can be filled in 3 ,2 and 1
    So total number of ways = 1 * 2 * 3 * 4 * 1 = 24 ways

    Case (b)
    If it ends with Non-zero digits (2,4)
    Five spaces: _ _ _ _ _
    I.e unit place can be filled in only two ways (2,4)
    Now one digit is fixed ,we are left with 4 digits
    First place(ten thousand position) can be filled in 3 ways as zero can't come on this place
    Now rest place can be filled in 3 ,2 and 1 as there is no constraint
    So total number of ways = 3 * 3 * 2 * 1 * 2 = 36 ways

    So total ways 36 + 24 = 60 ways

    #Note : whenever such Question come (zero + non - zero one )
    You will divide that Question into two sub-cases
    first one when last digit is zero
    Other one when last digit is Non-zero

    Case(i) There are 5 digits (1,2,3,4,5)
    Case (ii) There are 5 digits (0,1,2,3,4)
    In both the cases repetition is not allowed
    Q2. How many 5 digit numbers are divisible by 4 ?

    Case (i)
    Number to be divisible by 4,
    last 2 digits should be divisible by 4.
    Thus, we have the option as:
    12 , 24 , 32 , 52
    I.e last two.digits can be filled in these 4 ways only
    Remaining three digits can be filled in 3 * 2 * 1 ways
    = 6 * 4 = 24 ways

    Case (ii)
    In this case
    We have the option as :
    04 , 12, 20,24,32 , 40
    Now dividing into two sub cases

    Case(a)
    Last two digits are zero
    I.e 04 , 20 , 40
    So last two digits are filled in 3 ways
    Remaining three digits can be filled in 3 * 2 * 1 ways
    So total number of ways 3 * 2 * 1 * 3 = 18 ways

    Case (b) last two digits are Non-zero
    12 , 24 ,32
    So last two digits are filled in 3 ways
    Now two digits has already fixed ,we are left with only 3 digits
    First place can be filled in two ways only as zero can't come on this position
    So remaining two places can be filled in 2 * 1 ways
    So number of ways = 2 * 2 * 1 * 3 = 12 ways
    Total number of ways = 18 + 12 = 30 ways

    Case (i) There are 5 digits (1,2,3,4,5)
    Case (ii) There are 5 digits (0,1,2,3,4)
    In both the cases repetition is not allowed
    How many 5 digit numbers are divisible by 3?

    Case (i)
    Numbers to be divisibleby 3 when sum of the digits is divisible by 3
    Now we have to form a five digit number and since every digit can be used only once
    So 12345 would definitely be a one five digit number
    Sum of 1 + 2 + 3 + 4 + 5 = 15 divisible by 3
    So number divisible by 3 = total 5 digit numbers = 120

    Case (ii)
    Since sum of digits = 1 + 2 + 3 + 4 + 0 = 10
    Which is not divisible by 3
    So zero numbers possible

    Case (i) There are 5 digits (1,2,3,4,5)
    Case (ii) There are 5 digits (0,1,2,3,4)
    In both the cases repetition is not allowed
    How many 5 digit numbers such that unit digit > ten's digit ?

    Take any two digit number
    Suppose 12
    The possible arrangements are 12 or 21
    I.e 2 cases are possible
    In half of the Case unit digit > ten's digit Nd in rest half it is less than
    Similarly
    Taking any three digit number
    123
    Possible arrangements
    123
    132
    231
    213
    312
    321
    As you can see in half cases i.e 3
    Unit digit > ten's digit
    123 , 213 , 312
    Similarly in

    case (i)
    Total possible case = 120/2= 60

    case (ii)
    Total five digit arrangement are 96
    Total possible case = 96/2 = 48

    Case (i) There are 5 digits (1,2,3,4,5)
    Case (ii) There are 5 digits (0,1,2,3,4)
    In both the cases repetition is not allowed
    How many 5 digit numbers such that unit digit > ten's digit > hundred digit ?

    Taking any three digit number
    123
    Possible arrangements
    123
    132
    231
    213
    312
    321
    As you can see in only one case out of 6 satisfies the given condition
    Unit digit > ten's digit > hundred
    123
    Similarly in

    case (i)
    Total possible case = 120/6 = 20

    case (ii)
    Total five digit arrangement are 96
    Total possible case = 96/6 = 16

    How many 5 digit number formed by using digits (1,2,3,4,5) where 1 comes somewhere between 2 and 3 ?

    Take any 5 digit number formed
    Suppose 54213
    Now
    We have to look for the cases where
    1 comes between 2 and 3
    So fixing 5 and 4
    54 213
    54 123
    54 312
    54 132
    54 231
    54 321
    As you can see
    Out of these 6 arrangements , 2 are satisfying the above given condition
    213 and 312
    I.e 2 in every 6
    I.e 1 in every 3
    Here total 5 digit numbers would be 5 * 4 * 3 * 2 * 1 = 120
    So 1/3 of 120 = 40

    Factorial and its application in P & C

    Factorial of n is N! = N * (n-1) * (n-2) * (n-3) * ... 3 * 2 * 1

    And by definition
    0! = 1
    1! = 1
    2! = 2 * 1 = 2
    3! = 3 * 2 = 6
    4! = 4 * 3 * 2 * 1 = 24
    5! = 5 * 4 * 3 * 2 * 1 = 120
    And so on

    Let's see with an example

    If I say how many 5 digit number can be formed by digits (1,2,3,4,5) if the repetition is not allowed
    So we have 5 places
    First place can be filled in 5 ways
    Second in 4 ways
    And so on
    We would get 5 * 4 * 3 * 2 * 1
    Which is basically same as 5!

    So we can say that
    5 distinct digits , 5 distinct positions
    Total number of numbers/arrangements = 5!

    Similarly
    N distinct digits/alphabets, n distinct positions
    Total number of arrangements = n!

    How many words can be formed from the letter of RAMESH ?

    Since RAMESH contain 6 different letters
    So total number of words = 6! = 720

    Now What if Number of letters /digits repeats and still we have to find out total number of words /numbers

    Let's take an example

    How many words can be formed with the letters of word Ritika ?

    As you can see There are 6 letters where except 'I' every letter repeats one times and 'I' two times
    Had no letter been repeated (i.e all letters are distinct )
    Total number of words = 6!
    But since 'I' is repeating two times
    So divide 6! by 2! Ways

    #Note
    simple logic is If few letters/ digits repeat
    Then (Total number of letters) ! / (Letters repeats number of times )!
    Example :
    Malayalam
    M - 2 times
    A - 4 times
    L - 2 times
    Y - 1 times
    So total words = 9!/ (2! * 4! * 2!)

    How many words can be formed from the letters of the word 'Kattappa' such that they don't start with K ?

    Total words = 8!/ ( 2! * 3! * 2!)
    And words start with K
    K _ _ _ _ _ _ _
    Now remaining 7 letters can be arranged in 7!/(2! * 3! * 2!) Ways
    So total words don't start with K
    8!/( 2! * 3! * 2!) - 7!/(2! * 3! * 2!)
    => 7 * 7!/(2! * 3! * 2!)
    Or
    You can directly do in this way
    First position can be filled in seven ways other than K
    And remaining 7 position can be arranged in
    7!/(2! * 3! * 2!) Ways
    So 7 * 7! / (2! * 3! * 2!)

    The number of arrangements that can be made using all the letters of the word QUARTZ which begin with A but do not end with R .

    QUARTZ is a six letter word
    A is already fixed
    A_ _ _ _ _
    Last postion can be filled by 4 letters
    And remaining 4 positions can be filled in 4! Ways as 4 distinct letters are there
    So total number of ways 4 * 4! = 96

    Sum of all numbers formed from given digits (CAT favourite)

    We know n Distinct digits ,n-digit numbers , we get N! Numbers
    Now let's take an example and understand the concept

    Find the sum of all the four digit numbers formed using the digits 1, 2, 3 and 4 without repetition
    We know 4 distinct digits , so 4! = 24 total 4 digit number would be formed
    Now we have to find sum of all these 24 4-digit numbers

    Case (I)
    When 1 comes at thousands place in a particular number , it's contribution to the total will be 1000.
    The number of numbers can be formed with 1 in the thousands place is 3! ( As rest three positions can be filled in 3! Ways )
    Hence, when 1 is in the thousands place , it's contribution to the sum is 3! * 1000
    Similarly when 2 comes at the thousands place
    It's contribution to the sum 3! * 2000
    For 3 => 3! * 3000
    For 4 => 3! * 4000
    I.e total sum
    3! * 1000( 1+2+3+4)

    Case (II)
    When 1 comes in the hundreds place in a particular​ number , it's contribution to the total will be 100
    And there are 3! Such numbers with 1 in the hundreds place.
    So the contribution 1 makes to the sum when it comes in the hundreds places is 3! * 100
    Similarly for 2 => 3!*200
    3 => 3! * 300
    And for 4 => 3! * 400
    I.e total sum => 3! * (1+2+3+4) * 100

    Case (III)
    when 1,2,3,4 comes at the tens place
    So 3! * (1+2+3+4) *10

    Case (IV) when 1,2,3,4 comes at the unit place
    So 3! * (1+2+3+4) * 1
    So final sum
    => 3! * (1+2+3+4) * (1000+100+10+1)
    => 3! * (1+2+3+4) * (1111)

    Now we can generalise

    If n-digit numbers using n distinct digits are formed the sum of all the numbers so formed is equal to
    (N-1)! * ( Sum of all the n digits ) * (111... N times )

    Find the sum of all the numbers that can be formed by taking all the digits at a time from 1, 2, 3, 4, 5, 6 and 7 with repetition

    We fixed one digit and then we arrange the remaining digit
    Here since the repetition is allowed
    Number can be arranged in
    7 * 7 * 7 * 7 * 7 * 7 = 7^6 ways
    So
    7^6 ( 1+2+3+4+5+6+7) * 1111111
    7^6 * (28) * 1111111

    Finding the rank of a given word is basically finding out the position of the word when all the possible words have been formed using all the letters of this word exactly once and arranged in alphabetical order as in the case of dictionary .

    Let's take an example

    Suppose we have to find the rank of word 'ROHAN '
    The letter involved here A H N O R
    To arrive at the word ROHAN.
    Initially
    We have to go through the words that begin with A , then all those that begin with H and so on so forth .
    Now
    Case (i)
    Words begin with
    A _ _ _ _ ( 4! = 24 words )
    Similarly
    With O ,H ,N
    I.e 24 * 4
    Now
    When the first letter is R
    Case (ii)
    R _ _ _ _
    Now R is fixed
    According to dictionary
    Second letter would be A
    So words with R A
    R A _ _ _ (3! = 6 words )
    Similarly
    RH (6 words )
    R N( 6 words )
    Now
    Case (iii)
    RO is fixed
    Next again third letter will start from A
    I.e ROA _ _ ( 2! = 2 words )
    Now
    Next would be
    ROH
    Then
    Case (IV)
    ROHA
    Luckily we got the 4 letter as our desired one
    So ROHAN ( 1 word)
    rank = 24 * 4+ 6 * 3 + 2 + 1
    => 117

    Find the rank of word 'RAMESH'

    RAMESH has letters A E H M R S
    Words starting with A --> 5!
    Same for E , H , M
    So total words 5! *4 = 480
    Now
    R is fixed
    R_ _ _ _ _
    Case (ii)
    RA
    Case (iii)
    RAE ( 3! )
    RAH (3!)
    RAM fixed
    Case (IV)
    RAMEHS (1 word)
    RAMESH ( 1 word )
    480 + 12 + 2 = 494

    Combinations / Selections

    Let's understand this with an example

    Suppose there are three different fruits available in the market, A, B and C
    You have to pick two out of three
    Case (I) you can pick A and B
    Case (ii) you can pick B and C
    Case (iii) you can pick A and C
    I.e only three cases are possible
    Which can be directly find out by the formula which is NcR
    Selection of R things out of N
    I.e here selection of 2 fruits out of 3
    Which can be done in 3c2 ways
    And NcR = N! / ( N-R)! * R!
    So 3c2 = 3 ways

    Permutation

    We don't need to learn Permutation (NpR) separately coz NpR is nothing but basically arranging those things which you have selected.
    I.e NpR = NcR * R!
    Example
    Suppose there are three persons A,B and C and we have to select two people
    We can do it in easily 3 ways
    But if i have to arrange those two people
    A, B can be arranged in AB and BA ways
    So 3 * 2! = 6 ways
    That we can directly do Without using 3p2

    Although I am telling you - NpR = N!/(N-R)!

    How many words can be formed using all the letters of the word PROBLEM without repetition such that vowels occupy the even places ?

    Problem word has two vowels
    O and E
    And
    There are seven places : _ _ _ _ _ _ _
    On these seven places
    Even places are 2,4 and 6th one
    I.e for two vowels ,three positions are available
    So two positions can be selected in 3c2 ways
    And now these vowels can also arranged together
    So 3c2 * 2! Ways
    Now consonants
    5 different consonants ,5 different positions
    So 5! Ways
    Total number of ways = 3c2 * 2! * 5!
    => 3 * 2 * 120 = 720

    In how many ways can the letters of the word 'DhinchakPooja' be arranged such that vowels are always together

    Dhinchakpooja has I, A, A, O, O
    Five vowels
    And 8 consonants
    Now since these vowels should come together
    I am taking them as a unit
    I.e
    (IAAOO) as they will always appear together
    Suppose it is named as #
    Now this # and 8 consonants can be arranged together
    I.e total 9 letters
    So 9!
    But out of these 'h' repeats two times
    So 9!/2!
    And now vowels can also be arranged in 5!/ (2!*2!)
    So total number of ways =
    9!/2! * 5!/(2!*2!)

    In how many ways can the letters of the word 'DhinchakPooja' be arranged such that no two vowels are together ?

    Vowels can not come together
    So we first fix consonants
    8 consonants ,so 8 positions for consonants : _ _ _ _ _ _ _ _
    Now if you carefully look
    There are 9 positions available for vowels ( tip hamesha ek jyada hoti hai 8+1 = 9)
    v_ v _ v _ v _ v _ v _ v_ v_ v
    But vowels are only 5
    So 9c5 to select 5 positions
    Now these vowels can be arranged
    In 5!/(2!2!)
    So total number of vowels = 9c5 * 5!/(2! * 2!)
    And now consonants
    These can be arranged in 8!/(2!)
    So total number of ways
    9c5 * 5!/(2!*2!) * 8!/(2!)


Log in to reply
 

Looks like your connection to MBAtious was lost, please wait while we try to reconnect.