Professional Documents
Culture Documents
By
Dr Richard Olatokunbo Akinola
Department of Mathematics
University of Jos
P. M. B. 2084, Jos, Nigeria
roakinola@ gmail.com
2
Chapter 1
1.1 Introduction
According to Risteski [2] a chemical reaction is an expression showing a symbolic represen-
tation of the reactants and products that is usually positioned on the left and right hand
sides of a particular chemical reaction. Substances that takes part in a chemical reaction are
represented by their molecular formula and their symbolic representation is also regarded
as a chemical reaction [3]. A chemical reaction can either be reversible or irreversible. These
differs from Mathematical equations in the sense that while a single arrow (in the case of
an irreversible reaction) or a double arrow points in the forward and backward directions
of both the reactants and products (in the case of a reversible reaction) connects chemical
reactions [4], an equality sign links the left and right hand sides of a Mathematical equation.
’The quantitative and qualitative knowledge of the chemical processes which estimates the
amount of reactants, predicting the nature and amount of products and determining con-
ditions under which a reaction takes place is important in balancing a chemical reaction.
Balancing Chemical reactions is an excellent demonstative and instructive example of the
inter-connectedness between Linear Algebra and Stoichiometric principles’ [1].
If the number of atoms of each type of element on the left is the same as the number
of atoms of the corrresponding type on the right, then the chemical equation is said to be
balanced [4], otherwise it is not. The qualitative study of the relationship between reactants
in a chemical reaction is termed Stoichiometry [6]. Tuckerman [5] mentioned two methods
for balancing a Chemical reaction: by inspection and algebraic. The balancing-by-inspection
method involves making successive intelligent guesses at making the coefficients that will
balance an equation equal and continuing until the equation is balanced [1]. For simple
equations this procedure is straight forward. However, according to [7], there is need for
a ’step-by-step’ approach which is easily applicable and can be mastered; rather than the
haphazard hoping of inspection or a highly refined inspection. In addition, balancing-by-
inspection method makes one to believe that there is only one possible solution rather than
an infinite number of solutions which the method proposed in this paper illustrates. The
algebraic approach circumvents the above loopholes provided in the inspection method and
can handle complex chemical reactions.
The algebraic approach discussed in [5], involves putting unknown coefficients in front
of each molecular species in the equation and solving for the unknowns. This is then fol-
lowed by writing down the balance conditions on each element. After which he lets one
of the unknowns to be one and takes turns to obtain the coefficients of the remaining un-
knowns. In the proposed approach, instead of setting one of the unknowns to zero, we write
3
4 CHAPTER 1. BALANCING CHEMICAL EQUATIONS
out the set of equations in matrix form, obtain a homogeneous system of equations. Since
the system of equations is homogeneous, the solution obtained is in the nullspace of the
corresponding matrix. We then perform elementary row operations on the matrix to reduce
it to row reduced echelon form. We also show the use of software environments like Mat-
lab/octave to reduce the corresponding matrix to row reduced echelon form using the rref
command. This approach surpasses those in [1]; in the sense that we do not need to manu-
ally reduce the matrix to echelon form as shown in that paper. In that paper, they showed
how the corresponding matrix is reduced to echelon form but did not use elementary row
operations to convert it to row reduced echelon form.
In the next section, we state two well known results partaining echelon form and row
reduced echelon form.
1.2 Theory
In this section, we state well known results about echelon form and row reduced echelon
form. We will not bother about the algorithm as this is readily available in most Linear
Algebra textbooks.
Lemma 1.2.1. : The number of nonzero rows and columns are the same in any echelon form produced
from a given matrix A by elementary row operations, irrespective of the sequence of row operations
used.
Given an n × m matrix A,
1. Use Gauss elimination to produce an echelon form from A.
2. Use the bottom-most non zero entry 1 in each leading column of the echelon form,
starting with the rightmost leading column and working to the left, so as to eliminate
all non-zero entries in that column strictly above that entry one.
Definition 1.2.1. An n × m matrix A is said to be in row reduced echelon from when :
(a). It is in echelon form (with k non-zero rows, say)
(b). The ith leading column equals ei , the ith column of the identity matrix of order p, for 1 ≤ i ≤ k.
The next result which can be found in [9], describes the uniqueness of the row reduced
echelon form. It is the uniqueness of the row reduced echelon form that makes it a tool for
finding the nullspace of a matrix.
Theorem 1.2.1. (Row Reduced Echelon Form): Each matrix has precisely one row reduced echelon
form to which it can be reduced by elementary row operations, regardless of the actual sequence of
operations used to produce it.
Proof. See [9].
In balancing the equation, let p, q and r be the unknown variables such that
We compare the number of Iron (Fe) and Oxygen (O) atoms of the reactants with the number
of atoms of the product. We obtain the following set of equations:
Fe : p = 2r
O : 2q = 3r,
From the above, the matrix A is already in the echelon form U, with two pivots 1 and 2
but not in row reduced echelon form, even though there is a zero above the second pivot 2.
However, to reduce it to row reduced echelon form R; all the pivots must be one. Hence, we
replace row two with half row two, that is R2 ↔ 12 R2 to yield,
1 0 −2
R= . (1.1)
0 1 − 23
Thus, Rx = 0 becomes
p
1 0 −2
q = 0.
0 1 − 32
r
Upon expanding, we have
p − 2r = 0 or p = 2r
3 3
q − r = 0 or q = r,
2 2
the nullspace solution
p 2
x = q = 32 r.
r 1
There are three pivot variables p, q and one free variable r. If we choose r = 1, then p =
2, q = 32 . To avoid fractions, we can also let r = 2, so that p = 4, q = 3 and r = 2. We remark
that these are not the only solutions since there is a free variable r, the nullspace solution is
infinitely many. Therefore, the chemical equation can be balanced as
3
2Fe + O2 −→ Fe2O3 ,
2
or
4Fe + 3O2 −→ 2Fe2O3 .
Example 1.3.2. : Ethane (C2 H6 ) burns in oxygen to produce carbon (IV) oxide CO2 and steam. The
steam condenses to form droplets of water viz;
C2 H6 + O2 −→ CO2 + H2 O,
We compare the number of Carbon (C), Hydrogen (H) and Oxygen (O) atoms of the reactants
with the number of atoms of the products. We obtain the following set of equations:
C : 2p = r
H : 6p = 2s
O : 2q = 2r + s.
In homogeneous form,
p 0
2 0 −1 0
6 0 0 −2 q = 0 .
r 0
0 2 −2 −1
s 0
In the first step of elimination, replace row two by row two minus three times row one, i.e.,
R2 ↔ R2 − 3R1 to yield,
2 0 −1 0
∼ 0 0 3 −2 .
0 2 −2 −1
Exchange row two with row three or vice versa to reduce A to echelon form U,
2 0 −1 0
U = 0 2 −2 −1 .
0 0 3 −2
In the next set of operations that we will carry out to reduce U to R, we perform row oper-
ations that will change the entries above the pivots to zero; Replace row one by three times
row two plus two times row three i.e., R2 ↔ 3R2 + 2R3 and replace row one with three times
row one plus row three (R1 ↔ 3R1 + R3 ) to yield
6 0 0 −2
∼ 0 6 0 −7
0 0 3 −2
The last operation that will give us R, is to reduce all the pivots to unity, that is replace row
one with one-sixth row one, row two with one-sixth row two and row three with one-third
row three to obtain
1 0 0 − 31
R = 0 1 0 − 67 . (1.2)
2
0 0 1 −3
The solution to Ax = 0 reduces to Rx = 0 where x is actually the nullspace of A which is
equivalent to the nullspace of R. Hence,
p
− 13
1 0 0
q
0 1 0 − 76
r = 0.
0 0 1 − 23 s
1.3. WORKED EXAMPLES 7
1 1
p− s = 0 or p= s
3 3
7 7
q− s = 0 or q= s
6 6
2 2
r− s = 0 or r = s,
3 3
the nullspace solution
1
p 3
7
q
6
x=
= s.
r 2
3
s 1
There are three pivot variables p, q, r and one free variable s. Let s = 3, so that p = 1, q = 72
and r = 2. We remark that this is not the only solution since there is a free variable s, the
nullspace solution is infinitely many. Therefore, the chemical equation can be balanced as
7
C2 H6 + O2 −→ 2CO2 + 3H2 O.
2
Example 1.3.3. : Sodium hydroxide (NaOH) reacts with sulphuric acid (H2 SO4 ) to yield sodium
sulphate (Na2 SO4 ) and water,
In balancing the equation, let p, q, r and s be the unknown variables such that
We compare the number of Sodium (Na), Oxygen (O), Hydrogen (H) and Sulphur (S) atoms
of the reactants with the number of atoms of the products. We obtain the following set of
equations:
Na : p = 2r
O : p + 4q = 4r + s
H : p + 2q = 2s
S : q = r.
p − 2r = 0
p + 4q − 4r − s = 0
p + 2q − 2s = 0
q−r = 0,
8 CHAPTER 1. BALANCING CHEMICAL EQUATIONS
or
1 0 −2 0 p 1 0 −2 0
1 4 −4 −1 q
= 0,
1 4 −4 −1
where A= .
1 2 0 −2 r 1 2 0 −2
0 1 −1 0 s 0 1 −1 0
The augmented system becomes
1 0 −2 0 | 0
1 4 −4 −1 | 0
[A 0] = .
1 2 0 −2 | 0
0 1 −1 0 | 0
Since the right hand side is the zero vector, we work with the matrix A because any row
operation will not change the zeros.
Replace row 2 with row two minus row one i.e, R2 ↔ R2 − R1 . Similarly, replace row
three with row three minus row one i.e, R3 ↔ R3 − R1 . These first set of row operations
reduces A to
1 0 −2 0
0 4 −2 −1
∼0 2 2 −2 .
0 1 −1 0
In the second set of row operations, we replace row three by two times row three minus
row two or R3 ↔ 2R3 − R2 and replace row four by four times row four minus row two or
R4 ↔ 4R4 − R2 to yield
1 0 −2 0
0 4 −2 −1
∼ 0 0 6 −3 .
0 0 −2 1
In the third stage of the elimination process, we replace row four with 3 times row four plus
row three i.e, R4 ↔ 3R4 + R3 to yield the row echelon matrix or upper triangular U,
1 0 −2 0
0 4 −2 −1
U= 0 0 6 −3 .
0 0 0 0
We now reduce U to row reduced echelon form R as follows: First, we reduce the pivots to
unity in rows two and three via R2 ↔ 41 R2 and R3 ↔ 61 R3 to obtain
1 0 −2 0
0 1 − 1 − 1
∼ 2 4
0 0 1 − 1 .
2
0 0 0 0
Replace row one by row one plus two times row three i.e, R1 ↔ R1 + 2R3 and row two
by row two plus half row three, that is R2 ↔ R2 + 12 R3 . These two operations replaces all
nonzeros above the pivots to zero resulting in the row reduced echelon form R
1 0 0 −1
0 1 0 − 1
R= 2
0 0 1 − 1 . (1.3)
2
0 0 0 0
1.3. WORKED EXAMPLES 9
In the same vein, the following row operations R3 ↔ R3 − 2R2 and R4 ↔ 4R4 − 3R2 reduces
the above matrix to
1 1 −2 0
0 −4 6 −2
∼0 0 −4 4 .
0 0 −2 2
Finally, R4 ↔ 2R4 − R3 reduces the matrix to echelon form
1 1 −2 0
0 −4 6 −2
U= 0 0 −4 4 .
0 0 0 0
There are three pivots respectively 1, −4, −4. Hence, to reduce the matrix to row reduced
echelon form, we make sure the entries above the pivots are zero and then change the pivots
to unity. The row operations R2 ↔ 4R2 + 6R3 , R1 ↔ 2R1 − R3 and R1 ↔ R1 + 81 R2 changes
the nonzero entries above the pivots to zero so that U reduces to
2 0 0 −2
0 −16 0 16
∼ .
0 0 −4 4
0 0 0 0
1 1
The row operations R1 ↔ 2 R1 , R2 ↔ − 16 R1 and R3 ↔ − 41 R1 leads to the row reduced
echelon form
1 0 0 −1
0 1 0 −1
R= . (1.4)
0 0 1 −1
0 0 0 0
Therefore, the solution x to Rx = 0 becomes
p 1
q 1
x= r = 1 s.
s 1
For simplicity, we equate s to one so that p = q = r = s = 1. This actually shows that the
equation was balanced in the first place.
Example 1.4.1. : Type the matrix A = [1 0 − 2; 0 2 − 3] and R = rref(A). This gives the
same R as in (1.1) as
1 0 −2
R= .
0 1 − 23
1.4. USING MATLAB OR OCTAVE RREF FUNCTION 11
Let A be an n by n matrix
Ax = λx
Ax = λIx
( A − λI ) x = o,
since x 6= o and ( A − λI ) x = o. This implies that A − λI must be singular and the solutions
x are infinitely many. Since (A − λI) is singular, its determinant must be zero. Hence
characteristic polynomial
= det( A − λI ) = | A − λI |
Eigenvalues are the roots of the characteristic polynomial. The Characteristic equation is
det( A − λI ) = 0. x is sometimes called a right eigenvector of A. The left eigenvector of A is
the eigenvector of A T . That is
A T y = λy, y 6= o
or
y T A = λy T .
3. For each eigenvalue, solve the equation ( A − λI ) x = o. Since the determinant is zero,
there are solutions other than x = o, those are the eigenvectors.
The set of all eigenvectors of A is called the eigenspace of A. It is often defined as the
nullspace of ( A − λI ).
Definition 2.0.1. When the characteristic polynomial of an n by n matrix is written in the form
13
14 CHAPTER 2. EIGENVALUES AND EIGENVECTORS
Definition 2.0.2. Let vλ = nullspace( A − λI ). The dimension of the eigenspace vλ is its geometric
multiplicity.
Definition 2.0.3. If the algebraic multiplicity of A is greater than the geometric multiplicity, then
the matrix is defective.
Theorem 2.0.1. Nonzero eigenvectors belonging to district eigenvalues are linearly independent.
Proof. The proof is by induction: Let v1 , v2 , · · · , vk be nonzero eigenvectors of A. For k = 1,
this is immediate because an eigenvector cannot be zero, c1 v1 = o. Assume the result holds
for k − 1 eigenvalues. Consider the linear combination
Since the eigenvalues were assumed to be distinct, λ j 6= λk when j 6= k. This implies that
c1 = c2 = · · · = ck−1 = 0. By substituting this back into equation (2.1), ck vk = o and so
ck = 0. because vk 6= o. We have proved that (2.1) holds if and only if c1 = c2 = · · · = ck = 0
, which implies the linear independence of the eigenvectors v1 , v2 , · · · , vk−1 , vk .
Crucial
The general formula for the determinant of an n by n matrix entries aij :
The sum is over all possible permutations π of the rows of A . The ’sign’ of the permutation,
written, sign π, equals the determinant of the corresponding permutation matrix P, so sign
π = det P = +1 If the permutation is composed of an even number of row exchanges and
−1, if composed of an odd number. For example, the six terms is the well known formula:
a11 a12 a13
a21 a22 a23 = a11 a22 a33 + a31 a12 a23 + a21 a32 a13 − a11 a32 a23 − a21 a12 a33 − a31 a22 a13 .
a31 a32 a33
(a). det( A − λI ) is a polynomial of exact degree n in the variable λ, this is called the characteristic
polynomial f A (λ) of A. The characteristics polynomial of A is
(c). The coefficient of λn−1 in f A (λ) equals (−1)n−1 tr ( A), Where tr ( A) (the trace of A) is the
sum of the entries on the main diagonal of A.
Then
a11 − λ a12 ··· a1n
a21 a22 − λ · · · a2n
| A − λI | = .. .
.. ..
. . .
an1 an2 ··· ann − λ
The fact that f A (λ) is a polynomial of degree n is a consequence of the general determinental
formula (2.2) . Indeed, every term is prescribed by a permutation π of the rows of the matrix,
and equals plus or minus a product of n distinct matrix entries including one from each row
and one from each column. The term corresponding to the identity permutation is obtained
by multiplying the diagonal entries together, which in this case is
All of the other terms have at most n − 2 diagonal factors aii − λ and so are polynomials of
degree less than or equal to n − 2 in λ.
(b). By comparing coefficients
cn = (−1)n
(c). cn = (−1)n−1 ( a11 + a22 + · · · + ann ) = (−1)n tr ( A)
(d). The constant term is any polynomial f (λ) can be found as f (0)
since f A (λ) = det( A − λI )
f A (0) = det( A − 0I ) = det A
Examples
of Theorem 0.0.2
a b
A=
c d
det A = ad − bc
16 CHAPTER 2. EIGENVALUES AND EIGENVECTORS
tr ( A) = a + d
a−λ b
=
c d−λ
= ( a − λ)(d − λ) − bc
= ad − aλ − dλ + λ2 − bc
= λ2 − ( a + d)λ + ad − bc
= λ2 − λtr ( A) + det( A)
√
( a+d)± ( a+d)2 −( ad−bc)
λ1,2 = 2
√ 2
tr ( A)± (trA) −det A
= 2
The numbers λ1 , λ2 , · · · , λn , some of which may be repeated are the roots of the characteris-
tic equation f A (λ) = 0 , and hence the eigenvalues of the matrix A.
Observe that:
= (−1)2n (λ1 , λ2 , · · · , λn )
= λ1 , λ2 , · · · , λ n ∀n ∈ N
If we multiply out (2.7) explicitly and equate the result to the characteristic polynomial (??)
, we find that its coefficients
Comparison with our previous formulae for the coefffients c0 and cn−1 leads to the following
result.
Theorem
The sum of the eigenvalues of a matrix equals its trace.
2.1. EIGENVECTORS AND DIAGONALIZABILITY 17
f A (λ) =
2
1 3 1 3 1 0 0 0
−2 −5 =
2 1 2 1 0 1 0 0
Theorem 2.1.1. Let A be a square n by n matrix with n linearly independent eigenvectors. If these
eigenvectors are the columns of a matrix S, then S−1 ΛS is a diagonal matrix Λ . The eigenvalues of
A are on the diagonal of Λ:
Remarks
4. Defective matrices are not diagonalizable. The standard example of a ” defective ma-
trix ” is
0 1
Its eigenvalues are λ1 = λ2 = 0 , since it is triangular with zeros on the diagonal:
0 0
−λ 1
det( A − λ) = det = λ2
0 −λ
1
All eigenvectors of A are multiples of the vectors
0
0 1 0 c
x= or x=
0 0 0 0
Examples
1 −1
1. A = λ1 = 2, λ2 = 3
2 4
1 1
x1 = and x2 =
−1 −2
1 1
S=
−1 −2
2 1 1 −1 1 1 2 0
S−1 AS = =
−1 1 2 4 −1 2 0 3
2.1. EIGENVECTORS AND DIAGONALIZABILITY 19
0 −1
2. K = ; det(k − λI ) = λ2 + 1 = 0 λ1 = i and λ2 = − i
1 0
− i −1 a 0
( k − λ1 I ) x 1 = =
1 −i b 0
− ai − b = o,
a − ib = 0 =⇒ a = ib
1
x1 =
−i
Similarly;
i −1 a 0
( k − λ2 I ) x 2 = =
1 i b 0
1
x2 =
i
1 1 −1 i 0
S= and S KS =
−i i 0 −i
0 −1 −1
3. A = 1 2 1 ; det(k − λI ) = −λ3 + 4λ2 − 5λ + 2 = −(λ − 12 )(λ − 2) = 0
1 1 2
λ1 = λ2 = 1 and λ3 = 2
−1 −1 −1
x 1 = 1 , x2 = 0 and x3 = 1
0 1 1
−1 0 −1 0 −1 −1 −1 −1 −1 1 0 0
S−1 AS = −1 −1 0 1 2 1 1 0 1 = 0 1 0
1 1 1 1 1 2 0 1 1 0 0 2
20 CHAPTER 2. EIGENVALUES AND EIGENVECTORS
λ1 2
λ2 2
( S −1 A 2 S ) = ( Λ )2 =
..
.
λn 2
or
A2 = (SΛS−1 )(SΛS−1 ) = SΛ(S−1 S)ΛS−1 = (SΛ)(ΛS−1 ) = SΛ2 S−1
Each S−1 cancels an S except for the first S and the Last S−1
=⇒
Ak = SΛk S−1
.
HOMEWORK
4 3
If A= then Find A100 by diagonalizing A.
1 2
2.2. POWERS OF MATRICES : AK 21
TUTORIAL TWO
1. Find the eigenvalues and eigenvectors of the following matrices
1 − 32
1 −2 3 1 1 2
( a ). A = ( b ). F = 1 1 ( c ). ( d ).
−2 1 2 −6
−1 1 −1 1
4 0 0 0
3 −1 0 1 2 −1 −1
−1 2 −1 3 0 0
( e ). ( f ).
−1 1
( g ). A = −2 1 1
2 0
0 −1 3 1 0 1
1 −1 1 1
0 c −b
( h ). − c 0 a
b −a 0
2(a). Find the eigenvalues of the rotation matrix
cos θ − sin θ
R=
sin θ cos θ
2(b). For what values of θ are the eigenvalues real.
TUTORIAL THREE
(1). Choose a, b, c such that det( A − λI ) = 9λ − λ3 . Then the eigenvalues are −3, c, 3
0 1 0
A = 0 0 1
a b c
(2). Compute the eigenvalues and corresponding eigenvectors of
1 4 4
A = 3 −1 0
0 2 3
(b). Compute the trace of A and check that it equals the sum of the eigenvalues.
(c). Find the determinant of A and check that it is equal to the product of the eigenval-
ues
f A ( A) = A2 − Atr ( A) + det( A) I = 0
((trA) I − A)
(b). Prove the inverse formula; A−1 = det A
2 1
(c). Check the Cayley-Hamitton theorem for A =
−3 2
2.2. POWERS OF MATRICES : AK 23
TUTORIAL FOUR
5
Diagonalize
the
following matrices
and find A .
3 −9 5 −4 −4 −2
(1). (2). A = (3). K =
2 −6 2 −1 5 2
0 0 1 0
−2 3 1 3 3 5 0 0 0 1
(4). A = 0 1 6 (5). C = 5 6 5 (6). K=
1
0 0 0
0 0 3 −5 −8 −7
0 1 0 0
2 1 −1 0
−3 −2 0 2 5 5
1
(7). A=
0
(8). B = 0 2 0
0 1 2
0 −5 −3
0 0 1 −1
[1] Gabriel C. I and Onwuka G. I: Balancing of Chemical Equations using Matrix Algebra.
Journal of Natural Sciences Research, Vol3, No. 5, 29–36, 2015.
[2] Risteski I. B: Journal of the Chinese Chemical Society, 56: 65–79, 2009.
[6] Hill J. W., Mecreary T. W., Kolb D. K: Chemistry for changing times. Pearson Education
Inc., 123–143, 2000.
[7] Hutchings L., Peterson L., Almasude A: The Journal of Mathematics and Science: Col-
laborative Explorations 9: 119–133, 2007.
[9] Ben Noble, James W. Daniel : Applied Linear Algebra, Third Edition pp. 90–97, 103, 140–
149, 1988.
25