1
00:00:04,600 --> 00:00:13,870
Welcome. So, today we will be starting a new
subject in discrete math is called combinatorics.
2
00:00:13,870 --> 00:00:16,380
Now what is combinatorics?
3
00:00:16,380 --> 00:00:24,960
So, taking a combinatorics is a branch of
math concerning studies of finite or countable
4
00:00:24,960 --> 00:00:31,550
discrete structures. Aspects of combinatorics
include counting the structures of a given
5
00:00:31,550 --> 00:00:39,489
kind and size, deciding whether certain criteria
can be met, and constructing and analyzing
6
00:00:39,489 --> 00:00:47,649
objects meeting the criteria, finding “largest”,
“smallest”, or “optimal” objects and
7
00:00:47,649 --> 00:00:56,129
studying combinatorial structures arising
in an algebraic context, or applying algebraic
8
00:00:56,129 --> 00:00:58,909
techniques to combinatorial problems.
9
00:00:58,909 --> 00:01:08,670
Now, this is what Wikipedia says about combinatorics
and as you can see in this quotation there
10
00:01:08,670 --> 00:01:18,560
are sub-branches of combinatorics for example,
enumerative combinatorics, combinatorial design
11
00:01:18,560 --> 00:01:25,140
and matroid theory, extremal combinatorics
and combinatorics optimization, algebraic
12
00:01:25,140 --> 00:01:35,340
combinatorics and so on. This is one of the
most interesting and challenging part of discrete
13
00:01:35,340 --> 00:01:45,359
math and we will see some of the basic aspects
of combinatorics .
14
00:01:45,359 --> 00:01:53,030
Of course, we will not be able to do a full
in depth coverage of combinatorics in fact
15
00:01:53,030 --> 00:02:01,990
each of the subject itself requires a whole
course for advance course for understanding,
16
00:02:01,990 --> 00:02:12,370
even understanding the context of this subject.
Now, why do we need combinatorics? And Again
17
00:02:12,370 --> 00:02:14,480
as Wikipedia says
18
00:02:14,480 --> 00:02:23,630
Combinatorial problems arise in many areas
of pure mathematics, notably in algebra, probability
19
00:02:23,630 --> 00:02:30,640
theory, topology, and geometry, and combinatorics
also has many applications in mathematical
20
00:02:30,640 --> 00:02:35,080
optimization, computer science, ergodic theory
and statistical physics. Many combinatorial
21
00:02:35,080 --> 00:02:39,561
questions have historically been considered
in isolation, given an ad hoc solution to
22
00:02:39,561 --> 00:02:42,770
a problem arising in some mathematical context.
23
00:02:42,770 --> 00:02:50,660
Combinatorics is used frequently in computer
science to obtain formulas and estimates in
24
00:02:50,660 --> 00:03:04,120
the analysis of algorithms. So, in short combinatoric
is kind of the back bone of mathematics or
25
00:03:04,120 --> 00:03:21,820
applied mathematics or many kinds of mathematics
that actually. So, in the next few weeks we
26
00:03:21,820 --> 00:03:27,240
will be concentrating only on this subject
of combinatorics and let us see how to go
27
00:03:27,240 --> 00:03:28,280
about it?
28
00:03:28,280 --> 00:03:35,020
So, in short combinatorics is a branch of
subject that involves counting. So, in fact
29
00:03:35,020 --> 00:03:40,660
that is what we will be doing for most of
our time in combinatorics. We will not have
30
00:03:40,660 --> 00:03:49,510
time to deal with the other aspects of combinatorics
but we will be talking about counting. Now,
31
00:03:49,510 --> 00:03:59,550
the typical question is something like I give
you a set and I ask you cardinality of set
32
00:03:59,550 --> 00:04:03,620
S. What is cardinality? Cardinality means
the number of elements in the set S.
33
00:04:03,620 --> 00:04:06,001
Now, you might be wondering what is there
to ask in this question. I might give you
34
00:04:06,001 --> 00:04:12,690
a set you just count the number of elements
in set S. Unfortunately, sometimes the set
35
00:04:12,690 --> 00:04:25,730
S is not given in explicitly. It is given
you kind of implicitly in other words something
36
00:04:25,730 --> 00:04:38,240
like okay take all the solutions satisfying
this form. This is a set, right and it is
37
00:04:38,240 --> 00:04:57,100
not a set that I have given you explicitly
and now I ask you how many what is the cardinality
38
00:04:57,100 --> 00:04:59,220
of set S, right.
39
00:04:59,220 --> 00:05:07,960
Now, the main question is how is the set given
as I told you that if the set is given explicitly
40
00:05:07,960 --> 00:05:19,650
means set S is, if I say set S is the set
of 1, 2, 4, 6, 9, 10. Now, you can just go
41
00:05:19,650 --> 00:05:32,160
and count it and say the set has six elements.
But what happens if I tell you set S is the
42
00:05:32,160 --> 00:05:39,610
set of prime numbers less than three thousand.
Okay, already you can realize that counting
43
00:05:39,610 --> 00:05:43,813
the set is not the easiest job and you do
not know how to exactly simplify your way
44
00:05:43,813 --> 00:05:46,450
get a simple solution other than just listing
out all the possible prime numbers.
45
00:05:46,450 --> 00:05:55,660
Now, in general we can ask you something like,
okay what is the if S is the set of all prime
46
00:05:55,660 --> 00:06:03,340
numbers less than integer n then what will
be the cardinality of the set S? So, that
47
00:06:03,340 --> 00:06:12,150
means I am asking the number of prime numbers
less then n, can you give me a formula for
48
00:06:12,150 --> 00:06:19,000
that? And again you can hear, you can understand
that this is a very hard problem. Its not
49
00:06:19,000 --> 00:06:23,500
a trivial problem, it is not just counting
the number of primes.
50
00:06:23,500 --> 00:06:46,090
So, as I just told here the sets are usually
described in words like I just now did
51
00:06:46,090 --> 00:06:50,090
And So, typical example is how many elements
of a set satisfy a certain set of conditions?
52
00:06:50,090 --> 00:06:59,790
So, as in the other example if universe that
we are looking at is the set of integers,
53
00:06:59,790 --> 00:07:08,460
I am asking how many integers satisfies the
condition that which is less then n and which
54
00:07:08,460 --> 00:07:18,510
is prime and that is what we want to ask.
Equivalently, the same question can be phrased
55
00:07:18,510 --> 00:07:28,910
in a different way. How many ways can you
draw an element from the set such that the
56
00:07:28,910 --> 00:07:32,890
elements satisfy the set of conditions?
57
00:07:32,890 --> 00:07:43,860
So, these are two exactly same things. I mean,
the first one says that how many elements
58
00:07:43,860 --> 00:07:59,430
are there. Second one says that if I am asking
to draw a particular number say between 1
59
00:07:59,430 --> 00:08:14,550
to n such that the number is prime. How many
different ways can you draw it? Now, of course
60
00:08:14,550 --> 00:08:29,190
the numbers of ways you can draw it is number
of prime numbers is less than n that is there.
61
00:08:29,190 --> 00:08:38,789
So, you can understand that these two numbers
are exactly same these two questions.
62
00:08:38,789 --> 00:08:48,579
And we would be kind of jumping between the
first way of stating and the second way of
63
00:08:48,579 --> 00:08:49,610
stating it.
64
00:08:49,610 --> 00:08:57,069
So, let us look at some examples. So, here
are some examples. First one is how many n
65
00:08:57,069 --> 00:09:06,110
digit numbers in decimal are there when no
consecutive digits are same? For example,
66
00:09:06,110 --> 00:09:19,459
something like if n equals to 1, I am sorry
n 1 is a trivial number if n equals to 2 then
67
00:09:19,459 --> 00:09:33,329
what I am asking is that okay you can have
1, you cannot have 1 1 but you can have 1
68
00:09:33,329 --> 00:09:48,970
2 you can have 1 3 you can have 1 4 you can
have 1 9 you can have 2 1 you cannot have
69
00:09:48,970 --> 00:10:05,399
2 2 but you can have 2 3 you can have 2 4
you can have 2 9 and similarly it goes on.
70
00:10:05,399 --> 00:10:06,399
Now, of course if n equals to 2 you can almost
write down the actual number, right. Or, actual
71
00:10:06,399 --> 00:10:07,399
number of such options but if n is a general
parameter then how many n digit integers are
72
00:10:07,399 --> 00:10:08,399
there where there are no two consecutive digits.
I mean no consecutive digits I mean like 3
73
00:10:08,399 --> 00:10:09,399
4 4 5 8 9 has two consecutive digits same
because there are 4 followed by a 4. But for
74
00:10:09,399 --> 00:10:10,790
example 3 4 5 4 8 9 is fine. This is an integer
with six digit when no two consecutive digits
75
00:10:10,790 --> 00:10:14,809
are same 3 it is followed by 4, 4 is followed
by 5, 5 is followed by 4, 4 is followed by
76
00:10:14,809 --> 00:10:15,910
8, 8 is followed by 9.
77
00:10:15,910 --> 00:10:23,990
No, integer so there is no two digits next
to each other as a set. Right, so this is
78
00:10:23,990 --> 00:10:28,300
a problem we will be getting back to this
set of problem after we do some theory on
79
00:10:28,300 --> 00:10:34,879
this particular subject of Combinatorics.
But let me first explain you all the various
80
00:10:34,879 --> 00:10:46,740
problems that we have or some of the problems
that we have. The next one is consider functions
81
00:10:46,740 --> 00:10:56,730
from the set 1 to n to set 1 to k. The 1 2
3 4 to n to 1 2 3 4 to k. How many non-decreasing
82
00:10:56,730 --> 00:10:57,730
functions are there?
83
00:10:57,730 --> 00:11:04,769
Now, what do I mean by non-decreasing function?
Meaning, if I take x and y from this set 1
84
00:11:04,769 --> 00:11:10,730
to n and x is less then y then f x must also
be less than or equal to y, it should not
85
00:11:10,730 --> 00:11:25,350
go down. So, in some set if I end up plotting
this graph so this is f of x. Of course it
86
00:11:25,350 --> 00:11:42,459
has integer value, it takes, right and if
this is x. Now x is so of course this will
87
00:11:42,459 --> 00:11:52,999
kind of a dot size so may be f of 1 is 1,
f of 2 is 3, f of 3 is 4 and so on. If I draw
88
00:11:52,999 --> 00:11:59,260
this one it should not end up suddenly jump
and dropping off.
89
00:11:59,260 --> 00:12:12,800
It is fine if it remains in the same level.
For example, something like, this is okay
90
00:12:12,800 --> 00:12:25,050
where there is no, the function curve does
not go down. Function curve is allowed to
91
00:12:25,050 --> 00:12:34,180
remain parallel to the x-axis. How many functions
are there from 1 to n to, 1 to k? The third
92
00:12:34,180 --> 00:12:42,889
question is if you have n identical toffees
and you have k kids, how many ways can you
93
00:12:42,889 --> 00:12:55,220
give it to the k kids? So, for example if
I have 5 toffees and 2 kids, how many ways
94
00:12:55,220 --> 00:12:56,249
can you give it?
95
00:12:56,249 --> 00:13:05,679
I can give first kid I can give 3, I can give
2 to the other one. Or I give first kid 2,
96
00:13:05,679 --> 00:13:11,230
3 to the other one. Or I can give 1 and 4
to other one or I can give 4 and 1 to the
97
00:13:11,230 --> 00:13:17,920
other one. Or, I may also can give 0 and 5,
5 and 0. So, here for example you can see
98
00:13:17,920 --> 00:13:30,910
that there are six ways of giving this 5 toffees
to this two kids. Now, how many ways if I
99
00:13:30,910 --> 00:13:38,050
have a general n number of toffees k kids.
How many ways can I distribute the n toffees
100
00:13:38,050 --> 00:13:39,439
to k kids?
101
00:13:39,439 --> 00:13:49,389
Again, we will go over this problem after
we do some theory on this subject. The last
102
00:13:49,389 --> 00:13:58,360
one that we are looking at is look at this
strings of length n made by zeros and 1. How
103
00:13:58,360 --> 00:14:11,939
many of them are there such that there is
no consecutive zeros. Meaning, if I have a
104
00:14:11,939 --> 00:14:18,440
string 110101011 is fine. This is an accepted
string but something like 11000111 is not
105
00:14:18,440 --> 00:14:28,040
an accepted string because there are two consecutive
zeros or here actually there are three consecutive
106
00:14:28,040 --> 00:14:29,040
zeros.
107
00:14:29,040 --> 00:14:41,509
So, how many strings are there of length n
which does not has any consecutive zero? Now,
108
00:14:41,509 --> 00:14:49,379
this is the four problems and let us try to
take a step back and see some theory behind
109
00:14:49,379 --> 00:14:55,890
this subject of combinatorics and we will
get back to this problems after a couple of
110
00:14:55,890 --> 00:14:56,890
videos.
111
00:14:56,890 --> 00:15:06,779
Now, how to count now this is an important
question. Note, that each problem is unique
112
00:15:06,779 --> 00:15:14,529
and has to be solved by applying a technique
that fits it. Which technique, fits which
113
00:15:14,529 --> 00:15:23,339
problem is not known that’s per se? In fact,
counting is one of the most challenging subjects
114
00:15:23,339 --> 00:15:33,439
in mathematics. Some of the best minds have
worked on it in fact some of the best works
115
00:15:33,439 --> 00:15:38,009
of Srinivasa Ramanujan was on counting. We
will be talking briefly on this particular
116
00:15:38,009 --> 00:15:44,199
aspect in one of the videos.
117
00:15:44,199 --> 00:15:49,420
Now, there are some handy tricks and tools
to attack this problems and that we will be
118
00:15:49,420 --> 00:15:57,549
learning in this set of lectures. But again
that we reiterate this problems, every problem
119
00:15:57,549 --> 00:16:07,509
is unique and you should try to be creative
in trying to solve any of the problems. Tricks
120
00:16:07,509 --> 00:16:18,560
and tools are just some handy gadgets that
will have to attack this problem.
121
00:16:18,560 --> 00:16:29,649
Let us start with the simplest of tricks or
rules that is there. The rules says that suppose
122
00:16:29,649 --> 00:16:38,259
p is the number of ways of choosing an object
satisfying some set of conditions say P, capital
123
00:16:38,259 --> 00:16:45,300
P and small q is the number of ways of choosing
an object satisfying the condition capital
124
00:16:45,300 --> 00:16:58,629
Q and if there is no object satisfying both
P and Q then the number of objects that satisfy
125
00:16:58,629 --> 00:17:11,100
either the condition P or conditions Q is
p + q, right. So, this is a very simple additive
126
00:17:11,100 --> 00:17:12,100
rule that we have.
127
00:17:12,100 --> 00:17:19,329
And we also have another rule called the product
rule and this says that if say we have to
128
00:17:19,329 --> 00:17:34,080
choose two objects and if p is the number
of ways of choosing an object satisfying P
129
00:17:34,080 --> 00:17:39,940
and q is the number of ways of choosing an
object satisfying the condition Q. Then the
130
00:17:39,940 --> 00:17:47,380
number of ways of choosing two elements such
that the first element satisfies condition
131
00:17:47,380 --> 00:18:00,010
P and second element satisfies the condition
Q is p times q. So let us quickly go over
132
00:18:00,010 --> 00:18:04,090
some examples to see both these rules.
133
00:18:04,090 --> 00:18:11,320
Say in a class there are 40 boys and 50 girls.
How many ways can you pick a monitor from
134
00:18:11,320 --> 00:18:26,960
the class? Now, here let me first define two
conditions P and Q, P being the number of
135
00:18:26,960 --> 00:18:45,410
ways or rather I shouldn’t say the number
of ways but P is the case that monitor is
136
00:18:45,410 --> 00:19:02,289
a boy. Q is the case that monitor is a girl,
now if this is the case, then what are you
137
00:19:02,289 --> 00:19:12,450
asking? In this problem, you are asking how
many ways can we pick up a monitor who either
138
00:19:12,450 --> 00:19:19,279
satisfies P, meaning that monitor is the boy
or satisfies Q that is the monitor is a girl.
139
00:19:19,279 --> 00:19:30,510
Now, number of ways I can pick a monitor with
a boy is since there are 40 boys I can pick
140
00:19:30,510 --> 00:19:40,230
any one of the 40 boys that means this is
40. So, in our definition p is 40 and here
141
00:19:40,230 --> 00:19:47,521
the q is 50. So, if there are 50 girls number
of ways I can pick up or monitor who is a
142
00:19:47,521 --> 00:20:00,409
girl is I can pick any one of the 50 girls
and I get 50. So, the total numbers of ways
143
00:20:00,409 --> 00:20:08,210
I can pick a monitor with either a boy or
a girl is p + q which is 90.
144
00:20:08,210 --> 00:20:11,279
Now, you might think that this is a very stupid
kind of example I could have just straight
145
00:20:11,279 --> 00:20:17,899
away gone and proved it directly that the
number of ways of picking a monitor from 90
146
00:20:17,899 --> 00:20:25,990
students is 90. You are right it is just a
way example of our showing the additive rule.
147
00:20:25,990 --> 00:20:31,899
Now, the additive rule is something really
simple but also we do apply it all the times
148
00:20:31,899 --> 00:20:41,909
and we will be coming back to the additive
rules sometimes the next video.
149
00:20:41,909 --> 00:20:44,380
Actually, next to next video when we will
be seeing some more complicated example for
150
00:20:44,380 --> 00:20:57,110
the additive rule. Now, let me ask the second
question, how many ways can you fix a boy
151
00:20:57,110 --> 00:21:04,019
monitor and a girl monitor from the class?
So, I want to fix two monitors first of them
152
00:21:04,019 --> 00:21:10,889
will be a boy monitor and second one will
be a girl monitor. Now, again the same way
153
00:21:10,889 --> 00:21:27,990
that I did the last time here. P if the monitor
is a boy and Q the monitor is a girl and there
154
00:21:27,990 --> 00:21:34,289
we saw that here p was equal to 40 and q equals
to 50.
155
00:21:34,289 --> 00:21:41,049
Now, the number of ways I can pick first a
boy monitor and then a girl monitor, is there
156
00:21:41,049 --> 00:21:59,809
is by the product rule p times q which is
2000 40 times 50 is 2000. So, there are 2000
157
00:21:59,809 --> 00:22:07,149
ways of picking one boy and one girl such
that one of them is a monitor, boy monitor
158
00:22:07,149 --> 00:22:13,760
and one of them is girl. So, this is some
very simple application of the product rule
159
00:22:13,760 --> 00:22:25,840
and the addition rule. Now, using these two
simple rules let us move ahead and try to
160
00:22:25,840 --> 00:22:26,840
see some more interesting problems.
161
00:22:26,840 --> 00:22:38,250
So here is a problem set. Imagine you are
a police office and there are n constables
162
00:22:38,250 --> 00:22:46,630
in your police station now every night for
seven nights you have to assign one of the
163
00:22:46,630 --> 00:22:53,580
constables to stay awake at night. Now, you
can ask the constable to stay awake for more
164
00:22:53,580 --> 00:23:01,460
than one night. May be for one particular
constable is a very –is someone you will
165
00:23:01,460 --> 00:23:13,429
depend on much more. So, you want him to stay
awake on two of the nights on Monday and Wednesday,
166
00:23:13,429 --> 00:23:14,429
right.
167
00:23:14,429 --> 00:23:25,370
So, let us think of this way that there are
seven nights, namely Monday, Tuesday, Wednesday,
168
00:23:25,370 --> 00:23:35,180
Thursday, Friday, Saturday, and Sunday. Now,
each of the night you have to assign a constable
169
00:23:35,180 --> 00:23:46,509
right? so I can for example, I can put the
here
170
00:23:46,509 --> 00:23:53,929
Constable number 1 goes for Monday, Constable
number 2 goes for Tuesday, Constable may be
171
00:23:53,929 --> 00:24:02,659
again I can again ask constable 1 to take
up to do the duty again on Wednesday. Thursday
172
00:24:02,659 --> 00:24:08,570
maybe I can ask constable number 3.
173
00:24:08,570 --> 00:24:19,700
On Friday maybe I can again ask constable
number 1. On Saturday may be constable number
174
00:24:19,700 --> 00:24:31,870
2 I ask and on Sunday also I ask constable
number 2. Now, this is a possibility. This
175
00:24:31,870 --> 00:24:40,193
is a one way of assigning the constables,
constable 1, 2, 3 to the seven days. Now,
176
00:24:40,193 --> 00:24:45,580
there is other way I can do it, right, for
example, I might have decided that no I will
177
00:24:45,580 --> 00:24:59,309
put constable 3 here and constable 1 here.
Now, you as you can see there are different
178
00:24:59,309 --> 00:25:08,629
ways of filling up this chart question is
that how many ways can you fix this schedule
179
00:25:08,629 --> 00:25:20,820
for who is staying away at which night. How
many different charts can you prepare?
180
00:25:20,820 --> 00:25:29,250
Now, the answer is not too hard it is again
by the kind of the same product rule application
181
00:25:29,250 --> 00:25:35,070
now the the first night I can assign, how
many ways can I assign a constable. I can
182
00:25:35,070 --> 00:25:47,629
assign any of the n constables, right. So,
the number of ways I can assign is n. On Tuesday,
183
00:25:47,629 --> 00:25:58,960
again the number of ways I can assign is n.
I can ask any of the n constables again to
184
00:25:58,960 --> 00:26:06,779
guard to stay awake at night. On Wednesday
again n and so for all the days number of
185
00:26:06,779 --> 00:26:14,580
ways I can fill up that or assign a constable
to that day is n.
186
00:26:14,580 --> 00:26:21,720
Now, with product rule the total number of
ways in which I can assign constables to this
187
00:26:21,720 --> 00:26:30,210
days. So that these are ordered in some sense
like there is order way of going about it
188
00:26:30,210 --> 00:26:32,620
is the product of them which is n power 7.
First day n, second day n. So, number of ways
189
00:26:32,620 --> 00:26:45,139
I can put a constable in the first day and
the constable in second day is n times n,
190
00:26:45,139 --> 00:26:57,059
n square and then along with wednesday n cube
and so on, right. So, this is a very simple
191
00:26:57,059 --> 00:27:06,700
observation and in fact this falls under a
general problem which basically asked the
192
00:27:06,700 --> 00:27:07,700
question.
193
00:27:07,700 --> 00:27:18,649
If there are n people in a group how many
ways can you choose r people, repetition allowed
194
00:27:18,649 --> 00:27:22,700
and ordering matters. Now, let us try to see
how does the earlier problem match here? Earlier
195
00:27:22,700 --> 00:27:32,389
problem I had n constables and there r was
the 7. I have to choose 7 people in this way
196
00:27:32,389 --> 00:27:39,549
back that I have to choose 7 constables for
seven days repetitions allowed in the sense
197
00:27:39,549 --> 00:27:47,919
that the same constable can be assigned multiple
nights and ordering matters meaning whether
198
00:27:47,919 --> 00:27:51,440
the constable 1 does the Monday job.
199
00:27:51,440 --> 00:27:57,370
And constable 2 does the Tuesday job is different
from constable 2 doing the Monday job and
200
00:27:57,370 --> 00:28:06,240
constable 1 doing the Tuesday job. If you
flip or reshuffle the assignment, I get a
201
00:28:06,240 --> 00:28:13,590
completely different allocation, right. So,
again how to answer this question let us see.
202
00:28:13,590 --> 00:28:19,679
First, of all there are positons we have to
people r people and their ordering matters.
203
00:28:19,679 --> 00:28:28,799
So, let us we call for Position 1, Position
2 till Position r.
204
00:28:28,799 --> 00:28:38,249
Now, Position 1, number of ways I can fill
up position 1 is I can choose any of the n
205
00:28:38,249 --> 00:28:44,700
people so n. Number of ways, I can fill Position
2, again since I am allowed to reuse this
206
00:28:44,700 --> 00:28:54,919
people and the repetitions are allowed we
can choose it with n also and similarly for
207
00:28:54,919 --> 00:29:07,019
all the r positions each of them can be filled
in n ways. So, the number of ways I can fill
208
00:29:07,019 --> 00:29:16,080
up the all of them is n times, n times, n
all the way which basically is n to the power
209
00:29:16,080 --> 00:29:18,970
r is the answer.
210
00:29:18,970 --> 00:29:27,019
Now, this is also sometimes called choosing
with replacement because here what we are
211
00:29:27,019 --> 00:29:37,050
doing is that we are drawing a person from
the list and then we have – so in some sense,
212
00:29:37,050 --> 00:29:43,320
imagine that you have n people and their names
have been written into piece of paper and
213
00:29:43,320 --> 00:29:51,090
put into a basket. Now, what I can do is that
I can pick up one person’s name from that
214
00:29:51,090 --> 00:30:00,179
one paper from the basket. I see someone’s
name assign that person the first position.
215
00:30:00,179 --> 00:30:09,290
If it put back the slip into the basket so
that I can again have an option of picking
216
00:30:09,290 --> 00:30:19,750
that person out and I can draw this one more
chit and assign the next one, next chit to
217
00:30:19,750 --> 00:30:25,960
the next position. So, this way, we are basically
choosing with replacement. We are replacing
218
00:30:25,960 --> 00:30:36,909
the chit every time. So, this is what is a
very generic thing that we did very general
219
00:30:36,909 --> 00:30:47,220
statement that for what we just show the constable
problem. Now, let us look at some slightly
220
00:30:47,220 --> 00:30:48,220
different problem.
221
00:30:48,220 --> 00:30:58,409
Here, it has the same thing except that again
you have to assign some n constables for seven
222
00:30:58,409 --> 00:31:07,809
nights but you cannot ask a constable to be
awake more than one night. Now Let us try
223
00:31:07,809 --> 00:31:12,769
to see how to go about it. Again I have Monday,
Tuesday, Wednesday, Thursday, Friday, Saturday
224
00:31:12,769 --> 00:31:28,009
and Sunday. Now, how many ways can
I pick a person to serve the Monday night?
225
00:31:28,009 --> 00:31:33,850
Of course, all the n people are there and
hence I can pick up in n ways.
226
00:31:33,850 --> 00:31:42,440
Now, how many ways can I pick up a constable
to serve the Tuesday night. Now, the person
227
00:31:42,440 --> 00:31:48,340
who has already done the Monday night cannot
be asked because I have been told that a constable
228
00:31:48,340 --> 00:31:56,240
cannot be asked to do two nights. So, he is
out of question. So, I am left with n minus
229
00:31:56,240 --> 00:32:07,090
1 possibility which means that this on Tuesday
I can fill up this position in n minus 1 ways.
230
00:32:07,090 --> 00:32:10,769
What about Wednesday night? Wednesday night.
231
00:32:10,769 --> 00:32:22,100
I cannot use the person who has served the
Monday night. I cannot use the person who
232
00:32:22,100 --> 00:32:23,909
has served Tuesday night. So, I am left with
n minus 2 constables and I can pick any one
233
00:32:23,909 --> 00:32:33,200
of them. So, the n minus 2 and it goes on
like this so I have n minus 3 over here, n
234
00:32:33,200 --> 00:32:49,059
minus 4, n minus 5, and n minus 6. So, at
the end how many ways can I select the 7 constables?
235
00:32:49,059 --> 00:32:59,970
I can n times n minus 1 times, n minus 2 times,
n minus 3 times, n minus 4 times, n minus
236
00:32:59,970 --> 00:33:07,759
5 times, n minus 6 times, n minus oh no that
is all n minus 6.
237
00:33:07,759 --> 00:33:19,019
So, it is like some product of all of this
is what my answer is. So, again this can be
238
00:33:19,019 --> 00:33:25,289
formed in a slightly more general setting.
239
00:33:25,289 --> 00:33:35,429
Namely, there are n people in a group in how
many ways you can choose r people with repetitions.
240
00:33:35,429 --> 00:33:47,659
Sorry, repetition is not allowed but ordering
matters. Meaning, I have the position p 1
241
00:33:47,659 --> 00:34:01,960
p 2 till p r. The first one I can assign in
n ways, second one I can assign it n minus
242
00:34:01,960 --> 00:34:10,070
1 way, third one is n minus 2 ways just like
in case of the constable problem and the last
243
00:34:10,070 --> 00:34:21,150
one will be n minus r + 1. So, the answer
would be product of this set n times n mins
244
00:34:21,150 --> 00:34:31,590
1, n minus 2 to n minus r + 1 which is by
definition n factorial by n minus r factorial,
245
00:34:31,590 --> 00:34:32,770
right.
246
00:34:32,770 --> 00:34:49,560
Now, note that here ordering matters in the
sense that if I pick constable 1 here and
247
00:34:49,560 --> 00:34:54,930
constable 2 here and constable 3 here the
constable r here that is different from constable
248
00:34:54,930 --> 00:35:06,410
2 here 1 here and 3 to r here. So, these two
are two different ways of assigning them because
249
00:35:06,410 --> 00:35:13,190
I am assuming that these two things are distinct
I mean this two positions are ordered, right.
250
00:35:13,190 --> 00:35:17,660
So p 1 and p 2 should not mixed with each
other.
251
00:35:17,660 --> 00:35:26,090
And as you correctly said since I am not allowing
repetitions this is also now called the choosing
252
00:35:26,090 --> 00:35:34,350
without replacement. Now this is also a special
case. There is a special case of this
253
00:35:34,350 --> 00:35:43,810
Namely if I give you n people in a group and
ask them to arrange in an order, where order
254
00:35:43,810 --> 00:35:51,690
matters so in that case what am I asking?
I am asking that can you choose n people from
255
00:35:51,690 --> 00:36:01,290
this n? How many ways can you choose n people
from this group of n people? The first one
256
00:36:01,290 --> 00:36:07,060
can be I can pick any one of the n people,
second one I can pick any one of the rest
257
00:36:07,060 --> 00:36:15,430
of them and it goes on till I have no one
left to pick. So, this one is r here is n
258
00:36:15,430 --> 00:36:21,570
and if you put plus in the values of r in
the original in their earlier problem you
259
00:36:21,570 --> 00:36:22,740
get n factorial.
260
00:36:22,740 --> 00:36:33,940
So, thus you see that n factorial is in fact
the number of ways in which n people in a
261
00:36:33,940 --> 00:36:47,570
group can be arranged in a n factorial is
the number of ways in which you can order
262
00:36:47,570 --> 00:36:53,700
n people in a particular order, meaning where
order matters
263
00:36:53,700 --> 00:37:04,310
Now, let me before I go to the next problem.
Let us talk another nice rule we call it equivalent
264
00:37:04,310 --> 00:37:12,670
partition rule. Now, let S be a set and let
us define let us have this three lines, three
265
00:37:12,670 --> 00:37:21,791
bars be an equivalent relation on the elements.
So, once you have an equivalent relation you
266
00:37:21,791 --> 00:37:29,960
know that as equivalent classes and all the
set of elements that is equivalent to each
267
00:37:29,960 --> 00:37:38,520
other. Now, if all the equivalent classes
has same size namely r then the number of
268
00:37:38,520 --> 00:37:42,920
equivalent classes that we have is size by
r.
269
00:37:42,920 --> 00:37:52,570
Now, this is not a very hard problem, hard
thing to realize, right. If I have a set here
270
00:37:52,570 --> 00:38:05,700
and I have equivalent classes all of them
have size r then total number of this kind
271
00:38:05,700 --> 00:38:20,810
of same equivalent classes is that S by r,
right. So, we can use this one for counting
272
00:38:20,810 --> 00:38:22,520
certain cases.
273
00:38:22,520 --> 00:38:31,130
For example look at this problem there are
n constable in a police station. You have
274
00:38:31,130 --> 00:38:37,010
to pick 7 of them for a project. How many
ways can you pick your team? Now, the difference
275
00:38:37,010 --> 00:38:50,510
from this and the earlier one was that here
the ordering does not matter. I do not care
276
00:38:50,510 --> 00:38:57,010
about who is the leader of the team and all.
There are 7 people in the team. How many ways
277
00:38:57,010 --> 00:39:08,400
can you pick them up, right? Now, okay may
be what we do is the following let us first
278
00:39:08,400 --> 00:39:17,470
write down the thing that we have done which
is the seven days of the week.
279
00:39:17,470 --> 00:39:33,080
And let us first try to assign the various
constables for this seven days. So, let us
280
00:39:33,080 --> 00:39:42,650
imagine that I have a –So I have assigned
Constable 1 here, Constable 2 here, Constable
281
00:39:42,650 --> 00:40:05,010
4 here, Constable 3 here, Constable 6 here,
Constable 9 here and Constable 10 here. So,
282
00:40:05,010 --> 00:40:13,580
this is one way of doing it. Now, this is
one way of in the earlier problem assigning
283
00:40:13,580 --> 00:40:22,670
the seven constables to seven nights. But
then in that problem even this one was a different
284
00:40:22,670 --> 00:40:24,200
way of assigning constables.
285
00:40:24,200 --> 00:40:35,570
Where I have all done is that I have swapped
this constable for Monday and Tuesday. Note,
286
00:40:35,570 --> 00:40:43,820
that in the earlier problem they too were
different but in this problem when I do not
287
00:40:43,820 --> 00:40:50,540
care about ordering I do not care about who
is doing which day. I just want seven people
288
00:40:50,540 --> 00:41:00,650
these two are equivalent. So, now because
here I pick the same set of it. So, in fact,
289
00:41:00,650 --> 00:41:11,180
question is that if I give you a set of seven
constables as long as this set has the same
290
00:41:11,180 --> 00:41:13,930
set of constables they are equivalent.
291
00:41:13,930 --> 00:41:23,470
Question is that how many such arrangement
is equivalent to say this particular set?
292
00:41:23,470 --> 00:41:31,860
It is the same number of ways I can permute
this seven constables, right. So, this is
293
00:41:31,860 --> 00:41:54,970
equivalent to 7 factorial number of other
picking up. So, in the whole set which if
294
00:41:54,970 --> 00:42:24,560
you remember was n minus sorry it was n factorial
by 7 factorial. It was n factorial by n minus
295
00:42:24,560 --> 00:42:34,870
7 factorial. This was the total number of
ways in which I could pick seven constables
296
00:42:34,870 --> 00:42:41,830
for the seven nights where ordering matter
but now each of those arrangements has an
297
00:42:41,830 --> 00:42:46,250
equivalent, is equivalent to seven factorial
number of ways.
298
00:42:46,250 --> 00:42:57,940
So, by the equivalent partition rule to get
the number of groups that I can get which
299
00:42:57,940 --> 00:43:05,230
is in this case I have to look at the number
of equivalent classes is that I have to divide
300
00:43:05,230 --> 00:43:12,940
this number by 7 seven factorial and hence
I get this number, right. So, you might have
301
00:43:12,940 --> 00:43:19,980
seen this particular thing earlier this is
called n choose 7 ofcourse number of ways
302
00:43:19,980 --> 00:43:33,230
I choose 7 people from group of n people.
But the idea is basically this that you first
303
00:43:33,230 --> 00:43:37,590
see how many ways you can pick people in an
ordered manner.
304
00:43:37,590 --> 00:43:44,220
And now each of the ordered selection is equivalent
to 7 factorial number of them and I have to
305
00:43:44,220 --> 00:43:52,230
divide by 7 factorial to get the number of
equivalent classes.
306
00:43:52,230 --> 00:44:10,740
Again, in a general setting same kind of ideas
if I have n people in a group and how many
307
00:44:10,740 --> 00:44:16,640
ways can I choose r people repetition is not
allowed and ordering does not matter it is
308
00:44:16,640 --> 00:44:26,680
whatever the answer that I had last time by
r factorial, right, this is exactly the same
309
00:44:26,680 --> 00:44:33,780
thing we didfor the constable case which is
n factorial by n minus r factorial and r factorial
310
00:44:33,780 --> 00:44:43,630
which is n choose r. So, this is number of
ways in which we can choose when repetitions
311
00:44:43,630 --> 00:44:48,950
are not-allowed but ordering does not matter.
312
00:44:48,950 --> 00:45:00,500
Now, what happens if I ask this following
question?
313
00:45:00,500 --> 00:45:08,030
There are n constables in your police station.
You have to give the names of 7 constables.
314
00:45:08,030 --> 00:45:21,860
You can give a constable name more than once.
How many ways can you give this 7 constables?
315
00:45:21,860 --> 00:45:27,940
So, in other words what I am asking is if
we go for the general problem here that there
316
00:45:27,940 --> 00:45:36,960
are n people in a group how many ways can
you choose r people when the same person can
317
00:45:36,960 --> 00:45:47,490
be chosen a few number of times repetitions
are allowed but ordering does not matter.
318
00:45:47,490 --> 00:45:55,090
I do not care about the ordering inside each
group. Now, how do you solve this particular
319
00:45:55,090 --> 00:46:03,620
problem? Ok, to, solve this problem let us
first start with the positions like we did.
320
00:46:03,620 --> 00:46:10,720
But earlier we were writing the positions
as p 1 to p r unfortunately we cannot such
321
00:46:10,720 --> 00:46:19,800
seats because the positions are not the same
in the sense that I do not care about the
322
00:46:19,800 --> 00:46:25,940
ordering. Since, I do not care about the ordering
so I cannot write this P 1 P r instead let
323
00:46:25,940 --> 00:46:29,200
me just try to write as some round balls.
324
00:46:29,200 --> 00:46:37,230
So, there are round balls and I have, how
many of round balls I have? I have r round
325
00:46:37,230 --> 00:46:52,270
balls, right, and these are the positions
that are there. Now, I have to kind of give
326
00:46:52,270 --> 00:47:00,270
the positions to people. So, if people r marked
right? so I have the person one P1 or maybe
327
00:47:00,270 --> 00:47:06,940
I go back it say I will use the fact that
they are constables. So, they have the Constable
328
00:47:06,940 --> 00:47:15,530
1, Constable 2 till Constable n. I have n
constables. Now, question is that how many
329
00:47:15,530 --> 00:47:18,690
times should constable ones name be in the
group?
330
00:47:18,690 --> 00:47:27,500
Should it be once, twice or no times or r
times or what. So, in other words, it is like
331
00:47:27,500 --> 00:47:39,430
I have this points and if I draw a line I
kind of say that okay if I give the constable
332
00:47:39,430 --> 00:47:45,510
1, two positons then I will draw line here
and I say that okay everything left of the
333
00:47:45,510 --> 00:47:53,722
line is for Constable 1. This basically implies
that Constable 1 gets two positions in that
334
00:47:53,722 --> 00:48:01,970
r. among the r positon. Similarly, in constable
2 I will draw a line here and whatever the
335
00:48:01,970 --> 00:48:04,010
number of point that are there is in Constable
1 and Constable 2 line in this case zero is
336
00:48:04,010 --> 00:48:07,090
the total number of position that Constable
2 gets.
337
00:48:07,090 --> 00:48:18,810
Now, in other words here Constable 2 does
not get any position, right. So, may be Constable
338
00:48:18,810 --> 00:48:26,550
3, I will draw a line over here and that is
saying that Constable 3 gets 1 position. Maybe
339
00:48:26,550 --> 00:48:32,100
Constable 4 has line next to Constable 3 that
is Constable 4 does not a position. Here,
340
00:48:32,100 --> 00:48:37,320
Constable 5 does not get a position. Here
Constable 6, gets 3 positions. So, in other
341
00:48:37,320 --> 00:48:45,710
words and at the end of the day how many lines
should I draw?
342
00:48:45,710 --> 00:49:00,440
If I have drawn n minus 1 such vertical lines
at the end I will say that okay whatever is
343
00:49:00,440 --> 00:49:10,850
left it goes to constable n. So, in another
words this is a particular arrangement of
344
00:49:10,850 --> 00:49:22,450
this round circles and straight line indicate
that since there are n minus 1 bars or straight
345
00:49:22,450 --> 00:49:30,470
lines I have n intervals in between these
straight lines as that indicate the number
346
00:49:30,470 --> 00:49:35,280
of times the ith constable’s name is in
the group.
347
00:49:35,280 --> 00:49:46,940
So, in other words the number of ways you
can permute or number of ways you can write
348
00:49:46,940 --> 00:49:58,920
down the set of a string forming with r circles
and n minus 1 red lines is going to be the
349
00:49:58,920 --> 00:50:12,690
number of ways you can pick r constables from
n constables where we draw it with repetition
350
00:50:12,690 --> 00:50:21,160
but ordering does not matter. Now if you do
it you see that how many objects are there?
351
00:50:21,160 --> 00:50:32,520
There are the r circles and n minus 1 straight
lines , right, which in turns become r + n
352
00:50:32,520 --> 00:50:34,420
minus 1 objects are there.
353
00:50:34,420 --> 00:50:40,580
So, in number of ways I can write a string
with r circle and n minus 1 straight line
354
00:50:40,580 --> 00:50:49,770
is r + n minus 1 factorial, I just permute
all of them but since all the positions are
355
00:50:49,770 --> 00:50:57,130
identical in since all these circles are identical
I should divide by r factorial and I should
356
00:50:57,130 --> 00:51:07,410
also divide by n minus 1 factorial because
this bars are also identical. So, this way
357
00:51:07,410 --> 00:51:18,980
I have been able to count in a indirect way
how many ways I can select r people from n
358
00:51:18,980 --> 00:51:26,090
people where repetitions are allowed and ordering
does not matter.
359
00:51:26,090 --> 00:51:42,880
So, the answer is in fact n + r minus 1 factorial
by n factorial times r minus 1 factorial which
360
00:51:42,880 --> 00:51:52,990
do become n + r minus 1 choose r minus 1.
So, this particular way of speaking in this
361
00:51:52,990 --> 00:52:00,180
particular problem the last part of it is
reasonably complicated and tricky. We will
362
00:52:00,180 --> 00:52:08,630
come back it again next video in a different
light. How to and we will see the same problem
363
00:52:08,630 --> 00:52:10,590
in the next video also.
364
00:52:10,590 --> 00:52:18,550
So, for now what we have seen? We have seen
that if you have to select k objects from
365
00:52:18,550 --> 00:52:33,000
n objects the number of ways of doing it is
in the case of with repetition is this n factorial
366
00:52:33,000 --> 00:52:39,970
- without repetition and order important n
factorial by k factorial. Sorry, I have made
367
00:52:39,970 --> 00:52:52,800
a mistake here this should be n factorial
by n minus k factorial. This is n factorial
368
00:52:52,800 --> 00:53:02,170
by k times n minus k factorial and the last
one which we just did now.
369
00:53:02,170 --> 00:53:11,700
Yes, this one, n + k minus 1 factorial by
n minus 1 factorial times k factorial. In
370
00:53:11,700 --> 00:53:18,859
the next video, we will come back and see
some more counting problems. Thank you.