 So, in the previous lectures, we have covered about joint distribution of random variables, marginals, PMF of, up marginals of PMF, PDF, independence of random variables, correlation of random variables. I think we also discussed joint distributions of functions of random variables, right? And we stopped at moment generating functions. Any questions so far on whatever we discussed so far? And where are you people in IE 621? Conditional expectations. I think and all these law of large numbers central limit theorem are reached and moment generating functions. So, we have conditional probability mass function in PDF, but I will be going through them very quickly today. So this is the last lecture on the necessary probability we need and whatever the two theorems we are going to discuss today, law of large numbers and central limit theorem here, they are the basically bridge between our probability and statistics, ok. So moment generating functions what is abbreviated as MGFs is a function phi which goes from real values to positive real numbers and how it is defined, phi of x of a random variable x at point t is defined as expectation of e to the power tx, ok. So x is your random variable and now you are going to take expectation of this. So what you are basically doing is we are defining a new random variable y which is e to the power t of x and now we are trying to find expectation of y and this is we are defining for every t that is why the argument of this function is the entire real line and now this e to the power tx, this is always going to be positive, right. So this random variable y I have defined, this is a positive valued random variable. Even if my x takes negative values, y will always take positive value. So that is why the range is always going to be positive value. Now it is expectation you can just see that and if you recall we had something called Lothar's right law of unconscious statisticians, yeah. If you just apply this, I really do not need to go and find out what is the PMF or PDF of y from PMF or PDF of x, all I just need to do is compute this probabilities and use up this function then you will directly gets this moment generating functions. So to find this moment generating function that is it like if I to find the moment generating function of x, if it is discrete just use this value to compute this expectation and if it is continuous just use CDF of x to compute this expect, I mean this expectation. Now why this moment generating functions are useful, ok. Now look into this for time being that does not matter, let us assume. So notice that if you look into this phi of x, is this function is differentiable in t, see phi of x is taking t as the argument, right. Can this function be differentiated at t, ok let us say we can differentiate. So what is this for time being just focus on the continuous case, ok. So now phi of x of t is f of x, x dx of t x dx and this is entire, now what I am asking is d by dt of phi of x at t and now I need to suppose I now what I am doing here first time doing the integration operation and then I am doing the differentiation operations. Can this integration and differentiation operation can be swapped? So instead of this I want to do this, now I want to do differentiation first d by dx, are they still the same if I do this, yes all the time when this is possible, it need to be, you said somebody say uniformly continuous what is that, ok anyway check this when this is possible, they are integrating, yeah x, yeah we are integrating over x that is fine, but is still always possible to change this integration and differentiation, it is in general not true, but it works under some conditions, you can look for those conditions. Now if you do this here, this becomes simpler, right only thing that is differentiable since I have to differentiate with respect to t, this is simply going to be t e to the power dx dx, right and now if I do this, this is going to be t times, what is this, now t has come out, right, alright. Now if you look into this expression, one thing you will notice is had this term not been there e to the power tx, this is exactly equal to expectation of x, right and when this term will not be there, one possibility is when t equals to 0. So, if I take do this d by dA t phi of x t and compute it at t equals to 0, I get expectation of x. So, like this if you do it, take that second derivation, you will end up with this expression, ok and now see like this one here, what I basically did here, this I can simply write as this is nothing but expectation of x e to the power tx, right. Now simply now if I, so that is why this is x e to the power tx, now if you do a double differentiation you will get and again if you put t equals to 0, you will get expectation of x square. And similarly if you keep on doing, take the nth derivative, you will get this and when you compute that value t equals to 0, you will get this. So now notice that you got expectation of x, expectation of x square and expectation of x power n. These are called basically the moments. Expectation of x is the first moment which we also call as mean and this is the second moment and like that and when you do it nth, this is called the nth moment, ok. So, if you somehow know the moment generating function of a random variable, basically you can generate all the moments, ok. Just you need to do, if you need to find the nth moment, you need to differentiate that many times and after that plug in t equals to 0 in the nth derivative, ok. This is true, I am doing this until the assumption that it is the differentiable at the point t equals. And now if I know the first moment and second momentum, moment, I know the relation for computing the variance. Now variance of x is nothing but second momentum minus square of the first momentum. You can even go and collect the variance in this case. So, another thing moment generating functions are used is with them operations becomes many times useful, ok. For example, let us say if you have this bunch of random variables and I say that they are independent, ok. Now in that case and I will be interested in this new random variable which is basically the sum of all these random variables and I am interested in finding phi of y at t. So, now that is y is nothing but summation and by definition, before I write this by definition this quantity is nothing but expectation of e to the power t x 1 x 2 all the way up to x n which is nothing but expectation of e to the power t x 1 e to the power t x 2 and e to the power t x n. And now if this x 1 x 2 are independent, can I write the expectation of the product as product of the expectations of each one of this term? Now we know that this is nothing but this product i equals to 1 to n expectation of e to the power t x i. And by definition this is nothing but phi of x i at t. And that is what we have obtained, ok. So, when I have this bunch of random variable and if they are independent, if I know the moment generating function of each one of them, then I can easily compute the moment generating function of their sum. All I need to do is take the product. Another good thing about MGF is moment generating functions uniquely determines the distribution. If you give a distribution and if I find out its moment generating function, there is a 1 to 1 map between them, ok. So, here is I have directly put a table here computing moment generating functions of some of the distributions that we have studied. The moment generating functions of a Bernoulli random variable with probability p or with parameter p is this quantity. And binomial is going to be like this. And geometric can be computed to be like this. Like this Poisson also computed and for the distributions like uniform, exponential, Gaussian and gamma also have computed and written here, ok. Now, suppose let us say I give you a moment generating function which is of this form. This is what? This means this x is definitely has to be binomial, ok. And let us take another example. If I have another moment generating function which I said to be like this. So, this has to be this is which distribution first? Normal. Normal, 0.7 and 1 variance is going to be 1, ok. So, like this if I tell you any moment generating functions, you should be able to uniquely map it to that distribution. And there is one more notion of characteristic function which is very analogous to moment generating function, but that involves this complex number. Instead of simply taking it to the power tx, we will take it as e to the power tjx. If our random variable has some complex value in that maybe it we can handle that, ok. And what is j here? j is the Euler's number, ok. And by definition or like as a property this characteristic function always exist, ok. So, once we make it complex valued, right, if something we cannot present in real we can always present in the complex domain. So, that is why this the good thing about characteristic function is this always exist. And sometime moment generating functions may not exist. And as a remark like if we know that let us say for some n, what does this mean? Yeah. So, the nth moment of a random variable is finite. That means its nth moment exist. What does this mean is this implies I mean this needs a proof, but I am just giving as a remark. This is going to be then this implies that x of j is going to be infinity less than infinity for all j less than or equals to n. So, if nth moment is finite that means if exist all the lower moments also exist. But with this information I cannot claim that expectation of xn plus 1 is finite. I cannot claim this. This does not imply, ok. So, more on the moment generating functions we will see in the tutorial session and we just you have to remember this. Like the only thing is discrete you have to use the appropriate summation formula like and if it is continuous you have to use the integration, use the PDF there.