WOLFRAM|DEMONSTRATIONS PROJECT

Balancing Abstract Chemical Equations with One Kind of Atom

​
a
5
b
7
c
19
Diophantine equation
Frobenius number
solution
x
A
5
+ y
A
7
= z
A
19
5x+7y19z
23
​
This Demonstration solves chemical-like equations with one kind of atom, represented by the letter
A
. An expression like
A
n
can be thought of as a "molecule" of
n
atoms of
A
. For the equation to be balanced, the counts of the atoms on both sides must be the same. Balancing the equation
x
A
a
+y
A
b
=z
A
c
is equivalent to solving the Diophantine equation
ax+by=cz
, where parameters
a
,
b
, and
c
are positive integers, and the solution should be in non-negative integers
x
,
y
and positive
z
.
The Diophantine equation
ax+by=d
, where
a
,
b
are positive and with a solution in non-negative integers, is a Frobenius equation. The largest
d
for which the equation has no solution is called the Frobenius number. So if
f
is the Frobenius number of the equation, then the Frobenius equation has solutions for all
d>f
. The problem of balancing the chemical equation is reduced to solving the Frobenius equations
ax+by=cz
for
z=1,2,…,k
, where
k
is the smallest number for which
f<ck
and
cz
is as small as possible.