THE REINSURANCE ACTUARY
  • Blog
  • Project Euler
  • Category Theory
  • Disclaimer

Uniqueness of Moment Generating Functions

18/10/2016

 

Most undergraduate probability textbooks make extensive use of the result that each random variable has a unique Moment Generating Function.  In particular, we can use this result to demonstrate the effect of adding or multiplying random variables.  For example, the proof that the sum of two Poisson Random Variables is also a Poisson Random Variable (with mean equal to the sum of the means of the two Poissons) is much easier if we can invoke this result.
​
Proof for the sum of two Poisson distributions:
Suppose $X$ and $Y$ are independent Poisson Distributions with parameters $\lambda_1$ and $\lambda_2$.
We know that the $MGF$ of a Poisson Distribution with parameter $\lambda$ is $e^{ \lambda ( e^t - 1)) }$.

​We can now use the result that:
$MGF_{X+Y} = MGF_X * MGF_Y = e^{ \lambda_1 ( e^t - 1)) } * e^{ \lambda_2 ( e^t - 1)) } = e^{ (\lambda_1 +\lambda_2) ( e^t - 1)) }$

Which is the $MGF$ of a Poisson Distribution with distribution $\lambda_1 + \lambda_2$ proving the result.

Do we need a proof?

Call me pedantic, but I never liked the fact that this uniqueness result is usually stated without proof. For me, there was always an elegance to a textbook that began with definitions and axioms, and possibly a handful of weak results which were taken as given, and then proved everything required on the way. In my experience Probability and Stats books seem particularly prone to not being self-contained and rigorous in this way. I suspect it has something to do with the fact that probability and stats, if done 100% rigorously, are both extremely technical and difficult! It would be a shame if we had to wait until we had mastered complex analysis and measure theory before we could learn about predicting the number of black and white balls in an urn. (I'm joking there are actually interesting and useful parts to probability once you get past of those boring exercises about urns)

I think my discomfort is added to by the fact that there is also something slightly disingenuous in using a very powerful result to prove a fairly trivial special case without really understanding the general result you are using. If you do this too much, you never really understand why anything is true, just that it is true.

Not only is this proof not often given, I had to look pretty hard to find it anywhere..

The general proof for all random variables requires either measure theory or complex analysis and is quite involved, therefore I thought I'd just write up the result for discrete random variables.

So here is a proof of the uniqueness of $MGFs$ for discrete random variables over the support $\mathbb{N}_0$.
​
Uniqueness of MGFs

Suppose $X$ and $Y$ are discrete random variables over $\{ 0 , 1, 2, ... \} $.

Further suppose that:
$$MGF_X = MGF_Y$$

That is:
$$\forall t \in \mathbb{R} , \sum_{i=0}^{\infty} e^{ti} f_X (i) = \sum_{j=0}^{ \infty } e^{tj} f_Y (j)$$

Then,

$$\sum_{i=0}^{\infty} e^{tx_i} f_X (i) - \sum_{j=0}^{ \infty } e^{tj} f_Y (j) = 0$$

Changing the range for the second sum: $$\sum_{i=0}^{\infty} e^{ti} f_X (i) - \sum_{i=0}^{ \infty } e^{ti} f_Y (i) = 0 $$

Bringing the two sums together: $$\sum_{i=0}^{\infty} ( e^{ti} f_X (i) - e^{ti} f_Y (i) ) = 0 $$

Rearranging:

$$\sum_{i=0}^{\infty} e^{ti}(f_X (i) - f_Y (i) ) = 0 $$


We can now think of this as a power series with coefficients:
​$$g(i) = f_X (i) -  f_Y (i)$$
i.e.
$$\sum_{i=0}^{\infty} (e^t)^i g(i) = 0 $$
Which allows us to use the result that a power series which is equal to $0$ in some interval (in this case $\mathbb{R}$), must have coefficients equal to $0$ on the interval.

To see this, we consider the $nth$ derivative, which allows us to recover the $nth$ coefficient.:

$$​f^{(n)}(0) = \sum_{k=n}^\infty \frac{k!}{(k-n)!}c_k0^{k-n} = n!c_{n}$$

​Which gives us our result since $g(i)=0$ implies that the two functions $f_X$ and $f_Y$ are equal.

Chemical Equations and Diophantine Equations

17/10/2016

 

I was reading about SpaceX on Wikipedia the other day, just after they announced their plan to travel to Mars, and about an hour later, as can happen on Wikipedia, I found myself reading about Chemistry and feeling nostalgic about all the subjects that I used to know in detail but now have just a hazy recollection of. 

Reading the material on Chemistry got me thinking that there are quite a few similarities between chemical elements and prime numbers. All chemical compounds can be reduced to a combination of chemical elements in a unique way, and all integers can be reduced to a product of prime factors in a unique way. Both serve as the building blocks from which more complicated objects are constructed.

What happens if we attempt to formalise this relationship? It turns out we can actually come up with a mathematical process for balancing chemical equations. And this solution is related to the study of mathematical objects called Diophantine equations.

What is a Chemical Equation?

Let’s start by reviewing what a chemical is. A chemical equation is an equation which defines a chemical reaction. The left hand side has the inputs to the reaction and the right hand side has the outputs. So for example, the process of adding hydrogen and oxygen to create water can be written as:

          H + O -> H2O

This equation though is not balanced. We’ve got two hydrogens on the right, but only one on the left. Therefore there is some information missing.

Balancing a Chemical Equation

How do we balance a Chemical Equation? We need to define the relative amounts of the inputs and outputs so that the total numbers of each element are the same on both sides of the equation. We do this by writing an integer before each input and an integer before each output to denote the relative amounts of each molecule in the reaction.
In the case of the combustion reaction above, we can see by inspection that we need two hydrogen elements and one water element to create a water molecule, that is:

          2 H + O = H2O

What happens though if we need to balance a more complicated Equation? For example, here is the equation for the combustion of gunpowder:

          KNO3 + S + C → K2S + N2 + CO2

It is not immediately obvious to me how to balance this equation. It’s not too complicated and could probably be balanced by inspection, but what if the equation was much more complicated?

Chemical Elements and Prime Numbers

If we take the step of associating a prime number to each element in the equation, for example, let’s make the following associations:

  • K = 67 (the 19th prime number, Potassium being the 19th element)
  • N = 17 (the 7th prime number, Nitrogen being the 7th element)
  • O = 19 (the 8th prime number, Oxygen being the 8th element)
  • S = 47 (the 16th prime number, Silicon being the 16th element)
  • C = 13 (the 13th prime number, Carbon being the 13th element)

And we also replace the additive notation with a multiplicative notation, then we get the following mathematical equation for the combustion of gunpowder:

$(67*17*(19^3))^a * 47^b * 13^c = ((67^2)*47)^d * (17^2)^e *(13*(19^2))^f$

​Equating prime factors on the right and prime factors on the left gives us a system of linear Diophantine equations, one for each prime:

a = 2d
a = 2e
3a = 2f
b = d
c = f

Diophantine Equations

A Diophantine equation is a polynomial equation for which we are only interested in integer solutions. Since a chemical equation must have integer coefficients, the resulting system of linear equations is actually a system of Diophantine equations.

So returning to our chemical equation above, we can solve this equation using linear algebra. In this case, I put the system of linear equations into an online calculator, and we find that solutions to this system are of the following form for integers n:
 
a = 2 n
b = n
c = 3 n
d = n
e = n
f = 3n

I used the following online calculator:


http://www.quickmath.com/webMathematica3/quickmath/equations/solve/advanced.jsp​
 
As we are interested in integer solutions, we need to now find n such that all our coefficients take integer values. In this case, we can take n to be 1 giving us:

a = 2
b = 1
c = 3
d = 1
e = 1
f = 3
 
Putting this back into our equation above we get:
 
          2 KNO3 + S + 3 C → K2S + N2 + 3 CO2

Which we can see is a balanced chemical equation.
​
This process can be extended to balance any chemical equation, no matter how complicated.

​​

    Author

    ​​I work as an actuary and underwriter at a global reinsurer in London.

    I mainly write about Maths, Finance, and Technology.
    ​
    If you would like to get in touch, then feel free to send me an email at:

    ​[email protected]

      Sign up to get updates when new posts are added​

    Subscribe

    RSS Feed

    Categories

    All
    Actuarial Careers/Exams
    Actuarial Modelling
    Bitcoin/Blockchain
    Book Reviews
    Economics
    Finance
    Forecasting
    Insurance
    Law
    Machine Learning
    Maths
    Misc
    Physics/Chemistry
    Poker
    Puzzles/Problems
    Statistics
    VBA

    Archives

    February 2025
    April 2024
    February 2024
    November 2023
    October 2023
    September 2023
    August 2023
    July 2023
    June 2023
    March 2023
    February 2023
    October 2022
    July 2022
    June 2022
    May 2022
    April 2022
    March 2022
    October 2021
    September 2021
    August 2021
    July 2021
    April 2021
    March 2021
    February 2021
    January 2021
    December 2020
    November 2020
    October 2020
    September 2020
    August 2020
    May 2020
    March 2020
    February 2020
    January 2020
    December 2019
    November 2019
    October 2019
    September 2019
    April 2019
    March 2019
    August 2018
    July 2018
    June 2018
    March 2018
    February 2018
    January 2018
    December 2017
    November 2017
    October 2017
    September 2017
    June 2017
    May 2017
    April 2017
    March 2017
    February 2017
    December 2016
    November 2016
    October 2016
    September 2016
    August 2016
    July 2016
    June 2016
    April 2016
    January 2016

  • Blog
  • Project Euler
  • Category Theory
  • Disclaimer