DM Unit 1
DM Unit 1
Rule of Sum
The rule of sum is a basic counting approach in combinatorics. A basic statement of the rule is
that if there are choices for one action, and choices for another action and the two actions cannot
be done at the same time, then there are ways to choose one of these actions.
The rule of sum only applies to choices that are mutually exclusive, meaning that only one of the
choices can be picked. To determine when to use the rule of sum try to rephrase the question. If
the question can be rephrased with the word "or," this usually indicates that the rule of sum
applies.
Example 1
Mary is wearing her lucky shirt today, and she has to choose among 3 red skirts and 4 blue skirts
to wear with the shirt. How many different outfit choices of one skirt and one shirt does she have
for the day?
Solution:
Since Mary can wear one of the 3 red skirts or one of the 4 blue skirts, the choices are mutually
exclusive and the rule of sum applies. This gives a total 3+4=7 of different outfit choices
Example 2:
Ravi goes to a pet shop and finds that the pet shop has reptiles, birds, rabbits, and fish. If Ravi
can only pick one animal as a pet, how many choices does Ravi have for a pet?
Since Ravi can choose a reptile or a bird or a rabbit or a fish, the rule of sum applies. Then
Chris is playing a card game and the cards in his hand include three 5's, two Jacks, two Aces, one
9, and one King. If he has to choose one card to play in the next round, how many choices does
he have for a card to play?
Since Chris can choose to play a or a Jack or an ace or a 9 or a King, the rule of sum applies.
Then
By the rule of sum, there are 3+2+2+1+1= 9 ways to select a card to play in the next roun
If there are ways of doing something, and ways of doing another thing after that, then there
are ways to perform both of these actions.
Example:
1. Calvin wants to go to Milwaukee. He can choose from bus services or train services to head
from home to downtown Chicago. From there, he can choose from 2 bus services or 3 train
services to head to Milwaukee. How many ways are there for him to get to Milwaukee?
Solution: Since Calvin can either take a bus or a train downtown , he has 3+2=5 ways to head
downtown (Rule of Sum). After which, he can either take a bus or a train to Milwaukee, hence
he has another 2+3=5 ways to head to Milwaukee (Rule of Sum). Thus in total, he
has 5X5=25 ways to head from home to Milwaukee .
2. Six friends Andy, Bandy, Candy, Dandy, Endy and Fandy want to sit in a row at the cinema.
If there are only six seats available, how many ways can we seat these friends?
Solution: For the first seat, we have a choice of any of the 6 friends. After seating the first
person, for the second seat, we have a choice of any of the remaining 5 friends. After seating the
second person, for the third seat, we have a choice of any of the remaining 4 friends. After
seating the third person, for the fourth seat, we have a choice of any of the remaining 3 friends.
After seating the fourth person, for the fifth seat, we have a choice of any of the remaining 2
friends. After seating the fifth person, for the sixth seat, we have a choice of only 1 of the
remaining friends. Hence, by the Rule of Product, there are 6x5x4x3x2x1=720 ways to seat
these 6 people. More generally, this problem is known as a Permutation.
Solution: Any positive divisor of 2000 must have the form 2a5b, where a and b are integers
satisfying 0 <=a <=4, 0<=b<=3 . There are 5 possibilities for a and 4 possibilities for b , hence
there are 5X4=20 (Rule of Product) positive divisors of 2000 in all.
Permutations
The notion of permutation relates to the act of arranging all the members of a set into
some sequence or order, or if the set is already ordered, rearranging (reordering) its elements, a
process called permuting. These differ from combinations, which are selections of some
members of a set where order is disregarded. For example, written as tuples, there are six
permutations of the set {1,2,3}, namely: (1,2,3), (1,3,2), (2,1,3), (2,3,1), (3,1,2), and (3,2,1).
These are all the possible orderings of this three element set. As another example, an anagram of
a word, all of whose letters are different, is a permutation of its letters. In this example, the letters
are already ordered in the original word and the anagram is a reordering of the letters. The study
of permutations of finite sets is a topic in the field of combinatorics.
Permutations occur, in more or less prominent ways, in almost every area of mathematics. They
often arise when different orderings on certain finite sets are considered, possibly only because
one wants to ignore such orderings and needs to know how many configurations are thus
identified. For similar reasons permutations arise in the study of sorting algorithms in computer
science.
The number of permutations of n distinct objects is n factorial, usually written as n!, which
means the product of all positive integers less than or equal to n.
The different arrangements of a given number of things by taking some or all at a time, are called
permutations.
Examples:
All permutations (or arrangements) made with the letters a, b, c by taking two at a time are
(ab, ba, ac, ca, bc, cb).
All permutations made with the letters a, b, c taking all at a time are:
( abc, acb, bac, bca, cab, cba)
Number of Permutations:
Problem 1: Find the number of words, with or without meaning, that can be formed with the
letters of the word ‘CHAIR’.
Solution:
Therefore, the number of words that can be formed with these 5 letters = 5! = 5*4*3*2*1 = 120.
Problem 2: Find the number of words, with or without meaning, that can be formed with the
letters of the word ‘INDIA’.
Solution:
When a letter occurs more than once in a word, we divide the factorial of the number of all
letters in the word by the number of occurrences of each letter.
Problem 3: Find the number of words, with or without meaning, that can be formed with the
letters of the word ‘SWIMMING?
Solution:
The word ‘SWIMMING contains 8 letters. Of which, I occurs twice and M occurs twice.
Solution:
In order to find the number of permutations that can be formed where the two vowels U and E
come together.
In these cases, we group the letters that should come together and consider that group as one
letter.
So, the letters are S,P,R, (UE). Now the number of words are 4.
Hence, the total number of ways in which the letters of the ‘SUPER’ can be arranged such that
vowels are always together are 4! * 2! = 48 ways.
Problem 5: Find the number of different words that can be formed with the letters of the word
‘BUTTER’ so that the vowels are always together.
Solution:
The letters U and E should always come together. So the letters are B, T, T, R, (UE).
Number of ways in which the letters above can be arranged = 5!/2! = 60 (since the letter ‘T’ is
repeated twice).
Solution:
Writing in the following way makes it easier to solve these type of questions.
After 3 vowels take 3 places, no. of ways 4 consonants can take 4 places = 4P4 = 4! = 24 ways.
Problem 7:
In how many different ways can the letters of the word 'CORPORATION' be arranged so that the
vowels always come together?
This has 7 (6 + 1) letters of which R occurs 2 times and the rest are different.
7!
Number of ways arranging these letters = = 2520.
2!
Now, 5 vowels in which O occurs 3 times and the rest are different, can be arranged
5!
in = 20 ways.
3!
In how many ways can the letters of the word 'LEADER' be arranged?
Solution:
The word 'LEADER' contains 6 letters, namely 1L, 2E, 1A, 1D and 1R.
6!
Required number of ways = = 360.
(1!)(2!)(1!)(1!)(1!)
Problem 9:
How many 3-digit numbers can be formed from the digits 2, 3, 5, 6, 7 and 9, which are divisible
by 5 and none of the digits is repeated?
Solution:
Since each desired number is divisible by 5, so we must have 5 at the unit place. So, there is 1
way of doing it.
The tens place can now be filled by any of the remaining 5 digits (2, 3, 6, 7, 9). So, there are 5
ways of filling the tens place.
The hundreds place can now be filled by any of the remaining 4 digits. So, there are 4 ways of
filling it.
A combination is a selection of items from a collection, such that (unlike permutations) the order
of selection does not matter. For example, given three fruits, say an apple, an orange and a pear,
there are three combinations of two that can be drawn from this set: an apple and a pear; an apple
and an orange; or a pear and an orange. More formally, a k-combination of a set S is a subset
of k distinct elements of S. If the set has n elements, the number of k-combinations is equal to
the binomial coefficient
nCr=n*(n-1)*(n-2)…1/(n-r)*(n-r-1)*(n-r-2)….1
which can be written using factorials as n!/r!(n-k)! whenever k<=n, and which is zero
when k>n.
Combinations refer to the combination of n things taken k at a time without repetition. To refer
to combinations in which repetition is allowed, the terms k-selection, k-multiset, or k-
combination with repetition are often used. If, in the above example, it were possible to have two
of any one kind of fruit there would be 3 more 2-selections: one with two apples, one with two
oranges, and one with two pears.
Examples:
Problem 1: Out of 7 consonants and 4 vowels, how many words of 3 consonants and 2 vowels
can be formed?
Problem 2: in a group of 6 boys and 4 girls, four children are to be selected. In how many
different ways can they be selected such that at least one boy should be there?
Solution In a group of 6 boys and 4 girls, four children are to be selected such that at least one
boy should be there.
Hence we have 4 options as given below
=6×52×1+6×5×43×2×1×4=6×52×1+6×5×43×2×1×4 +6×52×1×4×32×1+6×4+6×52×1×4×32×1+
6×4
=15+80+90+24=209
Problem 3:From a group of 7 men and 6 women, five persons are to be selected to form a
committee so that at least 3 men are there in the committee. In how many ways can it be done?
Solution: From a group of 7 men and 6 women, five persons are to be selected with at least 3
men.
=7×62×1+7×6×53×2×1×6=7×62×1+7×6×53×2×1×6 +7×6×53×2×1×6×52×1+7×6×53×2×1×6×5
2×1
=21+210+525=756
Problem 4:A bag contains 2 white balls, 3 black balls and 4 red balls. In how many ways can 3
balls be drawn from the bag, if at least one black ball is to be included in the draw?
From 2 white balls, 3 black balls and 4 red balls, 3 balls are to be selected such that at least one
black ball should be there.
Number of triangles that can be formed by joining the vertices of a polygon of n sides
= nC3
Here n = 8
Hence, number of triangles that can be formed by joining the vertices of an octagon
= 8C3 =8×7×66=56
Problem 6:If there are 9 horizontal lines and 9 vertical lines in a chess board, how many
rectangles can be formed in the chess board?
Here m = 9, n = 9
Binomial Theorem:
(a+b)(a+b) = a2 + 2ab + b2
And again:
The calculations get longer and longer as we go, but there is some kind of pattern developing.
That pattern is summed up by the Binomial Theorem:
where
There is another way to find the value of "nCr", and it's called "Pascal's Triangle". To make the
triangle, you start with a pyramid of three 1's, like this:
Then you get the next row of numbers by adding the pairs of numbers from above. (Where there
is only one number above, you just carry down the 1.)
Keep going, always adding pairs of numbers from the previous row.
To find, say, 6C4, you go down to the row where there is a "6" after the initial "1", and then go
over to the 5th (not the 4th) entry, to find that 6C4 = 15.
Permutations with Repeated Elements. Assume that we have an alphabet with k letters and we
want to write all possible words containing n1 times the first letter of the alphabet, n2 times the
second letter,. . . , nk times the kth letter. How many words can we write? We call this number
P(n; n1, n2, . . . , nk), where n = n1 + n2 + · · · + nk. Example: With 3 a’s and 2 b’s we can write
the following 5-letter words: aaabb, aabab, abaab, baaab, aabba, ababa, baaba, abbaa, babaa,
bbaaa. We may solve this problem in the following way, as illustrated with the example above.
Let us distinguish the different copies of a letter with subscripts: a1a2a3b1b2. Next, generate
each permutation of this five elements by choosing 1) the position of each kind of letter, then 2)
the subscripts to place on the 3 a’s, then 3) these subscripts to place on the 2 b’s. Task 1) can be
performed in P(5; 3, 2) ways, task 2) can be performed in 3! ways, task 3) can be performed in
2!. By the product rule we have 5! = P(5; 3, 2) × 3! × 2!, hence P(5; 3, 2) = 5!/3! 2!. In general
the formula is: P(n; n1, n2, . . . , nk) = n! /n1! n2! . . . nk!
Combinations with Repetition. Assume that we have a set A with n elements. Any selection of r
objects from A, where each object can be selected more than once, is called a combination of n
objects taken r at a time with repetition. For instance, the combinations of the letters a, b, c, d
taken 3 at a time with repetition are: aaa, aab, aac, aad, abb, abc, abd, acc, acd, add, bbb, bbc,
bbd, bcc, bcd, bdd, ccc, ccd, cdd, ddd. Two combinations with repetition are considered identical
if they have the same elements repeated the same number of times, regardless of their order.
Note that the following are equivalent: 1. The number of combinations of n objects taken r at a
time with repetition.
2. The number of ways r identical objects can be distributed among n distinct containers. 3. The
number of nonnegative integer solutions of the equation: x1 + x2 + · · · + xn = r . Example:
Assume that we have 3 different (empty) milk containers and 7 quarts of milk that we can
measure with a one quart measuring cup. In how many ways can we distribute the milk among
the three containers? We solve the problem in the following way. Let x1, x2, x3 be the quarts of
milk to put in containers number 1, 2 and 3 respectively. The number of possible distributions of
milk equals the number of non negative integer solutions for the equation x1 + x2 + x3 = 7.
Instead of using numbers for writing the solutions, we will use strokes, so for instance we
represent the solution x1 = 2, x2 = 1, x3 = 4, or 2 + 1 + 4, like this: ||+|+||||. Now, each possible
solution is an arrangement of 7 strokes and 2 plus signs, so the number of arrangements is
P(9; 7, 2) = 9!/7! 2! = ¡9 7 ¢ .
Lexicographic Order
Will use lexicographic order to list all permutations and/or combinations Similar to dictionary
(alphabetical) order IfWord A is shorter thanWord B, and every letter ofWord A occurs in the
same place in Word B, Word A comes before Word B (”compute” and ”computer”) If the first
letter that di_ers inWord A comes before the corresponding
letter in Word B, then Word A comes before Word B (”math” and”matter”)
For strings _ = s1s2s3 … sp and _ = t1t2t3 … tq taken from the set f1; 2; 3; : : : ; ng
2.p < q and si = ti for 1 <= i <= q (e.g., α = 1732 and _ = β 173245)
3.For the first i such that si , ti, si < ti (e.g., α = 28473 and = β 2848)
Example. For the following 4�permutations from the set f1; 2; 3; 4; 5; 6; 7g, find the
permutation that immediately follows them in lexicographic order
1. 1234 is followed by
2. 4567 is followed by
3. 5437 is followed by
4. 7654 is followed by
We will always list a given combinations the order s1 < s2 < _ _ _ < sp
Example. For the following 4 combinations from the set f 1; 2; 3; 4; 5; 6; 7, find the combination
that immediately follows them in lexicographic order
1. 1234 is followed by
2. 3467 is followed by