 This lecture is part of the course Berkeley Math 115, which is an introductory undergraduate course on number theory. And it will be on binomial coefficients. And this lecture will be in two parts. This video will be a review of some basic properties of binomial coefficients, and the next video will be some applications of binomial coefficients to number theory. So I will start off by reviewing the definition of a binomial coefficient. So binomial coefficients are denoted by nk and pronounced n choose k. And the first definition is that n choose k is the number of k element subsets of an n element set. And for example, let's just work out 5 choose 2 to see what this is equal to. So we take 5 elements, there's 5 points. So I want to pick out 2 of these, and let's just work out all the ways of doing this. Well, I can pick out the first and the second, or the first and the third, or the first and the fourth, or the first and the fifth, or I can pick out the second and third, second and fourth, second and fifth, or third and fourth, third and fifth, or the fourth and the fifth. So to count up, we see there are exactly 10 ways to choose these two elements. So 5 choose 2 is equal to 10. Another way of getting a binomial coefficient is to take the coefficient of an expansion of a binomial, which is where the name binomial coefficient comes from. So a binomial, well, bi means 2 and nomial sort of means names. So a binomial has two names and the names are variables. So here we've got a binomial, which is the sum of two variables. In general, a binomial is just a fancy way of saying the sum of two things. And I can take its nth power and expand this out as n0 x to the n plus n1 x to the n minus 1y plus n2 x to the n minus 2y squared and so on. So I can just define these numbers here to be the numbers I get by doing this expansion. And if we do n equals 5 as an example, I have x plus y to the 5 is equal to x to the 5 plus 5x to the 4y plus 10x cubed y squared and so on. So this coefficient here is 5 choose 2. So a third way of defining binomial coefficients is by an explicit formula. So I could just say n choose k is equal to n factorial over n minus k factorial times k factorial. For example, if I want to work at 5 choose 2, this is just 5 factorial over 5 minus 2 factorial times 2 factorial, which is 120 divided by 6 times 2, which is just 10. Or we can define them using Pascal's Triangle. So you remember Pascal's Triangle is formed by writing down rows like this where each number is the sum of the two numbers immediately above it except maybe on the edges. Well, I guess you should sort of put zeros down here or something. Pascal's Triangle is named after the French mathematician Pascal, but he certainly wasn't the first to come up with it. It was known to Indian and Chinese mathematicians way before Pascal. For example, Wikipedia has this picture from a Chinese manuscript many centuries before Pascal. And even if you can't read Chinese, you can see that this is in fact Pascal's Triangle because the Chinese numbers for 1, 2 and 3 are pretty obvious. They're just 1, 2 or 3 horizontal lines. This is using some rather old Chinese characters for numbers where 4 is 4 horizontal lines and so on. I think modern Chinese characters for numbers look a bit different from this. Actually, I think these days Chinese just use Arabic numerals like the rest of us most of the time, but anyway. So if we go back to this picture, we've got four different ways of defining these binomial coefficients and we want to show they're all equivalent. So what I'm going to do is I'm going to show that the definition using this combinatorial definition is the same as these three ways of defining it. So first let's do the fact that the combinatorial definition is the same as the generating function definition. So here I want to show the x plus y to the 5. I want to show the coefficient of, I want to work out the coefficient of x cubed y squared in this. And how do we work this out? Well, we take five copies of x plus y and we just multiply them out. And we want to find the coefficient of x cubed y squared in this. And how do we do this? Well, we see we've sort of got five objects here where each object is a binomial. And I'm going to pick two of these objects, say if I pick these two. And for these two objects, I'm going to take the y in the corresponding binomial. And for the others, I'm going to take the x. So here I'm going to get a factor x times x times y times x times y. And this is going to give me a copy of x cubed y squared. And you notice that any other way of choosing two of these binomials will give me x cubed y squared with the x's and y's in a different order. For example, if I take these two as my special elements, I will get y, y, x, x, x, which will be another copy of x cubed y squared. So you can see the coefficient of x cubed y squared is equal to the number of ways to choose two elements from a five-element subset. And of course, there's nothing special about two and five here. The same works for any coefficient of any power of x plus y. So the first two ways of defining binomial coefficients are the same. Next, I'll do the Pascal's Triangle definition. So if we write out Pascal's Triangle, we see, for example, that this element here is the sum of these two elements here. So what I want to do is to show the corresponding thing holds for the binomial coefficient. So this is five-choose-two, and this is four-choose-two, and this is four-choose-one. And so I want to show that five-choose-two is the sum of these two numbers here. Let's work out the number of ways of choosing two elements from a five-element set. And what I'm going to do is I'm going to make one of the elements very special. Let's pick the first one. So how can I choose a two-element subset? Well, first of all, I could pick this special element plus one of the remaining four elements. And there are four-choose-one ways to pick one of the remaining four elements. Alternatively, I could not have this special element and pick two of these four elements, and that gives me four-choose-two. So what we see is that five-choose-two is equal to four-choose-two plus four-choose-one. And exactly the same argument works if you replace five and two by any n and k. And we find nk is equal to n minus one-choose-k plus n minus one-k minus one, because you can choose k elements either by including the first element or by not including the first element. So if we take the binomial coefficients and write them out on a table like this, two-zero, two-one, two-two, three-zero, three-one, and so on, we see by this formula that each number is the sum of the two above it. So it has exactly the same property as Pascal's Triangle. So to show it really is Pascal's Triangle, all we need to do to finish off is to show the numbers on the boundary are the same in both of them. And this is kind of really obvious. For example, these numbers are the number of ways of choosing zero elements from an n-element subset. And there's obviously only one way to do that because we just don't choose anything. And similarly, this line is the number of ways of choosing an n-element subset of an n-element set. And again, there's obviously only one way to do that. We just choose the whole set. So that shows that these two definitions are the same. So to finish off, we just have to show that these two definitions are the same. So let's see how to do that. So we want to show that n factorial over n minus k factorial times k factorial is equal to n choose k, which is the number of k-element subsets. And I'm going to rewrite the left-hand side in a slightly different way. I'm going to write this as n times n minus 1 times n minus 2 all the way down to n minus k plus 1 divided by n factorial. Sorry, k factorial. And you can see these two expressions are equal because this expression here is just n factorial over n minus k factorial. n factorial is the product of all numbers up to n and then we throw away all the numbers up to n minus k and we're left with this. So let's do this for 5 and 2 just to see what's going on. So I've got 5 factorial over 3 factorial times 2 factorial, which is equal to 5 times 5 minus 1 divided by 2 factorial. And I want to show this as the number of 2-element subsets of a set of 5 points. So let's count them. Well, if I pick 2 elements, I need to choose a first element, say that one, and there are 5 ways of doing that. And then I need to pick the second element of my subset and I can pick anything except the element I first chose, so maybe this one. And there are 4 ways of doing that because that's 5 minus 1 possibilities. So the number of ways of picking 2 elements from a 5-element subset is now 5 times 4. Well, this is 20, which isn't what we want. We wanted the answer 10, so we've miscounted somehow. And the reason we've miscounted is that we could have picked these 2 elements in a different way. We could have picked the first element to be this one and the second element to be this one. So we actually counted this subset twice because there are 2 ways in which to order the 2 elements. So we should divide by the number of ways of ordering the k elements we picked. And the number of ways of ordering k elements is just k factorial. So the number of ways of picking 2 elements from a 5-element set is really 5 times 4 divided by 2 factorial, which is indeed 10. And in the same way, you can see that the number of ways of choosing a k element subset of n elements is given by this expression here. The numerator counts the number of ways of picking these elements where we take the order into account and the denominator just divides by the number of different ways of ordering our k elements. Well, binomial, bi means 2 and nomule sort of means name. This suggests you should also have things called trinomials where you replace 2 by 3. And you can indeed do this. For instance, a typical trinomial is x plus y plus c. And we can have a trinomial theorem where you expand this to the power of n and write it as the sum over i, j and k of x to the i, y to the j, z to the k times some mystery coefficient. And what is this coefficient? Well, pretty much anything you can say about binomials has a sort of analog for trinomials. In particular, we can write down explicit expressions for this. That's not very difficult. It's just n factorial over i factorial times j factorial times k factorial. You can see this really is a generalization of the binomial theorem, because if we're writing x plus y to the n as sum of x to the i, y to the n minus i times something, then this coefficient here is going to be n factorial over i factorial times n minus i factorial, where I'm writing n minus i instead of j. So we can also find things like a three-dimensional Pascal's Triangle, which I guess should be called a Pascal's Tetrahedron, whose coefficients are given like this. And everything I said about binomial coefficients, you can generalize the trinomial ones. I'm not going to do this explicitly, because we don't really need trinomial coefficients very much. Next we can look at a sort of binomial polynomial. So if I take the left-hand edge of Pascal's Triangle, you can see this is a polynomial. It's not a terribly interesting polynomial, because it's just one everywhere. The next one goes 1, 2, 3, 4, and you can see that this is also a polynomial. It's just a polynomial taking n to n, which is again not terribly interesting. The next row looks like this. We get 1, 3, 6, 10, and so on. And this is slightly more interesting because these are called the triangular numbers. And they're called triangular numbers because they're the number of ways of arranging some points in a triangle. For instance, you can arrange one point in, well, they're all hard to see. It's a triangle if there's only one of them, but it's a sort of degenerate triangle. Or you can take three points in a triangle or six points in a triangle or ten points in a triangle. And you see that if we take ten points in a triangle, this is formed by taking the previous triangle with six points and then adding on four points at the bottom. And if we look in here, this is given by the ten points of a triangle, the sum of the six points of the smaller triangle plus the four points on the bottom. So you can see that triangular numbers really do have the property of binomial coefficients. The next row looks like this. So the numbers now become 1, 4, 10, 20, and so on. And these numbers are called tetrahedral numbers. And they give the number of points or number of marbles in a tetrahedron built out of marbles. For example, let's do a case of 20. So if I want to form a pile of marbles, I can start by putting ten marbles in a triangle on the bottom. That's going to be the base of my tetrahedron. Then on top of this, I can put another six marbles because I can form a little triangle of marbles like this. So you see there's a triangle of six marbles. And on top of that, I can put another three marbles. And finally, on top of that, I can put a single marble. And here I've got a tetrahedron of 20 marbles. And you can see you can think of this number 20 in two ways. You can either think of it as ten marbles in a slightly smaller tetrahedron plus ten marbles in the triangle at the bottom. Or you could think of it as the sum of all the rows. So the various rows of 1, 3, 6 and ten marbles. So this number 20 is actually the sum of all these numbers here. And that fact will actually be quite useful as we will see in a moment. Of course, there's no reason to stop at three dimensions. If you want to pack four-dimensional spheres in a four-dimensional tetrahedron, then you can do that. And that will give us the next row here. So these numbers here, 1, 5, 15 and so on, will be the four-dimensional, whatever the four-dimensional name for tetrahedra is. So these polynomials are called the binomial polynomials. And they're given by mapping n to n choose k for various values of k. So let's write out the first few of them just to see what they're like. So if n choose 0 is just 1 and the polynomials n choose 1 go 1, 1, 1 and they're just polynomial n. And n choose 2, which is n times n minus 1 over 2. And n choose 3 is the polynomial n minus 1, n minus 2 over 6. And if we write these out, we find this is a half n squared plus a half n, minus a half n. And this is equal to a sixth of n cubed minus a half n squared plus a third n. And these polynomials have a following rather useful property. These are all integers if n is an integer. And that's because they're just counting the number of k-element subsets of n. And the number of k-element subsets is also an integer. And this is a little bit surprising if you look at their polynomial form because the coefficients here are certainly not integers. I mean, if you take a polynomial whose coefficients are integers, then it always takes integer values. But the converse is not true, as you see from these examples, that a half of n squared minus a half of n is always an integer, although this is perhaps not obvious if you just look at it as a polynomial. In fact, there's something to be said for using these binomial polynomials as a base for polynomials instead of n to the k. So we can write all polynomials either in terms of these polynomials or in terms of the polynomials 1, n, n squared, n cubed, and so on. So let's sort of compare them. So I suppose n is equal to 0, 1, 2, 3, 4, and so on. Let's first of all look at the monomials. So I'm going to look at n to the 0, n to the 1, n to the 2, and so on. So n to the 0 is just 1, n to the 1 goes to 0, 1, 2, 3, 4, and n squared goes to 0, 1, 4, 9, 16, and the next one would be 0, 1, 8, and so on. On the other hand, let's write down the values of the binomial polynomials n choose 0, n choose 1, n choose 2, and so on. So n choose 0 will always be 1, just as the same as here, and n choose 1 will be the same. But n choose 2 is now a bit different because it goes 0, 0, 1, 3, 6, and n choose 3 will now be 0, 0, 0, 1, and so on. And now there's a really useful difference between these. If you look at this triangle here, for n to the k, you know, it's a little bit of a mess. However, for the binomial polynomials, it's incredibly simple because it's just got 1s down the diagonals and 0s elsewhere. And this fact has the following very useful applications. Suppose you've got a polynomial which you write in terms of these binomial base. So we have a0 times n0 plus a1, n choose 1, plus a2, n choose 2, and so on. And suppose this is an integer whenever n is an integer. So suppose I've got a polynomial that always takes integer values on integers and write it out like this. Then let's think about what a0, a1, and a2 and so on have to be. Well, first of all, if we look at n equals 0, we see that a0 must be an integer because for n equals 0, all these terms here vanish, so we're just left with a0, and that means a0 must be an integer. Well, if a0 is an integer, then we may as well cross off this term, and this remaining polynomial is also an integer whenever n is an integer. Now, let's take n equals 1, so the value of this is going to be a1 because all these terms vanish because of all these zeros here. So a1 must also be an integer, so we can cross it off. And now the sum of all these terms is always an integer when n is an integer. Now let's look at n equals 2. Well, for n equals 2, this term is 1, and all the remaining terms are 0, so the value is a2, and a2 is an integer. And we can go on like this, and we find ai is always an integer. So we have the following really nice fact about polynomials. If we write polynomials in the form a0, n choose 0, plus a1, n choose 1, and so on, then this is an integer for all integers n is equivalent to saying all the ai are integers. So the analog is definitely false if instead of using binomial polynomials, n squared, n cubed, and so on, as we just saw a counterexample earlier than this. So if we write polynomials in terms of binomials, it's easy to check whether they're all integer values. If we write them in terms of powers, well, suppose we take n cubed over 6 plus 5 over 6n. Is this always an integer? And you see, if you look at this, it's not at all obvious. You have to stop and think about it a bit. I mean, it's not that difficult to tell, but it's something you have to think about. So let's see another advantage of these polynomials. If you remember, we pointed out when we were doing tetrahedral numbers that this number here is the sum of all these numbers above it. And much the same argument shows that for each binomial coefficient, it's always the sum of all the numbers above it in the next line across. And this is really useful because it makes it very easy to work out 0 choose k, plus 1 choose k, plus 2 choose k, and so on. In fact, if we sum all the way up to n choose k, this will just be n plus 1 choose k plus 1 by the same argument. So this is saying in Pascal's Triangle, this number here is the sum of all the numbers in this diagonal above it. And we can prove that just by using the usual property of Pascal's Triangle. And this makes it very easy to add up values of a polynomial. For example, suppose you want to know 0 squared plus 1 squared plus 2 squared plus all the way up to n squared. Well, adding up all the squares is not completely trivial. And there's a formula for it. It's equal to n times n plus 1 times 2n plus 1 over 6. And if you remember from when you were learning about induction, having to prove this by induction is a standard exercise. But proving this by induction is a bit of a mess. I mean, you can say, where does this funny formula come from? I guess you could find it by trial and error or something. But it's really not easy adding up polynomials. And if I asked you for something like 0 to the 4 plus 1 to the 4 plus 2 to the 4, it wouldn't be that easy to figure out what it was. However, by using these binomial polynomials, it becomes much easier. For instance, we can notice that n squared can be written as a sum of binomial polynomials. So it's nn minus 1 over 2 times 2 plus n. So this is 2n choose 2 plus n choose 1. And now we can sum up all the numbers from 1 to n squared. So this is just going to be 2 times 1 choose 2 all the way up to plus n choose 2 plus 1 choose 1 all the way up to n choose 1. And because we know how to sum up binomial coefficients, this is just going to be 2 times n plus 1 choose 3 plus n plus 1 choose 2. It's because adding up binomial polynomials is really easy. And you can just calculate this is n times n plus 1 times 2n plus 1 over 6. So if you want to add up numbers of values of a polynomial, you should think about writing your polynomials in terms of binomial polynomials, not in terms of powers of n. Next, we come to some basic properties of binomial coefficients. First of all, we notice that n choose k is equal to n choose n minus k, at least if n and k are positive integers. And that's because if we choose a k element subset of n elements, so let's take n equals 5. So if I choose a k element subset, for instance I might choose this 2 element subset, you notice the complement, all the things not in that, are a 3 element subset. So this follows because the complement of a subset is always a subset. Another basic property is if we add up the rows of Pascal's Triangle, let's add up all the elements in each row. We get 1, 2, 4, 8 and so on. And you notice these are just powers of 2, 2 to the power of n. And this can be proved in many different ways. For instance, let's do a combinatorial definition. So n choose 0 plus n choose 1 and so on plus n choose, all the way up to plus n choose n, is equal to the number of 0 element plus 1 element and all the way up to plus n element subsets. And this means it's just the number of all subsets of n. And the total number of subsets of an n element set is just 2 to the power of n. So that's a combinatorial proof of this. You can also prove that this sum is equal to 2 to the n by using the generating function definition or the factorial definition or the Pascal's Triangle definition. For instance, if we wanted the generating function definition, we know x plus y to the n is equal to the sum of n choose k, x to the n minus k, y to the k. And if we just put x equals y equals 1, we find 2 to the n is sum over k of n choose k, which is what we wanted. Another thing that comes up quite often is actually an alternating sum over these. So if we look at Pascal's Triangle, what we're going to do now is take an alternating sum like this. And if we do this, we find the sum here is 1, 0, 0, 0, 0, and so on. So an alternating sum is always 0. For some of the rows, this is obvious. For instance, here, the 3s are cancelling out and the 1s are cancelling out because Pascal's Triangle is symmetric. But for some of the rows, it's a little bit less obvious. And let's see why this sum is 0 except, of course, for the first row. Well, we could give, again, we can give a generating function definition, which would be just like this one except we take y equals minus 1. But I'm going to give a combinatorial definition. What we do is this sum is equal to the number of even element subsets minus the number of odd element subsets. So what we want to do is to show that if we've got more than zero elements, the number of even element subsets of a set is equal to the number of odd element subsets. And let's just take n equals 5 as usual. So here I've got 5 elements. And I'm going to pick out one of the elements as being special. This is why I need n to be greater than 0 because if I had no elements, I couldn't pick out one of them as being special. And then if I take any subset, for example, if I take this subset of 3 elements, I can form another subset by changing whether or not the first element is in it. So I can group all the subsets in pairs where you get from one element of the pair to the other by adding or subtracting the first element. And you can see in each pair one of them is odd and the other is even. So this gives a one-to-one correspondence between the odd element subsets and the even element subsets, which shows that this sum must be zero. There's another sum which turns up quite a lot. This says that if we sum over all i of m choose i times n choose k minus i, this is equal to m plus n choose k. This is probably the single most useful of the more complicated sums involving binomial coefficients. There are endless more complicated sums involving binomial coefficients, but this is probably the one that turns up most often. And let's see why this is true. Well, let's give a combinatorial definition. This is the number of k element subsets of an m plus n element set. So let's write out an m plus n element set. We have m elements here and we have n elements there. And we're choosing a few elements here and a few elements here and ignoring the others. So here, for example, we've got a five-element subset. And this particular five-element subset has three elements from m and two elements from n. And if we want to get all the five-element subsets, then there are several ways. We could take zero from m and five from n or one from m and four from n. And similarly, we could look at these other possibilities. And the number of ways of taking zero from m and five from m is m zero times n choose five. And the number of ways of taking one element from m is just m one times n choose four. And here we get m two times n choose three and so on. So we can see that sum of these is just equal to all the five-element subsets of m plus n, which is m plus n choose five. And if you look, this sum here is just the sum appearing on the left here. So we see by counting that these two expressions are equal. If you want to exercise, you can also prove this identity by using the generating function definition of binomial coefficients. So a couple more places that binomial coefficients turn up. First of all, they turn up if you're driving a taxi cab. So I suppose you're driving a taxi cab in an American town where all the streets are nicely arranged like this. And your taxi starts here. And you want to get to some point over here saying you want to know how many ways are there to drive from this point to this point. Of course, you want to do the shortest possible distance. And one way, well, you could just go along here and up there. You could take the obvious way. Another way, you might do something more complicated. You might go up here and along here and along here and along here like that. And as you can see, there are quite a lot of different possibilities you could do. So let's count how many ways there are. Well, first of all, the number of ways to go to something on this bottom row is obvious. There's only one shortest way along here and only one shortest way along here. And how many ways are there to get to here? Well, obviously, there are two ways because you can either go to this point first and then go up. Or you can go to this point first and then go along. What about this way? Well, you can either go to this point here. There's one way to do that. Or you can go to this point here. There are two ways to do that so that you get two plus one, which is three. And similarly, we get three there. And again, here, you can either go horizontally and then go up. Or you can go to this point and then go along so we get three plus one, which is four. And here we can either go to here, which is three ways. And then go to here so we get six. And you notice what we're doing is each number is the sum of the number below it and the number to the left. So we can easily fill these in. That's 10, 15, 21. And here we get 10, 20, 35, 56. And here we get 5, 15, 35, 70. And so we see that the total number of ways of getting here is actually 126. And you notice this is, of course, just Pascal's triangle. Because if I turn it this way around, we're just getting these numbers 1, 1, 1, 1, 2, 1, 1, 3, 3, 1, and so on. So binomial coefficients turn up as the number of ways of driving from one point to another on a rectangular grid. Another way is in dividing things up. So suppose you have a bunch of five pirates and they want to divide up 100 gold coins. And how many ways of doing this are there? Well, what we've got to do is we've got to give each pirate some of these 100 coins. So there are five numbers. We can have a, b, c, a plus b plus c plus d plus e are the numbers of coins the five pirates get. And this must equal 100. And we also have a, b, c, d, and e are integers. And they're all greater than or equal to zero. So we want to ask, how many solutions does this equation have in these unknowns? And the answer is it's 104. Choose four. And to see this, let's arrange all the coins in a row. So here's 100 coins in a row. And I'm going to put some vertical lines between the coins at various points. And I'm going to put in four vertical lines. And the number before the first vertical line is going to be a, and this number is going to be b, c, d, and e. So how many ways are there to put four vertical lines in a row of 100 gold coins? Well, if you notice, the number of coins plus the number of vertical lines is 100 plus four. So I've got 104 objects where each object is either a line or a coin. And in these 104 places, I've chosen four of them to be where the lines are. So the number of ways of putting these lines in is just 100 plus four. Choose four. So that's the number of solutions of this equation. Okay, that's the end of the first part of the talk. The next video will be on some applications of binomial coefficients to number theory.