The Goals of General ChemisfryA SYMPOSIUM
Chemical Equation Balancing A General Method which is Quick, Simple, and has Unexpected Applications G. R. Blakley Department of Mathematics, Texas A&M University, College Station, TX 77843 Still other skeletal chemical equations, such as
Introduction.
Some skeletal chemical equations, such as CO
+ COz + HZ= CHI + Hz0
are known to have a variety of truly distinct halancings, several of which describe various different chemical reactions which have been observed. For example the balancings CO + 3H2 COz 4H2 2C0 + 2Hz
+
--
+
CH, Hz0 CH4 2H20 CHI + C o t
+
of the aforementioned skeletal chemical equation are all known ( I ) to occur during the synthesis of methane at various temperatures between 280°C and 370% in the presence of a nickel catalyst. We will say that such original skeletal chemical equations have a many parameter family of balancings. And we will show how to calculate the number n of parameters exact Iy. In t he example ;above rht, numl~crof pari~mrterso m beshown to heruunl1112. A few moreofthe infinitelv m a w members of the Garameter family ofbalancings of the skeleta1 chemical equation above are
(NH4)2SOn= NH40H + SO2
have no balancings a t all, except the rather trivial-looking balancing This is a shorthand way of saying that no reaction whatever takes place if only some, or all, of the components appearing in the original skeletal chemical equation are allowed to take part. In this last case we say that the original skeletal chemical equation has a zero-parameter family of balancings. In other words, there is no nontrivial balancing. Only the matrix method (described below) is powerful enough to balance the skeletal chemical equation Hz
+ Ca(CN)s + NaAIFd + FeSOd + MgSiOj + KI
+ H3P04 + PbCrOp + BrCI + CF& + SOz
= PbBrz
+ CrC13 + MgC03 + KAI(OHh + Fe(SCN)3 + PIa + NazSiOs + CaFz + HzO
(1)
Moreover, if shown the balancing (which can easily he obtained by the matrix method)
Other skeletal chemical equations, such as CH,
+ 0 2 = C02 + Hz0
are known to have an essentially unique balancing. That balancing is I t would be silly to regard other halancings, such as
or even as being essentially different from the first halancing. They just say that, if you put 2 or 3 or 0 times as much in, you get 2 or 3 or 0 times as much out. Such skeletal chemical equations are said to have a one-parameter family of balancings. This terminology is synonomous with essentially unique balancing. This paper was presented at the Sympos um on lhe Goals of General Cnemistry. Pan II, helo our ng the 179th Nat~onalMeeting of the American Chemical Society in Houston, Texas, March 23-28, 1980. 728
Journal of Chemical Education
nobody today has a method at his disposal, other than the matrix method, capable of saying whether it is the only halancing of the foregoing original skeletal chemical equation. The matrix method easily verifies that this is the only possible balancing, however, in the process of finding it. Again, of course, we speak of a one-parameter family of halancings and we do not consider a balancing such as
to be essentially different from the first balancing. If you use ten times as much of each reactant, you will obviously get ten times as much of each product. The matrix method does more than balance the given skeletal equation. It shows t h a t i f vou chwse any 19 or fewer o f t h e 20 che~nrialsperies ~t~ove-it is impossible t o find a balanred chemicd equation i n ~ o l i i n g only those 19 or fewer chemical species. he given list of 20 chemical species is all or nothing. If yon want a reaction you do it the way the above balancing indicates, or not at all. This paper gives a completely general solution to the chemical equation balancing problem. It is elementary in the sense that it uses only the rudiments of algebra, no higher mathematics, and no specifically chemical principles, other than conservation of atoms and charges. Though trivial in
small cases, it is hard to carry out by hand for big examples. T h e examule in ean. (1)was originally done by hand before computer brogra& had been wrkten:hut thatwas a tedious job. Finally, the matrix method is far faster than any other approach when implemented on a large computer. Many very large examples of skeletal chemical equations (including eqn. (1)) have heen balanced on the comouter. T h e run time (excluding a 112 second program compile time) has always bken less than a second when no more than 20 kinds of molecules involving no more than 20 chemical elements are involved. ~
toemphasize the fact that, no matter what values theunknowns a and b take on, there is a corresponding solution list (x,y,z,a,b).If he lets o = 1 and b = 0 then the solution is x=4,
If hg lets o
y=-2,
z=-1,
= 0 and b = 1 then the
o = l , b=O
solution is
~
Using Matrices to Solve Mathematical Equations Before balancing chemical equations we will have to solve some mathematical equations. This section is a review and upgrading of universally known high school mathematics techniques for solving systems of homogeneous linear equations. Many readers may want t o skip this section on a first reading. and eo immediatelv to the next section to eet an idea of w h a t t h e method of thisupaper can accomplish-with this in mind, readers can see the use of going through t h e three examples immediately below. The idea behind them is t o use concrete instances of eauations t o show how the standard techniques for solving systems of homogeneous linear equations lead to the Gauss-Jordan (2,3) method of row reducing a matrix t o Hermite normal form (4). They also show how to use Hermite normal form to produce a standard vector space basis ( 2 , 3 ) for the collection of all solutions of the system.
It is easy to see that these two assignments of values solve the original system of equations. These two solutions are basic. He has only two degrees of freedom, amounting to choice of a , followed by choice of b. Letting one he 0 and the other be 1is the simplest way to choose. Nevertheless. there are manv other solutions of the final svstem of equations. And, of course, the solutions of the final system are the same as the solutions of the original system. Example of other solutions are x = 30, r = -2, x = 5
y y y
z = -10, z = 1, z = -1,
= -10, = 0, = -3,
o = 0,
a = 1, a = 2,
b = 10; b = -2. , b = -1.
or 01
consisting of all lists (x,y,z,a,b)of five real numbers. Example 2 The variable symbols x , y, r , a and b are no help, really, and cannot he used by a computer. So let us redo the description of Example 1, using just numbers and arrays, so that it can be programmed on a computer. Start with the coefficient matrix
Example 1 Suppose somebody wants to solve the system 2x
+ 2y + 4z
=0 a+b=O +2a+b=0
z+
y
of the original system of equations. The original system of homoge-
neous linear equations in Example 1 is the same as the matrix equa-
of three eouations in five unknowns. x.v.z.o.b. He observes only one
Replacing the old first equation hy the new first equation he gets the equivalent, but simpler looking, system
In this latter matrix, replace ROW 1 by ROW 1 - 4(ROW 2) to get the matrix
Putting the newer first equation in place of the new, he gets the equivalent, but even simpler looking, system
Now the unknowns r , v. and r occur only once. At this point he can pay a little attentionioappearsnees. lfhe replaces the newer first equation by half of itself, and interchanges the second and third equations he gets the equivalent,and simplest possible in appearance, system x
-4a-3b=0 y + 2 a + b=O r t a t b=O
Now, in the matrix immediately above, do two things. Replace ROW 1by (1/2)(ROW I), and interchange ROW 2 with ROW 3, to get
*
The matrix has been gotten from the original matrix 2 by three kinds of operations: 1) Replace a row by a nonzero multiple of itself; 2 ) Replace a row by a nonzero multiple of itself plus a multiple of another row; 3) Interchange 2 rows.
It can, of course, he written I. The first nonzero entry in any row is 1; 11. The first "onzeroentry in a lower row is to the right ofthe first nonzero entry in an upper row; and Volume 59
Number 9
Seotember 1982
729
111. If the first nonzero entry in ROW i occurs in COLUMN j, then every other entry in COLUMN j is 0. If 2 is an m by n matrix then a series of elementary row operations of types 1.2,and 3 above will take I:to an m byn matrix Q in Hermite normal form. Q is said t o be row equivalent (2,3,5)t o the original matrix 2.Moreover, Q is unique. Almost any hook on linear algebra or matrix theory has a theoretical development of this material. There are several elementary texts (2,3),widely used in college freshman courses, which contain a full treatment, replete with worked out examoles.. of Gauss-Jordan reduction t o Hermite normal form. Hur lrr us return ro rhr marrir 2 and 11s tlerm~remmml fmm. rhe matrix @. Sincr rlrmrnrnry rou opernrwns pnrlucrd $ frum 2' it is well known (2,3,5)that
we know that
(l)(x) + (O)(Y)+ (O)(z)+ (-4)(1) + (-3XO) = 0 ( O h )+ ( N Y )+ ( O k )+ (2)(1)+ (1x0)= 0 + (1)(1) + (ON01 = 0 (O)(x)+ (O)(Y)+
.
and, hence, that
far this first basis vector, which is therefore equal to
L 0J
if and only if
Next let a = 0,b = 1.Since we must have
where we use 0 for the column vector with all zero entries above. The columns of the Hermite normal form 4, which contain first nonzero entries of rows will be called slave columns. The rest will be called master columns. In this example, columns 1,2and 3 are slave columns (corresponding t o the fact that the first three unknowns, x , y and z , in the solution of the original system of equations were "forced" to take on values determined by a "free" choice of o and b). The fourth and fifth columns of Q are master columns (because the last two unknowns, a and b, were considered to be free to take on any value). Correspondingly the first three entries, xy,z, of a solution veetor
we know that
(I)(%)+ (O)(Y)+ (O)(Z)+ (-4)(0) + (-3)(1) = 0 (OK%)+ (l)(y)+ (0)(2)+ (2x0)+ (l)(l) = 0 (ON%)+ (0)Cy)+ (l)(z)+ (1)(0) + (l)(l) = 0 and, hence, that
for this second basis vector, which is therefore equal t o
are called slave entries and the last 2 entries, n,b,are called master entries. There are thus two deerees of freedom in oickine solutions
Examples of other solutions are found by building vectors of the form p a q@for various choices of p and q. Three cases in point are
+
space. Its dimension is the number of columns of Q minus the number of nonzero rows of Q. In this case its dimension is 5 - 3 = 2.The solutions thus form a plane through the origin of the 5 dimensional column-vector soace. To describe this solution olane we first find 2 vectors which form a vector space basis (2,3,4,5) for this solution space. In other words we want 2 solutions
with the property that every other solution is a linear combination (2,3)of them, i.e., that i t is of the form
solution veetor =
:I+ ql ::I ( =
(
PY+~Y* pr qz*
+
for some choice of real numhers p and q. A standard, easy, informative way (2,3,4,5) topickavector space hasis vector is to let one master variable he 1,let all the other master variables be0, and then find out what each slave variable must be to satisfy the matrix equation. Doing this with each master variable in turn provides the veetor space basis. So let n = 1, b = 0. Since we must satisfy the equation
730
Journal of Chemical Education
All these solutions are matrix descriptions of the solutions given a t the end of Example 1.The general solution veetor is, of course, of the form
for any numbers p and q.
Example 3 Consider the system 4w w
LoJ
+22=0
+ y =o 2 r + 5 + z=O
A veetor space basis for this 1 dimensionalvector space consists of a single nonzero vector. Evidently w ,x , and y are slave variables (since the first three columns of are slave columns). So we consider the master variahle z and let 2 = 1. To solve
*
which is the same as
The Gauss-Jordan reduction process (2,3) applied to is the same as to solve
suhtraets four copies of ROW 2 from ROW 1to get anew ROW 1and, thus, a new matrix
In this latter matrix, ROW 2 is replaced hy ROW 1plus 4 copies of ROW 2 to yield
FH-43
In this third matrix, ROW 3 is replaced by ROW 1plus 2 copies of ROW 3 to produce r0
0
-4
21
and thus the veetor
a=
is a basis for the vector space of solutions of the original matrix equation. Other memhers of this veetor space are -boa, 2.71a and, more generally,
Nuw thar sewml rulumns hare heen prrcry w l l emprird our. 11 is rime rc, qv.ae I hing5 up a hi1 Thii is done hy multiplying ROW I by - I 1, llON 2 hy I I. and ROW R hg I l . ' l ' h ~resultmy mnrrlx 3s In other words (w,z.y,2) is asolution of the original system of linear equations if and only if
Interchanging ROW 1and ROW 2 leads to
Now, upon interchanging ROW 2 and ROW 3, weobtain the Hermite normal farm
Since has 4 columns and 3 nonzero rows it is clear that the collection of all solutions X of
is a one-dimensional veetor suhspace of the four-dimensional space consisting of all columns
where z is any numher. Outline of the Matrix Method for Balancing Chemical Equations I t is clear t o anybody who thinks about t h e algebraic method (6, 7) of balancing chemical equations t h a t t h e problem is to solve a system of homogeneous linear equations. Various authors (8-10) have therefore pointed o u t t h a t matrices are valuable tools for balancing chemical equations. T h e y did n o t use all the most appropriate mathematical methods (especially module theory ( 1I )) t o analyze t h e solution, and gave short shrift t o t h e question of what happens when the halancings of the original skeletal chemical equation make u p a two (or more) parameter family. B u t they opened u p interesting theoretical approaches a n d their work may he influential in t h e long run. Example 4 The idea of thematrix method is to turn a skeletal chemical equation, such as CHI
+ 0%= COn + Hz0
(or, if you p~efel, to turn merely any list of chemical species, such as Con, CH4,On, H20) into a matrix 2. In this case the matrix is
of four real numbers. In other words, there is one degree of freedom in choosing solutions to the original system, i.e., there is a one-parameter family ofsolutions. In more geometric language, the solution set is a line containing the zero vector (again symbolized by 0)
CHp
Volume 59
Oz
COz
Hz0
0
2
0
0 1
2
2
Number 9
I
0 1
hydrogen carbon oxygen
September 1982
731
It is obtained by entering the number of atoms of a given element e occurine.. in a given of reaeent molecule m into the matrix in the .. tvue , rou nmesprmlinl: to c. and the t.dumn vc,rraspnndin,: rn. Thus, rpadln:. bun the lir>tcdumn 8,f the mnlrlx 2 a h w r . we find that a single molecule of methane consists aE
.
and observe that Q has 3 columns and 3 nonzero raws. Since 3 - 3 = 0 its kernel consists only of the zero veetor 8, and there is only a zero-parameter family of balancings of any original skeletal equation
4 atoms of hydrogen; 1 atom of carbon; and 0 atoms of oxygen.
We then use Gauss-Jordan elimination by row reduction to bring the original matrix 2: to Hermite (4) normal form Q. Then we use standard techniques (2-5) to find avector space basis for the collection of all column vectors X such that QA = 8 (where,as above, 8 stands for the column vector with 0 in every entry). This collection iscalled the kernel (3)of Q, or the null space (4) of Q. For the matrix 2 above it follows from Example 3 above that
-112
0 0 1
is the Hermite normal form of 2. Balancings of the original skeletal chemical equation correspond to column vectors X which Q right annihilates, i.e.. column vectors. such that the matrix uroduct QX is . equal to the zera colunm vectar8. For example if
T h i s m e a n s that t h e only balancing is t h e trivial balancing with all zero coefficients written down in t h e Introduction. I n o t h e r words n o reaction involving only those t h r e e chemical species c a n proceed. If you w a n t some o r all of t h e m t o t a k e p a r t you m u s t either provide m o r e r e a c t a n t s or accept more products (or both). Example 6
matrix Hz $1 IS clmr i l l thm rmmplc rhnr 2 A 1 I>\ = O. Thus the kernel of 2' is l Q. The h~lanrmr:nmprl,mdinr to A is equal r c r the k ~ r n e crf
H20 2
0
1
CHI 4 1 0
COz 0 1 2
CO 0 hydrogen 1 carbon 1 oxygen
I
has the Hermite normal form obtained hv attaching the successive entries of A t o the successive mde;ul,!s uhivh identilid rhe rulumna UI 2 , and l h r ! ~aurring rhr rcrnlr w r h p u . . ~ ~~sw i i l r i e n t sonto one side uf the rquotions and those with negative coefficients onto the other side (while stripping off their negative signs in the process). This is a one-parameter family of balancings because the kernel of Q is a 1dimensional vector space. This, in turn, is so (3) because Q has 4 columns and 3 nonzero rows, and 4 - 3 = 1. Balancings such as
rl o o
-4
-31
Since it has five columns and three nonzero rows, and 5 - 3 = 2, it has a two-dimensional kernel. In other words, there is a two-parameter family of balancings of the skeletal chemical equation
Hz + Hz0 = CO + CO2 + CHI Six of the infinitely many column vectors X belonging to this twodimensional kernel are
merelv reoeat the first balancine on a lareer scale. and so we reeard ~~~~~~A
~
~
~
.
~
~
~
~
Evidently thev correspond, res~ectivelv,to the balancings
them as not essentially differeni from it.'ln vector space t e r m c t h e first balancing shown is a vector space basis of the one-dimensional vector space of all balancings. I t is, in fact, a module basis (11) of the kernel of Q. In other words, every balancing of the equation can be gotten from A by multiplying it through by a whole number (i.e., an intezer).
Example 5 What reactions involving only ammonium sulfate ((NHI)~SOI), ammonium hydroxide (NHIOH) and sulfur dioxide ( S o d are possible? T o ask the question is to form the matrix (NHd)zSO~
NH40H 5 1
1 0
SO2 0 hydrogen 0 nitrogen 2 oxygen 1 sulfur
I
To answer the question is to produce the Hermite normal form Q of the matrix 2.
732
Journal of Chemical Education
The second, third, and fourth (0, y and 6) were discussed a t the beginning of this paper. Any pair of these six vectors area vector space basis for the two-dimensional kernel of 2 (which is the same as the kernel of Q). However, while the vector space bases liu,Pl, in,yl, Ia,61, IP.rl and IP,6) of the kernel of 2 aremodule bases ( 1 1 )for the kernel of 2, the vector space basis ly,61 of the kernel of 2 is not a module basis for the kernel of 2. To make this clearer we note that it is easy to verify the vector equalities
la (-110 (-3)a
+ 1p = y + 10 = 6 + 1p = f
do not isolate one bradykinin molecule and a few water molecules on one side of the equation and keep all five kinds of amino acid molecules on the other side. The chemist wants to know all hydrolyses in the kernel of 2. In other words, he wants to know all lists (o,b,e) of numbers such that the linear combination
2a+lfl=q (-l)a ly =P (-2)a Iy = 6 (-4)a l y = c la l y = q
+ + + +
All coefficients ahove are whole numbers (integers). On the other hand
+
(ll2)y (-l/2)6 = a (I& t (ll2)6 = 13 (-l)y t 26 = f (312)y (-11216 = 9
is a hydrolysis. Here he plays his hole care, the fact that liu,P,yl is a module basis. It enables him to ignore fractional coefficients and concentrate exclusively on integer values ofa, b and c. In other words the seventh entry of w must he -1. Its second entry must be a negative (or a t least nonoositive) inteeer. These two conditions eet one bradvkinin mo~eEu~e and an asvet unknown number of water mole-
+
In other words, every vector r which belongs to the kernel of *-and which has only integer entries-can be written in the form xa+yp=r where the weights (numerical coefficients) x and y of the vectors a and 0 are integers. Similarly la,?\, ln.61, iP,y\. (fl,61. However, it is sometimes (not always) necessary to use fractional weights u,w in order to write r=oy+ru6
conditions
as a linear combination of the vectors y and 6.
Example 7 Suppose a chemist knows only that bradykinin (CmHwN150d does not contain any amino acids (12) other than arginine (CsHlrNlOz), glyeine (C2HsN02),phenylalanine (C9HliN02). praline (CsHsNOz), and serine (CaH7N03).If he wants to know whether it has any cyclic peptide bonds, he forms the matrix CsHsNOz
z= ,
LZ
Hz0 0 2
CdbN03 3 7
n"
1
1
3
0 3 0 0
0 0 3 0
CsH9N0z 5
z
and finds its Hermite normal form hard to verify that. 3 0 0 0
CsHdWz 6 14 4
When he simplifies them by plugging in -1 fore, he gets the following six inequalities
9 1 2
CsHllN02 9 11 1 2
C~H~~NLSOII 50 carbon 13 hydrogen 15 nitrogen 111 oxygen
1
* by row reduction. In fact it is not
0 -18 -36 -123 -9 0 -1 27 0 13 3 18 3 2 They readily yield two further inequalities -13a
> -32,
and
-9b 2 -32
and
-b ?-3
from which i t is obvious that -0
As it stands this equation is chemically absurd. But the matrix method automatically sorts terms onto the proper sides and deletes terms which should not appear. Thestandard methods presented in the previous section proceed from to the following vector space basis of the kernel of 2 (i.e., the collection of all halancings of the original skeletal ch~miealequation):
+
> -2,
(since o and b must be integers). I t is now easy to check all twelve integer lists (a,b,c) such that 0 5 0 5 2 , and
O5b53,
and