In probability theory and statistics, the momentgenerating function of a random variable X is The momentgenerating function generates the moments of the probability distribution, as follows: If X has a continuous probability density function f(x) then the moment generating function is given by 

where m_{i} is the ith moment. Regardless of whether probability distribution is continuous or not, the momentgenerating function is given by the RiemannStieltjes integral where F is the cumulative distribution function. If X_{1}, X_{2}, ..., X_{n} is a sequence of independent (and not necessarily identically distributed) random variables, and 
where the a _{i} are constants, then the probability density function for S _{n} is the convolution of the probability density functions of each of the X _{i} and the momentgenerating function for S _{n} is given by 
Related concepts include the characteristic function, the probabilitygenerating function, and the cumulantgenerating function. The cumulantgenerating function is the logarithm of the momentgenerating function. 