Balancing Chemical Equations
Balancing Chemical equations
Chemical reactions involve the change of a collection of one or more chemical substances into a new collection of one or more different chemical substances. A chemical equation is a written means of describing a chemical reaction, stating both the chemical substances in the reaction, and the relative amount of each substance involved.
Often one may have the knowledge of a set of chemical substances that react with each other, but lack the corresponding information concerning the relative amounts of each substance involved in the reaction. We can write this information in terms of what is known as an unbalanced equation. An example of an unbalanced equation is given by
Cr(OH)_{3} + HClO_{4} > Cr(ClO_{4})_{3} + H_{2}O
which states that Cr(OH)_{3} reacts with HClO_{4} to produce Cr(ClO_{4})_{3} and H_{2}O. Note that, on the left side of this equation the element Cl occurs only once (in HClO_{4}), whereas on the right side of the equation Cl occurs three times (in Cr(ClO_{4})_{3}), implying that this unbalanced equation does not account for the proportions in which the chemical substances must occur in the reaction in order for the element Cl to be conserved. To mathematically balance such an equation is to find the proportions in which each substance must occur in order to conserve each type of element and the overall electrical charge of the system (if a unique mathematical solution does not exist, then some additional considerations concerning the chemical properties of the substances involved will be needed in order to properly balance the equation). Thus we mathematically balance a chemical equation according to the following two principals:

1) The number of each type of element must be the same before and after the reaction.
2) The overall electrical charge must be the same before and after the reaction.
The proportions in which each substance in the equation occurs are expressed as integer coefficients of the substances in the chemical equation. They are found by determining a set of positive integers, having no overall common factor, such that the above two principals for balancing a chemical equation are satisfied. The balanced form of the above chemical equation is
Cr(OH)_{3} + 3 HClO_{4} > Cr(ClO_{4})_{3} + 3 H_{2}O
Note that the total number of each type of element (Cr, O, H, and Cl) on one side of the equation is the same as the total number of the same type of element on the other side of the equation.
We shall attempt to balance chemical equations by first expressing the coefficient of each chemical substance in the equation as an unknown. We can then form a system of linear equations in these unknowns by finding the number of occurrences of each type of atom on each side of the equation and setting them equal to each other. We may be able to form an additional equation by equating the overall charges on each side of the equation. This resulting system of equations will have an infinite number of solutions, so we cannot find a unique solution to this system, but there may exist a unique set of positive values that satisfy the equations and have no common factors other than ±1. To find such a set of values, we shall try to solve this system in terms of one of the unknowns. We do this with the Mathematica command Reduce as follows:
Reduce[equations,variables]
where equations is the system of linear equations in our unknowns, and variables is a list of all but one of our unknowns. If this is successful, we can find numerical values for all of our unknowns by specifying a value for the one unknown in which all of the other unknowns are expressed. Unfortunately, this method does not succeed in all cases, and we shall explore this more later. However, regardless of whether or not we are successful, the information we gain about the coefficients of the chemical equation from the reduction of the resulting system of linear equations must hold true.

Example 1: Balance the equation
NaOH + SO_{2} > Na_{2}SO_{3} + H_{2}O
We need to find the smallest possible positive integers a, b, c, and d such that the following chemical equation
a NaOH + b SO_{2} > c Na_{2}SO_{3} + d H_{2}O
is balanced. This implies that the number of each type of atom on opposite sides of the equation must be equal:

Na: a = 2 c,
O: a + 2 b = 3 c + d,
H: a = 2 d,
S: b = c.
We can utilize Mathematica to reduce this system of four equations in four unknowns so that it solves for the three unknowns a, b, and c in terms of the fourth unknown d as follows:
In[1]:= values=Reduce[{a==2*c,a+2*b==3*c+d,a==2*d,b==c},
{a,b,c}]
Out[1]= b == d && a == 2 d && c == d
Note that we used a double equals sign "==" in the expression of each equation within the Reduce command. Since each of a, b, and c are in terms of integer multiples of d, we can let d = 1 to obtain a set of values for our four unknowns such that are all of the values are positive integers and there is no set of smaller, positive integers that will satisfy our system of linear equations. Thus, designating d as 1, we obtain
In[2]:= d=1;
values
Out[2]= b == 1 && a == 2 && c == 1
Thus we have a = 2, b = 1, and c = 1 for the value d = 1. Thus, we balance our equation as follows:
2 NaOH + SO_{2} > Na_{2}SO_{3} + H_{2}O
When doing several of these problems during the same session with Mathematica, we tend to use the same unknowns (a, b, c, d, ...) over and over again for each problem. If we specify values for the variables in a given problem (as we did by setting d = 1 in the previous example), then we must be careful to clear the values of the variables before attempting to reuse these variables in the next problem so that they will not already have specified values before we try to solve for them. We do this with the command Clear as follows:
Clear[variables]
where variables are the variables whose values we wish to clear.

Example 2: Balance the following equation:
Cr(OH)_{3} + HClO_{4} > Cr(ClO_{4})_{3} + H_{2}O
Specifying the values a, b, c, and d for the coefficients of this equation,
a Cr(OH)_{3} + b HClO_{4} > c Cr(ClO_{4})_{3} + d H_{2}O
we can obtain a set of linear equations in these variables by considering the number of times each type of atom occurs on each side of this equation:

Cr: a = c,
O: 3 a + 4 b = 12 c + d,
H: 3 a + b = 2 d,
Cl: b = 3 c.
Assuming we have already found the solution of the previous problem in this session, we need to clear the values of a, b, c, and d:
In[3]:= Clear[a,b,c,d]
Reducing this system of four equations in four unknowns by solving for a, b, and c in terms of d, we obtain
In[4]:= values=Reduce[{a==c,3*a+4*b==12*c+d,3*a+b==2*d,
b==3*c},{a,b,c}]
d d
Out[4]= a ==  && b == d && c == 
3 3
Since b is an integer multiple of d, and a and c are in terms of 1/3 of an integer multiple of d, we can let d = 3 to obtain a set of values for our four unknowns such that all of the values are positive integers and there is no set of smaller positive integers that can be used for these unknowns. Thus, designating d as 3, we obtain
In[5]:= d=3;
values
Out[5]= a == 1 && b == 3 && c == 1
Thus we have a = 1, b = 3, and c = 1 for d = 3. Therefore, we balance our equation as follows:
Cr(OH)_{3} + 3 HClO_{4} > Cr(ClO_{4})_{3} + 3 H_{2}O

Example 3: Balance the equation
H_{2}S + H_{3}AsO_{4} > As_{2}S_{3} + S + H_{2}O
We now have a chemical equation involving five terms. Therefore we shall need to specify five unknowns for the coefficients of this equation:
a H_{2}S + b H_{3}AsO_{4} > c As_{2}S_{3} + d S + e H_{2}O
From this equation we obtain the following relations in the unknowns a, b, c, d, and e:

H: 2 a + 3 b = 2 e,
S: a = 3 c + d,
As: b = 2 c,
O: 4 b = e.
Clearing the values of a, b, c, and d,
In[6]:= Clear[a,b,c,d]
we can solve for a, b, c, and d in terms of e as follows:
In[7]:= values=Reduce[{2*a+3*b==2*e,a==3*c+d,b==2*c,
4*b==e},{a,b,c,d}]
e 5 e e e
Out[7]= d ==  && a ==  && c ==  && b == 
4 8 8 4
The smallest positive value of e that will produce integer values for each of a, b, c, and d is the value e = 8. Thus, letting e = 8, we obtain
In[8]:= e=8;
values
Out[8]= d == 2 && a == 5 && c == 1 && b == 2
Therefore we see that a = 5, b = 2, c = 1, d = 2, and e = 8 will produce a balanced equation:
5 H_{2}S + 2 H_{3}AsO_{4} > As_{2}S_{3} + 2 S + 8 H_{2}O

Example 4: Balance the equation
I_{4} O_{9} > I_{2} O_{6} + I_{2} + O_{2}
Specifying the four unknowns a, b, c, and d for the coefficients of this equation:
a I_{4} O_{9} > b I_{2} O_{6} + c I_{2} + d O_{2}
we obtain the following relations in terms of these unknowns:

I: 4 a = 2 b + 2 c,
O: 9 a = 6 b + 2 d.
Clearing the values of a, b, c, and d,
In[9]:= Clear[a,b,c,d]
we can solve for b, c, and d in terms of a by means of the command
In[10]:= values=Reduce[{4*a==2*b+2*c,9*a==6*b+2*d},{b,c,d}]
3
Out[10]= c == 2 a  b && d ==  (3 a  2 b)
2
Here we see that instead of providing the values of b, c, and d in terms of a, Mathematica gave the values of c and d in terms of a and b. This occurred because the two equations that we tried to reduce do not yield enough information to solve for three of the variables in terms of a fourth. The information that is contained in the solution is still true, but it is less precise than we need in order to find a specific solution.
Note that in order for c and d to be integers, the value a must be an even integer, and the value of b can be either odd or even. If we take a = 2 and b = 1, we then obtain c = 3 and d = 6.
2 I_{4} O_{9} > I_{2} O_{6} + 3 I_{2} + 6 O_{2}
However, if we let a = 2 and b = 2, we obtain c = 2 and d = 3.
2 I_{4} O_{9} > 2 I_{2} O_{6} + 2 I_{2} + 3 O_{2}
Both of these possibilies are mathematically valid in that there is no factor common to each of the resulting values of a, b, c, and d (other than the factors ±1). In fact there are an infinite number of possibilities that will yield valid solutions to the balancing of the equation, although not all of these possibilities may hold for the corresponding chemical reaction. In such a case, to find the valid solutions with respect to the chemical reaction, one must utilize principles of chemistry instead of relying solely on the mathematics of the problem.
If we had tried instead to solve for a, b, and c in terms of d, we would have gotten the results
In[11]:= values=Reduce[{4*a==2*b+2*c,9*a==6*b+2*d},{a,b,c}]
1 2
Out[11]= c ==  (3 b + 4 d) && a ==  (3 b + d)
9 9
or if we would have tried to solve for a, b, and d in terms of c, then we would have obtained
In[12]:= values=Reduce[{4*a==2*b+2*c,9*a==6*b+2*d},{a,b,d}]
3 b + c
Out[12]= d ==   (b  3 c) && a == 
4 2
Note that each of these expressions is more difficult to analyze than the expression from which we obtained our solution. Thus, in such problems, it may be practical to experiment with which variables are best to solve for.
Balancing oxidationreduction equations
For reactions in aqueous solutions, we often need to balance the chemical equation that represents the reaction by adding hydrogen atoms or oxygen atoms. For reactions that occur in an acidic solution, we may need to add one or both of H^{+} and H_{2}O to the chemical equation, whereas for reactions that occur in basic solutions, we may need to add one or both of OH^{} and H_{2}O. We proceed to balance such an equation as we would any other equation of a chemical reaction, by forcing the numbers of a given element on opposite sides of the equation to be equal, and by forcing the overall charges of each side of the equation to be equal. From these relations we obtain a system of linear equations which we attempt to solve in terms of one variable by means of the Mathematica function Reduce.

Example 5: Balance the following net ionic equation for reaction in an acidic solution:
HgS (s) + Cl^{} (aq) + NO_{3}^{} (aq) > HgCl_{4}^{2} (aq) + NO_{2} (g) + S (s)
Since this reaction occurs in an acidic solution, we shall try adding H^{+} ions to the left and H_{2}O molecules to the right of the equation
HgS (s) + Cl^{} (aq) + NO_{3}^{} (aq) + H^{+} (aq) > HgCl_{4}^{2} (aq) + NO_{2} (g) + S (s) + H_{2}O (l)
and proceed to balance this modified form of the equation, taking the overall charge of each side of the equation into account. Designating a, b, c, ..., and h as the coefficients of the individual substances in the resulting equation,
a HgS + b Cl^{} + c NO_{3}^{} + d H^{+} > e HgCl_{4}^{2} + f NO_{2} + g S + h H_{2}O
we need to find the smallest possible positive integer values for these unknowns (with possibly d = 0 and/or h = 0) so that this equation is balanced. Since the number of each type of atom on opposite sides of the equation must be equal, we have

Hg: a = e,
S: a = g,
Cl: b = 4 e,
N: c = f,
O: 3 c = 2 f + h,
H: d = 2 h.
In addition, the charges on opposite sides of this equation must be equal, so that

b  c + d = 2 e.
Here we have equated the sign of the charge with the sign of the coefficient of the charged substance in the resulting linear equation. Since it is feasible that at least one of d = 0 or h = 0, it is best not to try to solve for the unknowns in terms of either d or h. We shall instead solve for the set of unknowns in terms of the unknown a. Clearing the values of our previously defined variables,
In[13]:= Clear[a,b,c,d,e]
we then utilize Mathematica to reduce this system of seven equations in eight unknowns so that it solves for the seven unknowns b, c, ..., and h in terms of the eighth unknown a:
In[14]:= values=Reduce[{a==e,a==g,b==4*e,c==f,3*c==2*f+h,
d==2*h,bc+d==2*e},{b,c,d,e,f,g,h}]
Out[14]= g == a && b == 4 a && d == 4 a && f == 2 a &&
h == 2 a && c == 2 a && e == a
Since each of b, c, ..., and h are in terms of integer multiples of a, we can let a = 1 to obtain a set of values for our unknowns such that all of the values are positive integers and there is no set of smaller, positive values that will satisfy our system of linear equations. Thus, designating a = 1, we obtain
In[15]:= a=1;
values
Out[15]= g == 1 && b == 4 && d == 4 && f == 2 && h == 2 &&
c == 2 && e == 1
Thus we have a = 1, b = 4, c = 2, d = 4, e = 1, f = 2, g = 1, and h = 2 for this chemical equation, implying that we balance our equation as follows:
HgS (s) + 4 Cl^{} (aq) + 2 NO_{3}^{} (aq) + 4 H^{+} (aq) > HgCl_{4}^{2} (aq) + 2 NO_{2} (g) + S (s) + 2 H_{2}O (l)

Example 6: Balance the following net ionic equation in basic solution:
Cl_{2} (g) > ClO_{3}^{} (aq) + Cl^{} (aq)
For a basic solution we add OH^{} ions along with H_{2}O to opposite sides of the equation
Cl_{2} (g) + H_{2}O (l) > ClO_{3}^{} (aq) + Cl^{} (aq) + OH^{} (aq)
and then proceed to balance it. Specifying the values a, b, c, d, and e for the coefficients of this equation,
a Cl_{2} + b H_{2}O > c ClO_{3}^{} + d Cl^{} + e OH^{}
we can obtain a set of linear equations in these variables by considering the number of times each type of atom occurs on each side of this equation:

Cl: 2 a = c + d,
H: 2 b = e,
O: b = 3 c + e.
From the balance of charge, we obtain the equation

0 = c  d  e.
Clearing the values of a, b, c, d, and e,
In[16]:= Clear[a,b,c,d,e]
we reduce this system of four equations in five unknowns by solving for b, c, d, and e in terms of a:
In[17]:= values=Reduce[{2*a==c+d,2*b==e,b==3*c+e,
0==cde},{b,c,d,e}]
5 a a
Out[17]= b == a && d ==  && c ==  && e == 2 a
3 3
From this we see that the pair a and b and the pair a and e must be of opposite sign. Since a must be positive (b and e were introduced because we added H_{2}O and OH^{} to the equation), this implies that both b and e must be negative, meaning that each of H_{2}O and OH^{} are on the wrong sides of the chemical equation. With this understanding, by letting a = 3,
In[18]:= a=3;
values
Out[18]= b == 3 && d == 5 && c == 1 && e == 6
we see that our equation is balanced when we have a = 3, b = 3, c = 1, d = 5, and e = 6. Therefore, we balance our equation as follows:
3 Cl_{2} (g) + 6 OH^{} (aq) > ClO_{3}^{} (aq) + 5 Cl^{} (aq) + 3 H_{2}O (l)

Example 7: Balance the following net ionic equation for reaction in an acidic solution:
H_{2}O_{2} (aq) + MnO_{4}^{} (aq) > Mn^{2+} (aq) + O_{2} (g)
Adding H^{+} ions to the left and H_{2}O molecules to the right of the equation we obtain
H_{2}O_{2} (aq) + MnO_{4}^{} (aq) + H^{+} (aq) > Mn^{2+} (aq) + O_{2} (g) + H_{2}O (l)
Inserting the coefficients a, b, ..., and f,
a H_{2}O_{2} + b MnO_{4}^{} + c H^{+} > d Mn^{2+} + e O_{2} + f H_{2}O
we need to find positive integer values for these unknowns (with possibly c = 0 and/or f = 0) so that this equation is balanced. Equating the number of each type of atom on opposite sides of the equation, we have

H: 2 a + c = 2 f,
O: 2 a + 4 b = 2 e + f,
Mn: b = d,
and along with the equation due to the overall charge of the system,

b + c = 2 d,
we now have a complete system of linear equations from which to obtain the solution of this problem. Clearing the values of the unknowns
In[19]:= Clear[a,b,c,d,e,f]
we solve for a, b, c, d and f in terms of e as follows:
In[20]:= values=Reduce[{2*a+c==2*f,2*a+4*b==2*e+f,b==d,
b+c==2*d},{a,b,c,d,f}]
1
Out[20]= a ==  (5 b + 4 e) && c == 3 b && d == b &&
2
f == b + 2 e
We requested the solution in terms of e, but we actually received the solution in terms of e and b. This implies that we cannot obtain our solution in terms of one variable, but have to settle with two. Thus we have an infinite number of solutions of this problem for which the resulting set of coefficients of the chemical equation cannot be reduced by dividing through by a common factor. One of the simplest such cases is when e = 3 and b = 2. However, we have another solution when e = 5 and b = 2. Thus our mathematics will not find a unique solution to the problem, and so one will have to solve the problem by utilizing additional techniques in chemistry.
By analyzing these results, we see that for a to be an integer, the value b must be an even integer, whereas e can be either even or odd. Also, the above results imply that both d and f must be even and c must be a multiple of 6.
The actual solution to this problem is that which corresponds to e = 5 and b = 2:
In[21]:= b=2;e=5;
values
Out[21]= a == 5 && c == 6 && d == 2 && f == 8
In this case we obtain the balanced equation
5 H_{2}O_{2} (aq) + 2 MnO_{4}^{} + 6 H^{+} (aq) > 2 Mn^{2+} (aq) + 5 O_{2} (g) + 8 H_{2}O (l)
Exercises
Last modified: Wed Oct 17 2001