 Okay, so what we're going to talk about today is basically weight distributions. We won't do this in great detail, but I'll point out some users for it. And there is one very, very interesting property that connects weight distributions in the code and its dual. So that will be the main result that we'll look at. If we can prove it today, maybe not, but in general, I'll point out why weight distributions are nice. So let's begin with C, which is an NK binary code. I'll denote by A sub i, the number of code words will see the weight i. Is that okay? So that's A sub i. The number of code words of C would be, if you want a very mathematical looking kind of rotation, let's say a size of, let's say C in C, so this is A sub i. So you might wonder what's nice about weight distribution. So if you look at binary codes, linear binary codes, weight distribution kind of tells you what all the code words that are close to a particular code word. So if we take one code word, so if we take one code word, which may be, I denote like the star. So if we denote one code word, then, so to ask the question, how many code words are there at a distance one from it? There will be, I mean, how many vectors are there at a distance one from it? That will be N, right? There will be N vectors at a distance N from it, from one from it. I think this didn't come out quite as well as I like, so I could draw it again. So that's my code word. So now I want to ask the question, how many code words are there at a distance, say, i from it? So at a distance one from it, there are N vectors, but not all of them will be code words, right? But if I tell you that A1 is, say, 2, then out of the N vectors that are at a distance one from it, two of them are code words. How do I know that? Okay, so suppose this is a code word, and suppose I tell you A1 of 2, let's say, so for example. Okay, this is for example. Then, all the N vectors that are at a distance one from it, two of them will be valid code words of the code. How do I know that? Yeah, so you take the two code words of the 8i, and then add them to C, wait, 1, I'm sorry, it means A1 equals 2 means there are two code words of the 81. Take those two code words of the 81, and add it to the C. You will get what? Two other guys. Okay, so in a way, this weight distribution tells you how many code words are a certain distance away from a given code word. Okay, so that also tells you how many, how many ways you can go wrong when you make an error. Okay, so there are so many, so there are so many code words near you. If the channel adds errors, you can somehow get close to so many of these other code words. Okay, so the weight distributions are useful in computing exact expressions for probability of block error, probability of big error and all that. Okay, so that's one way in which you can use it. Okay, and there are lots of simple results you can talk about weight distribution, so I'll write them down. You'll see some of them are very simple and they tell you something nice about it. Okay, so the first result is that in 0, 1 to A0, 1 right, so any linear block binary code will have your all 0 program, and that all 0 program has weight 0, so A0 will be 1. Okay, and then you can say that AI will be 0 for I from 1 to D minus 1. Okay, so that's the other result you can say. Okay, so from AD onwards it will be non-zero and it will continue to be non-zero in various different ways, because it's difficult to predict what the weight distribution will be. Okay, so this is where the weight distribution will look. So let's take some very simple examples and then figure out what the weight distribution will be. Okay, so if you take, let's say the n from the wrong interpretation code. Okay, it has only two code words and one code word has weight, 0, another code word has weight, and also you can say that 0 will be equal to 1, A n will be 1. Another quick property is the code words, summation AI equals 0 to n will do what? 2 bar. 2 bar, okay, so that's the number of code words. So that's the other code word. So that's the quick result you have, so there are only two code words, so let's jump. Okay, that's the first one. Second result is by D minus 1 to D, what can we say about this game? Yes. Yeah, so A 2 I is going to be equal to n choose 2 again and that will be 2 bar I equals 0 to 1 to what? N by 2. N by 2, okay, so that's 1 by 2. And we know that if you add up all these guys together, you'll get 2 bar n minus 1 and that will be 5. Okay, so the other code we can look at, so let's look at some arbitrary code. It's the code with parity check metrics. 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0. Okay, so as I tell you, code has parity check metrics. How do you find out the right distribution? It's not really, there's no real easy way to do it. Okay, for finding minimum distributions, there's no real easy way. So obviously for finding the right distribution, there will be really no easy way. So you have to just distort all the code words and complete the right distribution for that. Okay, so let's do that. Okay, so let's start with this. So the last few things are going to be 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0. Okay, the message bits are the last 3 bits. The remaining parity at the faraway of the parity will be, so it will be 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0. 0 1 1 will be 1 1 0 1 0 1 will be 0 1 1, 1 1 0 will be 1 0 1 and 1 1 1 will be 0 4. But okay, those are my 8 code words. Then from here, 1 is just write down a 0 a 1 etc. a 0 is going to be 1, a 1 and a 2 will have to be 0. Here we know from the tidal check matrix that the minimum distance is 3. So a 1 and a 2 will have to be 0, but a 3 will be 1. 4, right? 4. Counting is a hard problem, I guess. a 4 will be, okay. So you get 1, right? So you add it up, you get 8. So that's the, okay. So what about the dual of this code? So if I want the dual of this code, it's again got 8. The way I find the dual will be just do linear combinations of the rows, I think. Right? Linear combinations of the rows. So we do that, let's do that. 0 4 0 1 0 1. Okay, 0 1 0 1 1 0. 0 2 0 1 0 1 1. Then what else? 1 1 0. 0 1 1. 1 0 1. 1 1 0. 0 1 1. 1 0 1. Then 1 1 1. 0 1 1. Okay, fine. So what are the weight distribution of both? A 0 rows. So for the dual, we use A 0 prime. Just to denote the prime, so notation. A i prime is the size of code words in the dual codes, that's that. Weight of C equals. Yeah, just to differentiate. A 0 prime is 1. What about the A 3 prime? 4 and A 4 prime is. It's a curious little code, I know it's mostly related to a self-dual code. So is it self-dual? It's not really self-dual in the way I've written it down. So you can do some manipulation too. But anyway, so that's the weight distribution. This is how you go about finding it for the code and its dual. So even here, for instance, this is the code and this is the dual, right? So we can do prime if you like. Anyway, so that's the result. And it's very common to write instead of A 1, A 2, A 3 like that as a vector, people usually write it as coefficients of polynomial. So it's very common to do that. So that's called the weight distribution polynomial. And the notation, let me define that. It's actually mostly jargon, but still it gives nice results. So wc of x, y, basically summation ai, x power n minus i, y power n. Yeah, i goes from 0 to 1. The weight distribution polynomial for a code is basically a polynomial in x and y that are two variables here, not just x, two variables but x and y and it is basically coefficient is ai and the powers are x power n minus i, y power i. So you can rightfully ask, why do you need two variables? Why is it all n minus i, y power i? It doesn't really have any further information than just the information in ai. What's the point in all these things? It turns out there are transformations of these two variable polynomials which are interesting. In particular, there's a linear transformation which will take you from this polynomial to the dual state distribution polynomial. So that's a very powerful result. So that's called the McLean's identity. So we will see that hopefully tomorrow. But that's the main idea. That's why this two variable thing is very easy. So there's a point to it. We'll come to that soon. But let me write this in so many different ways for you just to see how it works. So the weight distribution polynomial can also be written in this way. Summation of the work. All the polynomials can see x power n minus weight of c y power weight. You see why this is equivalent to the previous thing? Every time the weight of the polynomial is i, I will get the x power n minus i, y power i term. How many of them do I have? I have a, s, and i. So it's equivalent to that. Both of these are exactly the same. So this is also a popular way in which this equation is written. Is it OK? So let's go back to our examples and figure out what the polynomial is. From an application code, we saw that a0 was 1 and an was 1, but nothing else in between. So the weight distribution polynomial is going to be x power n plus y power i. So the even weight code of c is equivalent to this. So c power n comma n minus 1, even weight code. What is wc power x comma i? It's going to be summation n choose 2i x power n minus 2i, y power 2i. I will have to go from 0, 1, 2, 4, and 2, 2 or f, n by 2. So another way to write it is basically instead of writing it like this, I can also do this. This guy will keep the summation over i even, 1, 2, y, x power n minus i, y power i. It's the same as that instead of going 2i, 2i, 2i. I'm just replacing it with i even. Do you know of any other formula for this? Summation is one way to get it. So one way to get it is to say, I do this and then what? Summation. Let's keep x minus y over power n. This will give you this formula, right? By 2. Yeah, that's right. So that's the direct way to do it. Think about it. So x plus 1 over power n is summation over all i, n choose i, x power i, x power n minus i over power i. That should be good. So x minus y is the same as that except that we have a minus 1 power i. So all the odd terms will cancel in the summation. All the even terms will double in the summation. So you divide by 2, you go back to this expression. So you notice here, curiously, if you replay the x plus y and y by x minus y, you go from the y distribution polynomial of the original code to that of the do it. And this turns out as a universal fact. For any code, this is true. For the repetition and even rate code, it seems like a very trivial result. But it's true for any code. For any code, you can do this. I will prove that. I've not yet proved it. It's a true statement. But there's also a constant factor. And that will basically be the number of code words in the original code. So you divide by the number of code words in the original code, you'll get there. So it's a very non-trivial, interesting little factor. You can go from the rate distribution of the code to its dual by simply doing a substitution in this polynomial. So that's a very powerful result. So let's give one more example here. Let's just see how it works. So for this, I'm going to use the 743 hamming code. So what's the 743 hamming code? So you take the palpitate check matrix, take duals, 0, 1, 1, 0, 1, 0, 1, 0. Of course, you take it in this form. So let's try and figure out the rate distribution. So A0 will be 1. A1 and A2 are going to be 0. What is A3? Let me see. Is there any smart answer out there? So if you notice, you'll see A7 will be 1 here. What is A7 being 1? All 1's is a valid code word. So if I find A3, if A3 is some x, A4 will also be the same x. So 2x plus 2 has to be equal to... See, I cannot be any A1, A2, which means A5 and A6 is also not there. Because A1 and A2 are there, A5 and A6 will also be there. But that, you know, is not there because 7 is the code word. So only thing is A3 and A4. And if A3 is x, A4 will also be x. So 2x plus 2 has to be equal to 16. So x has to be equal to 7. So from there, you can conclude A3 will be 7 and A4 will be 7. So those are the smart little tricks for small codes to figure out some things. If you want that for very, very too many codes, the simple codes, if you want to find out explicitly what the rate distribution is, even for the 6-3 code that we had before, we could have used this trick. But let's see. I mean, if I want one surprise, it's good to do it the hard way. And then you see that. So this is a nice little trick you can pull for the Hamming code. So what happens to the rate distribution polynomial? So if you want the rate distribution polynomial for the Hamming code, so C is the 743 Hamming code in the rate distribution of x, right? Basically, x power 7, right? Corresponding to the 0, right? And then, 7, x power 4, 1 power 3, plus 7, x power 3, 1 power 4, plus 1 power 7. So what's the build of the Hamming code? It's a 1, 3, 4 code. But we know that the build of the Hamming code is obtained from the Reed-Miller code, right? So it has a very specific structure. So in fact, you can show the build of the Hamming code has the rate 0 code word. And then I think all the remaining code words will have rate 4. So I think there is some such property for the build of the 743 Hamming code. But anyway, so something like that is true for the rate distribution of the build. So if you want, you can go back and check this. So each of the three rows have rate 4. Do any combination, what happens? You still get rate 4, right? This plus this is rate 4. This plus this is again rate 4. This plus this is also rate 4. Then you add all the three also, you get rate 4. So the dual code has just one code word of rate 0. And then it has some code words of rate 4. So that's the nice thing about the build. And in fact, even here, it's a little bit more painful to check. Even here, the identity I told you before is true. Instead of x if you put, x plus y instead of y if you put, x minus y. And then you have to divide by 16 because that's the number of code words in the Hamming code. You will go from here today. Put x equals, x plus y, y equals, x minus y, divide by 16. You can try this if you like. You'll go from there, the distribution of the code that that efforts to do it. So it's a powerful little idea to go from the code word to x do it. And we're going to prove that. We'll start the proof in this class. Maybe we can finish it. We'll see if you don't, we'll come back and look at it. So that's the idea. So try this if you have some time. It's a bit of an interesting way to learn this. So in general, what is true is what's known as Napoleon's identity. And they succinctly stated as follows. The rate distribution of the code is 1 by size of the code, rate distribution of the code, and the rate distribution of the code. There are several other forms for it. If you use this, y times x power minus y and y power i, it's going to be equal to 1 by 4 c. y times x plus y, y minus y. This is the other form for it. The other form is summation u and the code in the dual. x power n minus y for u. Maybe I'll put a vector here. y power y for u. It's the same as 1 over the size of c. It's the summation over u1. The code c, x plus y, x power n minus y for u. x minus y for u. There are three different forms in which you can write the Napoleon's identity. Depending on what you like, one form might appeal to you more than the other. In some cases, some of them are better. Essentially, if you look at something like this, the relationship is quite clear. Remember, these are both homogeneous polynomials, all of them are degree n. The power of y goes from y power 0 to y power n. Once you equate the coefficients on both sides, you essentially get linear relationships between the A i prime and A i. The A i prime is opened by a transformation of y with some linear relationship. It's some simple transformation that you can do from 1 to 4. That's the idea of this fantastic result. This is a quite nontrivial result. It's very interesting also that the way distribution of the dual is actually controlled by the way distribution of the original code. We're going to use this in the proof. This is the fan that we'll use for the proof. The proofs can be done in so many different ways but I'm going to use some elementary ideas. There are also more general group theoretic notions which are used to describe the proofs in simple language. Depending on mathematical sophistication, you can do them various things in this. What I'm going to do is very elementary. First property was a lemma that's used to the proof here. It's a cute little lemma. If you have a summation like this, minus 1 to the power u dot v. U dot v is the dot product to be nu and v. U and v are all binary vectors. We have all the binary vectors. I'm just sticking to binary. If you add it up to all u and c, what do you think will happen? v is an arbitrary vector. I'm going to take minus 1 to the power u dot v. I'm going to add all u and c. So it turns out there are only two different things that can happen. Either v is in the dual of the code. If v is in the dual of the code, what happens to u dot v for every u is 0. So minus 1 to the power 0 will always be 1. You will get size of c. This is if v is in the dual. If v is not in the dual, what do you think will happen? Based on similar results that we have seen in so many different contexts, v is not in the dual. You take u dot v for all u and c. What do you think will happen? You will get 0 and 1. How often do you get 0? How often do you get 1? It's going to be equally often. So what will happen to the summation? It's going to go to 0. So this is the main lemma that's used in the proof. So minus 1 to the power u dot v has a very nice behavior. In sum that over, all u is in the code. Every v is in the dual or v is not? If v is in the dual, you get size of c. If v is not in the dual, you simply get 0. Because u dot v will take values 0 and 1 equally often. So there are various ways to prove such results. So there's one slick, percept-based method which I can quickly prove. I'm not going to do it. I'll just orally prove it for you. So you look at all the subcode which is such that u dot v is 0. You fix a v and then look at the subcode of c for which u dot v is 0. That would be the subcode. You can show us the subcode. It will be added. And then you can show it has only one other process inside c. So c will have equally number of values. So I was just approving it. So I'm not going to prove this lemma for you. It's a simple result. Try it. It's easy to prove. You can also try it using so many other ways. But do it one way or another. Is it okay? So if you remember this proof, right? So basically look at the set. So that's for all u dot c for subcode. u dot v is 0. So v is in the dual. Of course, v is equal to the entire c. That's easy to show. If v is not in the dual, you can show it has at most one other, only one other course. So you see the subcode. And then if u dot v is 1, you take two of them, add it together, and you get u dot v is 0, right? So it works. So this set over the subcode put one other course. v is not 1. So of course, then this will have the same size. And there you can conclude. Very easily, often, 0 and 1. So that's the proof. I'm going to skip the proof for a sake of time. It's not really very critical. But that's the idea. There are no generalizations of this result in the group theoretic setting and all that. There is a more generalization of the result. So that's a good, more sophisticated. So how do we use this? So I'm going to start at the left-hand side there. And I'm going to use this result and get a summation over c. And then we'll see how to get rid of the summation. So let's start with... So this is proof for the material identity. So I'm going to prove that. So let's look at the summation. So let's look at the summation. So what I'm going to do in the first step is to prove it not obvious. But what I'm going to do is instead of restricting it to c, I'm going to take the summation over all binary n-tuples. So I'll keep the same thing. So if I do that, obviously it's not an equality. But to make it an equality, I'll use the previous lemma. So how do I use the previous lemma to make it an equality? So only when v is in c-top, I want this to be non-zero. So what do I do? Inside this, I'll put the summation over u in the code word minus 1 power u dot p. And then, of course, I have to divide by size of c. So you see, this is kind of like an inspired manipulation. So the final result, you can do is manipulation. So it's fine. I mean, it works out for this kind of dual. Do you see this? It is really easy enough equality to show. So instead of adding up only over the code words of the dual, I'll add a row, all the binary vectors. But then I will emphasize that only the code words of the dual play a role. I'll take minus 1 power u dot p, add a power, all u and c. I know only when v is in the dual, this will be non-zero. v is not in the dual, it's in graph v0. So I'll add a 1 by size of c to normalize that dual. Then you interchange the order of the summation here and you'll get closer to the first step. The next step is to interchange the order of the summation. So when you do that, there's no problem here. Everything is finite. So I can add up any which way I want. So I have 1 by size of c. Somewhere over u and c d. Minus 1 power. So I should keep the minus 1 also in size. Summation over v in 2 by 1 and minus 1 power u dot p. x power n minus weight of v, y power weight of c. You're okay? That's the summation. And this is the part that I have to simplify. And if I simplify, the result is true, which I said the result is true. Summation will have to work out to what? x power n minus weight of u times y power weight of u. Right? Yeah, x plus y. Sorry, x plus y power n minus weight of u, x minus y power weight of u. So everything works out right? The summation has to work out. That's the main point of the result. So we will show that this summation will simplify to that original result. If you have a challenge, try it. Try it overnight. The answer will be given tomorrow. Tomorrow I will show you how this simplification is done. If you want to try it, try this. I know it's an interesting way to prove it. It's not very hard, but you have to really work out and see what happens. Okay, expand all these things. Okay, so we'll stop here for today. We'll pick up somewhere in the next class.