Chemical Equations and Diophantine Equations17/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:
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: 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. 
AuthorI work as a pricing actuary at a reinsurer in London. Categories
All
Archives
October 2021

Leave a Reply.