1
00:00:00,320 --> 00:00:05,210
Welcome back. So we have been looking at counting.
2
00:00:05,210 --> 00:00:11,249
So this is, in the last few lectures, we have
been looking at Combinatorics, which is a
3
00:00:11,249 --> 00:00:20,009
branch of mathematics that involves counting.
A typical question that is asked is, given
4
00:00:20,009 --> 00:00:24,080
a set S, what is the cardinality of the set
S.
5
00:00:24,080 --> 00:00:35,489
Now, the main question is that, how is the
set given. Now most of the time, the set is
6
00:00:35,489 --> 00:00:42,420
not given explicitly, meaning elements of
the set are not given explicitly. Instead
7
00:00:42,420 --> 00:00:50,309
it is described in words and hence the set
S is kind of understood, but the elements
8
00:00:50,309 --> 00:01:01,390
of the set S is hard to understand or hard
to innumerate. And, so the question of counting
9
00:01:01,390 --> 00:01:11,400
the number of elements in the set is a valid
important and sometimes challenging problem.
10
00:01:11,400 --> 00:01:19,350
For example, one can ask things like, how
many elements in the universe satisfy a certain
11
00:01:19,350 --> 00:01:27,369
set of conditions, or equivalently, how many
ways can you draw an element from the universe,
12
00:01:27,369 --> 00:01:39,950
such that, the element satisfies the set of
conditions.
13
00:01:39,950 --> 00:01:50,759
Some example that we have been thinking about
is, the number one, how many n digit numbers
14
00:01:50,759 --> 00:01:54,369
are there, in the decimal representation,
where no consecutive digits are same. We will
15
00:01:54,369 --> 00:02:08,550
be seeing the proof of, or the answers to
all of this question in this video. Second
16
00:02:08,550 --> 00:02:16,890
one is, how many functions are there from
one to n to one to k, that are non-decreasing.
17
00:02:16,890 --> 00:02:25,240
That is if x and y are two numbers and if
x is less than y, then f of x is less than
18
00:02:25,240 --> 00:02:28,290
or equal to y.
19
00:02:28,290 --> 00:02:38,230
The third is, how many ways can you distribute
n identical toffees among k kids. And the
20
00:02:38,230 --> 00:02:57,060
last one is the number of 0 1 strings of length
n, which does not have any consecutive zeros.
21
00:02:57,060 --> 00:03:06,640
Now, the problem of counting as you have possibly
seen by now, or understood by now, that every
22
00:03:06,640 --> 00:03:13,080
problem is unique and there one can apply
different techniques to solving a problem,
23
00:03:13,080 --> 00:03:22,070
and you have to apply the technique that fits
the problem. In fact, counting is one of the
24
00:03:22,070 --> 00:03:28,390
most challenging subjects in maths. And, infact
some of the best works of the great Srinivasa
25
00:03:28,390 --> 00:03:36,310
Ramanujanâ€™s works was on counting. And there
are some handy tricks and tools that we teach
26
00:03:36,310 --> 00:03:39,290
in the set of lectures, that one can use to
solve them.
27
00:03:39,290 --> 00:03:51,100
So here is the thing that we found out for
the counting for selection, so namely if you
28
00:03:51,100 --> 00:04:00,020
have to select k objects from n objects, then
depending on certain things, namely depending
29
00:04:00,020 --> 00:04:07,660
on whether repetitions are allowed, meaning
whether the same object can be chosen more
30
00:04:07,660 --> 00:04:15,770
than once. And whether the order in which
we pick this k objects matters, we have got
31
00:04:15,770 --> 00:04:29,020
the various answers. Couple of videos earlier,
we did prove all these numbers.
32
00:04:29,020 --> 00:04:41,380
Another important question here is how to
distribute n balls into k bins. And there
33
00:04:41,380 --> 00:04:48,990
are a few problems that one should ask, namely,
are the bins distinguishable or are the bins
34
00:04:48,990 --> 00:04:58,420
labelled, or are they not. Are the balls distinguishable
and are the balls labelled. If the balls are
35
00:04:58,420 --> 00:05:06,740
distinguishable, then does the ordering of
the balls in the bins matter. Can the bins
36
00:05:06,740 --> 00:05:10,100
be empty, and are there any other restrictions.
37
00:05:10,100 --> 00:05:20,150
Now, at least of the first four such restrictions
we looked at all the possible cases. And we
38
00:05:20,150 --> 00:05:28,590
have got this particular matrix, namely whether
the bins are labelled or not, whether the
39
00:05:28,590 --> 00:05:36,610
items are distinguishable or indistinguishable.
And if the items are indeed distinguishable,
40
00:05:36,610 --> 00:05:47,850
then does the ordering matters or does not
matter. Now, we have one of them that was
41
00:05:47,850 --> 00:06:02,420
left unsolved, namely this one, right. Namely
whether bins are labelled, when the bins are
42
00:06:02,420 --> 00:06:10,670
unlabelled and items are indistinguishable.
How many ways can you solve.
43
00:06:10,670 --> 00:06:23,650
Now this one is related to how many ways can
you write the integer in the sum of positive
44
00:06:23,650 --> 00:06:36,600
numbers. Now why is it so, let us see, so
I have, say n balls. And I want to break it
45
00:06:36,600 --> 00:06:46,010
up into bins. But I do not care, the labelling
of the bins. So, In other words, I want to
46
00:06:46,010 --> 00:06:53,500
say that, okay, I want to put two of them
in one bin, one of them into other bin, maybe
47
00:06:53,500 --> 00:07:00,340
three of them in the third bin, maybe two
of them in this another bin, and so on.
48
00:07:00,340 --> 00:07:10,030
So what matters is that, I have one bin here
so neglect it, complete this one. So this
49
00:07:10,030 --> 00:07:23,030
is a breakup of this set of thirteen balls
into five bins. I do not care about labelling.
50
00:07:23,030 --> 00:07:31,020
So in other words, it basically looks like
I have one bin containing one, two bins containing
51
00:07:31,020 --> 00:07:39,730
two, one bin containing three and one bin
containing four. I do not care about the ordering,
52
00:07:39,730 --> 00:07:47,440
so in other words, what I get. I get one,
two, two, three, four.
53
00:07:47,440 --> 00:07:56,770
And I know that the sum of them must be equal
to, sorry this was twelve balls actually,
54
00:07:56,770 --> 00:08:08,490
yeah, twelve. So, this is one way of splitting
twelve balls into four bins. Now I could have
55
00:08:08,490 --> 00:08:13,280
done a separate one, for example, maybe I
could have, what I could have done is I could
56
00:08:13,280 --> 00:08:27,260
have split this one, and I could also have
maybe caught hold of this one also. So, in
57
00:08:27,260 --> 00:08:38,490
that case I would have got three bins of two
each, two plus two plus two, and two bins
58
00:08:38,490 --> 00:08:40,180
of three each, right.
59
00:08:40,180 --> 00:08:45,650
This is three, and this is three, and one,
two, three, are two, and this is the 12. So,
60
00:08:45,650 --> 00:08:53,100
the number of ways I have writing this twelve
as sum of integers is basically the number
61
00:08:53,100 --> 00:09:11,810
of ways, I can split this n indistinguishable
balls into exactly k bins, when none of the
62
00:09:11,810 --> 00:09:21,130
bins are empty, right. So we denote this number
by Pn, and the question is that, how many
63
00:09:21,130 --> 00:09:28,420
balls, how many ways can you write the integer
n as sum of k positive numbers.
64
00:09:28,420 --> 00:09:35,480
So this is when we do not want the bins to
be empty, and we denote it by Pnk. And as
65
00:09:35,480 --> 00:09:50,830
you can, And as you can realise that Pn equals
to sum over Pnk, where k equals to one to
66
00:09:50,830 --> 00:10:05,649
n. So, when we ask, how many ways can we split
n indistinguishable balls into distinguishable
67
00:10:05,649 --> 00:10:17,779
bins, what we mean here is, so into k indistinguishable
bins, so this number is actually Pnk. Now,
68
00:10:17,779 --> 00:10:32,000
this Pnk is of course a very, very well studied
problem. And in fact Srinivasa Ramanujan worked
69
00:10:32,000 --> 00:10:35,630
on this problem quite a lot.
70
00:10:35,630 --> 00:10:46,300
And, while we do not have a easy way of calculating
Pnk, Srinivasa Ramanujan came up with the
71
00:10:46,300 --> 00:10:56,890
formula, that is very close to Pnk. We call
it asymptotically similar. And this formula
72
00:10:56,890 --> 00:11:03,380
is extremely extremely complicated. I want
to show you the formula, and this will help
73
00:11:03,380 --> 00:11:08,660
you to appreciate how hard the problem is,
of calculating the number of ways one can
74
00:11:08,660 --> 00:11:16,649
distribute n indistinguishable balls into
k indistinguishable bins.
75
00:11:16,649 --> 00:11:25,100
So here, Srinivasa Ramanujan gave an expression,
which was basically this term, which not only
76
00:11:25,100 --> 00:11:33,050
has some weird objects like exponential of
pi. So this term basically means, this is
77
00:11:33,050 --> 00:11:44,230
the number e power Pi b k square root of two
three n minus one divided by twenty four,
78
00:11:44,230 --> 00:11:53,589
okay. And not only have this thing, it also
has things like a derivative and the term
79
00:11:53,589 --> 00:11:57,339
Ak, where, what is Ak?
80
00:11:57,339 --> 00:12:09,550
Ak is this object, which is e power Pi, where
i is the complex number minus square root
81
00:12:09,550 --> 00:12:21,779
of minus one smk, now what is smk? An smk
is this expression, now this shows how complicated
82
00:12:21,779 --> 00:12:28,670
it is. Infact this number is not exactly correct,
it is very close to being correct, expression
83
00:12:28,670 --> 00:12:38,970
for Pn. And a few years later, Ramanujan,
Hardy and Rademacher, got a formula, which
84
00:12:38,970 --> 00:12:41,459
was the exact formula for Pn.
85
00:12:41,459 --> 00:12:49,930
And it was instead of exponential they replaced
it with, so they just made some changes to
86
00:12:49,930 --> 00:12:56,620
this part, and keeping everything else same.
So infact this is aexpression for Pn, how
87
00:12:56,620 --> 00:13:02,589
did they come about with this particular formula,
that is clearly a hard problem, right, it
88
00:13:02,589 --> 00:13:17,750
is clearly very hard way of getting it, but
couple of things to note here. This shows,
89
00:13:17,750 --> 00:13:23,040
how important hard this counting problem can
be.
90
00:13:23,040 --> 00:13:30,320
And also shows that it is of such importance
that, the great men like Srinivasa Ramanujan
91
00:13:30,320 --> 00:13:38,810
and all have worked on this problems. In fact,
this is one of the greatest work of Srinivasa
92
00:13:38,810 --> 00:13:51,700
Ramanujan, of proving that Pn is actually
this number. So, this brings us to the kind
93
00:13:51,700 --> 00:13:55,460
of the end of this whole thing.
94
00:13:55,460 --> 00:14:05,820
Where we can now know how many ways can we
distribute n items into k bins. Now with this
95
00:14:05,820 --> 00:14:13,680
done, let us try to solve the problems, that
we had in our minds.
96
00:14:13,680 --> 00:14:25,410
So, start with, let us see how many ways,
how many n digit numbers are there in which
97
00:14:25,410 --> 00:14:31,330
there are no consecutive digits are same.
Now, how does the n digit number works, n
98
00:14:31,330 --> 00:14:39,311
digit number is something like, I have some
number a0, a1, till an minus one, right, where
99
00:14:39,311 --> 00:14:52,209
ais are either zero, one till nine and a0,
okay. Let me imagine that a0 is not equal
100
00:14:52,209 --> 00:14:58,860
to zero, because if a0 is zero then I do not
have a n digit number, right.
101
00:14:58,860 --> 00:15:09,640
So a0 can have one to nine, any one of those
possibilities. Now, what can a1 have, a1 can
102
00:15:09,640 --> 00:15:15,820
have any of the same possibilities, but it
cannot have the number that a0 have. So if
103
00:15:15,820 --> 00:15:23,860
a0 is one, then a1 can have anything like
zero, two, three, four, five, six, seven,
104
00:15:23,860 --> 00:15:32,810
eight, nine. If a0 is five, then a1 can be
zero, one, two, three, four, six, seven, eight,
105
00:15:32,810 --> 00:15:38,300
nine. So for every possibility of a0, a1 can
have nine possibilities.
106
00:15:38,300 --> 00:15:45,270
And what about the next ones a2, same, because
we are not allowed to have two consecutive
107
00:15:45,270 --> 00:15:54,290
digits. So whatever that a2 is, a1 is a2 can
have anything other than a1. So again there
108
00:15:54,290 --> 00:16:02,310
are nine possibilities. And by this way, all
this n terms can have nine possibilities.
109
00:16:02,310 --> 00:16:11,579
So, the answer to this question is product
of all of them, which is nine to the power
110
00:16:11,579 --> 00:16:35,010
n. So, the number of n digit numbers in decimal
representation, where no consecutive digits
111
00:16:35,010 --> 00:16:46,310
are same is nine to the power n, okay.
112
00:16:46,310 --> 00:16:53,970
Now moving on to the next problem, this is
an interesting problem, how many functions
113
00:16:53,970 --> 00:17:01,899
are there from one to n to one to k, that
are non-decreasing. So, let us forget the
114
00:17:01,899 --> 00:17:12,939
non-decreasing part, let us first ask, how
many functions are there, how many functions
115
00:17:12,939 --> 00:17:34,419
are there from one to n to one to k. Now,
how do I calculate that, any of this function
116
00:17:34,419 --> 00:17:37,210
can send any this, function can send first
item to any of this k points, right. It can
117
00:17:37,210 --> 00:17:41,109
also send second item to any of the k points.
118
00:17:41,109 --> 00:17:51,320
It can send the third item to any of the k
points. So, total number of ways you can get
119
00:17:51,320 --> 00:18:00,480
this function is, k times k times k like this
n times, which is k power n. So, this is the
120
00:18:00,480 --> 00:18:14,700
number of functions that are there from one
to n to one to k, good. Now if I add the question,
121
00:18:14,700 --> 00:18:25,650
that number of increasing function. What does
increasing mean? Increasing means that if
122
00:18:25,650 --> 00:18:37,309
x is less than y, then f of x is strictly
less than f of y.
123
00:18:37,309 --> 00:18:50,340
Now how many such functions are there from
one to n to one to k. Now as you can say here,
124
00:18:50,340 --> 00:18:53,240
that of course, if k is less than n, it is
less than n, then I cannot have a increasing
125
00:18:53,240 --> 00:19:06,770
function, why? Because how can I have a increasing
function, because of one goes to one, two
126
00:19:06,770 --> 00:19:14,690
goes to two, three goes to three, I have to
keep on increasing, then n has to go to something
127
00:19:14,690 --> 00:19:24,080
like n, but n is greater than k. I do not
even have enough terms there, then the number
128
00:19:24,080 --> 00:19:31,340
is zero.
129
00:19:31,340 --> 00:19:37,440
And if n if the opposite is true, if is k
is bigger than or equal to n, then what happens?
130
00:19:37,440 --> 00:19:52,570
If k is bigger than or equal to n, it means
that I can, I can pick n elements from this
131
00:19:52,570 --> 00:20:00,609
1 to k and once I have picked some n elements
out of this 1 to k, there is a unique way
132
00:20:00,609 --> 00:20:07,389
of sending this 1 to n to the set of n elements.
Why? Because this 1 has to go to the smallest
133
00:20:07,389 --> 00:20:10,909
element in n, two has to go to the second
smallest element, set A.
134
00:20:10,909 --> 00:20:31,559
So I say I have set A, so it is A is a set
subset of 1 to k of size n, so size of A is
135
00:20:31,559 --> 00:20:38,820
n, then there is only unique way of sending
this set 1 to n to the set A. Because I have
136
00:20:38,820 --> 00:20:46,919
to send the first element, the element 1 to
the smallest element in A, second one to the
137
00:20:46,919 --> 00:20:52,779
second smallest element in A and so on. So
the number of ways, number of increasing functions
138
00:20:52,779 --> 00:21:01,679
is the same as the number of ways I can select
n objects from 1 to k.
139
00:21:01,679 --> 00:21:20,979
So the number is equal to k choose n. Now
if I make this problem a bit more complicated,
140
00:21:20,979 --> 00:21:24,649
by asking the main question, which is this
question, how many non-decreasing functions.
141
00:21:24,649 --> 00:21:35,489
Now, again here, so the result is ofcourse
what is written there. This can be less than,
142
00:21:35,489 --> 00:21:47,909
x is less than or equal to y, then f of x
is less than or equal to f y. Now again, the
143
00:21:47,909 --> 00:22:05,009
idea is simple. Once I pick a subset A, okay
and in this time with replacement.
144
00:22:05,009 --> 00:22:16,850
The size of A equals to n, and but A can have
multiple copies, right multiple copies of
145
00:22:16,850 --> 00:22:26,750
the same element. So once I pick the subset
A with replacement from 1 to k, then I know
146
00:22:26,750 --> 00:22:35,710
there is a unique way of sending 1 to n to
A once again. So the number here is basically
147
00:22:35,710 --> 00:22:49,960
number of ways of getting n objects from k
objects with replacement and how many ways
148
00:22:49,960 --> 00:23:10,240
can I get it. So this is equal to choosing
n objects from the set 1 to k with replacement.
149
00:23:10,240 --> 00:23:23,989
An how many ways can I get it? Now I quickly
take you back to this old slide and this number
150
00:23:23,989 --> 00:23:30,320
is basically what we are asking for the way
in which selecting k objects, actually I am
151
00:23:30,320 --> 00:23:35,710
asking how to select n objects from k objects,
but this is just the opposite of that with
152
00:23:35,710 --> 00:23:44,049
repetitions and I do not care of the ordering,
right, so it is this number. So in our case,
153
00:23:44,049 --> 00:23:49,580
it will be this number with k and n shift.
154
00:23:49,580 --> 00:24:04,789
So if I go back where I started, this is n
plus k minus 1 factorial by k minus 1 factorial
155
00:24:04,789 --> 00:24:12,659
times n, okay. Now let us move on to the third
problem.
156
00:24:12,659 --> 00:24:25,729
The third problem is how many ways can you
distribute n identical toffees among k kids
157
00:24:25,729 --> 00:24:34,210
and this is again, I have done this calculcation
many times, is n plus k minus 1 factorial
158
00:24:34,210 --> 00:24:55,769
by k minus 1 factorial times n, okay. Now
let us move on to the last problem.
159
00:24:55,769 --> 00:25:02,639
The last problem states the number of 01 string
of length n, which does not have any consecutive
160
00:25:02,639 --> 00:25:11,879
zeros. This problem is quite a challenging
problem. I will let you guys to think about
161
00:25:11,879 --> 00:25:21,710
this problem. We will come back to the next
class with this problem and this we will help
162
00:25:21,710 --> 00:25:26,459
us to start a completely new way of calculating.
Thank you.